UNPKG

ts-onvif

Version:

Client to ONVIF devices

186 lines 6.83 kB
"use strict"; /** * Thermal ver10 module * @author Andrew D.Laptev <a.d.laptev@gmail.com> * @see https://www.onvif.org/ver10/thermal/wsdl/thermal.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")); /** * Thermal service * @example * ```ts * const configs = await cam.thermal.getConfigurations(); * const token = configs.configurations![0].token; * console.log((await cam.thermal.getConfiguration({ videoSourceToken: token })).polarity); * await cam.thermal.setConfiguration({ * videoSourceToken: token, * configuration: { * colorPalette: configs.configurations![0].configuration.colorPalette, * polarity: 'WhiteHot', * }, * }); * ``` */ class Thermal extends service_1.default { constructor(onvif) { super(onvif, 'thermal'); } static colorPaletteToBuild(colorPalette) { return { $: { token: colorPalette.token, Type: colorPalette.type, }, Name: colorPalette.name, }; } static NUCTableToBuild(nucTable) { return { $: { token: nucTable.token, ...(nucTable.lowTemperature !== undefined && { LowTemperature: nucTable.lowTemperature }), ...(nucTable.highTemperature !== undefined && { HighTemperature: nucTable.highTemperature }), }, Name: nucTable.name, }; } static coolerToBuild(cooler) { return { Enabled: cooler.enabled, ...(cooler.runTime !== undefined && { RunTime: cooler.runTime }), }; } static configurationToBuild(configuration) { return { ColorPalette: Thermal.colorPaletteToBuild(configuration.colorPalette), Polarity: configuration.polarity, ...(configuration.NUCTable && { NUCTable: Thermal.NUCTableToBuild(configuration.NUCTable) }), ...(configuration.cooler && { Cooler: Thermal.coolerToBuild(configuration.cooler) }), }; } static radiometryGlobalParametersToBuild(parameters) { return { ReflectedAmbientTemperature: parameters.reflectedAmbientTemperature, Emissivity: parameters.emissivity, DistanceToObject: parameters.distanceToObject, ...(parameters.relativeHumidity !== undefined && { RelativeHumidity: parameters.relativeHumidity, }), ...(parameters.atmosphericTemperature !== undefined && { AtmosphericTemperature: parameters.atmosphericTemperature, }), ...(parameters.atmosphericTransmittance !== undefined && { AtmosphericTransmittance: parameters.atmosphericTransmittance, }), ...(parameters.extOpticsTemperature !== undefined && { ExtOpticsTemperature: parameters.extOpticsTemperature, }), ...(parameters.extOpticsTransmittance !== undefined && { ExtOpticsTransmittance: parameters.extOpticsTransmittance, }), }; } static radiometryConfigurationToBuild(configuration) { return { ...(configuration.radiometryGlobalParameters && { RadiometryGlobalParameters: Thermal.radiometryGlobalParametersToBuild(configuration.radiometryGlobalParameters), }), }; } /** * Returns the capabilities of the thermal service. */ async getServiceCapabilities() { const response = await this.request({ GetServiceCapabilities: {}, }); return response.getServiceCapabilitiesResponse?.capabilities ?? {}; } /** * Gets the valid ranges for the Thermal parameters that have device specific ranges. * @param options */ async getConfigurationOptions({ videoSourceToken }) { const response = await this.request({ GetConfigurationOptions: { VideoSourceToken: videoSourceToken, }, }, { array: ['colorPalette', 'NUCTable'] }); return response.getConfigurationOptionsResponse.configurationOptions; } /** * Gets the Thermal Configuration for the requested VideoSource. * @param options */ async getConfiguration({ videoSourceToken }) { const response = await this.request({ GetConfiguration: { VideoSourceToken: videoSourceToken, }, }); return response.getConfigurationResponse.configuration; } /** * Gets the Thermal Configuration for all thermal VideoSources of the Device. */ async getConfigurations() { const response = await this.request({ GetConfigurations: {}, }, { array: ['configurations'] }); return response.getConfigurationsResponse ?? {}; } /** * Sets the Thermal Configuration for the requested VideoSource. * @param options */ async setConfiguration({ videoSourceToken, configuration }) { await this.request({ SetConfiguration: { VideoSourceToken: videoSourceToken, Configuration: Thermal.configurationToBuild(configuration), }, }); } /** * Gets the valid ranges for the Radiometry parameters that have device specific ranges. * @param options */ async getRadiometryConfigurationOptions({ videoSourceToken, }) { const response = await this.request({ GetRadiometryConfigurationOptions: { VideoSourceToken: videoSourceToken, }, }); return response.getRadiometryConfigurationOptionsResponse.configurationOptions; } /** * Gets the Radiometry Configuration for the requested VideoSource. * @param options */ async getRadiometryConfiguration({ videoSourceToken }) { const response = await this.request({ GetRadiometryConfiguration: { VideoSourceToken: videoSourceToken, }, }); return response.getRadiometryConfigurationResponse.configuration; } /** * Sets the Radiometry Configuration for the requested VideoSource. * @param options */ async setRadiometryConfiguration({ videoSourceToken, configuration }) { await this.request({ SetRadiometryConfiguration: { VideoSourceToken: videoSourceToken, Configuration: Thermal.radiometryConfigurationToBuild(configuration), }, }); } } exports.default = Thermal; //# sourceMappingURL=thermal.js.map