hap-nodejs 0.12.3-beta.2 → 0.12.3-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/accessories/AirConditioner_accessory.js +24 -24
- package/dist/accessories/AirConditioner_accessory.js.map +1 -1
- package/dist/accessories/AppleTVRemote_accessory.js +23 -23
- package/dist/accessories/AppleTVRemote_accessory.js.map +1 -1
- package/dist/accessories/Camera_accessory.js +292 -373
- package/dist/accessories/Camera_accessory.js.map +1 -1
- package/dist/accessories/Fan_accessory.js +15 -21
- package/dist/accessories/Fan_accessory.js.map +1 -1
- package/dist/accessories/GarageDoorOpener_accessory.js +12 -12
- package/dist/accessories/GarageDoorOpener_accessory.js.map +1 -1
- package/dist/accessories/Light-AdaptiveLighting_accessory.js +31 -21
- package/dist/accessories/Light-AdaptiveLighting_accessory.js.map +1 -1
- package/dist/accessories/Light_accessory.js +45 -48
- package/dist/accessories/Light_accessory.js.map +1 -1
- package/dist/accessories/Lock_accessory.js +11 -11
- package/dist/accessories/Lock_accessory.js.map +1 -1
- package/dist/accessories/MotionSensor_accessory.js +8 -8
- package/dist/accessories/MotionSensor_accessory.js.map +1 -1
- package/dist/accessories/Outlet_accessory.js +10 -10
- package/dist/accessories/Outlet_accessory.js.map +1 -1
- package/dist/accessories/SmartSpeaker_accessory.js +11 -11
- package/dist/accessories/SmartSpeaker_accessory.js.map +1 -1
- package/dist/accessories/Sprinkler_accessory.js +19 -19
- package/dist/accessories/Sprinkler_accessory.js.map +1 -1
- package/dist/accessories/TV_accessory.js +17 -17
- package/dist/accessories/TV_accessory.js.map +1 -1
- package/dist/accessories/TemperatureSensor_accessory.js +6 -6
- package/dist/accessories/TemperatureSensor_accessory.js.map +1 -1
- package/dist/accessories/Wi-FiRouter_accessory.js +3 -3
- package/dist/accessories/Wi-FiRouter_accessory.js.map +1 -1
- package/dist/accessories/Wi-FiSatellite_accessory.js +4 -4
- package/dist/accessories/Wi-FiSatellite_accessory.js.map +1 -1
- package/dist/accessories/gstreamer-audioProducer.js +36 -47
- package/dist/accessories/gstreamer-audioProducer.js.map +1 -1
- package/dist/accessories/types.js +2 -2
- package/dist/accessories/types.js.map +1 -1
- package/dist/index.d.ts +0 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -28
- package/dist/index.js.map +1 -1
- package/dist/lib/Accessory.d.ts +1 -58
- package/dist/lib/Accessory.d.ts.map +1 -1
- package/dist/lib/Accessory.js +747 -1149
- package/dist/lib/Accessory.js.map +1 -1
- package/dist/lib/Advertiser.d.ts +1 -2
- package/dist/lib/Advertiser.d.ts.map +1 -1
- package/dist/lib/Advertiser.js +392 -524
- package/dist/lib/Advertiser.js.map +1 -1
- package/dist/lib/Bridge.js +6 -10
- package/dist/lib/Bridge.js.map +1 -1
- package/dist/lib/Characteristic.d.ts +2 -133
- package/dist/lib/Characteristic.d.ts.map +1 -1
- package/dist/lib/Characteristic.js +1467 -669
- package/dist/lib/Characteristic.js.map +1 -1
- package/dist/lib/HAPServer.d.ts +0 -10
- package/dist/lib/HAPServer.d.ts.map +1 -1
- package/dist/lib/HAPServer.js +216 -280
- package/dist/lib/HAPServer.js.map +1 -1
- package/dist/lib/Service.d.ts +1 -51
- package/dist/lib/Service.d.ts.map +1 -1
- package/dist/lib/Service.js +474 -322
- package/dist/lib/Service.js.map +1 -1
- package/dist/lib/camera/RTPProxy.js +112 -104
- package/dist/lib/camera/RTPProxy.js.map +1 -1
- package/dist/lib/camera/RTPStreamManagement.d.ts +0 -65
- package/dist/lib/camera/RTPStreamManagement.d.ts.map +1 -1
- package/dist/lib/camera/RTPStreamManagement.js +255 -278
- package/dist/lib/camera/RTPStreamManagement.js.map +1 -1
- package/dist/lib/camera/RecordingManagement.js +318 -381
- package/dist/lib/camera/RecordingManagement.js.map +1 -1
- package/dist/lib/camera/index.d.ts +0 -1
- package/dist/lib/camera/index.d.ts.map +1 -1
- package/dist/lib/camera/index.js +1 -2
- package/dist/lib/camera/index.js.map +1 -1
- package/dist/lib/controller/AdaptiveLightingController.d.ts +19 -3
- package/dist/lib/controller/AdaptiveLightingController.d.ts.map +1 -1
- package/dist/lib/controller/AdaptiveLightingController.js +217 -218
- package/dist/lib/controller/AdaptiveLightingController.js.map +1 -1
- package/dist/lib/controller/CameraController.d.ts +0 -4
- package/dist/lib/controller/CameraController.d.ts.map +1 -1
- package/dist/lib/controller/CameraController.js +189 -256
- package/dist/lib/controller/CameraController.js.map +1 -1
- package/dist/lib/controller/DoorbellController.js +38 -39
- package/dist/lib/controller/DoorbellController.js.map +1 -1
- package/dist/lib/controller/RemoteController.d.ts +0 -14
- package/dist/lib/controller/RemoteController.d.ts.map +1 -1
- package/dist/lib/controller/RemoteController.js +340 -415
- package/dist/lib/controller/RemoteController.js.map +1 -1
- package/dist/lib/controller/index.js +1 -1
- package/dist/lib/datastream/DataStreamManagement.js +56 -57
- package/dist/lib/datastream/DataStreamManagement.js.map +1 -1
- package/dist/lib/datastream/DataStreamParser.js +259 -304
- package/dist/lib/datastream/DataStreamParser.js.map +1 -1
- package/dist/lib/datastream/DataStreamServer.d.ts +0 -5
- package/dist/lib/datastream/DataStreamServer.d.ts.map +1 -1
- package/dist/lib/datastream/DataStreamServer.js +252 -269
- package/dist/lib/datastream/DataStreamServer.js.map +1 -1
- package/dist/lib/datastream/index.js +1 -1
- package/dist/lib/definitions/CharacteristicDefinitions.d.ts +1 -106
- package/dist/lib/definitions/CharacteristicDefinitions.d.ts.map +1 -1
- package/dist/lib/definitions/CharacteristicDefinitions.js +2000 -2995
- package/dist/lib/definitions/CharacteristicDefinitions.js.map +1 -1
- package/dist/lib/definitions/ServiceDefinitions.d.ts +0 -32
- package/dist/lib/definitions/ServiceDefinitions.d.ts.map +1 -1
- package/dist/lib/definitions/ServiceDefinitions.js +820 -1147
- package/dist/lib/definitions/ServiceDefinitions.js.map +1 -1
- package/dist/lib/definitions/generate-definitions.js +383 -679
- package/dist/lib/definitions/generate-definitions.js.map +1 -1
- package/dist/lib/definitions/generator-configuration.js +29 -29
- package/dist/lib/definitions/generator-configuration.js.map +1 -1
- package/dist/lib/definitions/index.js +1 -1
- package/dist/lib/model/AccessoryInfo.js +101 -136
- package/dist/lib/model/AccessoryInfo.js.map +1 -1
- package/dist/lib/model/ControllerStorage.js +86 -89
- package/dist/lib/model/ControllerStorage.js.map +1 -1
- package/dist/lib/model/HAPStorage.js +15 -16
- package/dist/lib/model/HAPStorage.js.map +1 -1
- package/dist/lib/model/IdentifierCache.js +49 -49
- package/dist/lib/model/IdentifierCache.js.map +1 -1
- package/dist/lib/tv/AccessControlManagement.js +40 -44
- package/dist/lib/tv/AccessControlManagement.js.map +1 -1
- package/dist/lib/util/checkName.d.ts +2 -1
- package/dist/lib/util/checkName.d.ts.map +1 -1
- package/dist/lib/util/checkName.js +7 -11
- package/dist/lib/util/checkName.js.map +1 -1
- package/dist/lib/util/clone.js +5 -27
- package/dist/lib/util/clone.js.map +1 -1
- package/dist/lib/util/color-utils.js +8 -12
- package/dist/lib/util/color-utils.js.map +1 -1
- package/dist/lib/util/eventedhttp.d.ts.map +1 -1
- package/dist/lib/util/eventedhttp.js +301 -409
- package/dist/lib/util/eventedhttp.js.map +1 -1
- package/dist/lib/util/hapCrypto.js +31 -32
- package/dist/lib/util/hapCrypto.js.map +1 -1
- package/dist/lib/util/hapStatusError.js +9 -12
- package/dist/lib/util/hapStatusError.js.map +1 -1
- package/dist/lib/util/net-utils.js +32 -53
- package/dist/lib/util/net-utils.js.map +1 -1
- package/dist/lib/util/once.js +3 -8
- package/dist/lib/util/once.js.map +1 -1
- package/dist/lib/util/promise-utils.js +8 -13
- package/dist/lib/util/promise-utils.js.map +1 -1
- package/dist/lib/util/request-util.js +2 -3
- package/dist/lib/util/request-util.js.map +1 -1
- package/dist/lib/util/time.js +5 -5
- package/dist/lib/util/time.js.map +1 -1
- package/dist/lib/util/tlv.d.ts +0 -27
- package/dist/lib/util/tlv.d.ts.map +1 -1
- package/dist/lib/util/tlv.js +71 -113
- package/dist/lib/util/tlv.js.map +1 -1
- package/dist/lib/util/uuid.d.ts +0 -9
- package/dist/lib/util/uuid.d.ts.map +1 -1
- package/dist/lib/util/uuid.js +15 -33
- package/dist/lib/util/uuid.js.map +1 -1
- package/dist/types.d.ts +0 -35
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +10 -10
- package/dist/BridgedCore.d.ts +0 -2
- package/dist/BridgedCore.d.ts.map +0 -1
- package/dist/BridgedCore.js +0 -43
- package/dist/BridgedCore.js.map +0 -1
- package/dist/Core.d.ts +0 -2
- package/dist/Core.d.ts.map +0 -1
- package/dist/Core.js +0 -52
- package/dist/Core.js.map +0 -1
- package/dist/lib/AccessoryLoader.d.ts +0 -28
- package/dist/lib/AccessoryLoader.d.ts.map +0 -1
- package/dist/lib/AccessoryLoader.js +0 -166
- package/dist/lib/AccessoryLoader.js.map +0 -1
- package/dist/lib/camera/Camera.d.ts +0 -43
- package/dist/lib/camera/Camera.d.ts.map +0 -1
- package/dist/lib/camera/Camera.js +0 -36
- package/dist/lib/camera/Camera.js.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Characteristic = exports.CharacteristicEventTypes = exports.ChangeReason = exports.Access = exports.Perms = exports.Units = exports.Formats = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
|
+
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
7
|
+
const events_1 = require("events");
|
|
8
|
+
const HAPServer_1 = require("./HAPServer");
|
|
9
|
+
const clone_1 = require("./util/clone");
|
|
10
|
+
const hapStatusError_1 = require("./util/hapStatusError");
|
|
11
|
+
const once_1 = require("./util/once");
|
|
12
|
+
const request_util_1 = require("./util/request-util");
|
|
13
|
+
const uuid_1 = require("./util/uuid");
|
|
14
|
+
const checkName_1 = require("./util/checkName");
|
|
15
|
+
const debug = (0, debug_1.default)("HAP-NodeJS:Characteristic");
|
|
16
16
|
/**
|
|
17
17
|
* @group Characteristic
|
|
18
18
|
*/
|
|
@@ -55,14 +55,6 @@ var Formats;
|
|
|
55
55
|
* Base64 encoded tlv8 string.
|
|
56
56
|
*/
|
|
57
57
|
Formats["TLV8"] = "tlv8";
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated Not contained in the HAP spec
|
|
60
|
-
*/
|
|
61
|
-
Formats["ARRAY"] = "array";
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated Not contained in the HAP spec
|
|
64
|
-
*/
|
|
65
|
-
Formats["DICTIONARY"] = "dict";
|
|
66
58
|
})(Formats || (exports.Formats = Formats = {}));
|
|
67
59
|
/**
|
|
68
60
|
* @group Characteristic
|
|
@@ -74,261 +66,1202 @@ var Units;
|
|
|
74
66
|
* Unit conversion is always done on the client side e.g. on the iPhone in the Home App depending on
|
|
75
67
|
* the configured unit on the device itself.
|
|
76
68
|
*/
|
|
77
|
-
Units["CELSIUS"] = "celsius";
|
|
78
|
-
Units["PERCENTAGE"] = "percentage";
|
|
79
|
-
Units["ARC_DEGREE"] = "arcdegrees";
|
|
80
|
-
Units["LUX"] = "lux";
|
|
81
|
-
Units["SECONDS"] = "seconds";
|
|
82
|
-
})(Units || (exports.Units = Units = {}));
|
|
83
|
-
/**
|
|
84
|
-
* @group Characteristic
|
|
85
|
-
*/
|
|
86
|
-
var Perms;
|
|
87
|
-
(function (Perms) {
|
|
88
|
-
//
|
|
69
|
+
Units["CELSIUS"] = "celsius";
|
|
70
|
+
Units["PERCENTAGE"] = "percentage";
|
|
71
|
+
Units["ARC_DEGREE"] = "arcdegrees";
|
|
72
|
+
Units["LUX"] = "lux";
|
|
73
|
+
Units["SECONDS"] = "seconds";
|
|
74
|
+
})(Units || (exports.Units = Units = {}));
|
|
75
|
+
/**
|
|
76
|
+
* @group Characteristic
|
|
77
|
+
*/
|
|
78
|
+
var Perms;
|
|
79
|
+
(function (Perms) {
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
81
|
+
Perms["PAIRED_READ"] = "pr";
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
83
|
+
Perms["PAIRED_WRITE"] = "pw";
|
|
84
|
+
Perms["NOTIFY"] = "ev";
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
86
|
+
Perms["EVENTS"] = "ev";
|
|
87
|
+
Perms["ADDITIONAL_AUTHORIZATION"] = "aa";
|
|
88
|
+
Perms["TIMED_WRITE"] = "tw";
|
|
89
|
+
Perms["HIDDEN"] = "hd";
|
|
90
|
+
Perms["WRITE_RESPONSE"] = "wr";
|
|
91
|
+
})(Perms || (exports.Perms = Perms = {}));
|
|
92
|
+
/**
|
|
93
|
+
* Describes the abstract access to a {@link Characteristic}.
|
|
94
|
+
* It abstracts the more granular access described by {@link Perms}.
|
|
95
|
+
*
|
|
96
|
+
* It is used in {@link CharacteristicProps.adminOnlyAccess}.
|
|
97
|
+
*
|
|
98
|
+
* @group Characteristic
|
|
99
|
+
*/
|
|
100
|
+
var Access;
|
|
101
|
+
(function (Access) {
|
|
102
|
+
Access[Access["READ"] = 0] = "READ";
|
|
103
|
+
Access[Access["WRITE"] = 1] = "WRITE";
|
|
104
|
+
Access[Access["NOTIFY"] = 2] = "NOTIFY";
|
|
105
|
+
})(Access || (exports.Access = Access = {}));
|
|
106
|
+
/**
|
|
107
|
+
* @group Characteristic
|
|
108
|
+
*/
|
|
109
|
+
var ChangeReason;
|
|
110
|
+
(function (ChangeReason) {
|
|
111
|
+
/**
|
|
112
|
+
* Reason used when HomeKit writes a value or the API user calls {@link Characteristic.setValue}.
|
|
113
|
+
*/
|
|
114
|
+
ChangeReason["WRITE"] = "write";
|
|
115
|
+
/**
|
|
116
|
+
* Reason used when the API user calls the method {@link Characteristic.updateValue}.
|
|
117
|
+
*/
|
|
118
|
+
ChangeReason["UPDATE"] = "update";
|
|
119
|
+
/**
|
|
120
|
+
* Used when HomeKit reads a value or the API user calls the deprecated method `Characteristic.getValue`.
|
|
121
|
+
*/
|
|
122
|
+
ChangeReason["READ"] = "read";
|
|
123
|
+
/**
|
|
124
|
+
* Used when call to {@link Characteristic.sendEventNotification} was made.
|
|
125
|
+
*/
|
|
126
|
+
ChangeReason["EVENT"] = "event";
|
|
127
|
+
})(ChangeReason || (exports.ChangeReason = ChangeReason = {}));
|
|
128
|
+
/**
|
|
129
|
+
* @group Characteristic
|
|
130
|
+
*/
|
|
131
|
+
var CharacteristicEventTypes;
|
|
132
|
+
(function (CharacteristicEventTypes) {
|
|
133
|
+
/**
|
|
134
|
+
* This event is thrown when a HomeKit controller wants to read the current value of the characteristic.
|
|
135
|
+
* The event handler should call the supplied callback as fast as possible.
|
|
136
|
+
*
|
|
137
|
+
* HAP-NodeJS will complain about slow running get handlers after 3 seconds and terminate the request after 10 seconds.
|
|
138
|
+
*/
|
|
139
|
+
CharacteristicEventTypes["GET"] = "get";
|
|
140
|
+
/**
|
|
141
|
+
* This event is thrown when a HomeKit controller wants to write a new value to the characteristic.
|
|
142
|
+
* The event handler should call the supplied callback as fast as possible.
|
|
143
|
+
*
|
|
144
|
+
* HAP-NodeJS will complain about slow running set handlers after 3 seconds and terminate the request after 10 seconds.
|
|
145
|
+
*/
|
|
146
|
+
CharacteristicEventTypes["SET"] = "set";
|
|
147
|
+
/**
|
|
148
|
+
* Emitted after a new value is set for the characteristic.
|
|
149
|
+
* The new value can be set via a request by a HomeKit controller or via an API call.
|
|
150
|
+
*/
|
|
151
|
+
CharacteristicEventTypes["CHANGE"] = "change";
|
|
152
|
+
/**
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
CharacteristicEventTypes["SUBSCRIBE"] = "subscribe";
|
|
156
|
+
/**
|
|
157
|
+
* @private
|
|
158
|
+
*/
|
|
159
|
+
CharacteristicEventTypes["UNSUBSCRIBE"] = "unsubscribe";
|
|
160
|
+
/**
|
|
161
|
+
* @private
|
|
162
|
+
*/
|
|
163
|
+
CharacteristicEventTypes["CHARACTERISTIC_WARNING"] = "characteristic-warning";
|
|
164
|
+
})(CharacteristicEventTypes || (exports.CharacteristicEventTypes = CharacteristicEventTypes = {}));
|
|
165
|
+
/**
|
|
166
|
+
* @group Characteristic
|
|
167
|
+
*/
|
|
168
|
+
class ValidValuesIterable {
|
|
169
|
+
props;
|
|
170
|
+
constructor(props) {
|
|
171
|
+
(0, assert_1.default)((0, request_util_1.isNumericFormat)(props.format), "Cannot instantiate valid values iterable when format is not numeric. Found " + props.format);
|
|
172
|
+
this.props = props;
|
|
173
|
+
}
|
|
174
|
+
*[Symbol.iterator]() {
|
|
175
|
+
if (this.props.validValues) {
|
|
176
|
+
for (const value of this.props.validValues) {
|
|
177
|
+
yield value;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
let min = 0; // default is zero for all the uint types
|
|
182
|
+
let max;
|
|
183
|
+
let stepValue = 1;
|
|
184
|
+
if (this.props.validValueRanges) {
|
|
185
|
+
min = this.props.validValueRanges[0];
|
|
186
|
+
max = this.props.validValueRanges[1];
|
|
187
|
+
}
|
|
188
|
+
else if (this.props.minValue != null && this.props.maxValue != null) {
|
|
189
|
+
min = this.props.minValue;
|
|
190
|
+
max = this.props.maxValue;
|
|
191
|
+
if (this.props.minStep != null) {
|
|
192
|
+
stepValue = this.props.minStep;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else if ((0, request_util_1.isUnsignedNumericFormat)(this.props.format)) {
|
|
196
|
+
max = (0, request_util_1.numericUpperBound)(this.props.format);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
throw new Error("Could not find valid iterator strategy for props: " + JSON.stringify(this.props));
|
|
200
|
+
}
|
|
201
|
+
for (let i = min; i <= max; i += stepValue) {
|
|
202
|
+
yield i;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const numberPattern = /^-?\d+$/;
|
|
208
|
+
function extractHAPStatusFromError(error) {
|
|
209
|
+
let errorValue = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;
|
|
210
|
+
if (numberPattern.test(error.message)) {
|
|
211
|
+
const value = parseInt(error.message, 10);
|
|
212
|
+
if ((0, HAPServer_1.IsKnownHAPStatusError)(value)) {
|
|
213
|
+
errorValue = value;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return errorValue;
|
|
217
|
+
}
|
|
218
|
+
function maxWithUndefined(a, b) {
|
|
219
|
+
if (a == null) {
|
|
220
|
+
return b;
|
|
221
|
+
}
|
|
222
|
+
else if (b == null) {
|
|
223
|
+
return a;
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
return Math.max(a, b);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function minWithUndefined(a, b) {
|
|
230
|
+
if (a == null) {
|
|
231
|
+
return b;
|
|
232
|
+
}
|
|
233
|
+
else if (b == null) {
|
|
234
|
+
return a;
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
return Math.min(a, b);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Characteristic represents a particular typed variable that can be assigned to a Service. For instance, a
|
|
242
|
+
* "Hue" Characteristic might store a 'float' value of type 'arcdegrees'. You could add the Hue Characteristic
|
|
243
|
+
* to a {@link Service} in order to store that value. A particular Characteristic is distinguished from others by its
|
|
244
|
+
* UUID. HomeKit provides a set of known Characteristic UUIDs defined in HomeKit.ts along with a
|
|
245
|
+
* corresponding concrete subclass.
|
|
246
|
+
*
|
|
247
|
+
* You can also define custom Characteristics by providing your own UUID. Custom Characteristics can be added
|
|
248
|
+
* to any native or custom Services, but Siri will likely not be able to work with these.
|
|
249
|
+
*
|
|
250
|
+
* @group Characteristic
|
|
251
|
+
*/
|
|
252
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
253
|
+
class Characteristic extends events_1.EventEmitter {
|
|
254
|
+
// Pattern below is for automatic detection of the section of defined characteristics. Used by the generator
|
|
255
|
+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
|
256
|
+
/**
|
|
257
|
+
* @group Characteristic Definitions
|
|
258
|
+
*/
|
|
259
|
+
static AccessCodeControlPoint;
|
|
260
|
+
/**
|
|
261
|
+
* @group Characteristic Definitions
|
|
262
|
+
*/
|
|
263
|
+
static AccessCodeSupportedConfiguration;
|
|
264
|
+
/**
|
|
265
|
+
* @group Characteristic Definitions
|
|
266
|
+
*/
|
|
267
|
+
static AccessControlLevel;
|
|
268
|
+
/**
|
|
269
|
+
* @group Characteristic Definitions
|
|
270
|
+
*/
|
|
271
|
+
static AccessoryFlags;
|
|
272
|
+
/**
|
|
273
|
+
* @group Characteristic Definitions
|
|
274
|
+
*/
|
|
275
|
+
static AccessoryIdentifier;
|
|
276
|
+
/**
|
|
277
|
+
* @group Characteristic Definitions
|
|
278
|
+
*/
|
|
279
|
+
static Active;
|
|
280
|
+
/**
|
|
281
|
+
* @group Characteristic Definitions
|
|
282
|
+
*/
|
|
283
|
+
static ActiveIdentifier;
|
|
284
|
+
/**
|
|
285
|
+
* @group Characteristic Definitions
|
|
286
|
+
*/
|
|
287
|
+
static ActivityInterval;
|
|
288
|
+
/**
|
|
289
|
+
* @group Characteristic Definitions
|
|
290
|
+
*/
|
|
291
|
+
static AdministratorOnlyAccess;
|
|
292
|
+
/**
|
|
293
|
+
* @group Characteristic Definitions
|
|
294
|
+
*/
|
|
295
|
+
static AirParticulateDensity;
|
|
296
|
+
/**
|
|
297
|
+
* @group Characteristic Definitions
|
|
298
|
+
*/
|
|
299
|
+
static AirParticulateSize;
|
|
300
|
+
/**
|
|
301
|
+
* @group Characteristic Definitions
|
|
302
|
+
*/
|
|
303
|
+
static AirPlayEnable;
|
|
304
|
+
/**
|
|
305
|
+
* @group Characteristic Definitions
|
|
306
|
+
*/
|
|
307
|
+
static AirQuality;
|
|
308
|
+
/**
|
|
309
|
+
* @group Characteristic Definitions
|
|
310
|
+
*/
|
|
311
|
+
static AppMatchingIdentifier;
|
|
312
|
+
/**
|
|
313
|
+
* @group Characteristic Definitions
|
|
314
|
+
*/
|
|
315
|
+
static AssetUpdateReadiness;
|
|
316
|
+
/**
|
|
317
|
+
* @group Characteristic Definitions
|
|
318
|
+
*/
|
|
319
|
+
static AudioFeedback;
|
|
320
|
+
/**
|
|
321
|
+
* @group Characteristic Definitions
|
|
322
|
+
*/
|
|
323
|
+
static BatteryLevel;
|
|
324
|
+
/**
|
|
325
|
+
* @group Characteristic Definitions
|
|
326
|
+
*/
|
|
327
|
+
static Brightness;
|
|
328
|
+
/**
|
|
329
|
+
* @group Characteristic Definitions
|
|
330
|
+
*/
|
|
331
|
+
static ButtonEvent;
|
|
332
|
+
/**
|
|
333
|
+
* @group Characteristic Definitions
|
|
334
|
+
*/
|
|
335
|
+
static CameraOperatingModeIndicator;
|
|
336
|
+
/**
|
|
337
|
+
* @group Characteristic Definitions
|
|
338
|
+
*/
|
|
339
|
+
static CarbonDioxideDetected;
|
|
340
|
+
/**
|
|
341
|
+
* @group Characteristic Definitions
|
|
342
|
+
*/
|
|
343
|
+
static CarbonDioxideLevel;
|
|
344
|
+
/**
|
|
345
|
+
* @group Characteristic Definitions
|
|
346
|
+
*/
|
|
347
|
+
static CarbonDioxidePeakLevel;
|
|
348
|
+
/**
|
|
349
|
+
* @group Characteristic Definitions
|
|
350
|
+
*/
|
|
351
|
+
static CarbonMonoxideDetected;
|
|
352
|
+
/**
|
|
353
|
+
* @group Characteristic Definitions
|
|
354
|
+
*/
|
|
355
|
+
static CarbonMonoxideLevel;
|
|
356
|
+
/**
|
|
357
|
+
* @group Characteristic Definitions
|
|
358
|
+
*/
|
|
359
|
+
static CarbonMonoxidePeakLevel;
|
|
360
|
+
/**
|
|
361
|
+
* @group Characteristic Definitions
|
|
362
|
+
*/
|
|
363
|
+
static CCAEnergyDetectThreshold;
|
|
364
|
+
/**
|
|
365
|
+
* @group Characteristic Definitions
|
|
366
|
+
*/
|
|
367
|
+
static CCASignalDetectThreshold;
|
|
368
|
+
/**
|
|
369
|
+
* @group Characteristic Definitions
|
|
370
|
+
*/
|
|
371
|
+
static CharacteristicValueActiveTransitionCount;
|
|
372
|
+
/**
|
|
373
|
+
* @group Characteristic Definitions
|
|
374
|
+
*/
|
|
375
|
+
static CharacteristicValueTransitionControl;
|
|
376
|
+
/**
|
|
377
|
+
* @group Characteristic Definitions
|
|
378
|
+
*/
|
|
379
|
+
static ChargingState;
|
|
380
|
+
/**
|
|
381
|
+
* @group Characteristic Definitions
|
|
382
|
+
*/
|
|
383
|
+
static ClosedCaptions;
|
|
384
|
+
/**
|
|
385
|
+
* @group Characteristic Definitions
|
|
386
|
+
*/
|
|
387
|
+
static ColorTemperature;
|
|
388
|
+
/**
|
|
389
|
+
* @group Characteristic Definitions
|
|
390
|
+
*/
|
|
391
|
+
static ConfigurationState;
|
|
392
|
+
/**
|
|
393
|
+
* @group Characteristic Definitions
|
|
394
|
+
*/
|
|
395
|
+
static ConfiguredName;
|
|
396
|
+
/**
|
|
397
|
+
* @group Characteristic Definitions
|
|
398
|
+
*/
|
|
399
|
+
static ContactSensorState;
|
|
400
|
+
/**
|
|
401
|
+
* @group Characteristic Definitions
|
|
402
|
+
*/
|
|
403
|
+
static CoolingThresholdTemperature;
|
|
404
|
+
/**
|
|
405
|
+
* @group Characteristic Definitions
|
|
406
|
+
*/
|
|
407
|
+
static CryptoHash;
|
|
408
|
+
/**
|
|
409
|
+
* @group Characteristic Definitions
|
|
410
|
+
*/
|
|
411
|
+
static CurrentAirPurifierState;
|
|
412
|
+
/**
|
|
413
|
+
* @group Characteristic Definitions
|
|
414
|
+
*/
|
|
415
|
+
static CurrentAmbientLightLevel;
|
|
416
|
+
/**
|
|
417
|
+
* @group Characteristic Definitions
|
|
418
|
+
*/
|
|
419
|
+
static CurrentDoorState;
|
|
420
|
+
/**
|
|
421
|
+
* @group Characteristic Definitions
|
|
422
|
+
*/
|
|
423
|
+
static CurrentFanState;
|
|
424
|
+
/**
|
|
425
|
+
* @group Characteristic Definitions
|
|
426
|
+
*/
|
|
427
|
+
static CurrentHeaterCoolerState;
|
|
428
|
+
/**
|
|
429
|
+
* @group Characteristic Definitions
|
|
430
|
+
*/
|
|
431
|
+
static CurrentHeatingCoolingState;
|
|
432
|
+
/**
|
|
433
|
+
* @group Characteristic Definitions
|
|
434
|
+
*/
|
|
435
|
+
static CurrentHorizontalTiltAngle;
|
|
436
|
+
/**
|
|
437
|
+
* @group Characteristic Definitions
|
|
438
|
+
*/
|
|
439
|
+
static CurrentHumidifierDehumidifierState;
|
|
440
|
+
/**
|
|
441
|
+
* @group Characteristic Definitions
|
|
442
|
+
*/
|
|
443
|
+
static CurrentMediaState;
|
|
444
|
+
/**
|
|
445
|
+
* @group Characteristic Definitions
|
|
446
|
+
*/
|
|
447
|
+
static CurrentPosition;
|
|
448
|
+
/**
|
|
449
|
+
* @group Characteristic Definitions
|
|
450
|
+
*/
|
|
451
|
+
static CurrentRelativeHumidity;
|
|
452
|
+
/**
|
|
453
|
+
* @group Characteristic Definitions
|
|
454
|
+
*/
|
|
455
|
+
static CurrentSlatState;
|
|
456
|
+
/**
|
|
457
|
+
* @group Characteristic Definitions
|
|
458
|
+
*/
|
|
459
|
+
static CurrentTemperature;
|
|
460
|
+
/**
|
|
461
|
+
* @group Characteristic Definitions
|
|
462
|
+
*/
|
|
463
|
+
static CurrentTiltAngle;
|
|
464
|
+
/**
|
|
465
|
+
* @group Characteristic Definitions
|
|
466
|
+
*/
|
|
467
|
+
static CurrentTransport;
|
|
468
|
+
/**
|
|
469
|
+
* @group Characteristic Definitions
|
|
470
|
+
*/
|
|
471
|
+
static CurrentVerticalTiltAngle;
|
|
472
|
+
/**
|
|
473
|
+
* @group Characteristic Definitions
|
|
474
|
+
*/
|
|
475
|
+
static CurrentVisibilityState;
|
|
476
|
+
/**
|
|
477
|
+
* @group Characteristic Definitions
|
|
478
|
+
*/
|
|
479
|
+
static DataStreamHAPTransport;
|
|
480
|
+
/**
|
|
481
|
+
* @group Characteristic Definitions
|
|
482
|
+
*/
|
|
483
|
+
static DataStreamHAPTransportInterrupt;
|
|
484
|
+
/**
|
|
485
|
+
* @group Characteristic Definitions
|
|
486
|
+
*/
|
|
487
|
+
static DiagonalFieldOfView;
|
|
488
|
+
/**
|
|
489
|
+
* @group Characteristic Definitions
|
|
490
|
+
*/
|
|
491
|
+
static DigitalZoom;
|
|
492
|
+
/**
|
|
493
|
+
* @group Characteristic Definitions
|
|
494
|
+
*/
|
|
495
|
+
static DisplayOrder;
|
|
496
|
+
/**
|
|
497
|
+
* @group Characteristic Definitions
|
|
498
|
+
*/
|
|
499
|
+
static EventRetransmissionMaximum;
|
|
500
|
+
/**
|
|
501
|
+
* @group Characteristic Definitions
|
|
502
|
+
*/
|
|
503
|
+
static EventSnapshotsActive;
|
|
504
|
+
/**
|
|
505
|
+
* @group Characteristic Definitions
|
|
506
|
+
*/
|
|
507
|
+
static EventTransmissionCounters;
|
|
508
|
+
/**
|
|
509
|
+
* @group Characteristic Definitions
|
|
510
|
+
*/
|
|
511
|
+
static FilterChangeIndication;
|
|
512
|
+
/**
|
|
513
|
+
* @group Characteristic Definitions
|
|
514
|
+
*/
|
|
515
|
+
static FilterLifeLevel;
|
|
516
|
+
/**
|
|
517
|
+
* @group Characteristic Definitions
|
|
518
|
+
*/
|
|
519
|
+
static FirmwareRevision;
|
|
520
|
+
/**
|
|
521
|
+
* @group Characteristic Definitions
|
|
522
|
+
*/
|
|
523
|
+
static FirmwareUpdateReadiness;
|
|
524
|
+
/**
|
|
525
|
+
* @group Characteristic Definitions
|
|
526
|
+
*/
|
|
527
|
+
static FirmwareUpdateStatus;
|
|
528
|
+
/**
|
|
529
|
+
* @group Characteristic Definitions
|
|
530
|
+
*/
|
|
531
|
+
static HardwareFinish;
|
|
532
|
+
/**
|
|
533
|
+
* @group Characteristic Definitions
|
|
534
|
+
*/
|
|
535
|
+
static HardwareRevision;
|
|
536
|
+
/**
|
|
537
|
+
* @group Characteristic Definitions
|
|
538
|
+
*/
|
|
539
|
+
static HeartBeat;
|
|
540
|
+
/**
|
|
541
|
+
* @group Characteristic Definitions
|
|
542
|
+
*/
|
|
543
|
+
static HeatingThresholdTemperature;
|
|
544
|
+
/**
|
|
545
|
+
* @group Characteristic Definitions
|
|
546
|
+
*/
|
|
547
|
+
static HoldPosition;
|
|
548
|
+
/**
|
|
549
|
+
* @group Characteristic Definitions
|
|
550
|
+
*/
|
|
551
|
+
static HomeKitCameraActive;
|
|
552
|
+
/**
|
|
553
|
+
* @group Characteristic Definitions
|
|
554
|
+
*/
|
|
555
|
+
static Hue;
|
|
556
|
+
/**
|
|
557
|
+
* @group Characteristic Definitions
|
|
558
|
+
*/
|
|
559
|
+
static Identifier;
|
|
560
|
+
/**
|
|
561
|
+
* @group Characteristic Definitions
|
|
562
|
+
*/
|
|
563
|
+
static Identify;
|
|
564
|
+
/**
|
|
565
|
+
* @group Characteristic Definitions
|
|
566
|
+
*/
|
|
567
|
+
static ImageMirroring;
|
|
568
|
+
/**
|
|
569
|
+
* @group Characteristic Definitions
|
|
570
|
+
*/
|
|
571
|
+
static ImageRotation;
|
|
572
|
+
/**
|
|
573
|
+
* @group Characteristic Definitions
|
|
574
|
+
*/
|
|
575
|
+
static InputDeviceType;
|
|
576
|
+
/**
|
|
577
|
+
* @group Characteristic Definitions
|
|
578
|
+
*/
|
|
579
|
+
static InputSourceType;
|
|
580
|
+
/**
|
|
581
|
+
* @group Characteristic Definitions
|
|
582
|
+
*/
|
|
583
|
+
static InUse;
|
|
584
|
+
/**
|
|
585
|
+
* @group Characteristic Definitions
|
|
586
|
+
*/
|
|
587
|
+
static IsConfigured;
|
|
588
|
+
/**
|
|
589
|
+
* @group Characteristic Definitions
|
|
590
|
+
*/
|
|
591
|
+
static LeakDetected;
|
|
592
|
+
/**
|
|
593
|
+
* @group Characteristic Definitions
|
|
594
|
+
*/
|
|
595
|
+
static ListPairings;
|
|
596
|
+
/**
|
|
597
|
+
* @group Characteristic Definitions
|
|
598
|
+
*/
|
|
599
|
+
static LockControlPoint;
|
|
600
|
+
/**
|
|
601
|
+
* @group Characteristic Definitions
|
|
602
|
+
*/
|
|
603
|
+
static LockCurrentState;
|
|
604
|
+
/**
|
|
605
|
+
* @group Characteristic Definitions
|
|
606
|
+
*/
|
|
607
|
+
static LockLastKnownAction;
|
|
608
|
+
/**
|
|
609
|
+
* @group Characteristic Definitions
|
|
610
|
+
*/
|
|
611
|
+
static LockManagementAutoSecurityTimeout;
|
|
612
|
+
/**
|
|
613
|
+
* @group Characteristic Definitions
|
|
614
|
+
*/
|
|
615
|
+
static LockPhysicalControls;
|
|
616
|
+
/**
|
|
617
|
+
* @group Characteristic Definitions
|
|
618
|
+
*/
|
|
619
|
+
static LockTargetState;
|
|
620
|
+
/**
|
|
621
|
+
* @group Characteristic Definitions
|
|
622
|
+
*/
|
|
623
|
+
static Logs;
|
|
624
|
+
/**
|
|
625
|
+
* @group Characteristic Definitions
|
|
626
|
+
*/
|
|
627
|
+
static MACRetransmissionMaximum;
|
|
628
|
+
/**
|
|
629
|
+
* @group Characteristic Definitions
|
|
630
|
+
*/
|
|
631
|
+
static MACTransmissionCounters;
|
|
632
|
+
/**
|
|
633
|
+
* @group Characteristic Definitions
|
|
634
|
+
*/
|
|
635
|
+
static ManagedNetworkEnable;
|
|
636
|
+
/**
|
|
637
|
+
* @group Characteristic Definitions
|
|
638
|
+
*/
|
|
639
|
+
static ManuallyDisabled;
|
|
640
|
+
/**
|
|
641
|
+
* @group Characteristic Definitions
|
|
642
|
+
*/
|
|
643
|
+
static Manufacturer;
|
|
644
|
+
/**
|
|
645
|
+
* @group Characteristic Definitions
|
|
646
|
+
*/
|
|
647
|
+
static MaximumTransmitPower;
|
|
648
|
+
/**
|
|
649
|
+
* @group Characteristic Definitions
|
|
650
|
+
*/
|
|
651
|
+
static MetricsBufferFullState;
|
|
652
|
+
/**
|
|
653
|
+
* @group Characteristic Definitions
|
|
654
|
+
*/
|
|
655
|
+
static Model;
|
|
656
|
+
/**
|
|
657
|
+
* @group Characteristic Definitions
|
|
658
|
+
*/
|
|
659
|
+
static MotionDetected;
|
|
660
|
+
/**
|
|
661
|
+
* @group Characteristic Definitions
|
|
662
|
+
*/
|
|
663
|
+
static MultifunctionButton;
|
|
664
|
+
/**
|
|
665
|
+
* @group Characteristic Definitions
|
|
666
|
+
*/
|
|
667
|
+
static Mute;
|
|
668
|
+
/**
|
|
669
|
+
* @group Characteristic Definitions
|
|
670
|
+
*/
|
|
671
|
+
static Name;
|
|
672
|
+
/**
|
|
673
|
+
* @group Characteristic Definitions
|
|
674
|
+
*/
|
|
675
|
+
static NetworkAccessViolationControl;
|
|
676
|
+
/**
|
|
677
|
+
* @group Characteristic Definitions
|
|
678
|
+
*/
|
|
679
|
+
static NetworkClientProfileControl;
|
|
680
|
+
/**
|
|
681
|
+
* @group Characteristic Definitions
|
|
682
|
+
*/
|
|
683
|
+
static NetworkClientStatusControl;
|
|
684
|
+
/**
|
|
685
|
+
* @group Characteristic Definitions
|
|
686
|
+
*/
|
|
687
|
+
static NFCAccessControlPoint;
|
|
688
|
+
/**
|
|
689
|
+
* @group Characteristic Definitions
|
|
690
|
+
*/
|
|
691
|
+
static NFCAccessSupportedConfiguration;
|
|
692
|
+
/**
|
|
693
|
+
* @group Characteristic Definitions
|
|
694
|
+
*/
|
|
695
|
+
static NightVision;
|
|
696
|
+
/**
|
|
697
|
+
* @group Characteristic Definitions
|
|
698
|
+
*/
|
|
699
|
+
static NitrogenDioxideDensity;
|
|
700
|
+
/**
|
|
701
|
+
* @group Characteristic Definitions
|
|
702
|
+
*/
|
|
703
|
+
static ObstructionDetected;
|
|
704
|
+
/**
|
|
705
|
+
* @group Characteristic Definitions
|
|
706
|
+
*/
|
|
707
|
+
static OccupancyDetected;
|
|
708
|
+
/**
|
|
709
|
+
* @group Characteristic Definitions
|
|
710
|
+
*/
|
|
711
|
+
static On;
|
|
712
|
+
/**
|
|
713
|
+
* @group Characteristic Definitions
|
|
714
|
+
*/
|
|
715
|
+
static OperatingStateResponse;
|
|
716
|
+
/**
|
|
717
|
+
* @group Characteristic Definitions
|
|
718
|
+
*/
|
|
719
|
+
static OpticalZoom;
|
|
720
|
+
/**
|
|
721
|
+
* @group Characteristic Definitions
|
|
722
|
+
*/
|
|
723
|
+
static OutletInUse;
|
|
724
|
+
/**
|
|
725
|
+
* @group Characteristic Definitions
|
|
726
|
+
*/
|
|
727
|
+
static OzoneDensity;
|
|
728
|
+
/**
|
|
729
|
+
* @group Characteristic Definitions
|
|
730
|
+
*/
|
|
731
|
+
static PairingFeatures;
|
|
732
|
+
/**
|
|
733
|
+
* @group Characteristic Definitions
|
|
734
|
+
*/
|
|
735
|
+
static PairSetup;
|
|
736
|
+
/**
|
|
737
|
+
* @group Characteristic Definitions
|
|
738
|
+
*/
|
|
739
|
+
static PairVerify;
|
|
740
|
+
/**
|
|
741
|
+
* @group Characteristic Definitions
|
|
742
|
+
*/
|
|
743
|
+
static PasswordSetting;
|
|
744
|
+
/**
|
|
745
|
+
* @group Characteristic Definitions
|
|
746
|
+
*/
|
|
747
|
+
static PeriodicSnapshotsActive;
|
|
748
|
+
/**
|
|
749
|
+
* @group Characteristic Definitions
|
|
750
|
+
*/
|
|
751
|
+
static PictureMode;
|
|
752
|
+
/**
|
|
753
|
+
* @group Characteristic Definitions
|
|
754
|
+
*/
|
|
755
|
+
static Ping;
|
|
756
|
+
/**
|
|
757
|
+
* @group Characteristic Definitions
|
|
758
|
+
*/
|
|
759
|
+
static PM10Density;
|
|
760
|
+
/**
|
|
761
|
+
* @group Characteristic Definitions
|
|
762
|
+
*/
|
|
763
|
+
static PM2_5Density;
|
|
764
|
+
/**
|
|
765
|
+
* @group Characteristic Definitions
|
|
766
|
+
*/
|
|
767
|
+
static PositionState;
|
|
768
|
+
/**
|
|
769
|
+
* @group Characteristic Definitions
|
|
770
|
+
*/
|
|
771
|
+
static PowerModeSelection;
|
|
772
|
+
/**
|
|
773
|
+
* @group Characteristic Definitions
|
|
774
|
+
*/
|
|
775
|
+
static ProductData;
|
|
776
|
+
/**
|
|
777
|
+
* @group Characteristic Definitions
|
|
778
|
+
*/
|
|
779
|
+
static ProgrammableSwitchEvent;
|
|
780
|
+
/**
|
|
781
|
+
* @group Characteristic Definitions
|
|
782
|
+
*/
|
|
783
|
+
static ProgrammableSwitchOutputState;
|
|
784
|
+
/**
|
|
785
|
+
* @group Characteristic Definitions
|
|
786
|
+
*/
|
|
787
|
+
static ProgramMode;
|
|
788
|
+
/**
|
|
789
|
+
* @group Characteristic Definitions
|
|
790
|
+
*/
|
|
791
|
+
static ReceivedSignalStrengthIndication;
|
|
792
|
+
/**
|
|
793
|
+
* @group Characteristic Definitions
|
|
794
|
+
*/
|
|
795
|
+
static ReceiverSensitivity;
|
|
796
|
+
/**
|
|
797
|
+
* @group Characteristic Definitions
|
|
798
|
+
*/
|
|
799
|
+
static RecordingAudioActive;
|
|
800
|
+
/**
|
|
801
|
+
* @group Characteristic Definitions
|
|
802
|
+
*/
|
|
803
|
+
static RelativeHumidityDehumidifierThreshold;
|
|
804
|
+
/**
|
|
805
|
+
* @group Characteristic Definitions
|
|
806
|
+
*/
|
|
807
|
+
static RelativeHumidityHumidifierThreshold;
|
|
808
|
+
/**
|
|
809
|
+
* @group Characteristic Definitions
|
|
810
|
+
*/
|
|
811
|
+
static RelayControlPoint;
|
|
812
|
+
/**
|
|
813
|
+
* @group Characteristic Definitions
|
|
814
|
+
*/
|
|
815
|
+
static RelayEnabled;
|
|
816
|
+
/**
|
|
817
|
+
* @group Characteristic Definitions
|
|
818
|
+
*/
|
|
819
|
+
static RelayState;
|
|
820
|
+
/**
|
|
821
|
+
* @group Characteristic Definitions
|
|
822
|
+
*/
|
|
823
|
+
static RemainingDuration;
|
|
824
|
+
/**
|
|
825
|
+
* @group Characteristic Definitions
|
|
826
|
+
*/
|
|
827
|
+
static RemoteKey;
|
|
828
|
+
/**
|
|
829
|
+
* @group Characteristic Definitions
|
|
830
|
+
*/
|
|
831
|
+
static ResetFilterIndication;
|
|
832
|
+
/**
|
|
833
|
+
* @group Characteristic Definitions
|
|
834
|
+
*/
|
|
835
|
+
static RotationDirection;
|
|
836
|
+
/**
|
|
837
|
+
* @group Characteristic Definitions
|
|
838
|
+
*/
|
|
839
|
+
static RotationSpeed;
|
|
840
|
+
/**
|
|
841
|
+
* @group Characteristic Definitions
|
|
842
|
+
*/
|
|
843
|
+
static RouterStatus;
|
|
844
|
+
/**
|
|
845
|
+
* @group Characteristic Definitions
|
|
846
|
+
*/
|
|
847
|
+
static Saturation;
|
|
848
|
+
/**
|
|
849
|
+
* @group Characteristic Definitions
|
|
850
|
+
*/
|
|
851
|
+
static SecuritySystemAlarmType;
|
|
852
|
+
/**
|
|
853
|
+
* @group Characteristic Definitions
|
|
854
|
+
*/
|
|
855
|
+
static SecuritySystemCurrentState;
|
|
856
|
+
/**
|
|
857
|
+
* @group Characteristic Definitions
|
|
858
|
+
*/
|
|
859
|
+
static SecuritySystemTargetState;
|
|
860
|
+
/**
|
|
861
|
+
* @group Characteristic Definitions
|
|
862
|
+
*/
|
|
863
|
+
static SelectedAudioStreamConfiguration;
|
|
864
|
+
/**
|
|
865
|
+
* @group Characteristic Definitions
|
|
866
|
+
*/
|
|
867
|
+
static SelectedCameraRecordingConfiguration;
|
|
868
|
+
/**
|
|
869
|
+
* @group Characteristic Definitions
|
|
870
|
+
*/
|
|
871
|
+
static SelectedDiagnosticsModes;
|
|
872
|
+
/**
|
|
873
|
+
* @group Characteristic Definitions
|
|
874
|
+
*/
|
|
875
|
+
static SelectedRTPStreamConfiguration;
|
|
876
|
+
/**
|
|
877
|
+
* @group Characteristic Definitions
|
|
878
|
+
*/
|
|
879
|
+
static SelectedSleepConfiguration;
|
|
880
|
+
/**
|
|
881
|
+
* @group Characteristic Definitions
|
|
882
|
+
*/
|
|
883
|
+
static SerialNumber;
|
|
884
|
+
/**
|
|
885
|
+
* @group Characteristic Definitions
|
|
886
|
+
*/
|
|
887
|
+
static ServiceLabelIndex;
|
|
888
|
+
/**
|
|
889
|
+
* @group Characteristic Definitions
|
|
890
|
+
*/
|
|
891
|
+
static ServiceLabelNamespace;
|
|
892
|
+
/**
|
|
893
|
+
* @group Characteristic Definitions
|
|
894
|
+
*/
|
|
895
|
+
static SetDuration;
|
|
896
|
+
/**
|
|
897
|
+
* @group Characteristic Definitions
|
|
898
|
+
*/
|
|
899
|
+
static SetupDataStreamTransport;
|
|
900
|
+
/**
|
|
901
|
+
* @group Characteristic Definitions
|
|
902
|
+
*/
|
|
903
|
+
static SetupEndpoints;
|
|
904
|
+
/**
|
|
905
|
+
* @group Characteristic Definitions
|
|
906
|
+
*/
|
|
907
|
+
static SetupTransferTransport;
|
|
908
|
+
/**
|
|
909
|
+
* @group Characteristic Definitions
|
|
910
|
+
*/
|
|
911
|
+
static SignalToNoiseRatio;
|
|
912
|
+
/**
|
|
913
|
+
* @group Characteristic Definitions
|
|
914
|
+
*/
|
|
915
|
+
static SiriEnable;
|
|
916
|
+
/**
|
|
917
|
+
* @group Characteristic Definitions
|
|
918
|
+
*/
|
|
919
|
+
static SiriEndpointSessionStatus;
|
|
920
|
+
/**
|
|
921
|
+
* @group Characteristic Definitions
|
|
922
|
+
*/
|
|
923
|
+
static SiriEngineVersion;
|
|
924
|
+
/**
|
|
925
|
+
* @group Characteristic Definitions
|
|
926
|
+
*/
|
|
927
|
+
static SiriInputType;
|
|
928
|
+
/**
|
|
929
|
+
* @group Characteristic Definitions
|
|
930
|
+
*/
|
|
931
|
+
static SiriLightOnUse;
|
|
932
|
+
/**
|
|
933
|
+
* @group Characteristic Definitions
|
|
934
|
+
*/
|
|
935
|
+
static SiriListening;
|
|
936
|
+
/**
|
|
937
|
+
* @group Characteristic Definitions
|
|
938
|
+
*/
|
|
939
|
+
static SiriTouchToUse;
|
|
940
|
+
/**
|
|
941
|
+
* @group Characteristic Definitions
|
|
942
|
+
*/
|
|
943
|
+
static SlatType;
|
|
944
|
+
/**
|
|
945
|
+
* @group Characteristic Definitions
|
|
946
|
+
*/
|
|
947
|
+
static SleepDiscoveryMode;
|
|
948
|
+
/**
|
|
949
|
+
* @group Characteristic Definitions
|
|
950
|
+
*/
|
|
951
|
+
static SleepInterval;
|
|
952
|
+
/**
|
|
953
|
+
* @group Characteristic Definitions
|
|
954
|
+
*/
|
|
955
|
+
static SmokeDetected;
|
|
956
|
+
/**
|
|
957
|
+
* @group Characteristic Definitions
|
|
958
|
+
*/
|
|
959
|
+
static SoftwareRevision;
|
|
960
|
+
/**
|
|
961
|
+
* @group Characteristic Definitions
|
|
962
|
+
*/
|
|
963
|
+
static StagedFirmwareVersion;
|
|
964
|
+
/**
|
|
965
|
+
* @group Characteristic Definitions
|
|
966
|
+
*/
|
|
967
|
+
static StatusActive;
|
|
968
|
+
/**
|
|
969
|
+
* @group Characteristic Definitions
|
|
970
|
+
*/
|
|
971
|
+
static StatusFault;
|
|
972
|
+
/**
|
|
973
|
+
* @group Characteristic Definitions
|
|
974
|
+
*/
|
|
975
|
+
static StatusJammed;
|
|
976
|
+
/**
|
|
977
|
+
* @group Characteristic Definitions
|
|
978
|
+
*/
|
|
979
|
+
static StatusLowBattery;
|
|
980
|
+
/**
|
|
981
|
+
* @group Characteristic Definitions
|
|
982
|
+
*/
|
|
983
|
+
static StatusTampered;
|
|
984
|
+
/**
|
|
985
|
+
* @group Characteristic Definitions
|
|
986
|
+
*/
|
|
987
|
+
static StreamingStatus;
|
|
988
|
+
/**
|
|
989
|
+
* @group Characteristic Definitions
|
|
990
|
+
*/
|
|
991
|
+
static SulphurDioxideDensity;
|
|
992
|
+
/**
|
|
993
|
+
* @group Characteristic Definitions
|
|
994
|
+
*/
|
|
995
|
+
static SupportedAssetTypes;
|
|
996
|
+
/**
|
|
997
|
+
* @group Characteristic Definitions
|
|
998
|
+
*/
|
|
999
|
+
static SupportedAudioRecordingConfiguration;
|
|
1000
|
+
/**
|
|
1001
|
+
* @group Characteristic Definitions
|
|
1002
|
+
*/
|
|
1003
|
+
static SupportedAudioStreamConfiguration;
|
|
1004
|
+
/**
|
|
1005
|
+
* @group Characteristic Definitions
|
|
1006
|
+
*/
|
|
1007
|
+
static SupportedCameraRecordingConfiguration;
|
|
1008
|
+
/**
|
|
1009
|
+
* @group Characteristic Definitions
|
|
1010
|
+
*/
|
|
1011
|
+
static SupportedCharacteristicValueTransitionConfiguration;
|
|
1012
|
+
/**
|
|
1013
|
+
* @group Characteristic Definitions
|
|
1014
|
+
*/
|
|
1015
|
+
static SupportedDataStreamTransportConfiguration;
|
|
1016
|
+
/**
|
|
1017
|
+
* @group Characteristic Definitions
|
|
1018
|
+
*/
|
|
1019
|
+
static SupportedDiagnosticsModes;
|
|
1020
|
+
/**
|
|
1021
|
+
* @group Characteristic Definitions
|
|
1022
|
+
*/
|
|
1023
|
+
static SupportedDiagnosticsSnapshot;
|
|
1024
|
+
/**
|
|
1025
|
+
* @group Characteristic Definitions
|
|
1026
|
+
*/
|
|
1027
|
+
static SupportedFirmwareUpdateConfiguration;
|
|
1028
|
+
/**
|
|
1029
|
+
* @group Characteristic Definitions
|
|
1030
|
+
*/
|
|
1031
|
+
static SupportedMetrics;
|
|
1032
|
+
/**
|
|
1033
|
+
* @group Characteristic Definitions
|
|
1034
|
+
*/
|
|
1035
|
+
static SupportedRouterConfiguration;
|
|
1036
|
+
/**
|
|
1037
|
+
* @group Characteristic Definitions
|
|
1038
|
+
*/
|
|
1039
|
+
static SupportedRTPConfiguration;
|
|
1040
|
+
/**
|
|
1041
|
+
* @group Characteristic Definitions
|
|
1042
|
+
*/
|
|
1043
|
+
static SupportedSleepConfiguration;
|
|
1044
|
+
/**
|
|
1045
|
+
* @group Characteristic Definitions
|
|
1046
|
+
*/
|
|
1047
|
+
static SupportedTransferTransportConfiguration;
|
|
1048
|
+
/**
|
|
1049
|
+
* @group Characteristic Definitions
|
|
1050
|
+
*/
|
|
1051
|
+
static SupportedVideoRecordingConfiguration;
|
|
1052
|
+
/**
|
|
1053
|
+
* @group Characteristic Definitions
|
|
1054
|
+
*/
|
|
1055
|
+
static SupportedVideoStreamConfiguration;
|
|
1056
|
+
/**
|
|
1057
|
+
* @group Characteristic Definitions
|
|
1058
|
+
*/
|
|
1059
|
+
static SwingMode;
|
|
1060
|
+
/**
|
|
1061
|
+
* @group Characteristic Definitions
|
|
1062
|
+
*/
|
|
1063
|
+
static TapType;
|
|
1064
|
+
/**
|
|
1065
|
+
* @group Characteristic Definitions
|
|
1066
|
+
*/
|
|
1067
|
+
static TargetAirPurifierState;
|
|
1068
|
+
/**
|
|
1069
|
+
* @group Characteristic Definitions
|
|
1070
|
+
*/
|
|
1071
|
+
static TargetControlList;
|
|
1072
|
+
/**
|
|
1073
|
+
* @group Characteristic Definitions
|
|
1074
|
+
*/
|
|
1075
|
+
static TargetControlSupportedConfiguration;
|
|
1076
|
+
/**
|
|
1077
|
+
* @group Characteristic Definitions
|
|
1078
|
+
*/
|
|
1079
|
+
static TargetDoorState;
|
|
1080
|
+
/**
|
|
1081
|
+
* @group Characteristic Definitions
|
|
1082
|
+
*/
|
|
1083
|
+
static TargetFanState;
|
|
1084
|
+
/**
|
|
1085
|
+
* @group Characteristic Definitions
|
|
1086
|
+
*/
|
|
1087
|
+
static TargetHeaterCoolerState;
|
|
1088
|
+
/**
|
|
1089
|
+
* @group Characteristic Definitions
|
|
1090
|
+
*/
|
|
1091
|
+
static TargetHeatingCoolingState;
|
|
1092
|
+
/**
|
|
1093
|
+
* @group Characteristic Definitions
|
|
1094
|
+
*/
|
|
1095
|
+
static TargetHorizontalTiltAngle;
|
|
1096
|
+
/**
|
|
1097
|
+
* @group Characteristic Definitions
|
|
1098
|
+
*/
|
|
1099
|
+
static TargetHumidifierDehumidifierState;
|
|
1100
|
+
/**
|
|
1101
|
+
* @group Characteristic Definitions
|
|
1102
|
+
*/
|
|
1103
|
+
static TargetMediaState;
|
|
1104
|
+
/**
|
|
1105
|
+
* @group Characteristic Definitions
|
|
1106
|
+
*/
|
|
1107
|
+
static TargetPosition;
|
|
1108
|
+
/**
|
|
1109
|
+
* @group Characteristic Definitions
|
|
1110
|
+
*/
|
|
1111
|
+
static TargetRelativeHumidity;
|
|
1112
|
+
/**
|
|
1113
|
+
* @group Characteristic Definitions
|
|
1114
|
+
*/
|
|
1115
|
+
static TargetTemperature;
|
|
1116
|
+
/**
|
|
1117
|
+
* @group Characteristic Definitions
|
|
1118
|
+
*/
|
|
1119
|
+
static TargetTiltAngle;
|
|
1120
|
+
/**
|
|
1121
|
+
* @group Characteristic Definitions
|
|
1122
|
+
*/
|
|
1123
|
+
static TargetVerticalTiltAngle;
|
|
1124
|
+
/**
|
|
1125
|
+
* @group Characteristic Definitions
|
|
1126
|
+
*/
|
|
1127
|
+
static TargetVisibilityState;
|
|
1128
|
+
/**
|
|
1129
|
+
* @group Characteristic Definitions
|
|
1130
|
+
*/
|
|
1131
|
+
static TemperatureDisplayUnits;
|
|
1132
|
+
/**
|
|
1133
|
+
* @group Characteristic Definitions
|
|
1134
|
+
*/
|
|
1135
|
+
static ThirdPartyCameraActive;
|
|
1136
|
+
/**
|
|
1137
|
+
* @group Characteristic Definitions
|
|
1138
|
+
*/
|
|
1139
|
+
static ThreadControlPoint;
|
|
1140
|
+
/**
|
|
1141
|
+
* @group Characteristic Definitions
|
|
1142
|
+
*/
|
|
1143
|
+
static ThreadNodeCapabilities;
|
|
1144
|
+
/**
|
|
1145
|
+
* @group Characteristic Definitions
|
|
1146
|
+
*/
|
|
1147
|
+
static ThreadOpenThreadVersion;
|
|
1148
|
+
/**
|
|
1149
|
+
* @group Characteristic Definitions
|
|
1150
|
+
*/
|
|
1151
|
+
static ThreadStatus;
|
|
1152
|
+
/**
|
|
1153
|
+
* @group Characteristic Definitions
|
|
1154
|
+
*/
|
|
1155
|
+
static Token;
|
|
1156
|
+
/**
|
|
1157
|
+
* @group Characteristic Definitions
|
|
1158
|
+
*/
|
|
1159
|
+
static TransmitPower;
|
|
1160
|
+
/**
|
|
1161
|
+
* @group Characteristic Definitions
|
|
1162
|
+
*/
|
|
1163
|
+
static TunnelConnectionTimeout;
|
|
1164
|
+
/**
|
|
1165
|
+
* @group Characteristic Definitions
|
|
1166
|
+
*/
|
|
1167
|
+
static TunneledAccessoryAdvertising;
|
|
1168
|
+
/**
|
|
1169
|
+
* @group Characteristic Definitions
|
|
1170
|
+
*/
|
|
1171
|
+
static TunneledAccessoryConnected;
|
|
1172
|
+
/**
|
|
1173
|
+
* @group Characteristic Definitions
|
|
1174
|
+
*/
|
|
1175
|
+
static TunneledAccessoryStateNumber;
|
|
1176
|
+
/**
|
|
1177
|
+
* @group Characteristic Definitions
|
|
1178
|
+
*/
|
|
1179
|
+
static ValveType;
|
|
1180
|
+
/**
|
|
1181
|
+
* @group Characteristic Definitions
|
|
1182
|
+
*/
|
|
1183
|
+
static Version;
|
|
1184
|
+
/**
|
|
1185
|
+
* @group Characteristic Definitions
|
|
1186
|
+
*/
|
|
1187
|
+
static VideoAnalysisActive;
|
|
1188
|
+
/**
|
|
1189
|
+
* @group Characteristic Definitions
|
|
1190
|
+
*/
|
|
1191
|
+
static VOCDensity;
|
|
89
1192
|
/**
|
|
90
|
-
* @
|
|
1193
|
+
* @group Characteristic Definitions
|
|
91
1194
|
*/
|
|
92
|
-
|
|
1195
|
+
static Volume;
|
|
93
1196
|
/**
|
|
94
|
-
* @
|
|
1197
|
+
* @group Characteristic Definitions
|
|
95
1198
|
*/
|
|
96
|
-
|
|
97
|
-
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
98
|
-
Perms["PAIRED_READ"] = "pr";
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
100
|
-
Perms["PAIRED_WRITE"] = "pw";
|
|
101
|
-
Perms["NOTIFY"] = "ev";
|
|
102
|
-
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
103
|
-
Perms["EVENTS"] = "ev";
|
|
104
|
-
Perms["ADDITIONAL_AUTHORIZATION"] = "aa";
|
|
105
|
-
Perms["TIMED_WRITE"] = "tw";
|
|
106
|
-
Perms["HIDDEN"] = "hd";
|
|
107
|
-
Perms["WRITE_RESPONSE"] = "wr";
|
|
108
|
-
})(Perms || (exports.Perms = Perms = {}));
|
|
109
|
-
/**
|
|
110
|
-
* Describes the abstract access to a {@link Characteristic}.
|
|
111
|
-
* It abstracts the more granular access described by {@link Perms}.
|
|
112
|
-
*
|
|
113
|
-
* It is used in {@link CharacteristicProps.adminOnlyAccess}.
|
|
114
|
-
*
|
|
115
|
-
* @group Characteristic
|
|
116
|
-
*/
|
|
117
|
-
var Access;
|
|
118
|
-
(function (Access) {
|
|
119
|
-
Access[Access["READ"] = 0] = "READ";
|
|
120
|
-
Access[Access["WRITE"] = 1] = "WRITE";
|
|
121
|
-
Access[Access["NOTIFY"] = 2] = "NOTIFY";
|
|
122
|
-
})(Access || (exports.Access = Access = {}));
|
|
123
|
-
/**
|
|
124
|
-
* @group Characteristic
|
|
125
|
-
*/
|
|
126
|
-
var ChangeReason;
|
|
127
|
-
(function (ChangeReason) {
|
|
1199
|
+
static VolumeControlType;
|
|
128
1200
|
/**
|
|
129
|
-
*
|
|
1201
|
+
* @group Characteristic Definitions
|
|
130
1202
|
*/
|
|
131
|
-
|
|
1203
|
+
static VolumeSelector;
|
|
132
1204
|
/**
|
|
133
|
-
*
|
|
1205
|
+
* @group Characteristic Definitions
|
|
134
1206
|
*/
|
|
135
|
-
|
|
1207
|
+
static WakeConfiguration;
|
|
136
1208
|
/**
|
|
137
|
-
*
|
|
1209
|
+
* @group Characteristic Definitions
|
|
138
1210
|
*/
|
|
139
|
-
|
|
1211
|
+
static WANConfigurationList;
|
|
140
1212
|
/**
|
|
141
|
-
*
|
|
1213
|
+
* @group Characteristic Definitions
|
|
142
1214
|
*/
|
|
143
|
-
|
|
144
|
-
})(ChangeReason || (exports.ChangeReason = ChangeReason = {}));
|
|
145
|
-
/**
|
|
146
|
-
* @group Characteristic
|
|
147
|
-
*/
|
|
148
|
-
var CharacteristicEventTypes;
|
|
149
|
-
(function (CharacteristicEventTypes) {
|
|
1215
|
+
static WANStatusList;
|
|
150
1216
|
/**
|
|
151
|
-
*
|
|
152
|
-
* The event handler should call the supplied callback as fast as possible.
|
|
153
|
-
*
|
|
154
|
-
* HAP-NodeJS will complain about slow running get handlers after 3 seconds and terminate the request after 10 seconds.
|
|
1217
|
+
* @group Characteristic Definitions
|
|
155
1218
|
*/
|
|
156
|
-
|
|
1219
|
+
static WaterLevel;
|
|
157
1220
|
/**
|
|
158
|
-
*
|
|
159
|
-
* The event handler should call the supplied callback as fast as possible.
|
|
160
|
-
*
|
|
161
|
-
* HAP-NodeJS will complain about slow running set handlers after 3 seconds and terminate the request after 10 seconds.
|
|
1221
|
+
* @group Characteristic Definitions
|
|
162
1222
|
*/
|
|
163
|
-
|
|
1223
|
+
static WiFiCapabilities;
|
|
164
1224
|
/**
|
|
165
|
-
*
|
|
166
|
-
* The new value can be set via a request by a HomeKit controller or via an API call.
|
|
1225
|
+
* @group Characteristic Definitions
|
|
167
1226
|
*/
|
|
168
|
-
|
|
1227
|
+
static WiFiConfigurationControl;
|
|
169
1228
|
/**
|
|
170
|
-
* @
|
|
1229
|
+
* @group Characteristic Definitions
|
|
171
1230
|
*/
|
|
172
|
-
|
|
1231
|
+
static WiFiSatelliteStatus;
|
|
1232
|
+
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
|
1233
|
+
// NOTICE: when adding/changing properties, remember to possibly adjust the serialize/deserialize functions
|
|
1234
|
+
displayName;
|
|
1235
|
+
UUID;
|
|
1236
|
+
iid = null;
|
|
1237
|
+
value = null;
|
|
173
1238
|
/**
|
|
174
1239
|
* @private
|
|
175
1240
|
*/
|
|
176
|
-
|
|
1241
|
+
statusCode = 0 /* HAPStatus.SUCCESS */;
|
|
1242
|
+
props;
|
|
1243
|
+
/**
|
|
1244
|
+
* The {@link Characteristic.onGet} handler
|
|
1245
|
+
*/
|
|
1246
|
+
getHandler;
|
|
1247
|
+
/**
|
|
1248
|
+
* The {@link Characteristic.onSet} handler
|
|
1249
|
+
*/
|
|
1250
|
+
setHandler;
|
|
1251
|
+
subscriptions = 0;
|
|
177
1252
|
/**
|
|
178
1253
|
* @private
|
|
179
1254
|
*/
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
function ValidValuesIterable(props) {
|
|
187
|
-
(0, assert_1.default)((0, request_util_1.isNumericFormat)(props.format), "Cannot instantiate valid values iterable when format is not numeric. Found " + props.format);
|
|
188
|
-
this.props = props;
|
|
189
|
-
}
|
|
190
|
-
ValidValuesIterable.prototype[Symbol.iterator] = function () {
|
|
191
|
-
var _a, _b, value, e_1_1, min, max, stepValue, i;
|
|
192
|
-
var e_1, _c;
|
|
193
|
-
return tslib_1.__generator(this, function (_d) {
|
|
194
|
-
switch (_d.label) {
|
|
195
|
-
case 0:
|
|
196
|
-
if (!this.props.validValues) return [3 /*break*/, 9];
|
|
197
|
-
_d.label = 1;
|
|
198
|
-
case 1:
|
|
199
|
-
_d.trys.push([1, 6, 7, 8]);
|
|
200
|
-
_a = tslib_1.__values(this.props.validValues), _b = _a.next();
|
|
201
|
-
_d.label = 2;
|
|
202
|
-
case 2:
|
|
203
|
-
if (!!_b.done) return [3 /*break*/, 5];
|
|
204
|
-
value = _b.value;
|
|
205
|
-
return [4 /*yield*/, value];
|
|
206
|
-
case 3:
|
|
207
|
-
_d.sent();
|
|
208
|
-
_d.label = 4;
|
|
209
|
-
case 4:
|
|
210
|
-
_b = _a.next();
|
|
211
|
-
return [3 /*break*/, 2];
|
|
212
|
-
case 5: return [3 /*break*/, 8];
|
|
213
|
-
case 6:
|
|
214
|
-
e_1_1 = _d.sent();
|
|
215
|
-
e_1 = { error: e_1_1 };
|
|
216
|
-
return [3 /*break*/, 8];
|
|
217
|
-
case 7:
|
|
218
|
-
try {
|
|
219
|
-
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
220
|
-
}
|
|
221
|
-
finally { if (e_1) throw e_1.error; }
|
|
222
|
-
return [7 /*endfinally*/];
|
|
223
|
-
case 8: return [3 /*break*/, 13];
|
|
224
|
-
case 9:
|
|
225
|
-
min = 0;
|
|
226
|
-
max = void 0;
|
|
227
|
-
stepValue = 1;
|
|
228
|
-
if (this.props.validValueRanges) {
|
|
229
|
-
min = this.props.validValueRanges[0];
|
|
230
|
-
max = this.props.validValueRanges[1];
|
|
231
|
-
}
|
|
232
|
-
else if (this.props.minValue != null && this.props.maxValue != null) {
|
|
233
|
-
min = this.props.minValue;
|
|
234
|
-
max = this.props.maxValue;
|
|
235
|
-
if (this.props.minStep != null) {
|
|
236
|
-
stepValue = this.props.minStep;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
else if ((0, request_util_1.isUnsignedNumericFormat)(this.props.format)) {
|
|
240
|
-
max = (0, request_util_1.numericUpperBound)(this.props.format);
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
throw new Error("Could not find valid iterator strategy for props: " + JSON.stringify(this.props));
|
|
244
|
-
}
|
|
245
|
-
i = min;
|
|
246
|
-
_d.label = 10;
|
|
247
|
-
case 10:
|
|
248
|
-
if (!(i <= max)) return [3 /*break*/, 13];
|
|
249
|
-
return [4 /*yield*/, i];
|
|
250
|
-
case 11:
|
|
251
|
-
_d.sent();
|
|
252
|
-
_d.label = 12;
|
|
253
|
-
case 12:
|
|
254
|
-
i += stepValue;
|
|
255
|
-
return [3 /*break*/, 10];
|
|
256
|
-
case 13: return [2 /*return*/];
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
};
|
|
260
|
-
return ValidValuesIterable;
|
|
261
|
-
}());
|
|
262
|
-
var numberPattern = /^-?\d+$/;
|
|
263
|
-
function extractHAPStatusFromError(error) {
|
|
264
|
-
var errorValue = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;
|
|
265
|
-
if (numberPattern.test(error.message)) {
|
|
266
|
-
var value = parseInt(error.message, 10);
|
|
267
|
-
if ((0, HAPServer_1.IsKnownHAPStatusError)(value)) {
|
|
268
|
-
errorValue = value;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
return errorValue;
|
|
272
|
-
}
|
|
273
|
-
function maxWithUndefined(a, b) {
|
|
274
|
-
if (a == null) {
|
|
275
|
-
return b;
|
|
276
|
-
}
|
|
277
|
-
else if (b == null) {
|
|
278
|
-
return a;
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
return Math.max(a, b);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
function minWithUndefined(a, b) {
|
|
285
|
-
if (a == null) {
|
|
286
|
-
return b;
|
|
287
|
-
}
|
|
288
|
-
else if (b == null) {
|
|
289
|
-
return a;
|
|
290
|
-
}
|
|
291
|
-
else {
|
|
292
|
-
return Math.min(a, b);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Characteristic represents a particular typed variable that can be assigned to a Service. For instance, a
|
|
297
|
-
* "Hue" Characteristic might store a 'float' value of type 'arcdegrees'. You could add the Hue Characteristic
|
|
298
|
-
* to a {@link Service} in order to store that value. A particular Characteristic is distinguished from others by its
|
|
299
|
-
* UUID. HomeKit provides a set of known Characteristic UUIDs defined in HomeKit.ts along with a
|
|
300
|
-
* corresponding concrete subclass.
|
|
301
|
-
*
|
|
302
|
-
* You can also define custom Characteristics by providing your own UUID. Custom Characteristics can be added
|
|
303
|
-
* to any native or custom Services, but Siri will likely not be able to work with these.
|
|
304
|
-
*
|
|
305
|
-
* @group Characteristic
|
|
306
|
-
*/
|
|
307
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
308
|
-
var Characteristic = /** @class */ (function (_super) {
|
|
309
|
-
tslib_1.__extends(Characteristic, _super);
|
|
310
|
-
function Characteristic(displayName, UUID, props) {
|
|
311
|
-
var _this = _super.call(this) || this;
|
|
312
|
-
_this.iid = null;
|
|
313
|
-
_this.value = null;
|
|
314
|
-
/**
|
|
315
|
-
* @deprecated replaced by {@link statusCode}
|
|
316
|
-
* @private
|
|
317
|
-
*/
|
|
318
|
-
_this.status = null;
|
|
319
|
-
/**
|
|
320
|
-
* @private
|
|
321
|
-
*/
|
|
322
|
-
_this.statusCode = 0 /* HAPStatus.SUCCESS */;
|
|
323
|
-
_this.subscriptions = 0;
|
|
324
|
-
_this.displayName = displayName;
|
|
325
|
-
_this.UUID = UUID;
|
|
326
|
-
_this.props = {
|
|
1255
|
+
additionalAuthorizationHandler;
|
|
1256
|
+
constructor(displayName, UUID, props) {
|
|
1257
|
+
super();
|
|
1258
|
+
this.displayName = displayName;
|
|
1259
|
+
this.UUID = UUID;
|
|
1260
|
+
this.props = {
|
|
327
1261
|
format: "int" /* Formats.INT */,
|
|
328
1262
|
perms: ["ev" /* Perms.NOTIFY */],
|
|
329
1263
|
};
|
|
330
|
-
|
|
331
|
-
return _this;
|
|
1264
|
+
this.setProps(props || {}); // ensure sanity checks are called
|
|
332
1265
|
}
|
|
333
1266
|
/**
|
|
334
1267
|
* Accepts a function that will be called to retrieve the current value of a Characteristic.
|
|
@@ -343,21 +1276,21 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
343
1276
|
* ```
|
|
344
1277
|
* @param handler
|
|
345
1278
|
*/
|
|
346
|
-
|
|
1279
|
+
onGet(handler) {
|
|
347
1280
|
if (typeof handler !== "function") {
|
|
348
1281
|
this.characteristicWarning(".onGet handler must be a function");
|
|
349
1282
|
return this;
|
|
350
1283
|
}
|
|
351
1284
|
this.getHandler = handler;
|
|
352
1285
|
return this;
|
|
353
|
-
}
|
|
1286
|
+
}
|
|
354
1287
|
/**
|
|
355
1288
|
* Removes the {@link CharacteristicGetHandler} handler which was configured using {@link onGet}.
|
|
356
1289
|
*/
|
|
357
|
-
|
|
1290
|
+
removeOnGet() {
|
|
358
1291
|
this.getHandler = undefined;
|
|
359
1292
|
return this;
|
|
360
|
-
}
|
|
1293
|
+
}
|
|
361
1294
|
/**
|
|
362
1295
|
* Accepts a function that will be called when setting the value of a Characteristic.
|
|
363
1296
|
* If the characteristic supports {@link Perms.WRITE_RESPONSE} and the request requests a write-response value,
|
|
@@ -372,21 +1305,21 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
372
1305
|
* ```
|
|
373
1306
|
* @param handler
|
|
374
1307
|
*/
|
|
375
|
-
|
|
1308
|
+
onSet(handler) {
|
|
376
1309
|
if (typeof handler !== "function") {
|
|
377
1310
|
this.characteristicWarning(".onSet handler must be a function");
|
|
378
1311
|
return this;
|
|
379
1312
|
}
|
|
380
1313
|
this.setHandler = handler;
|
|
381
1314
|
return this;
|
|
382
|
-
}
|
|
1315
|
+
}
|
|
383
1316
|
/**
|
|
384
1317
|
* Removes the {@link CharacteristicSetHandler} which was configured using {@link onSet}.
|
|
385
1318
|
*/
|
|
386
|
-
|
|
1319
|
+
removeOnSet() {
|
|
387
1320
|
this.setHandler = undefined;
|
|
388
1321
|
return this;
|
|
389
|
-
}
|
|
1322
|
+
}
|
|
390
1323
|
/**
|
|
391
1324
|
* Updates the properties of this characteristic.
|
|
392
1325
|
* Properties passed via the parameter will be set. Any parameter set to null will be deleted.
|
|
@@ -394,10 +1327,10 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
394
1327
|
*
|
|
395
1328
|
* @param props - Partial properties object with the desired updates.
|
|
396
1329
|
*/
|
|
397
|
-
|
|
1330
|
+
setProps(props) {
|
|
398
1331
|
(0, assert_1.default)(props, "props cannot be undefined when setting props");
|
|
399
1332
|
// TODO calling setProps after publish doesn't lead to a increment in the current configuration number
|
|
400
|
-
|
|
1333
|
+
let formatDidChange = false;
|
|
401
1334
|
// for every value "null" can be used to reset props, except for required props
|
|
402
1335
|
if (props.format) {
|
|
403
1336
|
formatDidChange = this.props.format !== props.format;
|
|
@@ -423,7 +1356,7 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
423
1356
|
props.minValue = undefined;
|
|
424
1357
|
}
|
|
425
1358
|
else if (typeof props.minValue !== "number" || !Number.isFinite(props.minValue)) {
|
|
426
|
-
this.characteristicWarning(
|
|
1359
|
+
this.characteristicWarning(`Characteristic Property 'minValue' must be a finite number, received "${props.minValue}" (${typeof props.minValue})`, "error-message" /* CharacteristicWarningType.ERROR_MESSAGE */);
|
|
427
1360
|
props.minValue = undefined;
|
|
428
1361
|
}
|
|
429
1362
|
else {
|
|
@@ -450,7 +1383,7 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
450
1383
|
props.maxValue = undefined;
|
|
451
1384
|
}
|
|
452
1385
|
else if (typeof props.maxValue !== "number" || !Number.isFinite(props.maxValue)) {
|
|
453
|
-
this.characteristicWarning(
|
|
1386
|
+
this.characteristicWarning(`Characteristic Property 'maxValue' must be a finite number, received "${props.maxValue}" (${typeof props.maxValue})`, "error-message" /* CharacteristicWarningType.ERROR_MESSAGE */);
|
|
454
1387
|
props.maxValue = undefined;
|
|
455
1388
|
}
|
|
456
1389
|
else {
|
|
@@ -554,14 +1487,14 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
554
1487
|
// - If the characteristic is marked as erroneous the value is not considered valid anyway, and we must not remove the `statusCode`.
|
|
555
1488
|
// - Special case for `ProgrammableSwitchEvent` where every change in value is considered an event which would result in ghost button presses
|
|
556
1489
|
// validateUserInput when called from setProps is intended to clamp value withing allowed range. It is why warnings should not be displayed.
|
|
557
|
-
|
|
1490
|
+
const correctedValue = this.validateUserInput(this.value, "debug-message" /* CharacteristicWarningType.DEBUG_MESSAGE */);
|
|
558
1491
|
if (correctedValue !== this.value) {
|
|
559
1492
|
// we don't want to emit a CHANGE event if the value didn't change at all!
|
|
560
1493
|
this.updateValue(correctedValue);
|
|
561
1494
|
}
|
|
562
1495
|
}
|
|
563
1496
|
return this;
|
|
564
|
-
}
|
|
1497
|
+
}
|
|
565
1498
|
/**
|
|
566
1499
|
* This method can be used to gain an Iterator to loop over all valid values defined for this characteristic.
|
|
567
1500
|
*
|
|
@@ -590,9 +1523,9 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
590
1523
|
* const validValues = Array.from(characteristic.validValuesIterator());
|
|
591
1524
|
* ```
|
|
592
1525
|
*/
|
|
593
|
-
|
|
1526
|
+
validValuesIterator() {
|
|
594
1527
|
return new ValidValuesIterable(this.props);
|
|
595
|
-
}
|
|
1528
|
+
}
|
|
596
1529
|
// noinspection JSUnusedGlobalSymbols
|
|
597
1530
|
/**
|
|
598
1531
|
* This method can be used to set up additional authorization for a characteristic.
|
|
@@ -610,37 +1543,15 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
610
1543
|
*
|
|
611
1544
|
* @param handler - Handler called to check additional authorization data.
|
|
612
1545
|
*/
|
|
613
|
-
|
|
1546
|
+
setupAdditionalAuthorization(handler) {
|
|
614
1547
|
if (!this.props.perms.includes("aa" /* Perms.ADDITIONAL_AUTHORIZATION */)) {
|
|
615
1548
|
this.props.perms.push("aa" /* Perms.ADDITIONAL_AUTHORIZATION */);
|
|
616
1549
|
}
|
|
617
1550
|
this.additionalAuthorizationHandler = handler;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
* Updates the current value of the characteristic.
|
|
621
|
-
*
|
|
622
|
-
* @param callback
|
|
623
|
-
* @param context
|
|
624
|
-
* @private use to return the current value on HAP requests
|
|
625
|
-
*
|
|
626
|
-
* @deprecated
|
|
627
|
-
*/
|
|
628
|
-
Characteristic.prototype.getValue = function (callback, context) {
|
|
629
|
-
this.handleGetRequest(undefined, context).then(function (value) {
|
|
630
|
-
if (callback) {
|
|
631
|
-
callback(null, value);
|
|
632
|
-
}
|
|
633
|
-
}, function (reason) {
|
|
634
|
-
if (callback) {
|
|
635
|
-
callback(reason);
|
|
636
|
-
}
|
|
637
|
-
});
|
|
638
|
-
};
|
|
639
|
-
Characteristic.prototype.setValue = function (value, callback, context) {
|
|
1551
|
+
}
|
|
1552
|
+
setValue(value, callback, context) {
|
|
640
1553
|
if (value instanceof Error) {
|
|
641
1554
|
this.statusCode = value instanceof hapStatusError_1.HapStatusError ? value.hapStatus : extractHAPStatusFromError(value);
|
|
642
|
-
// noinspection JSDeprecatedSymbols
|
|
643
|
-
this.status = value;
|
|
644
1555
|
if (callback) {
|
|
645
1556
|
callback();
|
|
646
1557
|
}
|
|
@@ -654,13 +1565,13 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
654
1565
|
value = this.validateUserInput(value);
|
|
655
1566
|
}
|
|
656
1567
|
catch (error) {
|
|
657
|
-
this.characteristicWarning(
|
|
1568
|
+
this.characteristicWarning(error?.message + "", "error-message" /* CharacteristicWarningType.ERROR_MESSAGE */, error?.stack);
|
|
658
1569
|
if (callback) {
|
|
659
1570
|
callback(error);
|
|
660
1571
|
}
|
|
661
1572
|
return this;
|
|
662
1573
|
}
|
|
663
|
-
this.handleSetRequest(value, undefined, context).then(
|
|
1574
|
+
this.handleSetRequest(value, undefined, context).then(value => {
|
|
664
1575
|
if (callback) {
|
|
665
1576
|
if (value) { // possible write response
|
|
666
1577
|
callback(null, value);
|
|
@@ -669,18 +1580,16 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
669
1580
|
callback(null);
|
|
670
1581
|
}
|
|
671
1582
|
}
|
|
672
|
-
},
|
|
1583
|
+
}, reason => {
|
|
673
1584
|
if (callback) {
|
|
674
1585
|
callback(reason);
|
|
675
1586
|
}
|
|
676
1587
|
});
|
|
677
1588
|
return this;
|
|
678
|
-
}
|
|
679
|
-
|
|
1589
|
+
}
|
|
1590
|
+
updateValue(value, callback, context) {
|
|
680
1591
|
if (value instanceof Error) {
|
|
681
1592
|
this.statusCode = value instanceof hapStatusError_1.HapStatusError ? value.hapStatus : extractHAPStatusFromError(value);
|
|
682
|
-
// noinspection JSDeprecatedSymbols
|
|
683
|
-
this.status = value;
|
|
684
1593
|
if (callback) {
|
|
685
1594
|
callback();
|
|
686
1595
|
}
|
|
@@ -694,23 +1603,21 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
694
1603
|
value = this.validateUserInput(value);
|
|
695
1604
|
}
|
|
696
1605
|
catch (error) {
|
|
697
|
-
this.characteristicWarning(
|
|
1606
|
+
this.characteristicWarning(error?.message + "", "error-message" /* CharacteristicWarningType.ERROR_MESSAGE */, error?.stack);
|
|
698
1607
|
if (callback) {
|
|
699
1608
|
callback();
|
|
700
1609
|
}
|
|
701
1610
|
return this;
|
|
702
1611
|
}
|
|
703
1612
|
this.statusCode = 0 /* HAPStatus.SUCCESS */;
|
|
704
|
-
|
|
705
|
-
this.status = null;
|
|
706
|
-
var oldValue = this.value;
|
|
1613
|
+
const oldValue = this.value;
|
|
707
1614
|
this.value = value;
|
|
708
1615
|
if (callback) {
|
|
709
1616
|
callback();
|
|
710
1617
|
}
|
|
711
1618
|
this.emit("change" /* CharacteristicEventTypes.CHANGE */, { originator: undefined, oldValue: oldValue, newValue: value, reason: "update" /* ChangeReason.UPDATE */, context: context });
|
|
712
1619
|
return this; // for chaining
|
|
713
|
-
}
|
|
1620
|
+
}
|
|
714
1621
|
/**
|
|
715
1622
|
* This method acts similarly to {@link updateValue} by setting the current value of the characteristic
|
|
716
1623
|
* without calling any {@link CharacteristicEventTypes.SET} or {@link onSet} handlers.
|
|
@@ -720,16 +1627,14 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
720
1627
|
* @param value - The new value.
|
|
721
1628
|
* @param context - Passed to the {@link CharacteristicEventTypes.CHANGE} event handler.
|
|
722
1629
|
*/
|
|
723
|
-
|
|
1630
|
+
sendEventNotification(value, context) {
|
|
724
1631
|
this.statusCode = 0 /* HAPStatus.SUCCESS */;
|
|
725
|
-
// noinspection JSDeprecatedSymbols
|
|
726
|
-
this.status = null;
|
|
727
1632
|
value = this.validateUserInput(value);
|
|
728
|
-
|
|
1633
|
+
const oldValue = this.value;
|
|
729
1634
|
this.value = value;
|
|
730
1635
|
this.emit("change" /* CharacteristicEventTypes.CHANGE */, { originator: undefined, oldValue: oldValue, newValue: value, reason: "event" /* ChangeReason.EVENT */, context: context });
|
|
731
1636
|
return this; // for chaining
|
|
732
|
-
}
|
|
1637
|
+
}
|
|
733
1638
|
/**
|
|
734
1639
|
* Called when a HAP requests wants to know the current value of the characteristic.
|
|
735
1640
|
*
|
|
@@ -737,130 +1642,98 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
737
1642
|
* @param context - Deprecated parameter. There for backwards compatibility.
|
|
738
1643
|
* @private Used by the Accessory to load the characteristic value
|
|
739
1644
|
*/
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
1645
|
+
async handleGetRequest(connection, context) {
|
|
1646
|
+
if (!this.props.perms.includes("pr" /* Perms.PAIRED_READ */)) { // check if we are allowed to read from this characteristic
|
|
1647
|
+
throw -70405 /* HAPStatus.WRITE_ONLY_CHARACTERISTIC */;
|
|
1648
|
+
}
|
|
1649
|
+
if (this.UUID === Characteristic.ProgrammableSwitchEvent.UUID) {
|
|
1650
|
+
// special workaround for event only programmable switch event, which must always return null
|
|
1651
|
+
return null;
|
|
1652
|
+
}
|
|
1653
|
+
if (this.getHandler) {
|
|
1654
|
+
if (this.listeners("get" /* CharacteristicEventTypes.GET */).length > 0) {
|
|
1655
|
+
this.characteristicWarning("Ignoring on('get') handler as onGet handler was defined instead");
|
|
1656
|
+
}
|
|
1657
|
+
try {
|
|
1658
|
+
let value = await this.getHandler(context, connection);
|
|
1659
|
+
this.statusCode = 0 /* HAPStatus.SUCCESS */;
|
|
1660
|
+
try {
|
|
1661
|
+
value = this.validateUserInput(value);
|
|
1662
|
+
}
|
|
1663
|
+
catch (error) {
|
|
1664
|
+
this.characteristicWarning(`An illegal value was supplied by the read handler for characteristic: ${error?.message}`, "warn-message" /* CharacteristicWarningType.WARN_MESSAGE */, error?.stack);
|
|
1665
|
+
this.statusCode = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;
|
|
1666
|
+
return Promise.reject(-70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
1667
|
+
}
|
|
1668
|
+
const oldValue = this.value;
|
|
1669
|
+
this.value = value;
|
|
1670
|
+
if (oldValue !== value) { // emit a change event if necessary
|
|
1671
|
+
this.emit("change" /* CharacteristicEventTypes.CHANGE */, { originator: connection, oldValue: oldValue, newValue: value, reason: "read" /* ChangeReason.READ */, context: context });
|
|
1672
|
+
}
|
|
1673
|
+
return value;
|
|
1674
|
+
}
|
|
1675
|
+
catch (error) {
|
|
1676
|
+
if (typeof error === "number") {
|
|
1677
|
+
const hapStatusError = new hapStatusError_1.HapStatusError(error);
|
|
1678
|
+
this.statusCode = hapStatusError.hapStatus;
|
|
1679
|
+
}
|
|
1680
|
+
else if (error instanceof hapStatusError_1.HapStatusError) {
|
|
1681
|
+
this.statusCode = error.hapStatus;
|
|
1682
|
+
}
|
|
1683
|
+
else {
|
|
1684
|
+
this.characteristicWarning(`Unhandled error thrown inside read handler for characteristic: ${error?.message}`, "error-message" /* CharacteristicWarningType.ERROR_MESSAGE */, error?.stack);
|
|
1685
|
+
this.statusCode = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;
|
|
1686
|
+
}
|
|
1687
|
+
throw this.statusCode;
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
if (this.listeners("get" /* CharacteristicEventTypes.GET */).length === 0) {
|
|
1691
|
+
if (this.statusCode) {
|
|
1692
|
+
throw this.statusCode;
|
|
1693
|
+
}
|
|
1694
|
+
try {
|
|
1695
|
+
return this.validateUserInput(this.value);
|
|
1696
|
+
}
|
|
1697
|
+
catch (error) {
|
|
1698
|
+
this.characteristicWarning(`An illegal value was supplied by setting \`value\` for characteristic: ${error?.message}`, "warn-message" /* CharacteristicWarningType.WARN_MESSAGE */, error?.stack);
|
|
1699
|
+
return Promise.reject(-70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
return new Promise((resolve, reject) => {
|
|
1703
|
+
try {
|
|
1704
|
+
this.emit("get" /* CharacteristicEventTypes.GET */, (0, once_1.once)((status, value) => {
|
|
1705
|
+
if (status) {
|
|
1706
|
+
if (typeof status === "number") {
|
|
1707
|
+
const hapStatusError = new hapStatusError_1.HapStatusError(status);
|
|
787
1708
|
this.statusCode = hapStatusError.hapStatus;
|
|
788
|
-
// noinspection JSDeprecatedSymbols
|
|
789
|
-
this.status = hapStatusError;
|
|
790
1709
|
}
|
|
791
|
-
else if (
|
|
792
|
-
this.statusCode =
|
|
793
|
-
// noinspection JSDeprecatedSymbols
|
|
794
|
-
this.status = error_1;
|
|
1710
|
+
else if (status instanceof hapStatusError_1.HapStatusError) {
|
|
1711
|
+
this.statusCode = status.hapStatus;
|
|
795
1712
|
}
|
|
796
1713
|
else {
|
|
797
|
-
|
|
798
|
-
this.statusCode =
|
|
799
|
-
// noinspection JSDeprecatedSymbols
|
|
800
|
-
this.status = error_1;
|
|
801
|
-
}
|
|
802
|
-
throw this.statusCode;
|
|
803
|
-
case 4:
|
|
804
|
-
if (this.listeners("get" /* CharacteristicEventTypes.GET */).length === 0) {
|
|
805
|
-
if (this.statusCode) {
|
|
806
|
-
throw this.statusCode;
|
|
807
|
-
}
|
|
808
|
-
try {
|
|
809
|
-
return [2 /*return*/, this.validateUserInput(this.value)];
|
|
810
|
-
}
|
|
811
|
-
catch (error) {
|
|
812
|
-
this.characteristicWarning("An illegal value was supplied by setting `value` for characteristic: ".concat(error === null || error === void 0 ? void 0 : error.message), "warn-message" /* CharacteristicWarningType.WARN_MESSAGE */, error === null || error === void 0 ? void 0 : error.stack);
|
|
813
|
-
return [2 /*return*/, Promise.reject(-70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */)];
|
|
814
|
-
}
|
|
1714
|
+
debug("[%s] Received error from get handler %s", this.displayName, status.stack);
|
|
1715
|
+
this.statusCode = extractHAPStatusFromError(status);
|
|
815
1716
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
// noinspection JSDeprecatedSymbols
|
|
835
|
-
_this.status = status;
|
|
836
|
-
}
|
|
837
|
-
reject(_this.statusCode);
|
|
838
|
-
return;
|
|
839
|
-
}
|
|
840
|
-
_this.statusCode = 0 /* HAPStatus.SUCCESS */;
|
|
841
|
-
// noinspection JSDeprecatedSymbols
|
|
842
|
-
_this.status = null;
|
|
843
|
-
value = _this.validateUserInput(value);
|
|
844
|
-
var oldValue = _this.value;
|
|
845
|
-
_this.value = value;
|
|
846
|
-
resolve(value);
|
|
847
|
-
if (oldValue !== value) { // emit a change event if necessary
|
|
848
|
-
_this.emit("change" /* CharacteristicEventTypes.CHANGE */, { originator: connection, oldValue: oldValue, newValue: value, reason: "read" /* ChangeReason.READ */, context: context });
|
|
849
|
-
}
|
|
850
|
-
}), context, connection);
|
|
851
|
-
}
|
|
852
|
-
catch (error) {
|
|
853
|
-
_this.characteristicWarning("Unhandled error thrown inside read handler for characteristic: ".concat(error === null || error === void 0 ? void 0 : error.message), "error-message" /* CharacteristicWarningType.ERROR_MESSAGE */, error === null || error === void 0 ? void 0 : error.stack);
|
|
854
|
-
_this.statusCode = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;
|
|
855
|
-
// noinspection JSDeprecatedSymbols
|
|
856
|
-
_this.status = error;
|
|
857
|
-
reject(-70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
858
|
-
}
|
|
859
|
-
})];
|
|
860
|
-
}
|
|
861
|
-
});
|
|
1717
|
+
reject(this.statusCode);
|
|
1718
|
+
return;
|
|
1719
|
+
}
|
|
1720
|
+
this.statusCode = 0 /* HAPStatus.SUCCESS */;
|
|
1721
|
+
value = this.validateUserInput(value);
|
|
1722
|
+
const oldValue = this.value;
|
|
1723
|
+
this.value = value;
|
|
1724
|
+
resolve(value);
|
|
1725
|
+
if (oldValue !== value) { // emit a change event if necessary
|
|
1726
|
+
this.emit("change" /* CharacteristicEventTypes.CHANGE */, { originator: connection, oldValue: oldValue, newValue: value, reason: "read" /* ChangeReason.READ */, context: context });
|
|
1727
|
+
}
|
|
1728
|
+
}), context, connection);
|
|
1729
|
+
}
|
|
1730
|
+
catch (error) {
|
|
1731
|
+
this.characteristicWarning(`Unhandled error thrown inside read handler for characteristic: ${error?.message}`, "error-message" /* CharacteristicWarningType.ERROR_MESSAGE */, error?.stack);
|
|
1732
|
+
this.statusCode = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;
|
|
1733
|
+
reject(-70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
1734
|
+
}
|
|
862
1735
|
});
|
|
863
|
-
}
|
|
1736
|
+
}
|
|
864
1737
|
/**
|
|
865
1738
|
* Called when a HAP requests update the current value of the characteristic.
|
|
866
1739
|
*
|
|
@@ -872,162 +1745,127 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
872
1745
|
* write response value is resolved.
|
|
873
1746
|
* @private
|
|
874
1747
|
*/
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
1748
|
+
async handleSetRequest(value, connection, context) {
|
|
1749
|
+
this.statusCode = 0 /* HAPStatus.SUCCESS */;
|
|
1750
|
+
if (connection !== undefined) {
|
|
1751
|
+
// if connection is undefined, the set "request" comes from the setValue method.
|
|
1752
|
+
// for setValue a value of "null" is allowed and checked via validateUserInput.
|
|
1753
|
+
try {
|
|
1754
|
+
value = this.validateClientSuppliedValue(value);
|
|
1755
|
+
}
|
|
1756
|
+
catch (e) {
|
|
1757
|
+
debug(`[${this.displayName}]`, e.message);
|
|
1758
|
+
return Promise.reject(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
const oldValue = this.value;
|
|
1762
|
+
if (this.setHandler) {
|
|
1763
|
+
if (this.listeners("set" /* CharacteristicEventTypes.SET */).length > 0) {
|
|
1764
|
+
this.characteristicWarning("Ignoring on('set') handler as onSet handler was defined instead");
|
|
1765
|
+
}
|
|
1766
|
+
try {
|
|
1767
|
+
const writeResponse = await this.setHandler(value, context, connection);
|
|
1768
|
+
this.statusCode = 0 /* HAPStatus.SUCCESS */;
|
|
1769
|
+
if (writeResponse != null && this.props.perms.includes("wr" /* Perms.WRITE_RESPONSE */)) {
|
|
1770
|
+
this.value = this.validateUserInput(writeResponse);
|
|
1771
|
+
return this.value;
|
|
1772
|
+
}
|
|
1773
|
+
else {
|
|
1774
|
+
if (writeResponse != null) {
|
|
1775
|
+
this.characteristicWarning("SET handler returned write response value, though the characteristic doesn't support write response", "debug-message" /* CharacteristicWarningType.DEBUG_MESSAGE */);
|
|
1776
|
+
}
|
|
1777
|
+
this.value = value;
|
|
1778
|
+
this.emit("change" /* CharacteristicEventTypes.CHANGE */, { originator: connection, oldValue: oldValue, newValue: value, reason: "write" /* ChangeReason.WRITE */, context: context });
|
|
1779
|
+
return;
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
catch (error) {
|
|
1783
|
+
if (typeof error === "number") {
|
|
1784
|
+
const hapStatusError = new hapStatusError_1.HapStatusError(error);
|
|
1785
|
+
this.statusCode = hapStatusError.hapStatus;
|
|
1786
|
+
}
|
|
1787
|
+
else if (error instanceof hapStatusError_1.HapStatusError) {
|
|
1788
|
+
this.statusCode = error.hapStatus;
|
|
1789
|
+
}
|
|
1790
|
+
else {
|
|
1791
|
+
this.characteristicWarning(`Unhandled error thrown inside write handler for characteristic: ${error?.message}`, "error-message" /* CharacteristicWarningType.ERROR_MESSAGE */, error?.stack);
|
|
1792
|
+
this.statusCode = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;
|
|
1793
|
+
}
|
|
1794
|
+
throw this.statusCode;
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
if (this.listeners("set" /* CharacteristicEventTypes.SET */).length === 0) {
|
|
1798
|
+
this.value = value;
|
|
1799
|
+
this.emit("change" /* CharacteristicEventTypes.CHANGE */, { originator: connection, oldValue: oldValue, newValue: value, reason: "write" /* ChangeReason.WRITE */, context: context });
|
|
1800
|
+
return Promise.resolve();
|
|
1801
|
+
}
|
|
1802
|
+
else {
|
|
1803
|
+
return new Promise((resolve, reject) => {
|
|
1804
|
+
try {
|
|
1805
|
+
this.emit("set" /* CharacteristicEventTypes.SET */, value, (0, once_1.once)((status, writeResponse) => {
|
|
1806
|
+
if (status) {
|
|
1807
|
+
if (typeof status === "number") {
|
|
1808
|
+
const hapStatusError = new hapStatusError_1.HapStatusError(status);
|
|
1809
|
+
this.statusCode = hapStatusError.hapStatus;
|
|
890
1810
|
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
return [2 /*return*/, Promise.reject(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */)];
|
|
1811
|
+
else if (status instanceof hapStatusError_1.HapStatusError) {
|
|
1812
|
+
this.statusCode = status.hapStatus;
|
|
894
1813
|
}
|
|
1814
|
+
else {
|
|
1815
|
+
debug("[%s] Received error from set handler %s", this.displayName, status.stack);
|
|
1816
|
+
this.statusCode = extractHAPStatusFromError(status);
|
|
1817
|
+
}
|
|
1818
|
+
reject(this.statusCode);
|
|
1819
|
+
return;
|
|
895
1820
|
}
|
|
896
|
-
oldValue = this.value;
|
|
897
|
-
if (!this.setHandler) return [3 /*break*/, 4];
|
|
898
|
-
if (this.listeners("set" /* CharacteristicEventTypes.SET */).length > 0) {
|
|
899
|
-
this.characteristicWarning("Ignoring on('set') handler as onSet handler was defined instead");
|
|
900
|
-
}
|
|
901
|
-
_a.label = 1;
|
|
902
|
-
case 1:
|
|
903
|
-
_a.trys.push([1, 3, , 4]);
|
|
904
|
-
return [4 /*yield*/, this.setHandler(value, context, connection)];
|
|
905
|
-
case 2:
|
|
906
|
-
writeResponse = _a.sent();
|
|
907
1821
|
this.statusCode = 0 /* HAPStatus.SUCCESS */;
|
|
908
|
-
// noinspection JSDeprecatedSymbols
|
|
909
|
-
this.status = null;
|
|
910
1822
|
if (writeResponse != null && this.props.perms.includes("wr" /* Perms.WRITE_RESPONSE */)) {
|
|
1823
|
+
// support write response simply by letting the implementor pass the response as second argument to the callback
|
|
911
1824
|
this.value = this.validateUserInput(writeResponse);
|
|
912
|
-
|
|
1825
|
+
resolve(this.value);
|
|
913
1826
|
}
|
|
914
1827
|
else {
|
|
915
1828
|
if (writeResponse != null) {
|
|
916
1829
|
this.characteristicWarning("SET handler returned write response value, though the characteristic doesn't support write response", "debug-message" /* CharacteristicWarningType.DEBUG_MESSAGE */);
|
|
917
1830
|
}
|
|
918
1831
|
this.value = value;
|
|
1832
|
+
resolve();
|
|
919
1833
|
this.emit("change" /* CharacteristicEventTypes.CHANGE */, { originator: connection, oldValue: oldValue, newValue: value, reason: "write" /* ChangeReason.WRITE */, context: context });
|
|
920
|
-
return [2 /*return*/];
|
|
921
|
-
}
|
|
922
|
-
return [3 /*break*/, 4];
|
|
923
|
-
case 3:
|
|
924
|
-
error_2 = _a.sent();
|
|
925
|
-
if (typeof error_2 === "number") {
|
|
926
|
-
hapStatusError = new hapStatusError_1.HapStatusError(error_2);
|
|
927
|
-
this.statusCode = hapStatusError.hapStatus;
|
|
928
|
-
// noinspection JSDeprecatedSymbols
|
|
929
|
-
this.status = hapStatusError;
|
|
930
|
-
}
|
|
931
|
-
else if (error_2 instanceof hapStatusError_1.HapStatusError) {
|
|
932
|
-
this.statusCode = error_2.hapStatus;
|
|
933
|
-
// noinspection JSDeprecatedSymbols
|
|
934
|
-
this.status = error_2;
|
|
935
|
-
}
|
|
936
|
-
else {
|
|
937
|
-
this.characteristicWarning("Unhandled error thrown inside write handler for characteristic: ".concat(error_2 === null || error_2 === void 0 ? void 0 : error_2.message), "error-message" /* CharacteristicWarningType.ERROR_MESSAGE */, error_2 === null || error_2 === void 0 ? void 0 : error_2.stack);
|
|
938
|
-
this.statusCode = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;
|
|
939
|
-
// noinspection JSDeprecatedSymbols
|
|
940
|
-
this.status = error_2;
|
|
941
|
-
}
|
|
942
|
-
throw this.statusCode;
|
|
943
|
-
case 4:
|
|
944
|
-
if (this.listeners("set" /* CharacteristicEventTypes.SET */).length === 0) {
|
|
945
|
-
this.value = value;
|
|
946
|
-
this.emit("change" /* CharacteristicEventTypes.CHANGE */, { originator: connection, oldValue: oldValue, newValue: value, reason: "write" /* ChangeReason.WRITE */, context: context });
|
|
947
|
-
return [2 /*return*/, Promise.resolve()];
|
|
948
1834
|
}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
var hapStatusError = new hapStatusError_1.HapStatusError(status);
|
|
956
|
-
_this.statusCode = hapStatusError.hapStatus;
|
|
957
|
-
// noinspection JSDeprecatedSymbols
|
|
958
|
-
_this.status = hapStatusError;
|
|
959
|
-
}
|
|
960
|
-
else if (status instanceof hapStatusError_1.HapStatusError) {
|
|
961
|
-
_this.statusCode = status.hapStatus;
|
|
962
|
-
// noinspection JSDeprecatedSymbols
|
|
963
|
-
_this.status = status;
|
|
964
|
-
}
|
|
965
|
-
else {
|
|
966
|
-
debug("[%s] Received error from set handler %s", _this.displayName, status.stack);
|
|
967
|
-
_this.statusCode = extractHAPStatusFromError(status);
|
|
968
|
-
// noinspection JSDeprecatedSymbols
|
|
969
|
-
_this.status = status;
|
|
970
|
-
}
|
|
971
|
-
reject(_this.statusCode);
|
|
972
|
-
return;
|
|
973
|
-
}
|
|
974
|
-
_this.statusCode = 0 /* HAPStatus.SUCCESS */;
|
|
975
|
-
// noinspection JSDeprecatedSymbols
|
|
976
|
-
_this.status = null;
|
|
977
|
-
if (writeResponse != null && _this.props.perms.includes("wr" /* Perms.WRITE_RESPONSE */)) {
|
|
978
|
-
// support write response simply by letting the implementor pass the response as second argument to the callback
|
|
979
|
-
_this.value = _this.validateUserInput(writeResponse);
|
|
980
|
-
resolve(_this.value);
|
|
981
|
-
}
|
|
982
|
-
else {
|
|
983
|
-
if (writeResponse != null) {
|
|
984
|
-
_this.characteristicWarning("SET handler returned write response value, though the characteristic doesn't support write response", "debug-message" /* CharacteristicWarningType.DEBUG_MESSAGE */);
|
|
985
|
-
}
|
|
986
|
-
_this.value = value;
|
|
987
|
-
resolve();
|
|
988
|
-
_this.emit("change" /* CharacteristicEventTypes.CHANGE */, { originator: connection, oldValue: oldValue, newValue: value, reason: "write" /* ChangeReason.WRITE */, context: context });
|
|
989
|
-
}
|
|
990
|
-
}), context, connection);
|
|
991
|
-
}
|
|
992
|
-
catch (error) {
|
|
993
|
-
_this.characteristicWarning("Unhandled error thrown inside write handler for characteristic: ".concat(error === null || error === void 0 ? void 0 : error.message), "error-message" /* CharacteristicWarningType.ERROR_MESSAGE */, error === null || error === void 0 ? void 0 : error.stack);
|
|
994
|
-
_this.statusCode = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;
|
|
995
|
-
// noinspection JSDeprecatedSymbols
|
|
996
|
-
_this.status = error;
|
|
997
|
-
reject(-70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
998
|
-
}
|
|
999
|
-
})];
|
|
1000
|
-
}
|
|
1001
|
-
return [2 /*return*/];
|
|
1835
|
+
}), context, connection);
|
|
1836
|
+
}
|
|
1837
|
+
catch (error) {
|
|
1838
|
+
this.characteristicWarning(`Unhandled error thrown inside write handler for characteristic: ${error?.message}`, "error-message" /* CharacteristicWarningType.ERROR_MESSAGE */, error?.stack);
|
|
1839
|
+
this.statusCode = -70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */;
|
|
1840
|
+
reject(-70402 /* HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
1002
1841
|
}
|
|
1003
1842
|
});
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1006
1845
|
/**
|
|
1007
1846
|
* Called once a HomeKit controller subscribes to events of this characteristic.
|
|
1008
1847
|
* @private
|
|
1009
1848
|
*/
|
|
1010
|
-
|
|
1849
|
+
subscribe() {
|
|
1011
1850
|
if (this.subscriptions === 0) {
|
|
1012
1851
|
this.emit("subscribe" /* CharacteristicEventTypes.SUBSCRIBE */);
|
|
1013
1852
|
}
|
|
1014
1853
|
this.subscriptions++;
|
|
1015
|
-
}
|
|
1854
|
+
}
|
|
1016
1855
|
/**
|
|
1017
1856
|
* Called once a HomeKit controller unsubscribe to events of this characteristic or a HomeKit controller
|
|
1018
1857
|
* which was subscribed to this characteristic disconnects.
|
|
1019
1858
|
* @private
|
|
1020
1859
|
*/
|
|
1021
|
-
|
|
1022
|
-
|
|
1860
|
+
unsubscribe() {
|
|
1861
|
+
const wasOne = this.subscriptions === 1;
|
|
1023
1862
|
this.subscriptions--;
|
|
1024
1863
|
this.subscriptions = Math.max(this.subscriptions, 0);
|
|
1025
1864
|
if (wasOne) {
|
|
1026
1865
|
this.emit("unsubscribe" /* CharacteristicEventTypes.UNSUBSCRIBE */);
|
|
1027
1866
|
}
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
var _a;
|
|
1867
|
+
}
|
|
1868
|
+
getDefaultValue() {
|
|
1031
1869
|
// noinspection JSDeprecatedSymbols
|
|
1032
1870
|
switch (this.props.format) {
|
|
1033
1871
|
case "bool" /* Formats.BOOL */:
|
|
@@ -1049,10 +1887,6 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
1049
1887
|
return ""; // who knows!
|
|
1050
1888
|
case "tlv8" /* Formats.TLV8 */:
|
|
1051
1889
|
return ""; // who knows!
|
|
1052
|
-
case "dict" /* Formats.DICTIONARY */:
|
|
1053
|
-
return {};
|
|
1054
|
-
case "array" /* Formats.ARRAY */:
|
|
1055
|
-
return [];
|
|
1056
1890
|
case "int" /* Formats.INT */:
|
|
1057
1891
|
case "float" /* Formats.FLOAT */:
|
|
1058
1892
|
case "uint8" /* Formats.UINT8 */:
|
|
@@ -1063,7 +1897,7 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
1063
1897
|
case Characteristic.CurrentTemperature.UUID:
|
|
1064
1898
|
return 0; // some existing integrations expect this to be 0 by default
|
|
1065
1899
|
default: {
|
|
1066
|
-
if (
|
|
1900
|
+
if (this.props.validValues?.length && typeof this.props.validValues[0] === "number") {
|
|
1067
1901
|
return this.props.validValues[0];
|
|
1068
1902
|
}
|
|
1069
1903
|
if (typeof this.props.minValue === "number" && Number.isFinite(this.props.minValue)) {
|
|
@@ -1075,16 +1909,16 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
1075
1909
|
default:
|
|
1076
1910
|
return 0;
|
|
1077
1911
|
}
|
|
1078
|
-
}
|
|
1912
|
+
}
|
|
1079
1913
|
/**
|
|
1080
1914
|
* Checks if the value received from the HAP request is valid.
|
|
1081
1915
|
* If returned false the received value is not valid and {@link HAPStatus.INVALID_VALUE_IN_REQUEST}
|
|
1082
1916
|
* must be returned.
|
|
1083
1917
|
* @param value - Value supplied by the HomeKit controller
|
|
1084
1918
|
*/
|
|
1085
|
-
|
|
1919
|
+
validateClientSuppliedValue(value) {
|
|
1086
1920
|
if (value == null) {
|
|
1087
|
-
throw new Error(
|
|
1921
|
+
throw new Error(`Client supplied invalid value for ${this.props.format}: ${value}`);
|
|
1088
1922
|
}
|
|
1089
1923
|
switch (this.props.format) {
|
|
1090
1924
|
case "bool" /* Formats.BOOL */: {
|
|
@@ -1094,7 +1928,7 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
1094
1928
|
if (typeof value === "number" && (value === 1 || value === 0)) {
|
|
1095
1929
|
return Boolean(value);
|
|
1096
1930
|
}
|
|
1097
|
-
throw new Error(
|
|
1931
|
+
throw new Error(`Client supplied invalid type for ${this.props.format}: "${value}" (${typeof value})`);
|
|
1098
1932
|
}
|
|
1099
1933
|
case "int" /* Formats.INT */:
|
|
1100
1934
|
case "float" /* Formats.FLOAT */:
|
|
@@ -1106,58 +1940,58 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
1106
1940
|
value = value ? 1 : 0;
|
|
1107
1941
|
}
|
|
1108
1942
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
1109
|
-
throw new Error(
|
|
1943
|
+
throw new Error(`Client supplied invalid type for ${this.props.format}: "${value}" (${typeof value})`);
|
|
1110
1944
|
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1945
|
+
const numericMin = maxWithUndefined(this.props.minValue, (0, request_util_1.numericLowerBound)(this.props.format));
|
|
1946
|
+
const numericMax = minWithUndefined(this.props.maxValue, (0, request_util_1.numericUpperBound)(this.props.format));
|
|
1113
1947
|
if (typeof numericMin === "number" && value < numericMin) {
|
|
1114
|
-
throw new Error(
|
|
1948
|
+
throw new Error(`Client supplied value of ${value} is less than the minimum allowed value of ${numericMin}`);
|
|
1115
1949
|
}
|
|
1116
1950
|
if (typeof numericMax === "number" && value > numericMax) {
|
|
1117
|
-
throw new Error(
|
|
1951
|
+
throw new Error(`Client supplied value of ${value} is greater than the maximum allowed value of ${numericMax}`);
|
|
1118
1952
|
}
|
|
1119
1953
|
if (this.props.validValues && !this.props.validValues.includes(value)) {
|
|
1120
|
-
throw new Error(
|
|
1954
|
+
throw new Error(`Client supplied value of ${value} is not in ${this.props.validValues.toString()}`);
|
|
1121
1955
|
}
|
|
1122
1956
|
if (this.props.validValueRanges && this.props.validValueRanges.length === 2) {
|
|
1123
1957
|
if (value < this.props.validValueRanges[0]) {
|
|
1124
|
-
throw new Error(
|
|
1958
|
+
throw new Error(`Client supplied value of ${value} is less than the minimum allowed value of ${this.props.validValueRanges[0]}`);
|
|
1125
1959
|
}
|
|
1126
1960
|
if (value > this.props.validValueRanges[1]) {
|
|
1127
|
-
throw new Error(
|
|
1961
|
+
throw new Error(`Client supplied value of ${value} is greater than the maximum allowed value of ${this.props.validValueRanges[1]}`);
|
|
1128
1962
|
}
|
|
1129
1963
|
}
|
|
1130
1964
|
return value;
|
|
1131
1965
|
}
|
|
1132
1966
|
case "string" /* Formats.STRING */: {
|
|
1133
1967
|
if (typeof value !== "string") {
|
|
1134
|
-
throw new Error(
|
|
1968
|
+
throw new Error(`Client supplied invalid type for ${this.props.format}: "${value}" (${typeof value})`);
|
|
1135
1969
|
}
|
|
1136
|
-
|
|
1970
|
+
const maxLength = this.props.maxLen != null ? this.props.maxLen : 64; // default is 64; max is 256 which is set in setProps
|
|
1137
1971
|
if (value.length > maxLength) {
|
|
1138
|
-
throw new Error(
|
|
1972
|
+
throw new Error(`Client supplied value length of ${value.length} exceeds maximum length allowed of ${maxLength}`);
|
|
1139
1973
|
}
|
|
1140
1974
|
return value;
|
|
1141
1975
|
}
|
|
1142
1976
|
case "data" /* Formats.DATA */: {
|
|
1143
1977
|
if (typeof value !== "string") {
|
|
1144
|
-
throw new Error(
|
|
1978
|
+
throw new Error(`Client supplied invalid type for ${this.props.format}: "${value}" (${typeof value})`);
|
|
1145
1979
|
}
|
|
1146
1980
|
// we don't validate base64 here
|
|
1147
|
-
|
|
1981
|
+
const maxLength = this.props.maxDataLen != null ? this.props.maxDataLen : 0x200000; // default is 0x200000
|
|
1148
1982
|
if (value.length > maxLength) {
|
|
1149
|
-
throw new Error(
|
|
1983
|
+
throw new Error(`Client supplied value length of ${value.length} exceeds maximum length allowed of ${maxLength}`);
|
|
1150
1984
|
}
|
|
1151
1985
|
return value;
|
|
1152
1986
|
}
|
|
1153
1987
|
case "tlv8" /* Formats.TLV8 */:
|
|
1154
1988
|
if (typeof value !== "string") {
|
|
1155
|
-
throw new Error(
|
|
1989
|
+
throw new Error(`Client supplied invalid type for ${this.props.format}: "${value}" (${typeof value})`);
|
|
1156
1990
|
}
|
|
1157
1991
|
return value;
|
|
1158
1992
|
}
|
|
1159
1993
|
return value;
|
|
1160
|
-
}
|
|
1994
|
+
}
|
|
1161
1995
|
/**
|
|
1162
1996
|
* Checks if the value received from the API call is valid.
|
|
1163
1997
|
* It adjusts the value where it makes sense, prints a warning where values may be rejected with an error
|
|
@@ -1166,9 +2000,7 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
1166
2000
|
* @param value - The value received from the API call
|
|
1167
2001
|
* @param warningType - Optionally defines the warning type to use when raising a {@link CharacteristicEventTypes.CHARACTERISTIC_WARNING}.
|
|
1168
2002
|
*/
|
|
1169
|
-
|
|
1170
|
-
var _a;
|
|
1171
|
-
if (warningType === void 0) { warningType = "warn-message" /* CharacteristicWarningType.WARN_MESSAGE */; }
|
|
2003
|
+
validateUserInput(value, warningType = "warn-message" /* CharacteristicWarningType.WARN_MESSAGE */) {
|
|
1172
2004
|
if (value === null) {
|
|
1173
2005
|
if (this.UUID === Characteristic.Model.UUID || this.UUID === Characteristic.SerialNumber.UUID) { // mirrors the statement in case: Formats.STRING
|
|
1174
2006
|
this.characteristicWarning("characteristic must have a non null value otherwise HomeKit will reject this accessory, ignoring new value", "error-message" /* CharacteristicWarningType.ERROR_MESSAGE */);
|
|
@@ -1229,12 +2061,12 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
1229
2061
|
value = this.props.format === "float" /* Formats.FLOAT */ ? parseFloat(value) : parseInt(value, 10);
|
|
1230
2062
|
}
|
|
1231
2063
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
1232
|
-
this.characteristicWarning(
|
|
2064
|
+
this.characteristicWarning(`characteristic value expected valid finite number and received "${value}" (${typeof value})`, warningType);
|
|
1233
2065
|
value = typeof this.value === "number" ? this.value : this.props.minValue || 0;
|
|
1234
2066
|
}
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
2067
|
+
const numericMin = maxWithUndefined(this.props.minValue, (0, request_util_1.numericLowerBound)(this.props.format));
|
|
2068
|
+
const numericMax = minWithUndefined(this.props.maxValue, (0, request_util_1.numericUpperBound)(this.props.format));
|
|
2069
|
+
let stepValue = undefined;
|
|
1238
2070
|
if (this.props.format === "float" /* Formats.FLOAT */) {
|
|
1239
2071
|
stepValue = this.props.minStep;
|
|
1240
2072
|
}
|
|
@@ -1242,28 +2074,30 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
1242
2074
|
stepValue = maxWithUndefined(this.props.minStep, 1);
|
|
1243
2075
|
}
|
|
1244
2076
|
if (stepValue != null && stepValue > 0) {
|
|
1245
|
-
|
|
2077
|
+
const minValue = this.props.minValue != null ? this.props.minValue : 0;
|
|
1246
2078
|
value = stepValue * Math.round((value - minValue) / stepValue) + minValue;
|
|
1247
2079
|
}
|
|
1248
2080
|
if (numericMin != null && value < numericMin) {
|
|
1249
|
-
this.characteristicWarning(
|
|
2081
|
+
this.characteristicWarning(`characteristic was supplied illegal value: number ${value} exceeded minimum of ${numericMin}`, warningType);
|
|
1250
2082
|
value = numericMin;
|
|
1251
2083
|
}
|
|
1252
2084
|
if (numericMax != null && value > numericMax) {
|
|
1253
|
-
this.characteristicWarning(
|
|
2085
|
+
this.characteristicWarning(`characteristic was supplied illegal value: number ${value} exceeded maximum of ${numericMax}`, warningType);
|
|
1254
2086
|
value = numericMax;
|
|
1255
2087
|
}
|
|
1256
2088
|
if (this.props.validValues && !this.props.validValues.includes(value)) {
|
|
1257
|
-
this.characteristicWarning(
|
|
2089
|
+
this.characteristicWarning(`characteristic value ${value} is not contained in valid values array`, warningType);
|
|
1258
2090
|
return this.props.validValues.includes(this.value) ? this.value : (this.props.validValues[0] || 0);
|
|
1259
2091
|
}
|
|
1260
2092
|
if (this.props.validValueRanges && this.props.validValueRanges.length === 2) {
|
|
1261
2093
|
if (value < this.props.validValueRanges[0]) {
|
|
1262
|
-
this.characteristicWarning(
|
|
2094
|
+
this.characteristicWarning(`characteristic was supplied illegal value: number ${value} not contained in valid value range of `
|
|
2095
|
+
+ `${this.props.validValueRanges}, supplying illegal values will throw errors in the future`, warningType);
|
|
1263
2096
|
value = this.props.validValueRanges[0];
|
|
1264
2097
|
}
|
|
1265
2098
|
else if (value > this.props.validValueRanges[1]) {
|
|
1266
|
-
this.characteristicWarning(
|
|
2099
|
+
this.characteristicWarning(`characteristic was supplied illegal value: number ${value} not contained in valid value range of `
|
|
2100
|
+
+ `${this.props.validValueRanges}, supplying illegal values will throw errors in the future`, warningType);
|
|
1267
2101
|
value = this.props.validValueRanges[1];
|
|
1268
2102
|
}
|
|
1269
2103
|
}
|
|
@@ -1281,16 +2115,17 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
1281
2115
|
}
|
|
1282
2116
|
// mirrors the case value = null at the beginning
|
|
1283
2117
|
if (value.length <= 1 && (this.UUID === Characteristic.Model.UUID || this.UUID === Characteristic.SerialNumber.UUID)) {
|
|
1284
|
-
this.characteristicWarning(
|
|
2118
|
+
this.characteristicWarning(`[${this.displayName}] characteristic must have a length of more than 1 character otherwise`
|
|
2119
|
+
+ ` HomeKit will reject this accessory, ignoring new value ${warningType}`);
|
|
1285
2120
|
return this.value; // just return the current value
|
|
1286
2121
|
}
|
|
1287
|
-
|
|
2122
|
+
const maxLength = this.props.maxLen ?? 64; // default is 64 (max is 256 which is set in setProps)
|
|
1288
2123
|
if (value.length > maxLength) {
|
|
1289
|
-
this.characteristicWarning(
|
|
2124
|
+
this.characteristicWarning(`characteristic was supplied illegal value: string '${value}' exceeded max length of ${maxLength}`, warningType);
|
|
1290
2125
|
value = value.substring(0, maxLength);
|
|
1291
2126
|
}
|
|
1292
|
-
if (this.UUID ===
|
|
1293
|
-
(0, checkName_1.checkName)(
|
|
2127
|
+
if (value.length > 0 && this.UUID === Characteristic.ConfiguredName.UUID) {
|
|
2128
|
+
(0, checkName_1.checkName)(this.displayName, "ConfiguredName", value);
|
|
1294
2129
|
}
|
|
1295
2130
|
return value;
|
|
1296
2131
|
}
|
|
@@ -1316,109 +2151,88 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
1316
2151
|
return this.value;
|
|
1317
2152
|
}
|
|
1318
2153
|
return value;
|
|
1319
|
-
}
|
|
2154
|
+
}
|
|
1320
2155
|
/**
|
|
1321
2156
|
* @private used to assign iid to characteristic
|
|
1322
2157
|
*/
|
|
1323
|
-
|
|
2158
|
+
_assignID(identifierCache, accessoryName, serviceUUID, serviceSubtype) {
|
|
1324
2159
|
// generate our IID based on our UUID
|
|
1325
2160
|
this.iid = identifierCache.getIID(accessoryName, serviceUUID, serviceSubtype, this.UUID);
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
if (type === void 0) { type = "warn-message" /* CharacteristicWarningType.WARN_MESSAGE */; }
|
|
1329
|
-
if (stack === void 0) { stack = new Error().stack; }
|
|
2161
|
+
}
|
|
2162
|
+
characteristicWarning(message, type = "warn-message" /* CharacteristicWarningType.WARN_MESSAGE */, stack = new Error().stack) {
|
|
1330
2163
|
this.emit("characteristic-warning" /* CharacteristicEventTypes.CHARACTERISTIC_WARNING */, type, message, stack);
|
|
1331
|
-
}
|
|
2164
|
+
}
|
|
1332
2165
|
/**
|
|
1333
2166
|
* @param event
|
|
1334
2167
|
* @private
|
|
1335
2168
|
*/
|
|
1336
|
-
|
|
2169
|
+
removeAllListeners(event) {
|
|
1337
2170
|
if (!event) {
|
|
1338
2171
|
this.removeOnGet();
|
|
1339
2172
|
this.removeOnSet();
|
|
1340
2173
|
}
|
|
1341
|
-
return
|
|
1342
|
-
}
|
|
2174
|
+
return super.removeAllListeners(event);
|
|
2175
|
+
}
|
|
1343
2176
|
/**
|
|
1344
2177
|
* @param characteristic
|
|
1345
2178
|
* @private
|
|
1346
2179
|
*/
|
|
1347
|
-
|
|
1348
|
-
var _this = this;
|
|
2180
|
+
replaceBy(characteristic) {
|
|
1349
2181
|
this.props = characteristic.props;
|
|
1350
2182
|
this.updateValue(characteristic.value);
|
|
1351
|
-
|
|
2183
|
+
const getListeners = characteristic.listeners("get" /* CharacteristicEventTypes.GET */);
|
|
1352
2184
|
if (getListeners.length) {
|
|
1353
2185
|
// the callback can only be called once, so we remove all old listeners
|
|
1354
2186
|
this.removeAllListeners("get" /* CharacteristicEventTypes.GET */);
|
|
1355
2187
|
// @ts-expect-error: force type
|
|
1356
|
-
getListeners.forEach(
|
|
2188
|
+
getListeners.forEach(listener => this.addListener("get" /* CharacteristicEventTypes.GET */, listener));
|
|
1357
2189
|
}
|
|
1358
2190
|
this.removeOnGet();
|
|
1359
2191
|
if (characteristic.getHandler) {
|
|
1360
2192
|
this.onGet(characteristic.getHandler);
|
|
1361
2193
|
}
|
|
1362
|
-
|
|
2194
|
+
const setListeners = characteristic.listeners("set" /* CharacteristicEventTypes.SET */);
|
|
1363
2195
|
if (setListeners.length) {
|
|
1364
2196
|
// the callback can only be called once, so we remove all old listeners
|
|
1365
2197
|
this.removeAllListeners("set" /* CharacteristicEventTypes.SET */);
|
|
1366
2198
|
// @ts-expect-error: force type
|
|
1367
|
-
setListeners.forEach(
|
|
2199
|
+
setListeners.forEach(listener => this.addListener("set" /* CharacteristicEventTypes.SET */, listener));
|
|
1368
2200
|
}
|
|
1369
2201
|
this.removeOnSet();
|
|
1370
2202
|
if (characteristic.setHandler) {
|
|
1371
2203
|
this.onSet(characteristic.setHandler);
|
|
1372
2204
|
}
|
|
1373
|
-
}
|
|
2205
|
+
}
|
|
1374
2206
|
/**
|
|
1375
2207
|
* Returns a JSON representation of this characteristic suitable for delivering to HAP clients.
|
|
1376
2208
|
* @private used to generate response to /accessories query
|
|
1377
2209
|
*/
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
debug("[%s] Error getting value for characteristic on /accessories request. Returning default value instead: %s", _this.displayName, "".concat(value));
|
|
1400
|
-
return value; // use default value
|
|
1401
|
-
})];
|
|
1402
|
-
case 3:
|
|
1403
|
-
_a = _b.sent();
|
|
1404
|
-
return [3 /*break*/, 5];
|
|
1405
|
-
case 4:
|
|
1406
|
-
_a = this.value;
|
|
1407
|
-
_b.label = 5;
|
|
1408
|
-
case 5:
|
|
1409
|
-
value = _a;
|
|
1410
|
-
object.value = (0, request_util_1.formatOutgoingCharacteristicValue)(value, this.props);
|
|
1411
|
-
_b.label = 6;
|
|
1412
|
-
case 6: return [2 /*return*/, object];
|
|
1413
|
-
}
|
|
1414
|
-
});
|
|
1415
|
-
});
|
|
1416
|
-
};
|
|
2210
|
+
async toHAP(connection, contactGetHandlers = true) {
|
|
2211
|
+
const object = this.internalHAPRepresentation();
|
|
2212
|
+
if (!this.props.perms.includes("pr" /* Perms.PAIRED_READ */)) {
|
|
2213
|
+
object.value = undefined;
|
|
2214
|
+
}
|
|
2215
|
+
else if (this.UUID === Characteristic.ProgrammableSwitchEvent.UUID) {
|
|
2216
|
+
// special workaround for event only programmable switch event, which must always return null
|
|
2217
|
+
object.value = null;
|
|
2218
|
+
}
|
|
2219
|
+
else { // query the current value
|
|
2220
|
+
const value = contactGetHandlers
|
|
2221
|
+
? await this.handleGetRequest(connection).catch(() => {
|
|
2222
|
+
const value = this.getDefaultValue();
|
|
2223
|
+
debug("[%s] Error getting value for characteristic on /accessories request. Returning default value instead: %s", this.displayName, `${value}`);
|
|
2224
|
+
return value; // use default value
|
|
2225
|
+
})
|
|
2226
|
+
: this.value;
|
|
2227
|
+
object.value = (0, request_util_1.formatOutgoingCharacteristicValue)(value, this.props);
|
|
2228
|
+
}
|
|
2229
|
+
return object;
|
|
2230
|
+
}
|
|
1417
2231
|
/**
|
|
1418
2232
|
* Returns a JSON representation of this characteristic without the value.
|
|
1419
2233
|
* @private used to generate the config hash
|
|
1420
2234
|
*/
|
|
1421
|
-
|
|
2235
|
+
internalHAPRepresentation() {
|
|
1422
2236
|
(0, assert_1.default)(this.iid, "iid cannot be undefined for characteristic '" + this.displayName + "'");
|
|
1423
2237
|
// TODO include the value for characteristics of the AccessoryInformation service
|
|
1424
2238
|
return {
|
|
@@ -1437,15 +2251,15 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
1437
2251
|
"valid-values": this.props.validValues,
|
|
1438
2252
|
"valid-values-range": this.props.validValueRanges,
|
|
1439
2253
|
};
|
|
1440
|
-
}
|
|
2254
|
+
}
|
|
1441
2255
|
/**
|
|
1442
2256
|
* Serialize characteristic into json string.
|
|
1443
2257
|
*
|
|
1444
2258
|
* @param characteristic - Characteristic object.
|
|
1445
2259
|
* @private used to store characteristic on disk
|
|
1446
2260
|
*/
|
|
1447
|
-
|
|
1448
|
-
|
|
2261
|
+
static serialize(characteristic) {
|
|
2262
|
+
let constructorName;
|
|
1449
2263
|
if (characteristic.constructor.name !== "Characteristic") {
|
|
1450
2264
|
constructorName = characteristic.constructor.name;
|
|
1451
2265
|
}
|
|
@@ -1457,18 +2271,18 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
1457
2271
|
value: characteristic.value,
|
|
1458
2272
|
props: (0, clone_1.clone)({}, characteristic.props),
|
|
1459
2273
|
};
|
|
1460
|
-
}
|
|
2274
|
+
}
|
|
1461
2275
|
/**
|
|
1462
2276
|
* Deserialize characteristic from json string.
|
|
1463
2277
|
*
|
|
1464
2278
|
* @param json - Json string representing a characteristic.
|
|
1465
2279
|
* @private used to recreate characteristic from disk
|
|
1466
2280
|
*/
|
|
1467
|
-
|
|
1468
|
-
|
|
2281
|
+
static deserialize(json) {
|
|
2282
|
+
let characteristic;
|
|
1469
2283
|
if (json.constructorName && json.constructorName.charAt(0).toUpperCase() === json.constructorName.charAt(0)
|
|
1470
2284
|
&& Characteristic[json.constructorName]) { // MUST start with uppercase character and must exist on Characteristic object
|
|
1471
|
-
|
|
2285
|
+
const constructor = Characteristic[json.constructorName];
|
|
1472
2286
|
characteristic = new constructor();
|
|
1473
2287
|
characteristic.displayName = json.displayName;
|
|
1474
2288
|
characteristic.setProps(json.props);
|
|
@@ -1478,24 +2292,8 @@ var Characteristic = /** @class */ (function (_super) {
|
|
|
1478
2292
|
}
|
|
1479
2293
|
characteristic.value = json.value;
|
|
1480
2294
|
return characteristic;
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
* @deprecated Please use the Formats const enum above.
|
|
1484
|
-
*/
|
|
1485
|
-
// @ts-expect-error: forceConsistentCasingInFileNames compiler option
|
|
1486
|
-
Characteristic.Formats = Formats;
|
|
1487
|
-
/**
|
|
1488
|
-
* @deprecated Please use the Units const enum above.
|
|
1489
|
-
*/
|
|
1490
|
-
// @ts-expect-error: forceConsistentCasingInFileNames compiler option
|
|
1491
|
-
Characteristic.Units = Units;
|
|
1492
|
-
/**
|
|
1493
|
-
* @deprecated Please use the Perms const enum above.
|
|
1494
|
-
*/
|
|
1495
|
-
// @ts-expect-error: forceConsistentCasingInFileNames compiler option
|
|
1496
|
-
Characteristic.Perms = Perms;
|
|
1497
|
-
return Characteristic;
|
|
1498
|
-
}(events_1.EventEmitter));
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
1499
2297
|
exports.Characteristic = Characteristic;
|
|
1500
2298
|
// We have a cyclic dependency problem. Within this file we have the definitions of "./definitions" as
|
|
1501
2299
|
// type imports only (in order to define the static properties). Setting those properties is done outside
|