UNPKG

ts-onvif

Version:

Client to ONVIF devices

115 lines 3.64 kB
"use strict"; /** * Provisioning ver10 module * @author Andrew D.Laptev <a.d.laptev@gmail.com> * @see https://www.onvif.org/ver10/provisioning/wsdl/provisioning.wsdl */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const service_1 = __importDefault(require("./service")); /** * Provisioning service * @example * ```ts * const caps = await cam.provisioning.getServiceCapabilities(); * const videoSource = caps.source![0].videoSourceToken; * await cam.provisioning.panMove({ videoSource, direction: 'Left', timeout: 'PT1S' }); * await cam.provisioning.stop({ videoSource }); * ``` */ class Provisioning extends service_1.default { constructor(onvif) { super(onvif, 'provisioning'); } /** * Returns the capabilities of the provisioning service. */ async getServiceCapabilities() { const response = await this.request({ GetServiceCapabilities: {} }, { array: ['source'] }); return response.getServiceCapabilitiesResponse?.capabilities || {}; } /** * Moves the device on the pan axis. * @param options */ async panMove({ videoSource, direction, timeout }) { await this.request({ PanMove: { VideoSource: videoSource, Direction: direction, ...(timeout !== undefined && { Timeout: timeout }), }, }); } /** * Moves the device on the tilt axis. * @param options */ async tiltMove({ videoSource, direction, timeout }) { await this.request({ TiltMove: { VideoSource: videoSource, Direction: direction, ...(timeout !== undefined && { Timeout: timeout }), }, }); } /** * Changes the focal length relative to the video source. * @param options */ async zoomMove({ videoSource, direction, timeout }) { await this.request({ ZoomMove: { VideoSource: videoSource, Direction: direction, ...(timeout !== undefined && { Timeout: timeout }), }, }); } /** * Moves the device on the roll axis. * @param options */ async rollMove({ videoSource, direction, timeout }) { await this.request({ RollMove: { VideoSource: videoSource, Direction: direction, ...(timeout !== undefined && { Timeout: timeout }), }, }); } /** * Moves the focal plane relative to the video source. * @param options */ async focusMove({ videoSource, direction, timeout }) { await this.request({ FocusMove: { VideoSource: videoSource, Direction: direction, ...(timeout !== undefined && { Timeout: timeout }), }, }); } /** * Stops all provisioning movements for a video source. * @param options */ async stop({ videoSource }) { await this.request({ Stop: { VideoSource: videoSource } }); } /** * Returns lifetime usage counters for provisioning movements. * @param options */ async getUsage({ videoSource }) { const response = await this.request({ GetUsage: { VideoSource: videoSource } }); return response.getUsageResponse?.usage || {}; } } exports.default = Provisioning; //# sourceMappingURL=provisioning.js.map