onvif-nvt-ts
Version:
Wrapper for ONVIF spec to control NVT (Network Video Transitter) devices. Forked and added TypeScript support from onvif-nvt.
92 lines (91 loc) • 2.83 kB
TypeScript
/// <reference types="node" />
/**
* SOAP management (sending, receiving, parsing) class for ONVIF modules.
*/
export default class Soap {
HTTP_TIMEOUT: number;
private username;
private password;
/**
* Internal method for parsing SOAP responses.
* @param soap The XML to parse.
*/
private parse;
/**
* Internal method used by the module classes.
* @param params Object containing required parameters to create a SOAP request.
* @param params.body Description in the <s:Body> of the generated xml.
* @param params.xmlns A list of xmlns attributes used in the body
* e.g., xmlns:tds="http://www.onvif.org/ver10/device/wsdl".
* @param params.diff Time difference [ms].
* @param params.username The user name.
* @param params.password The user Password.
* @param params.subscriptionId
*/
createRequest(params: {
body: string;
xmlns: string[];
diff: number;
username?: string;
password?: string;
subscriptionId?: any;
}): string;
/**
* Send a SOAP request to the specified serviceAddress.
* @param service The service name.
* @param serviceAddress The service address.
* @param methodName The request name.
* @param soapEnvelope The request SOAP envelope.
*/
makeRequest(service: string, serviceAddress: {
href: string;
}, methodName: string, soapEnvelope: string): Promise<{
raw?: boolean;
soap?: string;
parsed?: any;
} | {
soap: string;
schemas: any;
data: any;
}>;
/**
* Internal method to send a SOAP request.
* @param service The service.
* @param serviceAddress The service address.
* @param methodName The request name.
* @param soapEnvelope The request SOAP envelope.
*/
private runRequest;
private parseResponse;
/**
* Parses results to see if there is a fault.
* @param results The results of a communication with a server.
*/
getFault(results: {
Body: {
Fault?: any;
};
}): {
reason: string;
code: string;
detail: string;
};
parseForCode(fault: any): string;
parseForDetail(fault: any): string;
parseForReason(fault: any): string;
/**
* Internal method used to create the user token xml.
* @param diff The server timeDiff [ms].
* @param user The user name.
* @param pass The user password.
*/
createUserToken(diff: number, user: string, pass?: string): string;
createNonce(digit: number): Buffer;
getAddress(subscriptionid: {
Address?: string;
}): string;
getCustomSubscriptionIdXml(subscriptionId: {
_?: string;
$?: any;
}): string;
}