hap-nodejs 1.1.1-beta.2 → 1.1.1-beta.3

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.
Files changed (289) hide show
  1. package/@types/bonjour-hap.d.ts +50 -53
  2. package/README.md +16 -19
  3. package/dist/accessories/AirConditioner_accessory.js +28 -30
  4. package/dist/accessories/AirConditioner_accessory.js.map +1 -1
  5. package/dist/accessories/AppleTVRemote_accessory.js +69 -81
  6. package/dist/accessories/AppleTVRemote_accessory.js.map +1 -1
  7. package/dist/accessories/Camera_accessory.js +141 -136
  8. package/dist/accessories/Camera_accessory.js.map +1 -1
  9. package/dist/accessories/Fan_accessory.js +18 -22
  10. package/dist/accessories/Fan_accessory.js.map +1 -1
  11. package/dist/accessories/GarageDoorOpener_accessory.js +33 -35
  12. package/dist/accessories/GarageDoorOpener_accessory.js.map +1 -1
  13. package/dist/accessories/Light-AdaptiveLighting_accessory.js +42 -44
  14. package/dist/accessories/Light-AdaptiveLighting_accessory.js.map +1 -1
  15. package/dist/accessories/Light_accessory.js +32 -34
  16. package/dist/accessories/Light_accessory.js.map +1 -1
  17. package/dist/accessories/Lock_accessory.js +25 -26
  18. package/dist/accessories/Lock_accessory.js.map +1 -1
  19. package/dist/accessories/MotionSensor_accessory.js +13 -16
  20. package/dist/accessories/MotionSensor_accessory.js.map +1 -1
  21. package/dist/accessories/Outlet_accessory.js +20 -22
  22. package/dist/accessories/Outlet_accessory.js.map +1 -1
  23. package/dist/accessories/SmartSpeaker_accessory.js +18 -20
  24. package/dist/accessories/SmartSpeaker_accessory.js.map +1 -1
  25. package/dist/accessories/Sprinkler_accessory.js +34 -37
  26. package/dist/accessories/Sprinkler_accessory.js.map +1 -1
  27. package/dist/accessories/TV_accessory.js +43 -45
  28. package/dist/accessories/TV_accessory.js.map +1 -1
  29. package/dist/accessories/TemperatureSensor_accessory.js +12 -15
  30. package/dist/accessories/TemperatureSensor_accessory.js.map +1 -1
  31. package/dist/accessories/Wi-FiRouter_accessory.d.ts +1 -1
  32. package/dist/accessories/Wi-FiRouter_accessory.d.ts.map +1 -1
  33. package/dist/accessories/Wi-FiRouter_accessory.js +9 -12
  34. package/dist/accessories/Wi-FiRouter_accessory.js.map +1 -1
  35. package/dist/accessories/Wi-FiSatellite_accessory.d.ts +1 -1
  36. package/dist/accessories/Wi-FiSatellite_accessory.d.ts.map +1 -1
  37. package/dist/accessories/Wi-FiSatellite_accessory.js +11 -14
  38. package/dist/accessories/Wi-FiSatellite_accessory.js.map +1 -1
  39. package/dist/accessories/gstreamer-audioProducer.d.ts +3 -3
  40. package/dist/accessories/gstreamer-audioProducer.d.ts.map +1 -1
  41. package/dist/accessories/gstreamer-audioProducer.js +37 -38
  42. package/dist/accessories/gstreamer-audioProducer.js.map +1 -1
  43. package/dist/accessories/types.d.ts +63 -63
  44. package/dist/accessories/types.d.ts.map +1 -1
  45. package/dist/accessories/types.js +83 -87
  46. package/dist/accessories/types.js.map +1 -1
  47. package/dist/index.d.ts +26 -28
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +40 -34
  50. package/dist/index.js.map +1 -1
  51. package/dist/internal-types.d.ts +1 -1
  52. package/dist/internal-types.d.ts.map +1 -1
  53. package/dist/internal-types.js +19 -21
  54. package/dist/internal-types.js.map +1 -1
  55. package/dist/lib/Accessory.d.ts +38 -37
  56. package/dist/lib/Accessory.d.ts.map +1 -1
  57. package/dist/lib/Accessory.js +286 -291
  58. package/dist/lib/Accessory.js.map +1 -1
  59. package/dist/lib/Advertiser.d.ts +7 -7
  60. package/dist/lib/Advertiser.d.ts.map +1 -1
  61. package/dist/lib/Advertiser.js +128 -136
  62. package/dist/lib/Advertiser.js.map +1 -1
  63. package/dist/lib/Bridge.d.ts +1 -1
  64. package/dist/lib/Bridge.d.ts.map +1 -1
  65. package/dist/lib/Bridge.js +2 -6
  66. package/dist/lib/Bridge.js.map +1 -1
  67. package/dist/lib/Characteristic.d.ts +40 -41
  68. package/dist/lib/Characteristic.d.ts.map +1 -1
  69. package/dist/lib/Characteristic.js +204 -208
  70. package/dist/lib/Characteristic.js.map +1 -1
  71. package/dist/lib/HAPServer.d.ts +31 -30
  72. package/dist/lib/HAPServer.d.ts.map +1 -1
  73. package/dist/lib/HAPServer.js +220 -229
  74. package/dist/lib/HAPServer.js.map +1 -1
  75. package/dist/lib/Service.d.ts +22 -22
  76. package/dist/lib/Service.d.ts.map +1 -1
  77. package/dist/lib/Service.js +63 -67
  78. package/dist/lib/Service.js.map +1 -1
  79. package/dist/lib/camera/RTPProxy.d.ts +2 -1
  80. package/dist/lib/camera/RTPProxy.d.ts.map +1 -1
  81. package/dist/lib/camera/RTPProxy.js +28 -44
  82. package/dist/lib/camera/RTPProxy.js.map +1 -1
  83. package/dist/lib/camera/RTPStreamManagement.d.ts +34 -33
  84. package/dist/lib/camera/RTPStreamManagement.d.ts.map +1 -1
  85. package/dist/lib/camera/RTPStreamManagement.js +179 -151
  86. package/dist/lib/camera/RTPStreamManagement.js.map +1 -1
  87. package/dist/lib/camera/RecordingManagement.d.ts +19 -17
  88. package/dist/lib/camera/RecordingManagement.d.ts.map +1 -1
  89. package/dist/lib/camera/RecordingManagement.js +160 -151
  90. package/dist/lib/camera/RecordingManagement.js.map +1 -1
  91. package/dist/lib/camera/index.d.ts +3 -3
  92. package/dist/lib/camera/index.d.ts.map +1 -1
  93. package/dist/lib/camera/index.js +3 -6
  94. package/dist/lib/camera/index.js.map +1 -1
  95. package/dist/lib/controller/AdaptiveLightingController.d.ts +33 -33
  96. package/dist/lib/controller/AdaptiveLightingController.d.ts.map +1 -1
  97. package/dist/lib/controller/AdaptiveLightingController.js +152 -144
  98. package/dist/lib/controller/AdaptiveLightingController.js.map +1 -1
  99. package/dist/lib/controller/CameraController.d.ts +22 -20
  100. package/dist/lib/controller/CameraController.d.ts.map +1 -1
  101. package/dist/lib/controller/CameraController.js +74 -78
  102. package/dist/lib/controller/CameraController.js.map +1 -1
  103. package/dist/lib/controller/Controller.d.ts +4 -4
  104. package/dist/lib/controller/Controller.d.ts.map +1 -1
  105. package/dist/lib/controller/Controller.js +5 -8
  106. package/dist/lib/controller/Controller.js.map +1 -1
  107. package/dist/lib/controller/DoorbellController.d.ts +5 -4
  108. package/dist/lib/controller/DoorbellController.d.ts.map +1 -1
  109. package/dist/lib/controller/DoorbellController.js +9 -13
  110. package/dist/lib/controller/DoorbellController.js.map +1 -1
  111. package/dist/lib/controller/RemoteController.d.ts +39 -37
  112. package/dist/lib/controller/RemoteController.d.ts.map +1 -1
  113. package/dist/lib/controller/RemoteController.js +208 -197
  114. package/dist/lib/controller/RemoteController.js.map +1 -1
  115. package/dist/lib/controller/index.d.ts +5 -5
  116. package/dist/lib/controller/index.d.ts.map +1 -1
  117. package/dist/lib/controller/index.js +5 -8
  118. package/dist/lib/controller/index.js.map +1 -1
  119. package/dist/lib/datastream/DataStreamManagement.d.ts +2 -2
  120. package/dist/lib/datastream/DataStreamManagement.d.ts.map +1 -1
  121. package/dist/lib/datastream/DataStreamManagement.js +39 -39
  122. package/dist/lib/datastream/DataStreamManagement.js.map +1 -1
  123. package/dist/lib/datastream/DataStreamParser.d.ts +1 -0
  124. package/dist/lib/datastream/DataStreamParser.d.ts.map +1 -1
  125. package/dist/lib/datastream/DataStreamParser.js +57 -77
  126. package/dist/lib/datastream/DataStreamParser.js.map +1 -1
  127. package/dist/lib/datastream/DataStreamServer.d.ts +23 -22
  128. package/dist/lib/datastream/DataStreamServer.d.ts.map +1 -1
  129. package/dist/lib/datastream/DataStreamServer.js +154 -164
  130. package/dist/lib/datastream/DataStreamServer.js.map +1 -1
  131. package/dist/lib/datastream/index.d.ts +3 -3
  132. package/dist/lib/datastream/index.d.ts.map +1 -1
  133. package/dist/lib/datastream/index.js +3 -6
  134. package/dist/lib/datastream/index.js.map +1 -1
  135. package/dist/lib/dbus/align.d.ts +2 -0
  136. package/dist/lib/dbus/align.d.ts.map +1 -0
  137. package/dist/lib/dbus/align.js +12 -0
  138. package/dist/lib/dbus/align.js.map +1 -0
  139. package/dist/lib/dbus/bus.d.ts +38 -0
  140. package/dist/lib/dbus/bus.d.ts.map +1 -0
  141. package/dist/lib/dbus/bus.js +222 -0
  142. package/dist/lib/dbus/bus.js.map +1 -0
  143. package/dist/lib/dbus/constants.d.ts +43 -0
  144. package/dist/lib/dbus/constants.d.ts.map +1 -0
  145. package/dist/lib/dbus/constants.js +53 -0
  146. package/dist/lib/dbus/constants.js.map +1 -0
  147. package/dist/lib/dbus/dbus-buffer.d.ts +30 -0
  148. package/dist/lib/dbus/dbus-buffer.d.ts.map +1 -0
  149. package/dist/lib/dbus/dbus-buffer.js +175 -0
  150. package/dist/lib/dbus/dbus-buffer.js.map +1 -0
  151. package/dist/lib/dbus/handshake.d.ts +2 -0
  152. package/dist/lib/dbus/handshake.d.ts.map +1 -0
  153. package/dist/lib/dbus/handshake.js +130 -0
  154. package/dist/lib/dbus/handshake.js.map +1 -0
  155. package/dist/lib/dbus/index.d.ts +3 -0
  156. package/dist/lib/dbus/index.d.ts.map +1 -0
  157. package/dist/lib/dbus/index.js +123 -0
  158. package/dist/lib/dbus/index.js.map +1 -0
  159. package/dist/lib/dbus/introspect.d.ts +30 -0
  160. package/dist/lib/dbus/introspect.d.ts.map +1 -0
  161. package/dist/lib/dbus/introspect.js +208 -0
  162. package/dist/lib/dbus/introspect.js.map +1 -0
  163. package/dist/lib/dbus/marshall.d.ts +2 -0
  164. package/dist/lib/dbus/marshall.d.ts.map +1 -0
  165. package/dist/lib/dbus/marshall.js +97 -0
  166. package/dist/lib/dbus/marshall.js.map +1 -0
  167. package/dist/lib/dbus/marshallers.d.ts +10 -0
  168. package/dist/lib/dbus/marshallers.d.ts.map +1 -0
  169. package/dist/lib/dbus/marshallers.js +329 -0
  170. package/dist/lib/dbus/marshallers.js.map +1 -0
  171. package/dist/lib/dbus/message.d.ts +4 -0
  172. package/dist/lib/dbus/message.d.ts.map +1 -0
  173. package/dist/lib/dbus/message.js +116 -0
  174. package/dist/lib/dbus/message.js.map +1 -0
  175. package/dist/lib/dbus/put.d.ts +21 -0
  176. package/dist/lib/dbus/put.d.ts.map +1 -0
  177. package/dist/lib/dbus/put.js +120 -0
  178. package/dist/lib/dbus/put.js.map +1 -0
  179. package/dist/lib/dbus/readline.d.ts +2 -0
  180. package/dist/lib/dbus/readline.d.ts.map +1 -0
  181. package/dist/lib/dbus/readline.js +27 -0
  182. package/dist/lib/dbus/readline.js.map +1 -0
  183. package/dist/lib/dbus/signature.d.ts +2 -0
  184. package/dist/lib/dbus/signature.d.ts.map +1 -0
  185. package/dist/lib/dbus/signature.js +58 -0
  186. package/dist/lib/dbus/signature.js.map +1 -0
  187. package/dist/lib/dbus/stdifaces.d.ts +3 -0
  188. package/dist/lib/dbus/stdifaces.d.ts.map +1 -0
  189. package/dist/lib/dbus/stdifaces.js +206 -0
  190. package/dist/lib/dbus/stdifaces.js.map +1 -0
  191. package/dist/lib/definitions/CharacteristicDefinitions.d.ts +1 -1
  192. package/dist/lib/definitions/CharacteristicDefinitions.d.ts.map +1 -1
  193. package/dist/lib/definitions/CharacteristicDefinitions.js +958 -1204
  194. package/dist/lib/definitions/CharacteristicDefinitions.js.map +1 -1
  195. package/dist/lib/definitions/ServiceDefinitions.d.ts +1 -1
  196. package/dist/lib/definitions/ServiceDefinitions.d.ts.map +1 -1
  197. package/dist/lib/definitions/ServiceDefinitions.js +620 -695
  198. package/dist/lib/definitions/ServiceDefinitions.js.map +1 -1
  199. package/dist/lib/definitions/generate-definitions.d.ts +3 -3
  200. package/dist/lib/definitions/generate-definitions.d.ts.map +1 -1
  201. package/dist/lib/definitions/generate-definitions.js +246 -253
  202. package/dist/lib/definitions/generate-definitions.js.map +1 -1
  203. package/dist/lib/definitions/generator-configuration.d.ts +1 -1
  204. package/dist/lib/definitions/generator-configuration.d.ts.map +1 -1
  205. package/dist/lib/definitions/generator-configuration.js +160 -165
  206. package/dist/lib/definitions/generator-configuration.js.map +1 -1
  207. package/dist/lib/definitions/index.d.ts +2 -2
  208. package/dist/lib/definitions/index.d.ts.map +1 -1
  209. package/dist/lib/definitions/index.js +2 -5
  210. package/dist/lib/definitions/index.js.map +1 -1
  211. package/dist/lib/model/AccessoryInfo.d.ts +4 -3
  212. package/dist/lib/model/AccessoryInfo.d.ts.map +1 -1
  213. package/dist/lib/model/AccessoryInfo.js +50 -53
  214. package/dist/lib/model/AccessoryInfo.js.map +1 -1
  215. package/dist/lib/model/ControllerStorage.d.ts +3 -3
  216. package/dist/lib/model/ControllerStorage.d.ts.map +1 -1
  217. package/dist/lib/model/ControllerStorage.js +17 -22
  218. package/dist/lib/model/ControllerStorage.js.map +1 -1
  219. package/dist/lib/model/HAPStorage.d.ts +2 -2
  220. package/dist/lib/model/HAPStorage.d.ts.map +1 -1
  221. package/dist/lib/model/HAPStorage.js +4 -11
  222. package/dist/lib/model/HAPStorage.js.map +1 -1
  223. package/dist/lib/model/IdentifierCache.d.ts +1 -1
  224. package/dist/lib/model/IdentifierCache.d.ts.map +1 -1
  225. package/dist/lib/model/IdentifierCache.js +19 -27
  226. package/dist/lib/model/IdentifierCache.js.map +1 -1
  227. package/dist/lib/tv/AccessControlManagement.d.ts +9 -9
  228. package/dist/lib/tv/AccessControlManagement.d.ts.map +1 -1
  229. package/dist/lib/tv/AccessControlManagement.js +27 -29
  230. package/dist/lib/tv/AccessControlManagement.js.map +1 -1
  231. package/dist/lib/util/checkName.d.ts +2 -2
  232. package/dist/lib/util/checkName.d.ts.map +1 -1
  233. package/dist/lib/util/checkName.js +6 -9
  234. package/dist/lib/util/checkName.js.map +1 -1
  235. package/dist/lib/util/clone.d.ts.map +1 -1
  236. package/dist/lib/util/clone.js +1 -5
  237. package/dist/lib/util/clone.js.map +1 -1
  238. package/dist/lib/util/color-utils.d.ts +1 -1
  239. package/dist/lib/util/color-utils.d.ts.map +1 -1
  240. package/dist/lib/util/color-utils.js +4 -9
  241. package/dist/lib/util/color-utils.js.map +1 -1
  242. package/dist/lib/util/eventedhttp.d.ts +23 -22
  243. package/dist/lib/util/eventedhttp.d.ts.map +1 -1
  244. package/dist/lib/util/eventedhttp.js +109 -116
  245. package/dist/lib/util/eventedhttp.js.map +1 -1
  246. package/dist/lib/util/hapCrypto.d.ts +3 -2
  247. package/dist/lib/util/hapCrypto.d.ts.map +1 -1
  248. package/dist/lib/util/hapCrypto.js +31 -40
  249. package/dist/lib/util/hapCrypto.js.map +1 -1
  250. package/dist/lib/util/hapStatusError.d.ts +1 -1
  251. package/dist/lib/util/hapStatusError.d.ts.map +1 -1
  252. package/dist/lib/util/hapStatusError.js +4 -8
  253. package/dist/lib/util/hapStatusError.js.map +1 -1
  254. package/dist/lib/util/net-utils.d.ts +1 -1
  255. package/dist/lib/util/net-utils.js +17 -23
  256. package/dist/lib/util/net-utils.js.map +1 -1
  257. package/dist/lib/util/once.d.ts.map +1 -1
  258. package/dist/lib/util/once.js +2 -6
  259. package/dist/lib/util/once.js.map +1 -1
  260. package/dist/lib/util/promise-utils.d.ts +1 -1
  261. package/dist/lib/util/promise-utils.d.ts.map +1 -1
  262. package/dist/lib/util/promise-utils.js +3 -9
  263. package/dist/lib/util/promise-utils.js.map +1 -1
  264. package/dist/lib/util/request-util.d.ts +3 -2
  265. package/dist/lib/util/request-util.d.ts.map +1 -1
  266. package/dist/lib/util/request-util.js +11 -19
  267. package/dist/lib/util/request-util.js.map +1 -1
  268. package/dist/lib/util/time.d.ts +1 -0
  269. package/dist/lib/util/time.d.ts.map +1 -1
  270. package/dist/lib/util/time.js +6 -11
  271. package/dist/lib/util/time.js.map +1 -1
  272. package/dist/lib/util/tlv.d.ts +1 -0
  273. package/dist/lib/util/tlv.d.ts.map +1 -1
  274. package/dist/lib/util/tlv.js +28 -43
  275. package/dist/lib/util/tlv.js.map +1 -1
  276. package/dist/lib/util/uuid.d.ts +1 -0
  277. package/dist/lib/util/uuid.d.ts.map +1 -1
  278. package/dist/lib/util/uuid.js +26 -38
  279. package/dist/lib/util/uuid.js.map +1 -1
  280. package/dist/types.d.ts +24 -24
  281. package/dist/types.d.ts.map +1 -1
  282. package/dist/types.js +3 -5
  283. package/dist/types.js.map +1 -1
  284. package/package.json +48 -45
  285. package/@types/simple-plist.d.ts +0 -4
  286. package/dist/lib/gen/HomeKit.d.ts +0 -7
  287. package/dist/lib/gen/HomeKit.d.ts.map +0 -1
  288. package/dist/lib/gen/HomeKit.js +0 -8
  289. package/dist/lib/gen/HomeKit.js.map +0 -1
@@ -1,25 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RTPStreamManagement = exports.StreamRequestTypes = exports.AudioStreamingSamplerate = exports.AudioStreamingCodecType = exports.SRTPCryptoSuites = exports.AudioSamplerate = exports.AudioBitrate = exports.VideoCodecPacketizationMode = exports.H264Level = exports.H264Profile = exports.VideoCodecType = void 0;
4
- const tslib_1 = require("tslib");
5
- const assert_1 = tslib_1.__importDefault(require("assert"));
6
- const crypto_1 = tslib_1.__importDefault(require("crypto"));
7
- const debug_1 = tslib_1.__importDefault(require("debug"));
8
- const net_1 = tslib_1.__importDefault(require("net"));
9
- const Characteristic_1 = require("../Characteristic");
10
- const controller_1 = require("../controller");
11
- const Service_1 = require("../Service");
12
- const hapStatusError_1 = require("../util/hapStatusError");
13
- const once_1 = require("../util/once");
14
- const tlv = tslib_1.__importStar(require("../util/tlv"));
15
- const uuid = tslib_1.__importStar(require("../util/uuid"));
16
- const RTPProxy_1 = tslib_1.__importDefault(require("./RTPProxy"));
17
- const debug = (0, debug_1.default)("HAP-NodeJS:Camera:RTPStreamManagement");
1
+ import assert from 'node:assert';
2
+ import { Buffer } from 'node:buffer';
3
+ import { randomBytes } from 'node:crypto';
4
+ import { isIPv4 } from 'node:net';
5
+ import createDebug from 'debug';
6
+ import { Characteristic } from '../Characteristic.js';
7
+ import { CameraController } from '../controller/index.js';
8
+ import { Service } from '../Service.js';
9
+ import { HapStatusError } from '../util/hapStatusError.js';
10
+ import { once } from '../util/once.js';
11
+ import { decode, encode, writeUInt16, writeUInt32 } from '../util/tlv.js';
12
+ import { unparse, write } from '../util/uuid.js';
13
+ import RTPProxy from './RTPProxy.js';
14
+ const debug = createDebug('HAP-NodeJS:Camera:RTPStreamManagement');
18
15
  // ---------------------------------- TLV DEFINITIONS START ----------------------------------
16
+ // eslint-disable-next-line no-restricted-syntax
19
17
  var StreamingStatusTypes;
20
18
  (function (StreamingStatusTypes) {
21
19
  StreamingStatusTypes[StreamingStatusTypes["STATUS"] = 1] = "STATUS";
22
20
  })(StreamingStatusTypes || (StreamingStatusTypes = {}));
21
+ // eslint-disable-next-line no-restricted-syntax
23
22
  var StreamingStatus;
24
23
  (function (StreamingStatus) {
25
24
  StreamingStatus[StreamingStatus["AVAILABLE"] = 0] = "AVAILABLE";
@@ -27,16 +26,19 @@ var StreamingStatus;
27
26
  StreamingStatus[StreamingStatus["UNAVAILABLE"] = 2] = "UNAVAILABLE";
28
27
  })(StreamingStatus || (StreamingStatus = {}));
29
28
  // ----------
29
+ // eslint-disable-next-line no-restricted-syntax
30
30
  var SupportedVideoStreamConfigurationTypes;
31
31
  (function (SupportedVideoStreamConfigurationTypes) {
32
32
  SupportedVideoStreamConfigurationTypes[SupportedVideoStreamConfigurationTypes["VIDEO_CODEC_CONFIGURATION"] = 1] = "VIDEO_CODEC_CONFIGURATION";
33
33
  })(SupportedVideoStreamConfigurationTypes || (SupportedVideoStreamConfigurationTypes = {}));
34
+ // eslint-disable-next-line no-restricted-syntax
34
35
  var VideoCodecConfigurationTypes;
35
36
  (function (VideoCodecConfigurationTypes) {
36
37
  VideoCodecConfigurationTypes[VideoCodecConfigurationTypes["CODEC_TYPE"] = 1] = "CODEC_TYPE";
37
38
  VideoCodecConfigurationTypes[VideoCodecConfigurationTypes["CODEC_PARAMETERS"] = 2] = "CODEC_PARAMETERS";
38
39
  VideoCodecConfigurationTypes[VideoCodecConfigurationTypes["ATTRIBUTES"] = 3] = "ATTRIBUTES";
39
40
  })(VideoCodecConfigurationTypes || (VideoCodecConfigurationTypes = {}));
41
+ // eslint-disable-next-line no-restricted-syntax
40
42
  var VideoCodecParametersTypes;
41
43
  (function (VideoCodecParametersTypes) {
42
44
  VideoCodecParametersTypes[VideoCodecParametersTypes["PROFILE_ID"] = 1] = "PROFILE_ID";
@@ -45,6 +47,7 @@ var VideoCodecParametersTypes;
45
47
  VideoCodecParametersTypes[VideoCodecParametersTypes["CVO_ENABLED"] = 4] = "CVO_ENABLED";
46
48
  VideoCodecParametersTypes[VideoCodecParametersTypes["CVO_ID"] = 5] = "CVO_ID";
47
49
  })(VideoCodecParametersTypes || (VideoCodecParametersTypes = {}));
50
+ // eslint-disable-next-line no-restricted-syntax
48
51
  var VideoAttributesTypes;
49
52
  (function (VideoAttributesTypes) {
50
53
  VideoAttributesTypes[VideoAttributesTypes["IMAGE_WIDTH"] = 1] = "IMAGE_WIDTH";
@@ -54,53 +57,61 @@ var VideoAttributesTypes;
54
57
  /**
55
58
  * @group Camera
56
59
  */
57
- var VideoCodecType;
60
+ // eslint-disable-next-line no-restricted-syntax
61
+ export var VideoCodecType;
58
62
  (function (VideoCodecType) {
59
63
  VideoCodecType[VideoCodecType["H264"] = 0] = "H264";
60
64
  // while the namespace is already reserved for H265 it isn't currently supported.
61
65
  // H265 = 0x01,
62
- })(VideoCodecType || (exports.VideoCodecType = VideoCodecType = {}));
66
+ })(VideoCodecType || (VideoCodecType = {}));
63
67
  /**
64
68
  * @group Camera
65
69
  */
66
- var H264Profile;
70
+ // eslint-disable-next-line no-restricted-syntax
71
+ export var H264Profile;
67
72
  (function (H264Profile) {
68
73
  H264Profile[H264Profile["BASELINE"] = 0] = "BASELINE";
69
74
  H264Profile[H264Profile["MAIN"] = 1] = "MAIN";
70
75
  H264Profile[H264Profile["HIGH"] = 2] = "HIGH";
71
- })(H264Profile || (exports.H264Profile = H264Profile = {}));
76
+ })(H264Profile || (H264Profile = {}));
72
77
  /**
73
78
  * @group Camera
74
79
  */
75
- var H264Level;
80
+ // eslint-disable-next-line no-restricted-syntax
81
+ export var H264Level;
76
82
  (function (H264Level) {
77
83
  H264Level[H264Level["LEVEL3_1"] = 0] = "LEVEL3_1";
78
84
  H264Level[H264Level["LEVEL3_2"] = 1] = "LEVEL3_2";
79
85
  H264Level[H264Level["LEVEL4_0"] = 2] = "LEVEL4_0";
80
- })(H264Level || (exports.H264Level = H264Level = {}));
86
+ })(H264Level || (H264Level = {}));
81
87
  /**
82
88
  * @group Camera
83
89
  */
84
- var VideoCodecPacketizationMode;
90
+ // eslint-disable-next-line no-restricted-syntax
91
+ export var VideoCodecPacketizationMode;
85
92
  (function (VideoCodecPacketizationMode) {
86
93
  VideoCodecPacketizationMode[VideoCodecPacketizationMode["NON_INTERLEAVED"] = 0] = "NON_INTERLEAVED";
87
- })(VideoCodecPacketizationMode || (exports.VideoCodecPacketizationMode = VideoCodecPacketizationMode = {}));
94
+ })(VideoCodecPacketizationMode || (VideoCodecPacketizationMode = {}));
95
+ // eslint-disable-next-line no-restricted-syntax
88
96
  var VideoCodecCVO;
89
97
  (function (VideoCodecCVO) {
90
98
  VideoCodecCVO[VideoCodecCVO["UNSUPPORTED"] = 0] = "UNSUPPORTED";
91
99
  VideoCodecCVO[VideoCodecCVO["SUPPORTED"] = 1] = "SUPPORTED";
92
100
  })(VideoCodecCVO || (VideoCodecCVO = {}));
93
101
  // ----------
102
+ // eslint-disable-next-line no-restricted-syntax
94
103
  var SupportedAudioStreamConfigurationTypes;
95
104
  (function (SupportedAudioStreamConfigurationTypes) {
96
105
  SupportedAudioStreamConfigurationTypes[SupportedAudioStreamConfigurationTypes["AUDIO_CODEC_CONFIGURATION"] = 1] = "AUDIO_CODEC_CONFIGURATION";
97
106
  SupportedAudioStreamConfigurationTypes[SupportedAudioStreamConfigurationTypes["COMFORT_NOISE_SUPPORT"] = 2] = "COMFORT_NOISE_SUPPORT";
98
107
  })(SupportedAudioStreamConfigurationTypes || (SupportedAudioStreamConfigurationTypes = {}));
108
+ // eslint-disable-next-line no-restricted-syntax
99
109
  var AudioCodecConfigurationTypes;
100
110
  (function (AudioCodecConfigurationTypes) {
101
111
  AudioCodecConfigurationTypes[AudioCodecConfigurationTypes["CODEC_TYPE"] = 1] = "CODEC_TYPE";
102
112
  AudioCodecConfigurationTypes[AudioCodecConfigurationTypes["CODEC_PARAMETERS"] = 2] = "CODEC_PARAMETERS";
103
113
  })(AudioCodecConfigurationTypes || (AudioCodecConfigurationTypes = {}));
114
+ // eslint-disable-next-line no-restricted-syntax
104
115
  var AudioCodecTypes;
105
116
  (function (AudioCodecTypes) {
106
117
  AudioCodecTypes[AudioCodecTypes["PCMU"] = 0] = "PCMU";
@@ -111,33 +122,37 @@ var AudioCodecTypes;
111
122
  AudioCodecTypes[AudioCodecTypes["AMR"] = 5] = "AMR";
112
123
  AudioCodecTypes[AudioCodecTypes["AMR_WB"] = 6] = "AMR_WB";
113
124
  })(AudioCodecTypes || (AudioCodecTypes = {}));
125
+ // eslint-disable-next-line no-restricted-syntax
114
126
  var AudioCodecParametersTypes;
115
127
  (function (AudioCodecParametersTypes) {
116
128
  AudioCodecParametersTypes[AudioCodecParametersTypes["CHANNEL"] = 1] = "CHANNEL";
117
129
  AudioCodecParametersTypes[AudioCodecParametersTypes["BIT_RATE"] = 2] = "BIT_RATE";
118
130
  AudioCodecParametersTypes[AudioCodecParametersTypes["SAMPLE_RATE"] = 3] = "SAMPLE_RATE";
119
- AudioCodecParametersTypes[AudioCodecParametersTypes["PACKET_TIME"] = 4] = "PACKET_TIME"; // only present in selected audio codec parameters tlv
131
+ AudioCodecParametersTypes[AudioCodecParametersTypes["PACKET_TIME"] = 4] = "PACKET_TIME";
120
132
  })(AudioCodecParametersTypes || (AudioCodecParametersTypes = {}));
121
133
  /**
122
134
  * @group Camera
123
135
  */
124
- var AudioBitrate;
136
+ // eslint-disable-next-line no-restricted-syntax
137
+ export var AudioBitrate;
125
138
  (function (AudioBitrate) {
126
139
  AudioBitrate[AudioBitrate["VARIABLE"] = 0] = "VARIABLE";
127
140
  AudioBitrate[AudioBitrate["CONSTANT"] = 1] = "CONSTANT";
128
- })(AudioBitrate || (exports.AudioBitrate = AudioBitrate = {}));
141
+ })(AudioBitrate || (AudioBitrate = {}));
129
142
  /**
130
143
  * @group Camera
131
144
  */
132
- var AudioSamplerate;
145
+ // eslint-disable-next-line no-restricted-syntax
146
+ export var AudioSamplerate;
133
147
  (function (AudioSamplerate) {
134
148
  AudioSamplerate[AudioSamplerate["KHZ_8"] = 0] = "KHZ_8";
135
149
  AudioSamplerate[AudioSamplerate["KHZ_16"] = 1] = "KHZ_16";
136
150
  AudioSamplerate[AudioSamplerate["KHZ_24"] = 2] = "KHZ_24";
137
151
  // 3, 4, 5 are theoretically defined, but no idea to what kHz value they correspond to
138
152
  // probably KHZ_32, KHZ_44_1, KHZ_48 (as supported by Secure Video recordings)
139
- })(AudioSamplerate || (exports.AudioSamplerate = AudioSamplerate = {}));
153
+ })(AudioSamplerate || (AudioSamplerate = {}));
140
154
  // ----------
155
+ // eslint-disable-next-line no-restricted-syntax
141
156
  var SupportedRTPConfigurationTypes;
142
157
  (function (SupportedRTPConfigurationTypes) {
143
158
  SupportedRTPConfigurationTypes[SupportedRTPConfigurationTypes["SRTP_CRYPTO_SUITE"] = 2] = "SRTP_CRYPTO_SUITE";
@@ -145,13 +160,15 @@ var SupportedRTPConfigurationTypes;
145
160
  /**
146
161
  * @group Camera
147
162
  */
148
- var SRTPCryptoSuites;
163
+ // eslint-disable-next-line no-restricted-syntax
164
+ export var SRTPCryptoSuites;
149
165
  (function (SRTPCryptoSuites) {
150
166
  SRTPCryptoSuites[SRTPCryptoSuites["AES_CM_128_HMAC_SHA1_80"] = 0] = "AES_CM_128_HMAC_SHA1_80";
151
167
  SRTPCryptoSuites[SRTPCryptoSuites["AES_CM_256_HMAC_SHA1_80"] = 1] = "AES_CM_256_HMAC_SHA1_80";
152
168
  SRTPCryptoSuites[SRTPCryptoSuites["NONE"] = 2] = "NONE";
153
- })(SRTPCryptoSuites || (exports.SRTPCryptoSuites = SRTPCryptoSuites = {}));
169
+ })(SRTPCryptoSuites || (SRTPCryptoSuites = {}));
154
170
  // ----------
171
+ // eslint-disable-next-line no-restricted-syntax
155
172
  var SetupEndpointsTypes;
156
173
  (function (SetupEndpointsTypes) {
157
174
  SetupEndpointsTypes[SetupEndpointsTypes["SESSION_ID"] = 1] = "SESSION_ID";
@@ -159,6 +176,7 @@ var SetupEndpointsTypes;
159
176
  SetupEndpointsTypes[SetupEndpointsTypes["VIDEO_SRTP_PARAMETERS"] = 4] = "VIDEO_SRTP_PARAMETERS";
160
177
  SetupEndpointsTypes[SetupEndpointsTypes["AUDIO_SRTP_PARAMETERS"] = 5] = "AUDIO_SRTP_PARAMETERS";
161
178
  })(SetupEndpointsTypes || (SetupEndpointsTypes = {}));
179
+ // eslint-disable-next-line no-restricted-syntax
162
180
  var AddressTypes;
163
181
  (function (AddressTypes) {
164
182
  AddressTypes[AddressTypes["ADDRESS_VERSION"] = 1] = "ADDRESS_VERSION";
@@ -166,17 +184,20 @@ var AddressTypes;
166
184
  AddressTypes[AddressTypes["VIDEO_RTP_PORT"] = 3] = "VIDEO_RTP_PORT";
167
185
  AddressTypes[AddressTypes["AUDIO_RTP_PORT"] = 4] = "AUDIO_RTP_PORT";
168
186
  })(AddressTypes || (AddressTypes = {}));
187
+ // eslint-disable-next-line no-restricted-syntax
169
188
  var IPAddressVersion;
170
189
  (function (IPAddressVersion) {
171
190
  IPAddressVersion[IPAddressVersion["IPV4"] = 0] = "IPV4";
172
191
  IPAddressVersion[IPAddressVersion["IPV6"] = 1] = "IPV6";
173
192
  })(IPAddressVersion || (IPAddressVersion = {}));
193
+ // eslint-disable-next-line no-restricted-syntax
174
194
  var SRTPParametersTypes;
175
195
  (function (SRTPParametersTypes) {
176
196
  SRTPParametersTypes[SRTPParametersTypes["SRTP_CRYPTO_SUITE"] = 1] = "SRTP_CRYPTO_SUITE";
177
197
  SRTPParametersTypes[SRTPParametersTypes["MASTER_KEY"] = 2] = "MASTER_KEY";
178
- SRTPParametersTypes[SRTPParametersTypes["MASTER_SALT"] = 3] = "MASTER_SALT"; // 14 bytes
198
+ SRTPParametersTypes[SRTPParametersTypes["MASTER_SALT"] = 3] = "MASTER_SALT";
179
199
  })(SRTPParametersTypes || (SRTPParametersTypes = {}));
200
+ // eslint-disable-next-line no-restricted-syntax
180
201
  var SetupEndpointsResponseTypes;
181
202
  (function (SetupEndpointsResponseTypes) {
182
203
  SetupEndpointsResponseTypes[SetupEndpointsResponseTypes["SESSION_ID"] = 1] = "SESSION_ID";
@@ -187,6 +208,7 @@ var SetupEndpointsResponseTypes;
187
208
  SetupEndpointsResponseTypes[SetupEndpointsResponseTypes["VIDEO_SSRC"] = 6] = "VIDEO_SSRC";
188
209
  SetupEndpointsResponseTypes[SetupEndpointsResponseTypes["AUDIO_SSRC"] = 7] = "AUDIO_SSRC";
189
210
  })(SetupEndpointsResponseTypes || (SetupEndpointsResponseTypes = {}));
211
+ // eslint-disable-next-line no-restricted-syntax
190
212
  var SetupEndpointsStatus;
191
213
  (function (SetupEndpointsStatus) {
192
214
  SetupEndpointsStatus[SetupEndpointsStatus["SUCCESS"] = 0] = "SUCCESS";
@@ -194,12 +216,14 @@ var SetupEndpointsStatus;
194
216
  SetupEndpointsStatus[SetupEndpointsStatus["ERROR"] = 2] = "ERROR";
195
217
  })(SetupEndpointsStatus || (SetupEndpointsStatus = {}));
196
218
  // ----------
219
+ // eslint-disable-next-line no-restricted-syntax
197
220
  var SelectedRTPStreamConfigurationTypes;
198
221
  (function (SelectedRTPStreamConfigurationTypes) {
199
222
  SelectedRTPStreamConfigurationTypes[SelectedRTPStreamConfigurationTypes["SESSION_CONTROL"] = 1] = "SESSION_CONTROL";
200
223
  SelectedRTPStreamConfigurationTypes[SelectedRTPStreamConfigurationTypes["SELECTED_VIDEO_PARAMETERS"] = 2] = "SELECTED_VIDEO_PARAMETERS";
201
224
  SelectedRTPStreamConfigurationTypes[SelectedRTPStreamConfigurationTypes["SELECTED_AUDIO_PARAMETERS"] = 3] = "SELECTED_AUDIO_PARAMETERS";
202
225
  })(SelectedRTPStreamConfigurationTypes || (SelectedRTPStreamConfigurationTypes = {}));
226
+ // eslint-disable-next-line no-restricted-syntax
203
227
  var SessionControlTypes;
204
228
  (function (SessionControlTypes) {
205
229
  SessionControlTypes[SessionControlTypes["SESSION_IDENTIFIER"] = 1] = "SESSION_IDENTIFIER";
@@ -213,6 +237,7 @@ var SessionControlCommand;
213
237
  SessionControlCommand[SessionControlCommand["RESUME_SESSION"] = 3] = "RESUME_SESSION";
214
238
  SessionControlCommand[SessionControlCommand["RECONFIGURE_SESSION"] = 4] = "RECONFIGURE_SESSION";
215
239
  })(SessionControlCommand || (SessionControlCommand = {}));
240
+ // eslint-disable-next-line no-restricted-syntax
216
241
  var SelectedVideoParametersTypes;
217
242
  (function (SelectedVideoParametersTypes) {
218
243
  SelectedVideoParametersTypes[SelectedVideoParametersTypes["CODEC_TYPE"] = 1] = "CODEC_TYPE";
@@ -220,6 +245,7 @@ var SelectedVideoParametersTypes;
220
245
  SelectedVideoParametersTypes[SelectedVideoParametersTypes["ATTRIBUTES"] = 3] = "ATTRIBUTES";
221
246
  SelectedVideoParametersTypes[SelectedVideoParametersTypes["RTP_PARAMETERS"] = 4] = "RTP_PARAMETERS";
222
247
  })(SelectedVideoParametersTypes || (SelectedVideoParametersTypes = {}));
248
+ // eslint-disable-next-line no-restricted-syntax
223
249
  var VideoRTPParametersTypes;
224
250
  (function (VideoRTPParametersTypes) {
225
251
  VideoRTPParametersTypes[VideoRTPParametersTypes["PAYLOAD_TYPE"] = 1] = "PAYLOAD_TYPE";
@@ -228,6 +254,7 @@ var VideoRTPParametersTypes;
228
254
  VideoRTPParametersTypes[VideoRTPParametersTypes["MIN_RTCP_INTERVAL"] = 4] = "MIN_RTCP_INTERVAL";
229
255
  VideoRTPParametersTypes[VideoRTPParametersTypes["MAX_MTU"] = 5] = "MAX_MTU";
230
256
  })(VideoRTPParametersTypes || (VideoRTPParametersTypes = {}));
257
+ // eslint-disable-next-line no-restricted-syntax
231
258
  var SelectedAudioParametersTypes;
232
259
  (function (SelectedAudioParametersTypes) {
233
260
  SelectedAudioParametersTypes[SelectedAudioParametersTypes["CODEC_TYPE"] = 1] = "CODEC_TYPE";
@@ -235,6 +262,7 @@ var SelectedAudioParametersTypes;
235
262
  SelectedAudioParametersTypes[SelectedAudioParametersTypes["RTP_PARAMETERS"] = 3] = "RTP_PARAMETERS";
236
263
  SelectedAudioParametersTypes[SelectedAudioParametersTypes["COMFORT_NOISE"] = 4] = "COMFORT_NOISE";
237
264
  })(SelectedAudioParametersTypes || (SelectedAudioParametersTypes = {}));
265
+ // eslint-disable-next-line no-restricted-syntax
238
266
  var AudioRTPParametersTypes;
239
267
  (function (AudioRTPParametersTypes) {
240
268
  AudioRTPParametersTypes[AudioRTPParametersTypes["PAYLOAD_TYPE"] = 1] = "PAYLOAD_TYPE";
@@ -243,14 +271,14 @@ var AudioRTPParametersTypes;
243
271
  AudioRTPParametersTypes[AudioRTPParametersTypes["MIN_RTCP_INTERVAL"] = 4] = "MIN_RTCP_INTERVAL";
244
272
  AudioRTPParametersTypes[AudioRTPParametersTypes["COMFORT_NOISE_PAYLOAD_TYPE"] = 6] = "COMFORT_NOISE_PAYLOAD_TYPE";
245
273
  })(AudioRTPParametersTypes || (AudioRTPParametersTypes = {}));
246
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
247
274
  function isLegacySRTPOptions(options) {
248
- return "srtp" in options;
275
+ return 'srtp' in options;
249
276
  }
250
277
  /**
251
278
  * @group Camera
252
279
  */
253
- var AudioStreamingCodecType;
280
+ // eslint-disable-next-line no-restricted-syntax
281
+ export var AudioStreamingCodecType;
254
282
  (function (AudioStreamingCodecType) {
255
283
  AudioStreamingCodecType["PCMU"] = "PCMU";
256
284
  AudioStreamingCodecType["PCMA"] = "PCMA";
@@ -259,29 +287,31 @@ var AudioStreamingCodecType;
259
287
  AudioStreamingCodecType["MSBC"] = "mSBC";
260
288
  AudioStreamingCodecType["AMR"] = "AMR";
261
289
  AudioStreamingCodecType["AMR_WB"] = "AMR-WB";
262
- })(AudioStreamingCodecType || (exports.AudioStreamingCodecType = AudioStreamingCodecType = {}));
290
+ })(AudioStreamingCodecType || (AudioStreamingCodecType = {}));
263
291
  /**
264
292
  * @group Camera
265
293
  */
266
- var AudioStreamingSamplerate;
294
+ // eslint-disable-next-line no-restricted-syntax
295
+ export var AudioStreamingSamplerate;
267
296
  (function (AudioStreamingSamplerate) {
268
297
  AudioStreamingSamplerate[AudioStreamingSamplerate["KHZ_8"] = 8] = "KHZ_8";
269
298
  AudioStreamingSamplerate[AudioStreamingSamplerate["KHZ_16"] = 16] = "KHZ_16";
270
299
  AudioStreamingSamplerate[AudioStreamingSamplerate["KHZ_24"] = 24] = "KHZ_24";
271
- })(AudioStreamingSamplerate || (exports.AudioStreamingSamplerate = AudioStreamingSamplerate = {}));
300
+ })(AudioStreamingSamplerate || (AudioStreamingSamplerate = {}));
272
301
  /**
273
302
  * @group Camera
274
303
  */
275
- var StreamRequestTypes;
304
+ // eslint-disable-next-line no-restricted-syntax
305
+ export var StreamRequestTypes;
276
306
  (function (StreamRequestTypes) {
277
307
  StreamRequestTypes["RECONFIGURE"] = "reconfigure";
278
308
  StreamRequestTypes["START"] = "start";
279
309
  StreamRequestTypes["STOP"] = "stop";
280
- })(StreamRequestTypes || (exports.StreamRequestTypes = StreamRequestTypes = {}));
310
+ })(StreamRequestTypes || (StreamRequestTypes = {}));
281
311
  /**
282
312
  * @group Camera
283
313
  */
284
- class RTPStreamManagement {
314
+ export class RTPStreamManagement {
285
315
  id;
286
316
  delegate;
287
317
  service;
@@ -297,18 +327,18 @@ class RTPStreamManagement {
297
327
  activeConnectionClosedListener;
298
328
  sessionIdentifier = undefined;
299
329
  /**
300
- * @private private API
330
+ * @private
301
331
  */
302
332
  streamStatus = 0 /* StreamingStatus.AVAILABLE */; // use _updateStreamStatus to update this property
303
333
  ipVersion; // ip version for the current session
304
- selectedConfiguration = ""; // base64 representation of the currently selected configuration
305
- setupEndpointsResponse = ""; // response of the SetupEndpoints Characteristic
334
+ selectedConfiguration = ''; // base64 representation of the currently selected configuration
335
+ setupEndpointsResponse = ''; // response of the SetupEndpoints Characteristic
306
336
  /**
307
- * @private deprecated API
337
+ * @private
308
338
  */
309
339
  audioProxy;
310
340
  /**
311
- * @private deprecated API
341
+ * @private
312
342
  */
313
343
  videoProxy;
314
344
  /**
@@ -332,7 +362,7 @@ class RTPStreamManagement {
332
362
  this.supportedCryptoSuites.push(2 /* SRTPCryptoSuites.NONE */);
333
363
  }
334
364
  if (!options.video) {
335
- throw new Error("Video parameters cannot be undefined in options");
365
+ throw new Error('Video parameters cannot be undefined in options');
336
366
  }
337
367
  this.supportedRTPConfiguration = RTPStreamManagement._supportedRTPConfiguration(this.supportedCryptoSuites);
338
368
  this.supportedVideoStreamConfiguration = RTPStreamManagement._supportedVideoStreamConfiguration(options.video);
@@ -353,7 +383,7 @@ class RTPStreamManagement {
353
383
  handleFactoryReset() {
354
384
  this.resetSelectedStreamConfiguration();
355
385
  this.resetSetupEndpointsResponse();
356
- this.service.updateCharacteristic(Characteristic_1.Characteristic.Active, true);
386
+ this.service.updateCharacteristic(Characteristic.Active, true);
357
387
  // on a factory reset the assumption is that all connections were already terminated and thus "handleStopStream" was already called
358
388
  }
359
389
  destroy() {
@@ -362,46 +392,46 @@ class RTPStreamManagement {
362
392
  }
363
393
  }
364
394
  constructService(id) {
365
- const managementService = new Service_1.Service.CameraRTPStreamManagement("", id.toString());
395
+ const managementService = new Service.CameraRTPStreamManagement('', id.toString());
366
396
  // this service is required only when recording is enabled. We don't really have access to this info here,
367
397
  // so we just add the characteristic. Doesn't really hurt.
368
- managementService.setCharacteristic(Characteristic_1.Characteristic.Active, true);
398
+ managementService.setCharacteristic(Characteristic.Active, true);
369
399
  return managementService;
370
400
  }
371
401
  setupServiceHandlers() {
372
- if (!this.service.testCharacteristic(Characteristic_1.Characteristic.Active)) {
402
+ if (!this.service.testCharacteristic(Characteristic.Active)) {
373
403
  // the active characteristic might not be present on some older configurations.
374
- this.service.setCharacteristic(Characteristic_1.Characteristic.Active, true);
404
+ this.service.setCharacteristic(Characteristic.Active, true);
375
405
  }
376
- this.service.getCharacteristic(Characteristic_1.Characteristic.Active)
406
+ this.service.getCharacteristic(Characteristic.Active)
377
407
  .on("change" /* CharacteristicEventTypes.CHANGE */, () => this.stateChangeDelegate?.())
378
408
  .setProps({ adminOnlyAccess: [1 /* Access.WRITE */] });
379
409
  // ensure that configurations are up-to-date and reflected in the characteristic values
380
- this.service.setCharacteristic(Characteristic_1.Characteristic.SupportedRTPConfiguration, this.supportedRTPConfiguration);
381
- this.service.setCharacteristic(Characteristic_1.Characteristic.SupportedVideoStreamConfiguration, this.supportedVideoStreamConfiguration);
382
- this.service.setCharacteristic(Characteristic_1.Characteristic.SupportedAudioStreamConfiguration, this.supportedAudioStreamConfiguration);
410
+ this.service.setCharacteristic(Characteristic.SupportedRTPConfiguration, this.supportedRTPConfiguration);
411
+ this.service.setCharacteristic(Characteristic.SupportedVideoStreamConfiguration, this.supportedVideoStreamConfiguration);
412
+ this.service.setCharacteristic(Characteristic.SupportedAudioStreamConfiguration, this.supportedAudioStreamConfiguration);
383
413
  this._updateStreamStatus(0 /* StreamingStatus.AVAILABLE */); // reset streaming status to available
384
- this.service.setCharacteristic(Characteristic_1.Characteristic.SetupEndpoints, this.setupEndpointsResponse); // reset SetupEndpoints to default
385
- this.service.getCharacteristic(Characteristic_1.Characteristic.SelectedRTPStreamConfiguration)
386
- .on("get" /* CharacteristicEventTypes.GET */, callback => {
414
+ this.service.setCharacteristic(Characteristic.SetupEndpoints, this.setupEndpointsResponse); // reset SetupEndpoints to default
415
+ this.service.getCharacteristic(Characteristic.SelectedRTPStreamConfiguration)
416
+ .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
387
417
  if (this.streamingIsDisabled()) {
388
- callback(null, tlv.encode(1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */, tlv.encode(2 /* SessionControlTypes.COMMAND */, SessionControlCommand.SUSPEND_SESSION)).toString("base64"));
418
+ callback(null, encode(1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */, encode(2 /* SessionControlTypes.COMMAND */, SessionControlCommand.SUSPEND_SESSION)).toString('base64'));
389
419
  return;
390
420
  }
391
421
  callback(null, this.selectedConfiguration);
392
422
  })
393
423
  .on("set" /* CharacteristicEventTypes.SET */, this._handleSelectedStreamConfigurationWrite.bind(this));
394
- this.service.getCharacteristic(Characteristic_1.Characteristic.SetupEndpoints)
395
- .on("get" /* CharacteristicEventTypes.GET */, callback => {
424
+ this.service.getCharacteristic(Characteristic.SetupEndpoints)
425
+ .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
396
426
  if (this.streamingIsDisabled()) {
397
- callback(null, tlv.encode(2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString("base64"));
427
+ callback(null, encode(2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString('base64'));
398
428
  return;
399
429
  }
400
430
  callback(null, this.setupEndpointsResponse);
401
431
  })
402
432
  .on("set" /* CharacteristicEventTypes.SET */, (value, callback, context, connection) => {
403
433
  if (!connection) {
404
- debug("Set event handler for SetupEndpoints cannot be called from plugin. Connection undefined!");
434
+ debug('Set event handler for SetupEndpoints cannot be called from plugin. Connection undefined!');
405
435
  callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);
406
436
  return;
407
437
  }
@@ -429,15 +459,15 @@ class RTPStreamManagement {
429
459
  }
430
460
  }
431
461
  streamingIsDisabled(callback) {
432
- if (!this.service.getCharacteristic(Characteristic_1.Characteristic.Active).value) {
433
- if (typeof callback === "function") {
434
- callback(new hapStatusError_1.HapStatusError(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */));
462
+ if (!this.service.getCharacteristic(Characteristic.Active).value) {
463
+ if (typeof callback === 'function') {
464
+ callback(new HapStatusError(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */));
435
465
  }
436
466
  return true;
437
467
  }
438
468
  if (this.disabledThroughOperatingMode?.()) {
439
- if (typeof callback === "function") {
440
- callback(new hapStatusError_1.HapStatusError(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */));
469
+ if (typeof callback === 'function') {
470
+ callback(new HapStatusError(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */));
441
471
  }
442
472
  return true;
443
473
  }
@@ -447,10 +477,10 @@ class RTPStreamManagement {
447
477
  if (this.streamingIsDisabled(callback)) {
448
478
  return;
449
479
  }
450
- const data = Buffer.from(value, "base64");
451
- const objects = tlv.decode(data);
452
- const sessionControl = tlv.decode(objects[1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */]);
453
- const sessionIdentifier = uuid.unparse(sessionControl[1 /* SessionControlTypes.SESSION_IDENTIFIER */]);
480
+ const data = Buffer.from(value, 'base64');
481
+ const objects = decode(data);
482
+ const sessionControl = decode(objects[1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */]);
483
+ const sessionIdentifier = unparse(sessionControl[1 /* SessionControlTypes.SESSION_IDENTIFIER */]);
454
484
  const requestType = sessionControl[2 /* SessionControlTypes.COMMAND */][0];
455
485
  if (sessionIdentifier !== this.sessionIdentifier) {
456
486
  debug(`Received unknown session Identifier with request to ${SessionControlCommand[requestType]}`);
@@ -467,13 +497,13 @@ class RTPStreamManagement {
467
497
  };
468
498
  switch (requestType) {
469
499
  case SessionControlCommand.START_SESSION: {
470
- const selectedVideoParameters = tlv.decode(objects[2 /* SelectedRTPStreamConfigurationTypes.SELECTED_VIDEO_PARAMETERS */]);
471
- const selectedAudioParameters = tlv.decode(objects[3 /* SelectedRTPStreamConfigurationTypes.SELECTED_AUDIO_PARAMETERS */]);
500
+ const selectedVideoParameters = decode(objects[2 /* SelectedRTPStreamConfigurationTypes.SELECTED_VIDEO_PARAMETERS */]);
501
+ const selectedAudioParameters = decode(objects[3 /* SelectedRTPStreamConfigurationTypes.SELECTED_AUDIO_PARAMETERS */]);
472
502
  this._handleStartStream(selectedVideoParameters, selectedAudioParameters, streamCallback);
473
503
  break;
474
504
  }
475
505
  case SessionControlCommand.RECONFIGURE_SESSION: {
476
- const reconfiguredVideoParameters = tlv.decode(objects[2 /* SelectedRTPStreamConfigurationTypes.SELECTED_VIDEO_PARAMETERS */]);
506
+ const reconfiguredVideoParameters = decode(objects[2 /* SelectedRTPStreamConfigurationTypes.SELECTED_VIDEO_PARAMETERS */]);
477
507
  this.handleReconfigureStream(reconfiguredVideoParameters, streamCallback);
478
508
  break;
479
509
  }
@@ -485,38 +515,36 @@ class RTPStreamManagement {
485
515
  default:
486
516
  debug(`Unhandled request type ${SessionControlCommand[requestType]}`);
487
517
  callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);
488
- return;
489
518
  }
490
519
  }
491
520
  _handleStartStream(videoConfiguration, audioConfiguration, callback) {
492
521
  // selected video configuration
493
- // noinspection JSUnusedLocalSymbols
494
522
  const videoCodec = videoConfiguration[1 /* SelectedVideoParametersTypes.CODEC_TYPE */]; // always 0x00 for h264
495
523
  const videoParametersTLV = videoConfiguration[2 /* SelectedVideoParametersTypes.CODEC_PARAMETERS */];
496
524
  const videoAttributesTLV = videoConfiguration[3 /* SelectedVideoParametersTypes.ATTRIBUTES */];
497
525
  const videoRTPParametersTLV = videoConfiguration[4 /* SelectedVideoParametersTypes.RTP_PARAMETERS */];
498
526
  // video parameters
499
- const videoParameters = tlv.decode(videoParametersTLV);
527
+ const videoParameters = decode(videoParametersTLV);
500
528
  const h264Profile = videoParameters[1 /* VideoCodecParametersTypes.PROFILE_ID */][0];
501
529
  const h264Level = videoParameters[2 /* VideoCodecParametersTypes.LEVEL */][0];
502
530
  const packetizationMode = videoParameters[3 /* VideoCodecParametersTypes.PACKETIZATION_MODE */][0];
503
531
  const cvoEnabled = videoParameters[4 /* VideoCodecParametersTypes.CVO_ENABLED */];
504
- let cvoId = undefined;
532
+ let cvoId;
505
533
  if (cvoEnabled && cvoEnabled[0] === 1 /* VideoCodecCVO.SUPPORTED */) {
506
534
  cvoId = videoParameters[5 /* VideoCodecParametersTypes.CVO_ID */].readUInt8(0);
507
535
  }
508
536
  // video attributes
509
- const videoAttributes = tlv.decode(videoAttributesTLV);
537
+ const videoAttributes = decode(videoAttributesTLV);
510
538
  const width = videoAttributes[1 /* VideoAttributesTypes.IMAGE_WIDTH */].readUInt16LE(0);
511
539
  const height = videoAttributes[2 /* VideoAttributesTypes.IMAGE_HEIGHT */].readUInt16LE(0);
512
540
  const frameRate = videoAttributes[3 /* VideoAttributesTypes.FRAME_RATE */].readUInt8(0);
513
541
  // video rtp parameters
514
- const videoRTPParameters = tlv.decode(videoRTPParametersTLV);
542
+ const videoRTPParameters = decode(videoRTPParametersTLV);
515
543
  const videoPayloadType = videoRTPParameters[1 /* VideoRTPParametersTypes.PAYLOAD_TYPE */].readUInt8(0); // 99
516
544
  const videoSSRC = videoRTPParameters[2 /* VideoRTPParametersTypes.SYNCHRONIZATION_SOURCE */].readUInt32LE(0);
517
545
  const videoMaximumBitrate = videoRTPParameters[3 /* VideoRTPParametersTypes.MAX_BIT_RATE */].readUInt16LE(0);
518
546
  const videoRTCPInterval = videoRTPParameters[4 /* VideoRTPParametersTypes.MIN_RTCP_INTERVAL */].readFloatLE(0);
519
- let maxMTU = this.ipVersion === "ipv6" ? 1228 : 1378; // default values ipv4: 1378 bytes; ipv6: 1228 bytes
547
+ let maxMTU = this.ipVersion === 'ipv6' ? 1228 : 1378; // default values ipv4: 1378 bytes; ipv6: 1228 bytes
520
548
  if (videoRTPParameters[5 /* VideoRTPParametersTypes.MAX_MTU */]) {
521
549
  maxMTU = videoRTPParameters[5 /* VideoRTPParametersTypes.MAX_MTU */].readUInt16LE(0);
522
550
  }
@@ -526,13 +554,13 @@ class RTPStreamManagement {
526
554
  const audioRTPParametersTLV = audioConfiguration[3 /* SelectedAudioParametersTypes.RTP_PARAMETERS */];
527
555
  const comfortNoise = !!audioConfiguration[4 /* SelectedAudioParametersTypes.COMFORT_NOISE */].readUInt8(0);
528
556
  // audio parameters
529
- const audioParameters = tlv.decode(audioParametersTLV);
557
+ const audioParameters = decode(audioParametersTLV);
530
558
  const channels = audioParameters[1 /* AudioCodecParametersTypes.CHANNEL */][0];
531
559
  const audioBitrate = audioParameters[2 /* AudioCodecParametersTypes.BIT_RATE */][0];
532
560
  const samplerate = audioParameters[3 /* AudioCodecParametersTypes.SAMPLE_RATE */][0];
533
561
  const rtpPacketTime = audioParameters[4 /* AudioCodecParametersTypes.PACKET_TIME */].readUInt8(0);
534
562
  // audio rtp parameters
535
- const audioRTPParameters = tlv.decode(audioRTPParametersTLV);
563
+ const audioRTPParameters = decode(audioRTPParametersTLV);
536
564
  const audioPayloadType = audioRTPParameters[1 /* AudioRTPParametersTypes.PAYLOAD_TYPE */].readUInt8(0); // 110
537
565
  const audioSSRC = audioRTPParameters[2 /* AudioRTPParametersTypes.SYNCHRONIZATION_SOURCE */].readUInt32LE(0);
538
566
  const audioMaximumBitrate = audioRTPParameters[3 /* AudioRTPParametersTypes.MAX_BIT_RATE */].readUInt16LE(0);
@@ -548,10 +576,10 @@ class RTPStreamManagement {
548
576
  codec: videoCodec.readUInt8(0),
549
577
  profile: h264Profile,
550
578
  level: h264Level,
551
- packetizationMode: packetizationMode,
552
- cvoId: cvoId,
553
- width: width,
554
- height: height,
579
+ packetizationMode,
580
+ cvoId,
581
+ width,
582
+ height,
555
583
  fps: frameRate,
556
584
  pt: videoPayloadType,
557
585
  ssrc: videoSSRC,
@@ -625,18 +653,18 @@ class RTPStreamManagement {
625
653
  const videoAttributesTLV = videoConfiguration[3 /* SelectedVideoParametersTypes.ATTRIBUTES */];
626
654
  const videoRTPParametersTLV = videoConfiguration[4 /* SelectedVideoParametersTypes.RTP_PARAMETERS */];
627
655
  // video attributes
628
- const videoAttributes = tlv.decode(videoAttributesTLV);
656
+ const videoAttributes = decode(videoAttributesTLV);
629
657
  const width = videoAttributes[1 /* VideoAttributesTypes.IMAGE_WIDTH */].readUInt16LE(0);
630
658
  const height = videoAttributes[2 /* VideoAttributesTypes.IMAGE_HEIGHT */].readUInt16LE(0);
631
659
  const frameRate = videoAttributes[3 /* VideoAttributesTypes.FRAME_RATE */].readUInt8(0);
632
660
  // video rtp parameters
633
- const videoRTPParameters = tlv.decode(videoRTPParametersTLV);
661
+ const videoRTPParameters = decode(videoRTPParametersTLV);
634
662
  const videoMaximumBitrate = videoRTPParameters[3 /* VideoRTPParametersTypes.MAX_BIT_RATE */].readUInt16LE(0);
635
663
  // seems to be always zero, use default of 0.5
636
664
  const videoRTCPInterval = videoRTPParameters[4 /* VideoRTPParametersTypes.MIN_RTCP_INTERVAL */].readFloatLE(0) || 0.5;
637
665
  const reconfiguredVideoInfo = {
638
- width: width,
639
- height: height,
666
+ width,
667
+ height,
640
668
  fps: frameRate,
641
669
  max_bit_rate: videoMaximumBitrate,
642
670
  rtcp_interval: videoRTCPInterval,
@@ -660,15 +688,15 @@ class RTPStreamManagement {
660
688
  if (this.streamingIsDisabled(callback)) {
661
689
  return;
662
690
  }
663
- const data = Buffer.from(value, "base64");
664
- const objects = tlv.decode(data);
665
- const sessionIdentifier = uuid.unparse(objects[1 /* SetupEndpointsTypes.SESSION_ID */]);
691
+ const data = Buffer.from(value, 'base64');
692
+ const objects = decode(data);
693
+ const sessionIdentifier = unparse(objects[1 /* SetupEndpointsTypes.SESSION_ID */]);
666
694
  if (this.streamStatus !== 0 /* StreamingStatus.AVAILABLE */) {
667
- this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 1 /* SetupEndpointsStatus.BUSY */).toString("base64");
695
+ this.setupEndpointsResponse = encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 1 /* SetupEndpointsStatus.BUSY */).toString('base64');
668
696
  callback();
669
697
  return;
670
698
  }
671
- (0, assert_1.default)(this.activeConnection == null, "Found non-nil `activeConnection` when trying to setup streaming endpoints, even though streamStatus is reported to be AVAILABLE!");
699
+ assert(this.activeConnection == null, 'Found non-nil `activeConnection` when trying to setup streaming endpoints, even though streamStatus is reported to be AVAILABLE!');
672
700
  this.activeConnection = connection;
673
701
  this.activeConnection.setMaxListeners(this.activeConnection.getMaxListeners() + 1);
674
702
  this.activeConnection.on("closed" /* HAPConnectionEvent.CLOSED */, this.activeConnectionClosedListener);
@@ -676,29 +704,29 @@ class RTPStreamManagement {
676
704
  this._updateStreamStatus(1 /* StreamingStatus.IN_USE */);
677
705
  // Address
678
706
  const targetAddressPayload = objects[3 /* SetupEndpointsTypes.CONTROLLER_ADDRESS */];
679
- const processedAddressInfo = tlv.decode(targetAddressPayload);
707
+ const processedAddressInfo = decode(targetAddressPayload);
680
708
  const addressVersion = processedAddressInfo[1 /* AddressTypes.ADDRESS_VERSION */][0];
681
- const controllerAddress = processedAddressInfo[2 /* AddressTypes.ADDRESS */].toString("utf8");
709
+ const controllerAddress = processedAddressInfo[2 /* AddressTypes.ADDRESS */].toString('utf8');
682
710
  const targetVideoPort = processedAddressInfo[3 /* AddressTypes.VIDEO_RTP_PORT */].readUInt16LE(0);
683
711
  const targetAudioPort = processedAddressInfo[4 /* AddressTypes.AUDIO_RTP_PORT */].readUInt16LE(0);
684
712
  // Video SRTP Params
685
713
  const videoSRTPPayload = objects[4 /* SetupEndpointsTypes.VIDEO_SRTP_PARAMETERS */];
686
- const processedVideoInfo = tlv.decode(videoSRTPPayload);
714
+ const processedVideoInfo = decode(videoSRTPPayload);
687
715
  const videoCryptoSuite = processedVideoInfo[1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */][0];
688
716
  const videoMasterKey = processedVideoInfo[2 /* SRTPParametersTypes.MASTER_KEY */];
689
717
  const videoMasterSalt = processedVideoInfo[3 /* SRTPParametersTypes.MASTER_SALT */];
690
718
  // Audio SRTP Params
691
719
  const audioSRTPPayload = objects[5 /* SetupEndpointsTypes.AUDIO_SRTP_PARAMETERS */];
692
- const processedAudioInfo = tlv.decode(audioSRTPPayload);
720
+ const processedAudioInfo = decode(audioSRTPPayload);
693
721
  const audioCryptoSuite = processedAudioInfo[1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */][0];
694
722
  const audioMasterKey = processedAudioInfo[2 /* SRTPParametersTypes.MASTER_KEY */];
695
723
  const audioMasterSalt = processedAudioInfo[3 /* SRTPParametersTypes.MASTER_SALT */];
696
- debug("Session: ", sessionIdentifier, "\nControllerAddress: ", controllerAddress, "\nVideoPort: ", targetVideoPort, "\nAudioPort: ", targetAudioPort, "\nVideo Crypto: ", videoCryptoSuite, "\nVideo Master Key: ", videoMasterKey, "\nVideo Master Salt: ", videoMasterSalt, "\nAudio Crypto: ", audioCryptoSuite, "\nAudio Master Key: ", audioMasterKey, "\nAudio Master Salt: ", audioMasterSalt);
724
+ debug('Session: ', sessionIdentifier, '\nControllerAddress: ', controllerAddress, '\nVideoPort: ', targetVideoPort, '\nAudioPort: ', targetAudioPort, '\nVideo Crypto: ', videoCryptoSuite, '\nVideo Master Key: ', videoMasterKey, '\nVideo Master Salt: ', videoMasterSalt, '\nAudio Crypto: ', audioCryptoSuite, '\nAudio Master Key: ', audioMasterKey, '\nAudio Master Salt: ', audioMasterSalt);
697
725
  const prepareRequest = {
698
726
  sessionID: sessionIdentifier,
699
727
  sourceAddress: connection.localAddress,
700
728
  targetAddress: controllerAddress,
701
- addressVersion: addressVersion === 1 /* IPAddressVersion.IPV6 */ ? "ipv6" : "ipv4",
729
+ addressVersion: addressVersion === 1 /* IPAddressVersion.IPV6 */ ? 'ipv6' : 'ipv4',
702
730
  video: {
703
731
  port: targetVideoPort,
704
732
  srtpCryptoSuite: videoCryptoSuite,
@@ -714,11 +742,11 @@ class RTPStreamManagement {
714
742
  };
715
743
  const promises = [];
716
744
  if (this.requireProxy) {
717
- prepareRequest.targetAddress = connection.getLocalAddress(addressVersion === 1 /* IPAddressVersion.IPV6 */ ? "ipv6" : "ipv4"); // ip versions must be the same
718
- this.videoProxy = new RTPProxy_1.default({
745
+ prepareRequest.targetAddress = connection.getLocalAddress(addressVersion === 1 /* IPAddressVersion.IPV6 */ ? 'ipv6' : 'ipv4'); // ip versions must be the same
746
+ this.videoProxy = new RTPProxy({
719
747
  outgoingAddress: controllerAddress,
720
748
  outgoingPort: targetVideoPort,
721
- outgoingSSRC: crypto_1.default.randomBytes(4).readUInt32LE(0), // videoSSRC
749
+ outgoingSSRC: randomBytes(4).readUInt32LE(0), // videoSSRC
722
750
  disabled: false,
723
751
  });
724
752
  promises.push(this.videoProxy.setup().then(() => {
@@ -726,10 +754,10 @@ class RTPStreamManagement {
726
754
  prepareRequest.video.proxy_rtcp = this.videoProxy.incomingRTCPPort();
727
755
  }));
728
756
  if (!this.disableAudioProxy) {
729
- this.audioProxy = new RTPProxy_1.default({
757
+ this.audioProxy = new RTPProxy({
730
758
  outgoingAddress: controllerAddress,
731
759
  outgoingPort: targetAudioPort,
732
- outgoingSSRC: crypto_1.default.randomBytes(4).readUInt32LE(0), // audioSSRC
760
+ outgoingSSRC: randomBytes(4).readUInt32LE(0), // audioSSRC
733
761
  disabled: this.videoOnly,
734
762
  });
735
763
  promises.push(this.audioProxy.setup().then(() => {
@@ -739,10 +767,10 @@ class RTPStreamManagement {
739
767
  }
740
768
  }
741
769
  Promise.all(promises).then(() => {
742
- this.delegate.prepareStream(prepareRequest, (0, once_1.once)((error, response) => {
770
+ this.delegate.prepareStream(prepareRequest, once((error, response) => {
743
771
  if (error || !response) {
744
772
  debug(`PrepareStream request encountered an error: ${error ? error.message : undefined}`);
745
- this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString("base64");
773
+ this.setupEndpointsResponse = encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString('base64');
746
774
  this.handleSessionClosed();
747
775
  callback(error);
748
776
  }
@@ -766,12 +794,12 @@ class RTPStreamManagement {
766
794
  let videoSSRC;
767
795
  let audioSSRC;
768
796
  if (!this.videoOnly && !response.audio) {
769
- throw new Error("Audio was enabled but not supplied in PrepareStreamResponse!");
797
+ throw new Error('Audio was enabled but not supplied in PrepareStreamResponse!');
770
798
  }
771
799
  // Provide default values if audio was not supplied
772
800
  const audio = response.audio || {
773
801
  port: request.audio.port,
774
- ssrc: controller_1.CameraController.generateSynchronisationSource(),
802
+ ssrc: CameraController.generateSynchronisationSource(),
775
803
  srtp_key: request.audio.srtp_key,
776
804
  srtp_salt: request.audio.srtp_salt,
777
805
  };
@@ -779,7 +807,7 @@ class RTPStreamManagement {
779
807
  const videoInfo = response.video;
780
808
  const audioInfo = audio;
781
809
  if (response.addressOverride) {
782
- addressVersion = net_1.default.isIPv4(response.addressOverride) ? "ipv4" : "ipv6";
810
+ addressVersion = isIPv4(response.addressOverride) ? 'ipv4' : 'ipv6';
783
811
  address = response.addressOverride;
784
812
  }
785
813
  else {
@@ -792,11 +820,11 @@ class RTPStreamManagement {
792
820
  audioPort = audioInfo.port;
793
821
  if (request.video.srtpCryptoSuite !== 2 /* SRTPCryptoSuites.NONE */
794
822
  && (videoInfo.srtp_key === undefined || videoInfo.srtp_salt === undefined)) {
795
- throw new Error("SRTP was selected for the prepared video stream, but no 'srtp_key' or 'srtp_salt' was specified!");
823
+ throw new Error('SRTP was selected for the prepared video stream, but no \'srtp_key\' or \'srtp_salt\' was specified!');
796
824
  }
797
825
  if (request.audio.srtpCryptoSuite !== 2 /* SRTPCryptoSuites.NONE */
798
826
  && (audioInfo.srtp_key === undefined || audioInfo.srtp_salt === undefined)) {
799
- throw new Error("SRTP was selected for the prepared audio stream, but no 'srtp_key' or 'srtp_salt' was specified!");
827
+ throw new Error('SRTP was selected for the prepared audio stream, but no \'srtp_key\' or \'srtp_salt\' was specified!');
800
828
  }
801
829
  videoCryptoSuite = request.video.srtpCryptoSuite;
802
830
  videoSRTPKey = videoInfo.srtp_key || Buffer.alloc(0); // key and salt are zero-length for cryptoSuite = NONE
@@ -838,39 +866,39 @@ class RTPStreamManagement {
838
866
  }
839
867
  }
840
868
  this.ipVersion = addressVersion; // we need to save this in order to calculate some default mtu values later
841
- const accessoryAddress = tlv.encode(1 /* AddressTypes.ADDRESS_VERSION */, addressVersion === "ipv4" ? 0 /* IPAddressVersion.IPV4 */ : 1 /* IPAddressVersion.IPV6 */, 2 /* AddressTypes.ADDRESS */, address, 3 /* AddressTypes.VIDEO_RTP_PORT */, tlv.writeUInt16(videoPort), 4 /* AddressTypes.AUDIO_RTP_PORT */, tlv.writeUInt16(audioPort));
842
- const videoSRTPParameters = tlv.encode(1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */, videoCryptoSuite, 2 /* SRTPParametersTypes.MASTER_KEY */, videoSRTPKey, 3 /* SRTPParametersTypes.MASTER_SALT */, videoSRTPSalt);
843
- const audioSRTPParameters = tlv.encode(1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */, audioCryptoSuite, 2 /* SRTPParametersTypes.MASTER_KEY */, audioSRTPKey, 3 /* SRTPParametersTypes.MASTER_SALT */, audioSRTPSalt);
844
- this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(identifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 0 /* SetupEndpointsStatus.SUCCESS */, 3 /* SetupEndpointsResponseTypes.ACCESSORY_ADDRESS */, accessoryAddress, 4 /* SetupEndpointsResponseTypes.VIDEO_SRTP_PARAMETERS */, videoSRTPParameters, 5 /* SetupEndpointsResponseTypes.AUDIO_SRTP_PARAMETERS */, audioSRTPParameters, 6 /* SetupEndpointsResponseTypes.VIDEO_SSRC */, tlv.writeUInt32(videoSSRC), 7 /* SetupEndpointsResponseTypes.AUDIO_SSRC */, tlv.writeUInt32(audioSSRC)).toString("base64");
869
+ const accessoryAddress = encode(1 /* AddressTypes.ADDRESS_VERSION */, addressVersion === 'ipv4' ? 0 /* IPAddressVersion.IPV4 */ : 1 /* IPAddressVersion.IPV6 */, 2 /* AddressTypes.ADDRESS */, address, 3 /* AddressTypes.VIDEO_RTP_PORT */, writeUInt16(videoPort), 4 /* AddressTypes.AUDIO_RTP_PORT */, writeUInt16(audioPort));
870
+ const videoSRTPParameters = encode(1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */, videoCryptoSuite, 2 /* SRTPParametersTypes.MASTER_KEY */, videoSRTPKey, 3 /* SRTPParametersTypes.MASTER_SALT */, videoSRTPSalt);
871
+ const audioSRTPParameters = encode(1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */, audioCryptoSuite, 2 /* SRTPParametersTypes.MASTER_KEY */, audioSRTPKey, 3 /* SRTPParametersTypes.MASTER_SALT */, audioSRTPSalt);
872
+ this.setupEndpointsResponse = encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, write(identifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 0 /* SetupEndpointsStatus.SUCCESS */, 3 /* SetupEndpointsResponseTypes.ACCESSORY_ADDRESS */, accessoryAddress, 4 /* SetupEndpointsResponseTypes.VIDEO_SRTP_PARAMETERS */, videoSRTPParameters, 5 /* SetupEndpointsResponseTypes.AUDIO_SRTP_PARAMETERS */, audioSRTPParameters, 6 /* SetupEndpointsResponseTypes.VIDEO_SSRC */, writeUInt32(videoSSRC), 7 /* SetupEndpointsResponseTypes.AUDIO_SSRC */, writeUInt32(audioSSRC)).toString('base64');
845
873
  callback();
846
874
  }
847
875
  _updateStreamStatus(status) {
848
876
  this.streamStatus = status;
849
- this.service.updateCharacteristic(Characteristic_1.Characteristic.StreamingStatus, tlv.encode(1 /* StreamingStatusTypes.STATUS */, this.streamStatus).toString("base64"));
877
+ this.service.updateCharacteristic(Characteristic.StreamingStatus, encode(1 /* StreamingStatusTypes.STATUS */, this.streamStatus).toString('base64'));
850
878
  }
851
879
  static _supportedRTPConfiguration(supportedCryptoSuites) {
852
880
  if (supportedCryptoSuites.length === 1 && supportedCryptoSuites[0] === 2 /* SRTPCryptoSuites.NONE */) {
853
- debug("Client claims it doesn't support SRTP. The stream may stops working with future iOS releases.");
881
+ debug('Client claims it doesn\'t support SRTP. The stream may stops working with future iOS releases.');
854
882
  }
855
- return tlv.encode(2 /* SupportedRTPConfigurationTypes.SRTP_CRYPTO_SUITE */, supportedCryptoSuites).toString("base64");
883
+ return encode(2 /* SupportedRTPConfigurationTypes.SRTP_CRYPTO_SUITE */, supportedCryptoSuites).toString('base64');
856
884
  }
857
885
  static _supportedVideoStreamConfiguration(videoOptions) {
858
886
  if (!videoOptions.codec) {
859
- throw new Error("Video codec cannot be undefined");
887
+ throw new Error('Video codec cannot be undefined');
860
888
  }
861
889
  if (!videoOptions.resolutions) {
862
- throw new Error("Video resolutions cannot be undefined");
890
+ throw new Error('Video resolutions cannot be undefined');
863
891
  }
864
- let codecParameters = tlv.encode(1 /* VideoCodecParametersTypes.PROFILE_ID */, videoOptions.codec.profiles, 2 /* VideoCodecParametersTypes.LEVEL */, videoOptions.codec.levels, 3 /* VideoCodecParametersTypes.PACKETIZATION_MODE */, 0 /* VideoCodecPacketizationMode.NON_INTERLEAVED */);
892
+ let codecParameters = encode(1 /* VideoCodecParametersTypes.PROFILE_ID */, videoOptions.codec.profiles, 2 /* VideoCodecParametersTypes.LEVEL */, videoOptions.codec.levels, 3 /* VideoCodecParametersTypes.PACKETIZATION_MODE */, 0 /* VideoCodecPacketizationMode.NON_INTERLEAVED */);
865
893
  if (videoOptions.cvoId != null) {
866
894
  codecParameters = Buffer.concat([
867
895
  codecParameters,
868
- tlv.encode(4 /* VideoCodecParametersTypes.CVO_ENABLED */, 1 /* VideoCodecCVO.SUPPORTED */, 5 /* VideoCodecParametersTypes.CVO_ID */, videoOptions.cvoId),
896
+ encode(4 /* VideoCodecParametersTypes.CVO_ENABLED */, 1 /* VideoCodecCVO.SUPPORTED */, 5 /* VideoCodecParametersTypes.CVO_ID */, videoOptions.cvoId),
869
897
  ]);
870
898
  }
871
- const videoStreamConfiguration = tlv.encode(1 /* VideoCodecConfigurationTypes.CODEC_TYPE */, 0 /* VideoCodecType.H264 */, 2 /* VideoCodecConfigurationTypes.CODEC_PARAMETERS */, codecParameters, 3 /* VideoCodecConfigurationTypes.ATTRIBUTES */, videoOptions.resolutions.map(resolution => {
899
+ const videoStreamConfiguration = encode(1 /* VideoCodecConfigurationTypes.CODEC_TYPE */, 0 /* VideoCodecType.H264 */, 2 /* VideoCodecConfigurationTypes.CODEC_PARAMETERS */, codecParameters, 3 /* VideoCodecConfigurationTypes.ATTRIBUTES */, videoOptions.resolutions.map((resolution) => {
872
900
  if (resolution.length !== 3) {
873
- throw new Error("Unexpected video resolution");
901
+ throw new Error('Unexpected video resolution');
874
902
  }
875
903
  const width = Buffer.alloc(2);
876
904
  const height = Buffer.alloc(2);
@@ -878,16 +906,16 @@ class RTPStreamManagement {
878
906
  width.writeUInt16LE(resolution[0], 0);
879
907
  height.writeUInt16LE(resolution[1], 0);
880
908
  frameRate.writeUInt8(resolution[2], 0);
881
- return tlv.encode(1 /* VideoAttributesTypes.IMAGE_WIDTH */, width, 2 /* VideoAttributesTypes.IMAGE_HEIGHT */, height, 3 /* VideoAttributesTypes.FRAME_RATE */, frameRate);
909
+ return encode(1 /* VideoAttributesTypes.IMAGE_WIDTH */, width, 2 /* VideoAttributesTypes.IMAGE_HEIGHT */, height, 3 /* VideoAttributesTypes.FRAME_RATE */, frameRate);
882
910
  }));
883
- return tlv.encode(1 /* SupportedVideoStreamConfigurationTypes.VIDEO_CODEC_CONFIGURATION */, videoStreamConfiguration).toString("base64");
911
+ return encode(1 /* SupportedVideoStreamConfigurationTypes.VIDEO_CODEC_CONFIGURATION */, videoStreamConfiguration).toString('base64');
884
912
  }
885
913
  checkForLegacyAudioCodecRepresentation(codecs) {
886
914
  const codecMap = {};
887
- codecs.slice().forEach(codec => {
915
+ codecs.slice().forEach((codec) => {
888
916
  const previous = codecMap[codec.type];
889
917
  if (previous) {
890
- if (typeof previous.samplerate === "number") {
918
+ if (typeof previous.samplerate === 'number') {
891
919
  previous.samplerate = [previous.samplerate];
892
920
  }
893
921
  previous.samplerate = previous.samplerate.concat(codec.samplerate);
@@ -908,14 +936,14 @@ class RTPStreamManagement {
908
936
  const supportedCodecs = (audioOptions && audioOptions.codecs) || [];
909
937
  this.checkForLegacyAudioCodecRepresentation(supportedCodecs);
910
938
  if (supportedCodecs.length === 0) { // Fake a Codec if we haven't got anything
911
- debug("Client doesn't support any audio codec that HomeKit supports.");
939
+ debug('Client doesn\'t support any audio codec that HomeKit supports.');
912
940
  this.videoOnly = true;
913
941
  supportedCodecs.push({
914
942
  type: "OPUS" /* AudioStreamingCodecType.OPUS */, // Opus @16K required by Apple Watch AFAIK
915
943
  samplerate: [16 /* AudioStreamingSamplerate.KHZ_16 */, 24 /* AudioStreamingSamplerate.KHZ_24 */], // 16 and 24 must be supported
916
944
  });
917
945
  }
918
- const codecConfigurations = supportedCodecs.map(codec => {
946
+ const codecConfigurations = supportedCodecs.map((codec) => {
919
947
  let type;
920
948
  switch (codec.type) {
921
949
  case "OPUS" /* AudioStreamingCodecType.OPUS */:
@@ -940,9 +968,9 @@ class RTPStreamManagement {
940
968
  type = 6 /* AudioCodecTypes.AMR_WB */;
941
969
  break;
942
970
  default:
943
- throw new Error("Unsupported codec: " + codec.type);
971
+ throw new Error(`Unsupported codec: ${codec.type}`);
944
972
  }
945
- const providedSamplerates = (typeof codec.samplerate === "number" ? [codec.samplerate] : codec.samplerate).map(rate => {
973
+ const providedSamplerates = (typeof codec.samplerate === 'number' ? [codec.samplerate] : codec.samplerate).map((rate) => {
946
974
  let samplerate;
947
975
  switch (rate) {
948
976
  case 8 /* AudioStreamingSamplerate.KHZ_8 */:
@@ -955,32 +983,33 @@ class RTPStreamManagement {
955
983
  samplerate = 2 /* AudioSamplerate.KHZ_24 */;
956
984
  break;
957
985
  default:
958
- console.log("Unsupported sample rate: ", codec.samplerate);
986
+ // eslint-disable-next-line no-console
987
+ console.log('Unsupported sample rate: ', codec.samplerate);
959
988
  samplerate = -1;
960
989
  }
961
990
  return samplerate;
962
991
  }).filter(rate => rate !== -1);
963
992
  if (providedSamplerates.length === 0) {
964
- throw new Error("Audio samplerate cannot be empty!");
993
+ throw new Error('Audio samplerate cannot be empty!');
965
994
  }
966
- const audioParameters = tlv.encode(1 /* AudioCodecParametersTypes.CHANNEL */, Math.max(1, codec.audioChannels || 1), 2 /* AudioCodecParametersTypes.BIT_RATE */, codec.bitrate || 0 /* AudioBitrate.VARIABLE */, 3 /* AudioCodecParametersTypes.SAMPLE_RATE */, providedSamplerates);
967
- return tlv.encode(1 /* AudioCodecConfigurationTypes.CODEC_TYPE */, type, 2 /* AudioCodecConfigurationTypes.CODEC_PARAMETERS */, audioParameters);
995
+ const audioParameters = encode(1 /* AudioCodecParametersTypes.CHANNEL */, Math.max(1, codec.audioChannels || 1), 2 /* AudioCodecParametersTypes.BIT_RATE */, codec.bitrate || 0 /* AudioBitrate.VARIABLE */, 3 /* AudioCodecParametersTypes.SAMPLE_RATE */, providedSamplerates);
996
+ return encode(1 /* AudioCodecConfigurationTypes.CODEC_TYPE */, type, 2 /* AudioCodecConfigurationTypes.CODEC_PARAMETERS */, audioParameters);
968
997
  });
969
- return tlv.encode(1 /* SupportedAudioStreamConfigurationTypes.AUDIO_CODEC_CONFIGURATION */, codecConfigurations, 2 /* SupportedAudioStreamConfigurationTypes.COMFORT_NOISE_SUPPORT */, comfortNoise ? 1 : 0).toString("base64");
998
+ return encode(1 /* SupportedAudioStreamConfigurationTypes.AUDIO_CODEC_CONFIGURATION */, codecConfigurations, 2 /* SupportedAudioStreamConfigurationTypes.COMFORT_NOISE_SUPPORT */, comfortNoise ? 1 : 0).toString('base64');
970
999
  }
971
1000
  resetSetupEndpointsResponse() {
972
- this.setupEndpointsResponse = tlv.encode(2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString("base64");
973
- this.service.updateCharacteristic(Characteristic_1.Characteristic.SetupEndpoints, this.setupEndpointsResponse);
1001
+ this.setupEndpointsResponse = encode(2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString('base64');
1002
+ this.service.updateCharacteristic(Characteristic.SetupEndpoints, this.setupEndpointsResponse);
974
1003
  }
975
1004
  resetSelectedStreamConfiguration() {
976
- this.selectedConfiguration = tlv.encode(1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */, tlv.encode(2 /* SessionControlTypes.COMMAND */, SessionControlCommand.SUSPEND_SESSION)).toString("base64");
977
- this.service.updateCharacteristic(Characteristic_1.Characteristic.SelectedRTPStreamConfiguration, this.selectedConfiguration);
1005
+ this.selectedConfiguration = encode(1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */, encode(2 /* SessionControlTypes.COMMAND */, SessionControlCommand.SUSPEND_SESSION)).toString('base64');
1006
+ this.service.updateCharacteristic(Characteristic.SelectedRTPStreamConfiguration, this.selectedConfiguration);
978
1007
  }
979
1008
  /**
980
1009
  * @private
981
1010
  */
982
1011
  serialize() {
983
- const characteristicValue = this.service.getCharacteristic(Characteristic_1.Characteristic.Active).value;
1012
+ const characteristicValue = this.service.getCharacteristic(Characteristic.Active).value;
984
1013
  if (characteristicValue === true) {
985
1014
  return undefined;
986
1015
  }
@@ -993,8 +1022,8 @@ class RTPStreamManagement {
993
1022
  * @private
994
1023
  */
995
1024
  deserialize(serialized) {
996
- (0, assert_1.default)(serialized.id === this.id, `Tried to initialize RTPStreamManagement ${this.id} with data from management with id ${serialized.id}!`);
997
- this.service.updateCharacteristic(Characteristic_1.Characteristic.Active, serialized.active);
1025
+ assert(serialized.id === this.id, `Tried to initialize RTPStreamManagement ${this.id} with data from management with id ${serialized.id}!`);
1026
+ this.service.updateCharacteristic(Characteristic.Active, serialized.active);
998
1027
  }
999
1028
  /**
1000
1029
  * @private
@@ -1003,5 +1032,4 @@ class RTPStreamManagement {
1003
1032
  this.stateChangeDelegate = delegate;
1004
1033
  }
1005
1034
  }
1006
- exports.RTPStreamManagement = RTPStreamManagement;
1007
1035
  //# sourceMappingURL=RTPStreamManagement.js.map