UNPKG

ts-onvif

Version:

Client to ONVIF devices

110 lines 3.07 kB
"use strict"; /** * Application Management ver10 module * @author Andrew D.Laptev <a.d.laptev@gmail.com> * @see https://www.onvif.org/ver10/appmgmt.wsdl */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AppMgmt = void 0; const service_1 = __importDefault(require("./service")); /** * Application Management service * @example * ```ts * const apps = await cam.appMgmt.getInstalledApps(); * const info = await cam.appMgmt.getAppsInfo(); * await cam.appMgmt.activate({ appID: apps.app![0].appID }); * ``` */ class AppMgmt extends service_1.default { constructor(onvif, service) { super(onvif, service); } /** * Returns the capabilities of the application management service. */ async getServiceCapabilities() { const response = await this.request({ GetServiceCapabilities: {}, }); return response.getServiceCapabilitiesResponse?.capabilities ?? {}; } /** * Returns information about installed applications. * @param options */ async getAppsInfo(options = {}) { const response = await this.request({ GetAppsInfo: { ...(options.appID && { AppID: options.appID }), }, }, { array: ['info'] }); return response.getAppsInfoResponse ?? {}; } /** * Returns a list of installed applications. */ async getInstalledApps(_options = {}) { const response = await this.request({ GetInstalledApps: {} }, { array: ['app'] }); return response.getInstalledAppsResponse ?? {}; } /** * Activates an installed application. * @param options */ async activate({ appID }) { await this.request({ Activate: { AppID: appID, }, }); } /** * Deactivates an installed application. * @param options */ async deactivate({ appID }) { await this.request({ Deactivate: { AppID: appID, }, }); } /** * Installs a license for an application. * @param options */ async installLicense({ appID, license }) { await this.request({ InstallLicense: { ...(appID && { AppID: appID }), License: license, }, }); } /** * Uninstalls an application. * @param options */ async uninstall({ appID }) { await this.request({ Uninstall: { AppID: appID, }, }); } /** * Returns the device identifier used by the application management service. */ async getDeviceId(_options = {}) { const response = await this.request({ GetDeviceId: {}, }); return response.getDeviceIdResponse.deviceId; } } exports.AppMgmt = AppMgmt; //# sourceMappingURL=appmgmt.js.map