@homebridge/hap-nodejs 2.2.4-beta.6 → 2.3.0-beta.0

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 (234) hide show
  1. package/README.md +14 -17
  2. package/dist/accessories/AirConditioner_accessory.js +27 -29
  3. package/dist/accessories/AirConditioner_accessory.js.map +1 -1
  4. package/dist/accessories/AppleTVRemote_accessory.js +61 -71
  5. package/dist/accessories/AppleTVRemote_accessory.js.map +1 -1
  6. package/dist/accessories/Camera_accessory.js +151 -134
  7. package/dist/accessories/Camera_accessory.js.map +1 -1
  8. package/dist/accessories/Fan_accessory.js +18 -21
  9. package/dist/accessories/Fan_accessory.js.map +1 -1
  10. package/dist/accessories/GarageDoorOpener_accessory.js +33 -35
  11. package/dist/accessories/GarageDoorOpener_accessory.js.map +1 -1
  12. package/dist/accessories/Light-AdaptiveLighting_accessory.js +41 -44
  13. package/dist/accessories/Light-AdaptiveLighting_accessory.js.map +1 -1
  14. package/dist/accessories/Light_accessory.js +32 -34
  15. package/dist/accessories/Light_accessory.js.map +1 -1
  16. package/dist/accessories/Lock_accessory.js +24 -26
  17. package/dist/accessories/Lock_accessory.js.map +1 -1
  18. package/dist/accessories/MotionSensor_accessory.js +13 -15
  19. package/dist/accessories/MotionSensor_accessory.js.map +1 -1
  20. package/dist/accessories/Outlet_accessory.js +20 -22
  21. package/dist/accessories/Outlet_accessory.js.map +1 -1
  22. package/dist/accessories/SmartSpeaker_accessory.js +18 -20
  23. package/dist/accessories/SmartSpeaker_accessory.js.map +1 -1
  24. package/dist/accessories/Sprinkler_accessory.js +36 -38
  25. package/dist/accessories/Sprinkler_accessory.js.map +1 -1
  26. package/dist/accessories/TV_accessory.js +43 -45
  27. package/dist/accessories/TV_accessory.js.map +1 -1
  28. package/dist/accessories/TemperatureSensor_accessory.js +12 -14
  29. package/dist/accessories/TemperatureSensor_accessory.js.map +1 -1
  30. package/dist/accessories/Wi-FiRouter_accessory.d.ts +1 -1
  31. package/dist/accessories/Wi-FiRouter_accessory.d.ts.map +1 -1
  32. package/dist/accessories/Wi-FiRouter_accessory.js +9 -12
  33. package/dist/accessories/Wi-FiRouter_accessory.js.map +1 -1
  34. package/dist/accessories/Wi-FiSatellite_accessory.d.ts +1 -1
  35. package/dist/accessories/Wi-FiSatellite_accessory.d.ts.map +1 -1
  36. package/dist/accessories/Wi-FiSatellite_accessory.js +11 -14
  37. package/dist/accessories/Wi-FiSatellite_accessory.js.map +1 -1
  38. package/dist/accessories/gstreamer-audioProducer.d.ts +3 -3
  39. package/dist/accessories/gstreamer-audioProducer.d.ts.map +1 -1
  40. package/dist/accessories/gstreamer-audioProducer.js +35 -36
  41. package/dist/accessories/gstreamer-audioProducer.js.map +1 -1
  42. package/dist/accessories/types.d.ts +63 -63
  43. package/dist/accessories/types.d.ts.map +1 -1
  44. package/dist/accessories/types.js +83 -87
  45. package/dist/accessories/types.js.map +1 -1
  46. package/dist/hap.d.ts +50 -0
  47. package/dist/hap.d.ts.map +1 -0
  48. package/dist/hap.js +49 -0
  49. package/dist/hap.js.map +1 -0
  50. package/dist/index.d.ts +3 -49
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +5 -53
  53. package/dist/index.js.map +1 -1
  54. package/dist/internal-types.d.ts +1 -1
  55. package/dist/internal-types.d.ts.map +1 -1
  56. package/dist/internal-types.js +19 -19
  57. package/dist/internal-types.js.map +1 -1
  58. package/dist/lib/Accessory.d.ts +37 -37
  59. package/dist/lib/Accessory.d.ts.map +1 -1
  60. package/dist/lib/Accessory.js +265 -257
  61. package/dist/lib/Accessory.js.map +1 -1
  62. package/dist/lib/Advertiser.d.ts +6 -6
  63. package/dist/lib/Advertiser.d.ts.map +1 -1
  64. package/dist/lib/Advertiser.js +143 -139
  65. package/dist/lib/Advertiser.js.map +1 -1
  66. package/dist/lib/Bridge.d.ts +1 -1
  67. package/dist/lib/Bridge.d.ts.map +1 -1
  68. package/dist/lib/Bridge.js +2 -6
  69. package/dist/lib/Bridge.js.map +1 -1
  70. package/dist/lib/Characteristic.d.ts +40 -41
  71. package/dist/lib/Characteristic.d.ts.map +1 -1
  72. package/dist/lib/Characteristic.js +265 -216
  73. package/dist/lib/Characteristic.js.map +1 -1
  74. package/dist/lib/HAPServer.d.ts +30 -29
  75. package/dist/lib/HAPServer.d.ts.map +1 -1
  76. package/dist/lib/HAPServer.js +223 -224
  77. package/dist/lib/HAPServer.js.map +1 -1
  78. package/dist/lib/Service.d.ts +21 -22
  79. package/dist/lib/Service.d.ts.map +1 -1
  80. package/dist/lib/Service.js +60 -68
  81. package/dist/lib/Service.js.map +1 -1
  82. package/dist/lib/camera/RTPProxy.d.ts +2 -1
  83. package/dist/lib/camera/RTPProxy.d.ts.map +1 -1
  84. package/dist/lib/camera/RTPProxy.js +35 -37
  85. package/dist/lib/camera/RTPProxy.js.map +1 -1
  86. package/dist/lib/camera/RTPStreamManagement.d.ts +34 -33
  87. package/dist/lib/camera/RTPStreamManagement.d.ts.map +1 -1
  88. package/dist/lib/camera/RTPStreamManagement.js +178 -132
  89. package/dist/lib/camera/RTPStreamManagement.js.map +1 -1
  90. package/dist/lib/camera/RecordingManagement.d.ts +18 -17
  91. package/dist/lib/camera/RecordingManagement.d.ts.map +1 -1
  92. package/dist/lib/camera/RecordingManagement.js +182 -154
  93. package/dist/lib/camera/RecordingManagement.js.map +1 -1
  94. package/dist/lib/camera/index.d.ts +3 -3
  95. package/dist/lib/camera/index.d.ts.map +1 -1
  96. package/dist/lib/camera/index.js +3 -6
  97. package/dist/lib/camera/index.js.map +1 -1
  98. package/dist/lib/controller/AdaptiveLightingController.d.ts +8 -8
  99. package/dist/lib/controller/AdaptiveLightingController.d.ts.map +1 -1
  100. package/dist/lib/controller/AdaptiveLightingController.js +111 -99
  101. package/dist/lib/controller/AdaptiveLightingController.js.map +1 -1
  102. package/dist/lib/controller/CameraController.d.ts +21 -20
  103. package/dist/lib/controller/CameraController.d.ts.map +1 -1
  104. package/dist/lib/controller/CameraController.js +82 -80
  105. package/dist/lib/controller/CameraController.js.map +1 -1
  106. package/dist/lib/controller/Controller.d.ts +1 -1
  107. package/dist/lib/controller/Controller.d.ts.map +1 -1
  108. package/dist/lib/controller/Controller.js +5 -8
  109. package/dist/lib/controller/Controller.js.map +1 -1
  110. package/dist/lib/controller/DoorbellController.d.ts +4 -4
  111. package/dist/lib/controller/DoorbellController.d.ts.map +1 -1
  112. package/dist/lib/controller/DoorbellController.js +9 -13
  113. package/dist/lib/controller/DoorbellController.js.map +1 -1
  114. package/dist/lib/controller/RemoteController.d.ts +38 -37
  115. package/dist/lib/controller/RemoteController.d.ts.map +1 -1
  116. package/dist/lib/controller/RemoteController.js +188 -158
  117. package/dist/lib/controller/RemoteController.js.map +1 -1
  118. package/dist/lib/controller/index.d.ts +5 -5
  119. package/dist/lib/controller/index.d.ts.map +1 -1
  120. package/dist/lib/controller/index.js +5 -8
  121. package/dist/lib/controller/index.js.map +1 -1
  122. package/dist/lib/datastream/DataStreamManagement.d.ts +2 -2
  123. package/dist/lib/datastream/DataStreamManagement.d.ts.map +1 -1
  124. package/dist/lib/datastream/DataStreamManagement.js +32 -32
  125. package/dist/lib/datastream/DataStreamManagement.js.map +1 -1
  126. package/dist/lib/datastream/DataStreamParser.d.ts +1 -0
  127. package/dist/lib/datastream/DataStreamParser.d.ts.map +1 -1
  128. package/dist/lib/datastream/DataStreamParser.js +53 -69
  129. package/dist/lib/datastream/DataStreamParser.js.map +1 -1
  130. package/dist/lib/datastream/DataStreamServer.d.ts +23 -22
  131. package/dist/lib/datastream/DataStreamServer.d.ts.map +1 -1
  132. package/dist/lib/datastream/DataStreamServer.js +152 -154
  133. package/dist/lib/datastream/DataStreamServer.js.map +1 -1
  134. package/dist/lib/datastream/index.d.ts +3 -3
  135. package/dist/lib/datastream/index.d.ts.map +1 -1
  136. package/dist/lib/datastream/index.js +3 -6
  137. package/dist/lib/datastream/index.js.map +1 -1
  138. package/dist/lib/definitions/CharacteristicDefinitions.d.ts +1 -1
  139. package/dist/lib/definitions/CharacteristicDefinitions.d.ts.map +1 -1
  140. package/dist/lib/definitions/CharacteristicDefinitions.js +1103 -1288
  141. package/dist/lib/definitions/CharacteristicDefinitions.js.map +1 -1
  142. package/dist/lib/definitions/ServiceDefinitions.d.ts +1 -1
  143. package/dist/lib/definitions/ServiceDefinitions.d.ts.map +1 -1
  144. package/dist/lib/definitions/ServiceDefinitions.js +644 -722
  145. package/dist/lib/definitions/ServiceDefinitions.js.map +1 -1
  146. package/dist/lib/definitions/generate-definitions.d.ts +2 -2
  147. package/dist/lib/definitions/generate-definitions.d.ts.map +1 -1
  148. package/dist/lib/definitions/generate-definitions.js +241 -241
  149. package/dist/lib/definitions/generate-definitions.js.map +1 -1
  150. package/dist/lib/definitions/generator-configuration.d.ts +1 -1
  151. package/dist/lib/definitions/generator-configuration.d.ts.map +1 -1
  152. package/dist/lib/definitions/generator-configuration.js +572 -309
  153. package/dist/lib/definitions/generator-configuration.js.map +1 -1
  154. package/dist/lib/definitions/index.d.ts +2 -2
  155. package/dist/lib/definitions/index.d.ts.map +1 -1
  156. package/dist/lib/definitions/index.js +2 -5
  157. package/dist/lib/definitions/index.js.map +1 -1
  158. package/dist/lib/gen/HomeKit.js +1 -2
  159. package/dist/lib/gen/HomeKit.js.map +1 -1
  160. package/dist/lib/model/AccessoryInfo.d.ts +4 -3
  161. package/dist/lib/model/AccessoryInfo.d.ts.map +1 -1
  162. package/dist/lib/model/AccessoryInfo.js +53 -56
  163. package/dist/lib/model/AccessoryInfo.js.map +1 -1
  164. package/dist/lib/model/ControllerStorage.d.ts +3 -3
  165. package/dist/lib/model/ControllerStorage.d.ts.map +1 -1
  166. package/dist/lib/model/ControllerStorage.js +31 -30
  167. package/dist/lib/model/ControllerStorage.js.map +1 -1
  168. package/dist/lib/model/HAPFileStorage.d.ts.map +1 -1
  169. package/dist/lib/model/HAPFileStorage.js +71 -50
  170. package/dist/lib/model/HAPFileStorage.js.map +1 -1
  171. package/dist/lib/model/HAPStorage.d.ts +1 -1
  172. package/dist/lib/model/HAPStorage.d.ts.map +1 -1
  173. package/dist/lib/model/HAPStorage.js +11 -14
  174. package/dist/lib/model/HAPStorage.js.map +1 -1
  175. package/dist/lib/model/IdentifierCache.d.ts +1 -1
  176. package/dist/lib/model/IdentifierCache.d.ts.map +1 -1
  177. package/dist/lib/model/IdentifierCache.js +23 -27
  178. package/dist/lib/model/IdentifierCache.js.map +1 -1
  179. package/dist/lib/tv/AccessControlManagement.d.ts +6 -6
  180. package/dist/lib/tv/AccessControlManagement.d.ts.map +1 -1
  181. package/dist/lib/tv/AccessControlManagement.js +23 -24
  182. package/dist/lib/tv/AccessControlManagement.js.map +1 -1
  183. package/dist/lib/util/checkName.d.ts +2 -2
  184. package/dist/lib/util/checkName.d.ts.map +1 -1
  185. package/dist/lib/util/checkName.js +8 -14
  186. package/dist/lib/util/checkName.js.map +1 -1
  187. package/dist/lib/util/clone.d.ts.map +1 -1
  188. package/dist/lib/util/clone.js +1 -5
  189. package/dist/lib/util/clone.js.map +1 -1
  190. package/dist/lib/util/color-utils.d.ts +1 -1
  191. package/dist/lib/util/color-utils.d.ts.map +1 -1
  192. package/dist/lib/util/color-utils.js +1608 -410
  193. package/dist/lib/util/color-utils.js.map +1 -1
  194. package/dist/lib/util/eventedhttp.d.ts +23 -22
  195. package/dist/lib/util/eventedhttp.d.ts.map +1 -1
  196. package/dist/lib/util/eventedhttp.js +127 -122
  197. package/dist/lib/util/eventedhttp.js.map +1 -1
  198. package/dist/lib/util/hapCrypto.d.ts +2 -1
  199. package/dist/lib/util/hapCrypto.d.ts.map +1 -1
  200. package/dist/lib/util/hapCrypto.js +72 -59
  201. package/dist/lib/util/hapCrypto.js.map +1 -1
  202. package/dist/lib/util/hapStatusError.d.ts +1 -1
  203. package/dist/lib/util/hapStatusError.d.ts.map +1 -1
  204. package/dist/lib/util/hapStatusError.js +4 -8
  205. package/dist/lib/util/hapStatusError.js.map +1 -1
  206. package/dist/lib/util/net-utils.js +13 -19
  207. package/dist/lib/util/net-utils.js.map +1 -1
  208. package/dist/lib/util/once.js +3 -6
  209. package/dist/lib/util/once.js.map +1 -1
  210. package/dist/lib/util/promise-utils.d.ts +1 -1
  211. package/dist/lib/util/promise-utils.d.ts.map +1 -1
  212. package/dist/lib/util/promise-utils.js +9 -11
  213. package/dist/lib/util/promise-utils.js.map +1 -1
  214. package/dist/lib/util/request-util.d.ts +3 -3
  215. package/dist/lib/util/request-util.d.ts.map +1 -1
  216. package/dist/lib/util/request-util.js +13 -22
  217. package/dist/lib/util/request-util.js.map +1 -1
  218. package/dist/lib/util/time.d.ts +1 -0
  219. package/dist/lib/util/time.d.ts.map +1 -1
  220. package/dist/lib/util/time.js +6 -11
  221. package/dist/lib/util/time.js.map +1 -1
  222. package/dist/lib/util/tlv.d.ts +1 -0
  223. package/dist/lib/util/tlv.d.ts.map +1 -1
  224. package/dist/lib/util/tlv.js +38 -44
  225. package/dist/lib/util/tlv.js.map +1 -1
  226. package/dist/lib/util/uuid.d.ts +1 -0
  227. package/dist/lib/util/uuid.d.ts.map +1 -1
  228. package/dist/lib/util/uuid.js +26 -38
  229. package/dist/lib/util/uuid.js.map +1 -1
  230. package/dist/types.d.ts +24 -24
  231. package/dist/types.d.ts.map +1 -1
  232. package/dist/types.js +3 -5
  233. package/dist/types.js.map +1 -1
  234. package/package.json +50 -43
@@ -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 crypto from 'node:crypto';
4
+ import net 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 * as tlv from '../util/tlv.js';
12
+ import * as uuid 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
  /**
@@ -323,7 +353,9 @@ class RTPStreamManagement {
323
353
  this.requireProxy = options.proxy || false;
324
354
  this.disableAudioProxy = options.disable_audio_proxy || false;
325
355
  if (isLegacySRTPOptions(options)) {
326
- this.supportedCryptoSuites = [options.srtp ? 0 /* SRTPCryptoSuites.AES_CM_128_HMAC_SHA1_80 */ : 2 /* SRTPCryptoSuites.NONE */];
356
+ this.supportedCryptoSuites = [
357
+ options.srtp ? 0 /* SRTPCryptoSuites.AES_CM_128_HMAC_SHA1_80 */ : 2 /* SRTPCryptoSuites.NONE */,
358
+ ];
327
359
  }
328
360
  else {
329
361
  this.supportedCryptoSuites = options.supportedCryptoSuites;
@@ -332,7 +364,7 @@ class RTPStreamManagement {
332
364
  this.supportedCryptoSuites.push(2 /* SRTPCryptoSuites.NONE */);
333
365
  }
334
366
  if (!options.video) {
335
- throw new Error("Video parameters cannot be undefined in options");
367
+ throw new Error('Video parameters cannot be undefined in options');
336
368
  }
337
369
  this.supportedRTPConfiguration = RTPStreamManagement._supportedRTPConfiguration(this.supportedCryptoSuites);
338
370
  this.supportedVideoStreamConfiguration = RTPStreamManagement._supportedVideoStreamConfiguration(options.video);
@@ -353,7 +385,7 @@ class RTPStreamManagement {
353
385
  handleFactoryReset() {
354
386
  this.resetSelectedStreamConfiguration();
355
387
  this.resetSetupEndpointsResponse();
356
- this.service.updateCharacteristic(Characteristic_1.Characteristic.Active, true);
388
+ this.service.updateCharacteristic(Characteristic.Active, true);
357
389
  // on a factory reset the assumption is that all connections were already terminated and thus "handleStopStream" was already called
358
390
  }
359
391
  destroy() {
@@ -362,46 +394,48 @@ class RTPStreamManagement {
362
394
  }
363
395
  }
364
396
  constructService(id) {
365
- const managementService = new Service_1.Service.CameraRTPStreamManagement("", id.toString());
397
+ const managementService = new Service.CameraRTPStreamManagement('', id.toString());
366
398
  // this service is required only when recording is enabled. We don't really have access to this info here,
367
399
  // so we just add the characteristic. Doesn't really hurt.
368
- managementService.setCharacteristic(Characteristic_1.Characteristic.Active, true);
400
+ managementService.setCharacteristic(Characteristic.Active, true);
369
401
  return managementService;
370
402
  }
371
403
  setupServiceHandlers() {
372
- if (!this.service.testCharacteristic(Characteristic_1.Characteristic.Active)) {
404
+ if (!this.service.testCharacteristic(Characteristic.Active)) {
373
405
  // the active characteristic might not be present on some older configurations.
374
- this.service.setCharacteristic(Characteristic_1.Characteristic.Active, true);
406
+ this.service.setCharacteristic(Characteristic.Active, true);
375
407
  }
376
- this.service.getCharacteristic(Characteristic_1.Characteristic.Active)
408
+ this.service.getCharacteristic(Characteristic.Active)
377
409
  .on("change" /* CharacteristicEventTypes.CHANGE */, () => this.stateChangeDelegate?.())
378
- .setProps({ adminOnlyAccess: [1 /* Access.WRITE */] });
410
+ .setProps({
411
+ adminOnlyAccess: [1 /* Access.WRITE */],
412
+ });
379
413
  // 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);
414
+ this.service.setCharacteristic(Characteristic.SupportedRTPConfiguration, this.supportedRTPConfiguration);
415
+ this.service.setCharacteristic(Characteristic.SupportedVideoStreamConfiguration, this.supportedVideoStreamConfiguration);
416
+ this.service.setCharacteristic(Characteristic.SupportedAudioStreamConfiguration, this.supportedAudioStreamConfiguration);
383
417
  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 => {
418
+ this.service.setCharacteristic(Characteristic.SetupEndpoints, this.setupEndpointsResponse); // reset SetupEndpoints to default
419
+ this.service.getCharacteristic(Characteristic.SelectedRTPStreamConfiguration)
420
+ .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
387
421
  if (this.streamingIsDisabled()) {
388
- callback(null, tlv.encode(1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */, tlv.encode(2 /* SessionControlTypes.COMMAND */, SessionControlCommand.SUSPEND_SESSION)).toString("base64"));
422
+ callback(null, tlv.encode(1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */, tlv.encode(2 /* SessionControlTypes.COMMAND */, SessionControlCommand.SUSPEND_SESSION)).toString('base64'));
389
423
  return;
390
424
  }
391
425
  callback(null, this.selectedConfiguration);
392
426
  })
393
427
  .on("set" /* CharacteristicEventTypes.SET */, this._handleSelectedStreamConfigurationWrite.bind(this));
394
- this.service.getCharacteristic(Characteristic_1.Characteristic.SetupEndpoints)
395
- .on("get" /* CharacteristicEventTypes.GET */, callback => {
428
+ this.service.getCharacteristic(Characteristic.SetupEndpoints)
429
+ .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
396
430
  if (this.streamingIsDisabled()) {
397
- callback(null, tlv.encode(2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString("base64"));
431
+ callback(null, tlv.encode(2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString('base64'));
398
432
  return;
399
433
  }
400
434
  callback(null, this.setupEndpointsResponse);
401
435
  })
402
436
  .on("set" /* CharacteristicEventTypes.SET */, (value, callback, context, connection) => {
403
437
  if (!connection) {
404
- debug("Set event handler for SetupEndpoints cannot be called from plugin. Connection undefined!");
438
+ debug('Set event handler for SetupEndpoints cannot be called from plugin. Connection undefined!');
405
439
  callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);
406
440
  return;
407
441
  }
@@ -429,15 +463,15 @@ class RTPStreamManagement {
429
463
  }
430
464
  }
431
465
  streamingIsDisabled(callback) {
432
- if (!this.service.getCharacteristic(Characteristic_1.Characteristic.Active).value) {
466
+ if (!this.service.getCharacteristic(Characteristic.Active).value) {
433
467
  if (callback) {
434
- callback(new hapStatusError_1.HapStatusError(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */));
468
+ callback(new HapStatusError(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */));
435
469
  }
436
470
  return true;
437
471
  }
438
472
  if (this.disabledThroughOperatingMode?.()) {
439
473
  if (callback) {
440
- callback(new hapStatusError_1.HapStatusError(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */));
474
+ callback(new HapStatusError(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */));
441
475
  }
442
476
  return true;
443
477
  }
@@ -447,7 +481,7 @@ class RTPStreamManagement {
447
481
  if (this.streamingIsDisabled(callback)) {
448
482
  return;
449
483
  }
450
- const data = Buffer.from(value, "base64");
484
+ const data = Buffer.from(value, 'base64');
451
485
  const objects = tlv.decode(data);
452
486
  const sessionControl = tlv.decode(objects[1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */]);
453
487
  const sessionIdentifier = uuid.unparse(sessionControl[1 /* SessionControlTypes.SESSION_IDENTIFIER */]);
@@ -485,7 +519,6 @@ class RTPStreamManagement {
485
519
  default:
486
520
  debug(`Unhandled request type ${SessionControlCommand[requestType]}`);
487
521
  callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);
488
- return;
489
522
  }
490
523
  }
491
524
  _handleStartStream(videoConfiguration, audioConfiguration, callback) {
@@ -493,7 +526,7 @@ class RTPStreamManagement {
493
526
  this._handleStartStreamInner(videoConfiguration, audioConfiguration, callback);
494
527
  }
495
528
  catch (error) {
496
- debug("Failed to parse stream start request: %s", error.message);
529
+ debug('Failed to parse stream start request: %s', error.message);
497
530
  callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);
498
531
  }
499
532
  }
@@ -510,7 +543,7 @@ class RTPStreamManagement {
510
543
  const h264Level = videoParameters[2 /* VideoCodecParametersTypes.LEVEL */][0];
511
544
  const packetizationMode = videoParameters[3 /* VideoCodecParametersTypes.PACKETIZATION_MODE */][0];
512
545
  const cvoEnabled = videoParameters[4 /* VideoCodecParametersTypes.CVO_ENABLED */];
513
- let cvoId = undefined;
546
+ let cvoId;
514
547
  if (cvoEnabled && cvoEnabled[0] === 1 /* VideoCodecCVO.SUPPORTED */) {
515
548
  cvoId = videoParameters[5 /* VideoCodecParametersTypes.CVO_ID */].readUInt8(0);
516
549
  }
@@ -525,7 +558,9 @@ class RTPStreamManagement {
525
558
  const videoSSRC = videoRTPParameters[2 /* VideoRTPParametersTypes.SYNCHRONIZATION_SOURCE */].readUInt32LE(0);
526
559
  const videoMaximumBitrate = videoRTPParameters[3 /* VideoRTPParametersTypes.MAX_BIT_RATE */].readUInt16LE(0);
527
560
  const videoRTCPInterval = videoRTPParameters[4 /* VideoRTPParametersTypes.MIN_RTCP_INTERVAL */].readFloatLE(0);
528
- let maxMTU = this.ipVersion === "ipv6" ? 1228 : 1378; // default values ipv4: 1378 bytes; ipv6: 1228 bytes
561
+ let maxMTU = this.ipVersion === 'ipv6'
562
+ ? 1228
563
+ : 1378; // default values ipv4: 1378 bytes; ipv6: 1228 bytes
529
564
  if (videoRTPParameters[5 /* VideoRTPParametersTypes.MAX_MTU */]) {
530
565
  maxMTU = videoRTPParameters[5 /* VideoRTPParametersTypes.MAX_MTU */].readUInt16LE(0);
531
566
  }
@@ -557,10 +592,10 @@ class RTPStreamManagement {
557
592
  codec: videoCodec.readUInt8(0),
558
593
  profile: h264Profile,
559
594
  level: h264Level,
560
- packetizationMode: packetizationMode,
561
- cvoId: cvoId,
562
- width: width,
563
- height: height,
595
+ packetizationMode,
596
+ cvoId,
597
+ width,
598
+ height,
564
599
  fps: frameRate,
565
600
  pt: videoPayloadType,
566
601
  ssrc: videoSSRC,
@@ -644,8 +679,8 @@ class RTPStreamManagement {
644
679
  // seems to be always zero, use default of 0.5
645
680
  const videoRTCPInterval = videoRTPParameters[4 /* VideoRTPParametersTypes.MIN_RTCP_INTERVAL */].readFloatLE(0) || 0.5;
646
681
  const reconfiguredVideoInfo = {
647
- width: width,
648
- height: height,
682
+ width,
683
+ height,
649
684
  fps: frameRate,
650
685
  max_bit_rate: videoMaximumBitrate,
651
686
  rtcp_interval: videoRTCPInterval,
@@ -663,7 +698,9 @@ class RTPStreamManagement {
663
698
  type: "stop" /* StreamRequestTypes.STOP */,
664
699
  };
665
700
  this.handleSessionClosed();
666
- this.delegate.handleStreamRequest(request, error => callback ? callback(error) : undefined);
701
+ this.delegate.handleStreamRequest(request, error => callback
702
+ ? callback(error)
703
+ : undefined);
667
704
  }
668
705
  handleSetupEndpoints(value, callback, connection) {
669
706
  if (this.streamingIsDisabled(callback)) {
@@ -675,28 +712,30 @@ class RTPStreamManagement {
675
712
  request = this.parseSetupEndpointsRequest(value);
676
713
  }
677
714
  catch (error) {
678
- debug("Failed to parse SetupEndpoints request: %s", error.message);
715
+ debug('Failed to parse SetupEndpoints request: %s', error.message);
679
716
  callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);
680
717
  return;
681
718
  }
682
719
  const { sessionIdentifier, addressVersion, controllerAddress, targetVideoPort, targetAudioPort, videoCryptoSuite, videoMasterKey, videoMasterSalt, audioCryptoSuite, audioMasterKey, audioMasterSalt, } = request;
683
720
  if (this.streamStatus !== 0 /* StreamingStatus.AVAILABLE */) {
684
- this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 1 /* SetupEndpointsStatus.BUSY */).toString("base64");
721
+ this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 1 /* SetupEndpointsStatus.BUSY */).toString('base64');
685
722
  callback();
686
723
  return;
687
724
  }
688
- (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!");
725
+ assert(this.activeConnection == null, 'Found non-nil `activeConnection` when trying to setup streaming endpoints, even though streamStatus is reported to be AVAILABLE!');
689
726
  this.activeConnection = connection;
690
727
  this.activeConnection.setMaxListeners(this.activeConnection.getMaxListeners() + 1);
691
728
  this.activeConnection.on("closed" /* HAPConnectionEvent.CLOSED */, this.activeConnectionClosedListener);
692
729
  this.sessionIdentifier = sessionIdentifier;
693
730
  this._updateStreamStatus(1 /* StreamingStatus.IN_USE */);
694
- 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);
731
+ 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);
695
732
  const prepareRequest = {
696
733
  sessionID: sessionIdentifier,
697
734
  sourceAddress: connection.localAddress,
698
735
  targetAddress: controllerAddress,
699
- addressVersion: addressVersion === 1 /* IPAddressVersion.IPV6 */ ? "ipv6" : "ipv4",
736
+ addressVersion: addressVersion === 1 /* IPAddressVersion.IPV6 */
737
+ ? 'ipv6'
738
+ : 'ipv4',
700
739
  video: {
701
740
  port: targetVideoPort,
702
741
  srtpCryptoSuite: videoCryptoSuite,
@@ -712,11 +751,13 @@ class RTPStreamManagement {
712
751
  };
713
752
  const promises = [];
714
753
  if (this.requireProxy) {
715
- prepareRequest.targetAddress = connection.getLocalAddress(addressVersion === 1 /* IPAddressVersion.IPV6 */ ? "ipv6" : "ipv4"); // ip versions must be the same
716
- this.videoProxy = new RTPProxy_1.default({
754
+ prepareRequest.targetAddress = connection.getLocalAddress(addressVersion === 1 /* IPAddressVersion.IPV6 */
755
+ ? 'ipv6'
756
+ : 'ipv4'); // ip versions must be the same
757
+ this.videoProxy = new RTPProxy({
717
758
  outgoingAddress: controllerAddress,
718
759
  outgoingPort: targetVideoPort,
719
- outgoingSSRC: crypto_1.default.randomBytes(4).readUInt32LE(0), // videoSSRC
760
+ outgoingSSRC: crypto.randomBytes(4).readUInt32LE(0), // videoSSRC
720
761
  disabled: false,
721
762
  });
722
763
  promises.push(this.videoProxy.setup().then(() => {
@@ -724,10 +765,10 @@ class RTPStreamManagement {
724
765
  prepareRequest.video.proxy_rtcp = this.videoProxy.incomingRTCPPort();
725
766
  }));
726
767
  if (!this.disableAudioProxy) {
727
- this.audioProxy = new RTPProxy_1.default({
768
+ this.audioProxy = new RTPProxy({
728
769
  outgoingAddress: controllerAddress,
729
770
  outgoingPort: targetAudioPort,
730
- outgoingSSRC: crypto_1.default.randomBytes(4).readUInt32LE(0), // audioSSRC
771
+ outgoingSSRC: crypto.randomBytes(4).readUInt32LE(0), // audioSSRC
731
772
  disabled: this.videoOnly,
732
773
  });
733
774
  promises.push(this.audioProxy.setup().then(() => {
@@ -737,10 +778,10 @@ class RTPStreamManagement {
737
778
  }
738
779
  }
739
780
  Promise.all(promises).then(() => {
740
- this.delegate.prepareStream(prepareRequest, (0, once_1.once)((error, response) => {
781
+ this.delegate.prepareStream(prepareRequest, once((error, response) => {
741
782
  if (error || !response) {
742
783
  debug(`PrepareStream request encountered an error: ${error ? error.message : undefined}`);
743
- this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString("base64");
784
+ this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString('base64');
744
785
  this.handleSessionClosed();
745
786
  callback(error);
746
787
  }
@@ -751,7 +792,7 @@ class RTPStreamManagement {
751
792
  catch (error) {
752
793
  // the delegate usually calls back asynchronously, so nothing up the stack would catch this
753
794
  debug(`Failed to build the SetupEndpoints response from the PrepareStreamResponse: ${error.message}`);
754
- this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString("base64");
795
+ this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString('base64');
755
796
  this.handleSessionClosed();
756
797
  callback(error);
757
798
  }
@@ -759,20 +800,20 @@ class RTPStreamManagement {
759
800
  }));
760
801
  }).catch((error) => {
761
802
  debug(`RTP proxy setup failed: ${error.message}`);
762
- this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString("base64");
803
+ this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString('base64');
763
804
  this.handleSessionClosed();
764
805
  callback(error);
765
806
  });
766
807
  }
767
808
  parseSetupEndpointsRequest(value) {
768
- const data = Buffer.from(value, "base64");
809
+ const data = Buffer.from(value, 'base64');
769
810
  const objects = tlv.decode(data);
770
811
  const sessionIdentifier = uuid.unparse(objects[1 /* SetupEndpointsTypes.SESSION_ID */]);
771
812
  // Address
772
813
  const targetAddressPayload = objects[3 /* SetupEndpointsTypes.CONTROLLER_ADDRESS */];
773
814
  const processedAddressInfo = tlv.decode(targetAddressPayload);
774
815
  const addressVersion = processedAddressInfo[1 /* AddressTypes.ADDRESS_VERSION */].readUInt8(0);
775
- const controllerAddress = processedAddressInfo[2 /* AddressTypes.ADDRESS */].toString("utf8");
816
+ const controllerAddress = processedAddressInfo[2 /* AddressTypes.ADDRESS */].toString('utf8');
776
817
  const targetVideoPort = processedAddressInfo[3 /* AddressTypes.VIDEO_RTP_PORT */].readUInt16LE(0);
777
818
  const targetAudioPort = processedAddressInfo[4 /* AddressTypes.AUDIO_RTP_PORT */].readUInt16LE(0);
778
819
  // Video SRTP Params
@@ -789,10 +830,10 @@ class RTPStreamManagement {
789
830
  const audioMasterSalt = processedAudioInfo[3 /* SRTPParametersTypes.MASTER_SALT */];
790
831
  // if the suite is NONE, keys and salts are zero-length
791
832
  if (videoCryptoSuite !== 2 /* SRTPCryptoSuites.NONE */ && (!videoMasterKey || !videoMasterSalt)) {
792
- throw new Error("Video SRTP master key or salt is missing");
833
+ throw new Error('Video SRTP master key or salt is missing');
793
834
  }
794
835
  if (audioCryptoSuite !== 2 /* SRTPCryptoSuites.NONE */ && (!audioMasterKey || !audioMasterSalt)) {
795
- throw new Error("Audio SRTP master key or salt is missing");
836
+ throw new Error('Audio SRTP master key or salt is missing');
796
837
  }
797
838
  return {
798
839
  sessionIdentifier,
@@ -822,12 +863,12 @@ class RTPStreamManagement {
822
863
  let videoSSRC;
823
864
  let audioSSRC;
824
865
  if (!this.videoOnly && !response.audio) {
825
- throw new Error("Audio was enabled but not supplied in PrepareStreamResponse!");
866
+ throw new Error('Audio was enabled but not supplied in PrepareStreamResponse!');
826
867
  }
827
868
  // Provide default values if audio was not supplied
828
869
  const audio = response.audio || {
829
870
  port: request.audio.port,
830
- ssrc: controller_1.CameraController.generateSynchronisationSource(),
871
+ ssrc: CameraController.generateSynchronisationSource(),
831
872
  srtp_key: request.audio.srtp_key,
832
873
  srtp_salt: request.audio.srtp_salt,
833
874
  };
@@ -835,7 +876,9 @@ class RTPStreamManagement {
835
876
  const videoInfo = response.video;
836
877
  const audioInfo = audio;
837
878
  if (response.addressOverride) {
838
- addressVersion = net_1.default.isIPv4(response.addressOverride) ? "ipv4" : "ipv6";
879
+ addressVersion = net.isIPv4(response.addressOverride)
880
+ ? 'ipv4'
881
+ : 'ipv6';
839
882
  address = response.addressOverride;
840
883
  }
841
884
  else {
@@ -848,11 +891,11 @@ class RTPStreamManagement {
848
891
  audioPort = audioInfo.port;
849
892
  if (request.video.srtpCryptoSuite !== 2 /* SRTPCryptoSuites.NONE */
850
893
  && (videoInfo.srtp_key === undefined || videoInfo.srtp_salt === undefined)) {
851
- throw new Error("SRTP was selected for the prepared video stream, but no 'srtp_key' or 'srtp_salt' was specified!");
894
+ throw new Error('SRTP was selected for the prepared video stream, but no \'srtp_key\' or \'srtp_salt\' was specified!');
852
895
  }
853
896
  if (request.audio.srtpCryptoSuite !== 2 /* SRTPCryptoSuites.NONE */
854
897
  && (audioInfo.srtp_key === undefined || audioInfo.srtp_salt === undefined)) {
855
- throw new Error("SRTP was selected for the prepared audio stream, but no 'srtp_key' or 'srtp_salt' was specified!");
898
+ throw new Error('SRTP was selected for the prepared audio stream, but no \'srtp_key\' or \'srtp_salt\' was specified!');
856
899
  }
857
900
  videoCryptoSuite = request.video.srtpCryptoSuite;
858
901
  videoSRTPKey = videoInfo.srtp_key || Buffer.alloc(0); // key and salt are zero-length for cryptoSuite = NONE
@@ -894,28 +937,30 @@ class RTPStreamManagement {
894
937
  }
895
938
  }
896
939
  this.ipVersion = addressVersion; // we need to save this in order to calculate some default mtu values later
897
- 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));
940
+ const accessoryAddress = tlv.encode(1 /* AddressTypes.ADDRESS_VERSION */, addressVersion === 'ipv4'
941
+ ? 0 /* IPAddressVersion.IPV4 */
942
+ : 1 /* IPAddressVersion.IPV6 */, 2 /* AddressTypes.ADDRESS */, address, 3 /* AddressTypes.VIDEO_RTP_PORT */, tlv.writeUInt16(videoPort), 4 /* AddressTypes.AUDIO_RTP_PORT */, tlv.writeUInt16(audioPort));
898
943
  const videoSRTPParameters = tlv.encode(1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */, videoCryptoSuite, 2 /* SRTPParametersTypes.MASTER_KEY */, videoSRTPKey, 3 /* SRTPParametersTypes.MASTER_SALT */, videoSRTPSalt);
899
944
  const audioSRTPParameters = tlv.encode(1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */, audioCryptoSuite, 2 /* SRTPParametersTypes.MASTER_KEY */, audioSRTPKey, 3 /* SRTPParametersTypes.MASTER_SALT */, audioSRTPSalt);
900
- 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");
945
+ 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');
901
946
  callback();
902
947
  }
903
948
  _updateStreamStatus(status) {
904
949
  this.streamStatus = status;
905
- this.service.updateCharacteristic(Characteristic_1.Characteristic.StreamingStatus, tlv.encode(1 /* StreamingStatusTypes.STATUS */, this.streamStatus).toString("base64"));
950
+ this.service.updateCharacteristic(Characteristic.StreamingStatus, tlv.encode(1 /* StreamingStatusTypes.STATUS */, this.streamStatus).toString('base64'));
906
951
  }
907
952
  static _supportedRTPConfiguration(supportedCryptoSuites) {
908
953
  if (supportedCryptoSuites.length === 1 && supportedCryptoSuites[0] === 2 /* SRTPCryptoSuites.NONE */) {
909
- debug("Client claims it doesn't support SRTP. The stream may stops working with future iOS releases.");
954
+ debug('Client claims it doesn\'t support SRTP. The stream may stops working with future iOS releases.');
910
955
  }
911
- return tlv.encode(2 /* SupportedRTPConfigurationTypes.SRTP_CRYPTO_SUITE */, supportedCryptoSuites).toString("base64");
956
+ return tlv.encode(2 /* SupportedRTPConfigurationTypes.SRTP_CRYPTO_SUITE */, supportedCryptoSuites).toString('base64');
912
957
  }
913
958
  static _supportedVideoStreamConfiguration(videoOptions) {
914
959
  if (!videoOptions.codec) {
915
- throw new Error("Video codec cannot be undefined");
960
+ throw new Error('Video codec cannot be undefined');
916
961
  }
917
962
  if (!videoOptions.resolutions) {
918
- throw new Error("Video resolutions cannot be undefined");
963
+ throw new Error('Video resolutions cannot be undefined');
919
964
  }
920
965
  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 */);
921
966
  if (videoOptions.cvoId != null) {
@@ -924,9 +969,9 @@ class RTPStreamManagement {
924
969
  tlv.encode(4 /* VideoCodecParametersTypes.CVO_ENABLED */, 1 /* VideoCodecCVO.SUPPORTED */, 5 /* VideoCodecParametersTypes.CVO_ID */, videoOptions.cvoId),
925
970
  ]);
926
971
  }
927
- const videoStreamConfiguration = tlv.encode(1 /* VideoCodecConfigurationTypes.CODEC_TYPE */, 0 /* VideoCodecType.H264 */, 2 /* VideoCodecConfigurationTypes.CODEC_PARAMETERS */, codecParameters, 3 /* VideoCodecConfigurationTypes.ATTRIBUTES */, videoOptions.resolutions.map(resolution => {
972
+ const videoStreamConfiguration = tlv.encode(1 /* VideoCodecConfigurationTypes.CODEC_TYPE */, 0 /* VideoCodecType.H264 */, 2 /* VideoCodecConfigurationTypes.CODEC_PARAMETERS */, codecParameters, 3 /* VideoCodecConfigurationTypes.ATTRIBUTES */, videoOptions.resolutions.map((resolution) => {
928
973
  if (resolution.length !== 3) {
929
- throw new Error("Unexpected video resolution");
974
+ throw new Error('Unexpected video resolution');
930
975
  }
931
976
  const width = Buffer.alloc(2);
932
977
  const height = Buffer.alloc(2);
@@ -936,14 +981,14 @@ class RTPStreamManagement {
936
981
  frameRate.writeUInt8(resolution[2], 0);
937
982
  return tlv.encode(1 /* VideoAttributesTypes.IMAGE_WIDTH */, width, 2 /* VideoAttributesTypes.IMAGE_HEIGHT */, height, 3 /* VideoAttributesTypes.FRAME_RATE */, frameRate);
938
983
  }));
939
- return tlv.encode(1 /* SupportedVideoStreamConfigurationTypes.VIDEO_CODEC_CONFIGURATION */, videoStreamConfiguration).toString("base64");
984
+ return tlv.encode(1 /* SupportedVideoStreamConfigurationTypes.VIDEO_CODEC_CONFIGURATION */, videoStreamConfiguration).toString('base64');
940
985
  }
941
986
  checkForLegacyAudioCodecRepresentation(codecs) {
942
987
  const codecMap = {};
943
- codecs.slice().forEach(codec => {
988
+ codecs.slice().forEach((codec) => {
944
989
  const previous = codecMap[codec.type];
945
990
  if (previous) {
946
- if (typeof previous.samplerate === "number") {
991
+ if (typeof previous.samplerate === 'number') {
947
992
  previous.samplerate = [previous.samplerate];
948
993
  }
949
994
  previous.samplerate = previous.samplerate.concat(codec.samplerate);
@@ -964,14 +1009,14 @@ class RTPStreamManagement {
964
1009
  const supportedCodecs = (audioOptions && audioOptions.codecs) || [];
965
1010
  this.checkForLegacyAudioCodecRepresentation(supportedCodecs);
966
1011
  if (supportedCodecs.length === 0) { // Fake a Codec if we haven't got anything
967
- debug("Client doesn't support any audio codec that HomeKit supports.");
1012
+ debug('Client doesn\'t support any audio codec that HomeKit supports.');
968
1013
  this.videoOnly = true;
969
1014
  supportedCodecs.push({
970
1015
  type: "OPUS" /* AudioStreamingCodecType.OPUS */, // Opus @16K required by Apple Watch AFAIK
971
1016
  samplerate: [16 /* AudioStreamingSamplerate.KHZ_16 */, 24 /* AudioStreamingSamplerate.KHZ_24 */], // 16 and 24 must be supported
972
1017
  });
973
1018
  }
974
- const codecConfigurations = supportedCodecs.map(codec => {
1019
+ const codecConfigurations = supportedCodecs.map((codec) => {
975
1020
  let type;
976
1021
  switch (codec.type) {
977
1022
  case "OPUS" /* AudioStreamingCodecType.OPUS */:
@@ -996,9 +1041,11 @@ class RTPStreamManagement {
996
1041
  type = 6 /* AudioCodecTypes.AMR_WB */;
997
1042
  break;
998
1043
  default:
999
- throw new Error("Unsupported codec: " + codec.type);
1044
+ throw new Error(`Unsupported codec: ${codec.type}`);
1000
1045
  }
1001
- const providedSamplerates = (typeof codec.samplerate === "number" ? [codec.samplerate] : codec.samplerate).map(rate => {
1046
+ const providedSamplerates = (typeof codec.samplerate === 'number'
1047
+ ? [codec.samplerate]
1048
+ : codec.samplerate).map((rate) => {
1002
1049
  let samplerate;
1003
1050
  switch (rate) {
1004
1051
  case 8 /* AudioStreamingSamplerate.KHZ_8 */:
@@ -1011,32 +1058,32 @@ class RTPStreamManagement {
1011
1058
  samplerate = 2 /* AudioSamplerate.KHZ_24 */;
1012
1059
  break;
1013
1060
  default:
1014
- console.log("Unsupported sample rate: ", codec.samplerate);
1061
+ console.log('Unsupported sample rate: ', codec.samplerate);
1015
1062
  samplerate = -1;
1016
1063
  }
1017
1064
  return samplerate;
1018
1065
  }).filter(rate => rate !== -1);
1019
1066
  if (providedSamplerates.length === 0) {
1020
- throw new Error("Audio samplerate cannot be empty!");
1067
+ throw new Error('Audio samplerate cannot be empty!');
1021
1068
  }
1022
1069
  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);
1023
1070
  return tlv.encode(1 /* AudioCodecConfigurationTypes.CODEC_TYPE */, type, 2 /* AudioCodecConfigurationTypes.CODEC_PARAMETERS */, audioParameters);
1024
1071
  });
1025
- return tlv.encode(1 /* SupportedAudioStreamConfigurationTypes.AUDIO_CODEC_CONFIGURATION */, codecConfigurations, 2 /* SupportedAudioStreamConfigurationTypes.COMFORT_NOISE_SUPPORT */, comfortNoise ? 1 : 0).toString("base64");
1072
+ return tlv.encode(1 /* SupportedAudioStreamConfigurationTypes.AUDIO_CODEC_CONFIGURATION */, codecConfigurations, 2 /* SupportedAudioStreamConfigurationTypes.COMFORT_NOISE_SUPPORT */, comfortNoise ? 1 : 0).toString('base64');
1026
1073
  }
1027
1074
  resetSetupEndpointsResponse() {
1028
- this.setupEndpointsResponse = tlv.encode(2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString("base64");
1029
- this.service.updateCharacteristic(Characteristic_1.Characteristic.SetupEndpoints, this.setupEndpointsResponse);
1075
+ this.setupEndpointsResponse = tlv.encode(2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString('base64');
1076
+ this.service.updateCharacteristic(Characteristic.SetupEndpoints, this.setupEndpointsResponse);
1030
1077
  }
1031
1078
  resetSelectedStreamConfiguration() {
1032
- this.selectedConfiguration = tlv.encode(1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */, tlv.encode(2 /* SessionControlTypes.COMMAND */, SessionControlCommand.SUSPEND_SESSION)).toString("base64");
1033
- this.service.updateCharacteristic(Characteristic_1.Characteristic.SelectedRTPStreamConfiguration, this.selectedConfiguration);
1079
+ this.selectedConfiguration = tlv.encode(1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */, tlv.encode(2 /* SessionControlTypes.COMMAND */, SessionControlCommand.SUSPEND_SESSION)).toString('base64');
1080
+ this.service.updateCharacteristic(Characteristic.SelectedRTPStreamConfiguration, this.selectedConfiguration);
1034
1081
  }
1035
1082
  /**
1036
1083
  * @private
1037
1084
  */
1038
1085
  serialize() {
1039
- const characteristicValue = this.service.getCharacteristic(Characteristic_1.Characteristic.Active).value;
1086
+ const characteristicValue = this.service.getCharacteristic(Characteristic.Active).value;
1040
1087
  if (characteristicValue === true) {
1041
1088
  return undefined;
1042
1089
  }
@@ -1049,8 +1096,8 @@ class RTPStreamManagement {
1049
1096
  * @private
1050
1097
  */
1051
1098
  deserialize(serialized) {
1052
- (0, assert_1.default)(serialized.id === this.id, `Tried to initialize RTPStreamManagement ${this.id} with data from management with id ${serialized.id}!`);
1053
- this.service.updateCharacteristic(Characteristic_1.Characteristic.Active, serialized.active);
1099
+ assert(serialized.id === this.id, `Tried to initialize RTPStreamManagement ${this.id} with data from management with id ${serialized.id}!`);
1100
+ this.service.updateCharacteristic(Characteristic.Active, serialized.active);
1054
1101
  }
1055
1102
  /**
1056
1103
  * @private
@@ -1059,5 +1106,4 @@ class RTPStreamManagement {
1059
1106
  this.stateChangeDelegate = delegate;
1060
1107
  }
1061
1108
  }
1062
- exports.RTPStreamManagement = RTPStreamManagement;
1063
1109
  //# sourceMappingURL=RTPStreamManagement.js.map