@homebridge/hap-nodejs 2.2.4-beta.7 → 2.3.0-beta.1

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