@homebridge/hap-nodejs 2.2.4-beta.7 → 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 +49 -42
@@ -1,15 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SiriAudioSession = exports.SiriAudioSessionEvents = exports.RemoteController = exports.RemoteControllerEvents = exports.TargetUpdates = exports.AudioCodecTypes = exports.ButtonState = exports.TargetCategory = exports.ButtonType = void 0;
4
- const tslib_1 = require("tslib");
5
- const assert_1 = tslib_1.__importDefault(require("assert"));
6
- const debug_1 = tslib_1.__importDefault(require("debug"));
7
- const events_1 = require("events");
8
- const Characteristic_1 = require("../Characteristic");
9
- const datastream_1 = require("../datastream");
10
- const Service_1 = require("../Service");
11
- const tlv = tslib_1.__importStar(require("../util/tlv"));
12
- const debug = (0, debug_1.default)("HAP-NodeJS:Remote:Controller");
1
+ import assert from 'node:assert';
2
+ import { Buffer } from 'node:buffer';
3
+ import { EventEmitter } from 'node:events';
4
+ import createDebug from 'debug';
5
+ import { Characteristic, } from '../Characteristic.js';
6
+ import { DataStreamManagement, Float32, HDSStatus, Int64, } from '../datastream/index.js';
7
+ import { Service } from '../Service.js';
8
+ import * as tlv from '../util/tlv.js';
9
+ const debug = createDebug('HAP-NodeJS:Remote:Controller');
10
+ // eslint-disable-next-line no-restricted-syntax
13
11
  var TargetControlCommands;
14
12
  (function (TargetControlCommands) {
15
13
  TargetControlCommands[TargetControlCommands["MAXIMUM_TARGETS"] = 1] = "MAXIMUM_TARGETS";
@@ -17,6 +15,7 @@ var TargetControlCommands;
17
15
  TargetControlCommands[TargetControlCommands["SUPPORTED_BUTTON_CONFIGURATION"] = 3] = "SUPPORTED_BUTTON_CONFIGURATION";
18
16
  TargetControlCommands[TargetControlCommands["TYPE"] = 4] = "TYPE";
19
17
  })(TargetControlCommands || (TargetControlCommands = {}));
18
+ // eslint-disable-next-line no-restricted-syntax
20
19
  var SupportedButtonConfigurationTypes;
21
20
  (function (SupportedButtonConfigurationTypes) {
22
21
  SupportedButtonConfigurationTypes[SupportedButtonConfigurationTypes["BUTTON_ID"] = 1] = "BUTTON_ID";
@@ -25,7 +24,8 @@ var SupportedButtonConfigurationTypes;
25
24
  /**
26
25
  * @group Apple TV Remote
27
26
  */
28
- var ButtonType;
27
+ // eslint-disable-next-line no-restricted-syntax
28
+ export var ButtonType;
29
29
  (function (ButtonType) {
30
30
  // noinspection JSUnusedGlobalSymbols
31
31
  ButtonType[ButtonType["UNDEFINED"] = 0] = "UNDEFINED";
@@ -42,7 +42,8 @@ var ButtonType;
42
42
  ButtonType[ButtonType["SIRI"] = 11] = "SIRI";
43
43
  ButtonType[ButtonType["POWER"] = 12] = "POWER";
44
44
  ButtonType[ButtonType["GENERIC"] = 13] = "GENERIC";
45
- })(ButtonType || (exports.ButtonType = ButtonType = {}));
45
+ })(ButtonType || (ButtonType = {}));
46
+ // eslint-disable-next-line no-restricted-syntax
46
47
  var TargetControlList;
47
48
  (function (TargetControlList) {
48
49
  TargetControlList[TargetControlList["OPERATION"] = 1] = "OPERATION";
@@ -58,6 +59,7 @@ var Operation;
58
59
  Operation[Operation["RESET"] = 4] = "RESET";
59
60
  Operation[Operation["UPDATE"] = 5] = "UPDATE";
60
61
  })(Operation || (Operation = {}));
62
+ // eslint-disable-next-line no-restricted-syntax
61
63
  var TargetConfigurationTypes;
62
64
  (function (TargetConfigurationTypes) {
63
65
  TargetConfigurationTypes[TargetConfigurationTypes["TARGET_IDENTIFIER"] = 1] = "TARGET_IDENTIFIER";
@@ -68,18 +70,21 @@ var TargetConfigurationTypes;
68
70
  /**
69
71
  * @group Apple TV Remote
70
72
  */
71
- var TargetCategory;
73
+ // eslint-disable-next-line no-restricted-syntax
74
+ export var TargetCategory;
72
75
  (function (TargetCategory) {
73
76
  // noinspection JSUnusedGlobalSymbols
74
77
  TargetCategory[TargetCategory["UNDEFINED"] = 0] = "UNDEFINED";
75
78
  TargetCategory[TargetCategory["APPLE_TV"] = 24] = "APPLE_TV";
76
- })(TargetCategory || (exports.TargetCategory = TargetCategory = {}));
79
+ })(TargetCategory || (TargetCategory = {}));
80
+ // eslint-disable-next-line no-restricted-syntax
77
81
  var ButtonConfigurationTypes;
78
82
  (function (ButtonConfigurationTypes) {
79
83
  ButtonConfigurationTypes[ButtonConfigurationTypes["BUTTON_ID"] = 1] = "BUTTON_ID";
80
84
  ButtonConfigurationTypes[ButtonConfigurationTypes["BUTTON_TYPE"] = 2] = "BUTTON_TYPE";
81
85
  ButtonConfigurationTypes[ButtonConfigurationTypes["BUTTON_NAME"] = 3] = "BUTTON_NAME";
82
86
  })(ButtonConfigurationTypes || (ButtonConfigurationTypes = {}));
87
+ // eslint-disable-next-line no-restricted-syntax
83
88
  var ButtonEvent;
84
89
  (function (ButtonEvent) {
85
90
  ButtonEvent[ButtonEvent["BUTTON_ID"] = 1] = "BUTTON_ID";
@@ -90,22 +95,26 @@ var ButtonEvent;
90
95
  /**
91
96
  * @group Apple TV Remote
92
97
  */
93
- var ButtonState;
98
+ // eslint-disable-next-line no-restricted-syntax
99
+ export var ButtonState;
94
100
  (function (ButtonState) {
95
101
  ButtonState[ButtonState["UP"] = 0] = "UP";
96
102
  ButtonState[ButtonState["DOWN"] = 1] = "DOWN";
97
- })(ButtonState || (exports.ButtonState = ButtonState = {}));
103
+ })(ButtonState || (ButtonState = {}));
104
+ // eslint-disable-next-line no-restricted-syntax
98
105
  var SelectedAudioInputStreamConfigurationTypes;
99
106
  (function (SelectedAudioInputStreamConfigurationTypes) {
100
107
  SelectedAudioInputStreamConfigurationTypes[SelectedAudioInputStreamConfigurationTypes["SELECTED_AUDIO_INPUT_STREAM_CONFIGURATION"] = 1] = "SELECTED_AUDIO_INPUT_STREAM_CONFIGURATION";
101
108
  })(SelectedAudioInputStreamConfigurationTypes || (SelectedAudioInputStreamConfigurationTypes = {}));
102
109
  // ----------
110
+ // eslint-disable-next-line no-restricted-syntax
103
111
  var SupportedAudioStreamConfigurationTypes;
104
112
  (function (SupportedAudioStreamConfigurationTypes) {
105
113
  // noinspection JSUnusedGlobalSymbols
106
114
  SupportedAudioStreamConfigurationTypes[SupportedAudioStreamConfigurationTypes["AUDIO_CODEC_CONFIGURATION"] = 1] = "AUDIO_CODEC_CONFIGURATION";
107
115
  SupportedAudioStreamConfigurationTypes[SupportedAudioStreamConfigurationTypes["COMFORT_NOISE_SUPPORT"] = 2] = "COMFORT_NOISE_SUPPORT";
108
116
  })(SupportedAudioStreamConfigurationTypes || (SupportedAudioStreamConfigurationTypes = {}));
117
+ // eslint-disable-next-line no-restricted-syntax
109
118
  var AudioCodecConfigurationTypes;
110
119
  (function (AudioCodecConfigurationTypes) {
111
120
  AudioCodecConfigurationTypes[AudioCodecConfigurationTypes["CODEC_TYPE"] = 1] = "CODEC_TYPE";
@@ -114,7 +123,8 @@ var AudioCodecConfigurationTypes;
114
123
  /**
115
124
  * @group Camera
116
125
  */
117
- var AudioCodecTypes;
126
+ // eslint-disable-next-line no-restricted-syntax
127
+ export var AudioCodecTypes;
118
128
  (function (AudioCodecTypes) {
119
129
  // noinspection JSUnusedGlobalSymbols
120
130
  AudioCodecTypes[AudioCodecTypes["PCMU"] = 0] = "PCMU";
@@ -124,14 +134,16 @@ var AudioCodecTypes;
124
134
  AudioCodecTypes[AudioCodecTypes["MSBC"] = 4] = "MSBC";
125
135
  AudioCodecTypes[AudioCodecTypes["AMR"] = 5] = "AMR";
126
136
  AudioCodecTypes[AudioCodecTypes["AMR_WB"] = 6] = "AMR_WB";
127
- })(AudioCodecTypes || (exports.AudioCodecTypes = AudioCodecTypes = {}));
137
+ })(AudioCodecTypes || (AudioCodecTypes = {}));
138
+ // eslint-disable-next-line no-restricted-syntax
128
139
  var AudioCodecParametersTypes;
129
140
  (function (AudioCodecParametersTypes) {
130
141
  AudioCodecParametersTypes[AudioCodecParametersTypes["CHANNEL"] = 1] = "CHANNEL";
131
142
  AudioCodecParametersTypes[AudioCodecParametersTypes["BIT_RATE"] = 2] = "BIT_RATE";
132
143
  AudioCodecParametersTypes[AudioCodecParametersTypes["SAMPLE_RATE"] = 3] = "SAMPLE_RATE";
133
- AudioCodecParametersTypes[AudioCodecParametersTypes["PACKET_TIME"] = 4] = "PACKET_TIME"; // only present in selected audio codec parameters tlv
144
+ AudioCodecParametersTypes[AudioCodecParametersTypes["PACKET_TIME"] = 4] = "PACKET_TIME";
134
145
  })(AudioCodecParametersTypes || (AudioCodecParametersTypes = {}));
146
+ // eslint-disable-next-line no-restricted-syntax
135
147
  var SiriAudioSessionState;
136
148
  (function (SiriAudioSessionState) {
137
149
  SiriAudioSessionState[SiriAudioSessionState["STARTING"] = 0] = "STARTING";
@@ -142,17 +154,19 @@ var SiriAudioSessionState;
142
154
  /**
143
155
  * @group Apple TV Remote
144
156
  */
145
- var TargetUpdates;
157
+ // eslint-disable-next-line no-restricted-syntax
158
+ export var TargetUpdates;
146
159
  (function (TargetUpdates) {
147
160
  TargetUpdates[TargetUpdates["NAME"] = 0] = "NAME";
148
161
  TargetUpdates[TargetUpdates["CATEGORY"] = 1] = "CATEGORY";
149
162
  TargetUpdates[TargetUpdates["UPDATED_BUTTONS"] = 2] = "UPDATED_BUTTONS";
150
163
  TargetUpdates[TargetUpdates["REMOVED_BUTTONS"] = 3] = "REMOVED_BUTTONS";
151
- })(TargetUpdates || (exports.TargetUpdates = TargetUpdates = {}));
164
+ })(TargetUpdates || (TargetUpdates = {}));
152
165
  /**
153
166
  * @group Apple TV Remote
154
167
  */
155
- var RemoteControllerEvents;
168
+ // eslint-disable-next-line no-restricted-syntax
169
+ export var RemoteControllerEvents;
156
170
  (function (RemoteControllerEvents) {
157
171
  /**
158
172
  * This event is emitted when the active state of the remote has changed.
@@ -186,18 +200,17 @@ var RemoteControllerEvents;
186
200
  * when the accessory gets unpaired.
187
201
  */
188
202
  RemoteControllerEvents["TARGETS_RESET"] = "targets-reset";
189
- })(RemoteControllerEvents || (exports.RemoteControllerEvents = RemoteControllerEvents = {}));
203
+ })(RemoteControllerEvents || (RemoteControllerEvents = {}));
190
204
  /**
191
205
  * Handles everything needed to implement a fully working HomeKit remote controller.
192
206
  *
193
207
  * @group Apple TV Remote
194
208
  */
195
- // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
196
- class RemoteController extends events_1.EventEmitter {
209
+ // eslint-disable-next-line ts/no-unsafe-declaration-merging
210
+ export class RemoteController extends EventEmitter {
197
211
  stateChangeDelegate;
198
212
  audioSupported;
199
213
  audioProducerConstructor;
200
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
201
214
  audioProducerOptions;
202
215
  targetControlManagementService;
203
216
  targetControlService;
@@ -207,8 +220,8 @@ class RemoteController extends events_1.EventEmitter {
207
220
  buttons = {}; // internal mapping of buttonId to buttonType for supported buttons
208
221
  supportedConfiguration;
209
222
  targetConfigurations = new Map();
210
- targetConfigurationsString = "";
211
- lastButtonEvent = "";
223
+ targetConfigurationsString = '';
224
+ lastButtonEvent = '';
212
225
  activeIdentifier = 0; // id of 0 means no device selected
213
226
  activeConnection; // session which marked this remote as active and listens for events and siri
214
227
  activeConnectionDisconnectListener;
@@ -235,9 +248,9 @@ class RemoteController extends events_1.EventEmitter {
235
248
  *
236
249
  * @param audioProducerConstructor - constructor for a SiriAudioStreamProducer
237
250
  * @param producerOptions - if supplied this argument will be supplied as third argument of the SiriAudioStreamProducer
238
- * constructor. This should be used to supply configurations to the stream producer.
251
+ * constructor. This should be used to supply configurations to the stream producer.
239
252
  */
240
- // eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/explicit-module-boundary-types
253
+ // eslint-disable-next-line ts/explicit-module-boundary-types
241
254
  constructor(audioProducerConstructor, producerOptions) {
242
255
  super();
243
256
  this.audioSupported = audioProducerConstructor !== undefined;
@@ -276,11 +289,11 @@ class RemoteController extends events_1.EventEmitter {
276
289
  return;
277
290
  }
278
291
  if (activeIdentifier !== 0 && !this.targetConfigurations.has(activeIdentifier)) {
279
- throw Error("Tried setting unconfigured targetIdentifier to active");
292
+ throw new Error('Tried setting unconfigured targetIdentifier to active');
280
293
  }
281
- debug("%d is now the active target", activeIdentifier);
294
+ debug('%d is now the active target', activeIdentifier);
282
295
  this.activeIdentifier = activeIdentifier;
283
- this.targetControlService.getCharacteristic(Characteristic_1.Characteristic.ActiveIdentifier).updateValue(activeIdentifier);
296
+ this.targetControlService.getCharacteristic(Characteristic.ActiveIdentifier).updateValue(activeIdentifier);
284
297
  if (this.activeAudioSession) {
285
298
  this.handleSiriAudioStop();
286
299
  }
@@ -345,7 +358,7 @@ class RemoteController extends events_1.EventEmitter {
345
358
  }
346
359
  catch (error) {
347
360
  // e.g. the remote was set inactive in the meantime; throwing inside the timer would crash the process
348
- debug("Failed to release button %d: %s", button, error.message);
361
+ debug('Failed to release button %d: %s', button, error.message);
349
362
  }
350
363
  }, time);
351
364
  }
@@ -359,14 +372,23 @@ class RemoteController extends events_1.EventEmitter {
359
372
  hardwareImplemented: this.audioSupported, // siri is only allowed for hardware implemented remotes
360
373
  };
361
374
  const supportedButtons = [
362
- 1 /* ButtonType.MENU */, 2 /* ButtonType.PLAY_PAUSE */, 3 /* ButtonType.TV_HOME */, 4 /* ButtonType.SELECT */,
363
- 5 /* ButtonType.ARROW_UP */, 6 /* ButtonType.ARROW_RIGHT */, 7 /* ButtonType.ARROW_DOWN */, 8 /* ButtonType.ARROW_LEFT */,
364
- 9 /* ButtonType.VOLUME_UP */, 10 /* ButtonType.VOLUME_DOWN */, 12 /* ButtonType.POWER */, 13 /* ButtonType.GENERIC */,
375
+ 1 /* ButtonType.MENU */,
376
+ 2 /* ButtonType.PLAY_PAUSE */,
377
+ 3 /* ButtonType.TV_HOME */,
378
+ 4 /* ButtonType.SELECT */,
379
+ 5 /* ButtonType.ARROW_UP */,
380
+ 6 /* ButtonType.ARROW_RIGHT */,
381
+ 7 /* ButtonType.ARROW_DOWN */,
382
+ 8 /* ButtonType.ARROW_LEFT */,
383
+ 9 /* ButtonType.VOLUME_UP */,
384
+ 10 /* ButtonType.VOLUME_DOWN */,
385
+ 12 /* ButtonType.POWER */,
386
+ 13 /* ButtonType.GENERIC */,
365
387
  ];
366
388
  if (this.audioSupported) { // add siri button if this remote supports it
367
389
  supportedButtons.push(11 /* ButtonType.SIRI */);
368
390
  }
369
- supportedButtons.forEach(button => {
391
+ supportedButtons.forEach((button) => {
370
392
  const buttonConfiguration = {
371
393
  buttonID: 100 + button,
372
394
  buttonType: button,
@@ -390,16 +412,15 @@ class RemoteController extends events_1.EventEmitter {
390
412
  };
391
413
  }
392
414
  // --------------------------------- TARGET CONTROL ----------------------------------
393
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
394
415
  handleTargetControlWrite(value, callback) {
395
- const data = Buffer.from(value, "base64");
416
+ const data = Buffer.from(value, 'base64');
396
417
  const objects = tlv.decode(data);
397
418
  const operation = objects[1 /* TargetControlList.OPERATION */][0];
398
- let targetConfiguration = undefined;
419
+ let targetConfiguration;
399
420
  if (objects[2 /* TargetControlList.TARGET_CONFIGURATION */]) { // if target configuration was sent, parse it
400
421
  targetConfiguration = this.parseTargetConfigurationTLV(objects[2 /* TargetControlList.TARGET_CONFIGURATION */]);
401
422
  }
402
- debug("Received TargetControl write operation %s", Operation[operation]);
423
+ debug('Received TargetControl write operation %s', Operation[operation]);
403
424
  let handler;
404
425
  switch (operation) {
405
426
  case Operation.ADD:
@@ -429,7 +450,7 @@ class RemoteController extends events_1.EventEmitter {
429
450
  }
430
451
  }
431
452
  else {
432
- callback(new Error(status + ""));
453
+ callback(new Error(`${status}`));
433
454
  }
434
455
  }
435
456
  handleAddTarget(targetConfiguration) {
@@ -437,7 +458,7 @@ class RemoteController extends events_1.EventEmitter {
437
458
  return -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */;
438
459
  }
439
460
  this.targetConfigurations.set(targetConfiguration.targetIdentifier, targetConfiguration);
440
- debug("Configured new target '" + targetConfiguration.targetName + "' with targetIdentifier '" + targetConfiguration.targetIdentifier + "'");
461
+ debug(`Configured new target '${targetConfiguration.targetName}' with targetIdentifier '${targetConfiguration.targetIdentifier}'`);
441
462
  setTimeout(() => this.emit("target-add" /* RemoteControllerEvents.TARGET_ADDED */, targetConfiguration), 0);
442
463
  this.updatedTargetConfiguration(); // set response
443
464
  return 0 /* HAPStatus.SUCCESS */;
@@ -452,22 +473,22 @@ class RemoteController extends events_1.EventEmitter {
452
473
  return -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */;
453
474
  }
454
475
  if (targetConfiguration.targetName) {
455
- debug("Target name was updated '%s' => '%s' (%d)", configuredTarget.targetName, targetConfiguration.targetName, configuredTarget.targetIdentifier);
476
+ debug('Target name was updated \'%s\' => \'%s\' (%d)', configuredTarget.targetName, targetConfiguration.targetName, configuredTarget.targetIdentifier);
456
477
  configuredTarget.targetName = targetConfiguration.targetName;
457
478
  updates.push(0 /* TargetUpdates.NAME */);
458
479
  }
459
480
  if (targetConfiguration.targetCategory) {
460
- debug("Target category was updated '%d' => '%d' for target '%s' (%d)", configuredTarget.targetCategory, targetConfiguration.targetCategory, configuredTarget.targetName, configuredTarget.targetIdentifier);
481
+ debug('Target category was updated \'%d\' => \'%d\' for target \'%s\' (%d)', configuredTarget.targetCategory, targetConfiguration.targetCategory, configuredTarget.targetName, configuredTarget.targetIdentifier);
461
482
  configuredTarget.targetCategory = targetConfiguration.targetCategory;
462
483
  updates.push(1 /* TargetUpdates.CATEGORY */);
463
484
  }
464
485
  // the parsed buttonConfiguration is an empty object when the request didn't contain any buttons
465
486
  if (Object.keys(targetConfiguration.buttonConfiguration).length > 0) {
466
- debug("%d button configurations were updated for target '%s' (%d)", Object.keys(targetConfiguration.buttonConfiguration).length, configuredTarget.targetName, configuredTarget.targetIdentifier);
487
+ debug('%d button configurations were updated for target \'%s\' (%d)', Object.keys(targetConfiguration.buttonConfiguration).length, configuredTarget.targetName, configuredTarget.targetIdentifier);
467
488
  for (const configuration of Object.values(targetConfiguration.buttonConfiguration)) {
468
489
  const savedConfiguration = configuredTarget.buttonConfiguration[configuration.buttonID];
469
490
  if (!savedConfiguration) {
470
- debug("Ignoring update for unknown button %d of target '%s' (%d)", configuration.buttonID, configuredTarget.targetName, configuredTarget.targetIdentifier);
491
+ debug('Ignoring update for unknown button %d of target \'%s\' (%d)', configuration.buttonID, configuredTarget.targetName, configuredTarget.targetIdentifier);
471
492
  continue;
472
493
  }
473
494
  savedConfiguration.buttonType = configuration.buttonType;
@@ -490,16 +511,16 @@ class RemoteController extends events_1.EventEmitter {
490
511
  // the parsed buttonConfiguration is an empty object when the request didn't contain any buttons
491
512
  if (Object.keys(targetConfiguration.buttonConfiguration).length > 0) {
492
513
  for (const key in targetConfiguration.buttonConfiguration) {
493
- if (Object.prototype.hasOwnProperty.call(targetConfiguration.buttonConfiguration, key)) {
514
+ if (Object.hasOwn(targetConfiguration.buttonConfiguration, key)) {
494
515
  delete configuredTarget.buttonConfiguration[key];
495
516
  }
496
517
  }
497
- debug("Removed %d button configurations of target '%s' (%d)", Object.keys(targetConfiguration.buttonConfiguration).length, configuredTarget.targetName, configuredTarget.targetIdentifier);
518
+ debug('Removed %d button configurations of target \'%s\' (%d)', Object.keys(targetConfiguration.buttonConfiguration).length, configuredTarget.targetName, configuredTarget.targetIdentifier);
498
519
  setTimeout(() => this.emit("target-update" /* RemoteControllerEvents.TARGET_UPDATED */, configuredTarget, [3 /* TargetUpdates.REMOVED_BUTTONS */]), 0);
499
520
  }
500
521
  else {
501
522
  this.targetConfigurations.delete(targetConfiguration.targetIdentifier);
502
- debug("Target '%s' (%d) was removed", configuredTarget.targetName, configuredTarget.targetIdentifier);
523
+ debug('Target \'%s\' (%d) was removed', configuredTarget.targetName, configuredTarget.targetIdentifier);
503
524
  setTimeout(() => this.emit("target-remove" /* RemoteControllerEvents.TARGET_REMOVED */, targetConfiguration.targetIdentifier), 0);
504
525
  if (this.activeIdentifier === targetConfiguration.targetIdentifier) {
505
526
  // switch to next available remote
@@ -513,7 +534,7 @@ class RemoteController extends events_1.EventEmitter {
513
534
  if (targetConfiguration) {
514
535
  return -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */;
515
536
  }
516
- debug("Resetting all target configurations");
537
+ debug('Resetting all target configurations');
517
538
  this.targetConfigurations = new Map();
518
539
  this.updatedTargetConfiguration(); // set response
519
540
  setTimeout(() => this.emit("targets-reset" /* RemoteControllerEvents.TARGETS_RESET */), 0);
@@ -525,12 +546,12 @@ class RemoteController extends events_1.EventEmitter {
525
546
  return -70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */;
526
547
  }
527
548
  // this.targetConfigurationsString is updated after each change, so we basically don't need to do anything here
528
- debug("Returning " + this.targetConfigurations.size + " target configurations");
549
+ debug(`Returning ${this.targetConfigurations.size} target configurations`);
529
550
  return 0 /* HAPStatus.SUCCESS */;
530
551
  }
531
552
  handleActiveWrite(value, callback, connection) {
532
553
  if (this.activeIdentifier === 0) {
533
- debug("Tried to change active state. There is no active target set though");
554
+ debug('Tried to change active state. There is no active target set though');
534
555
  callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);
535
556
  return;
536
557
  }
@@ -549,7 +570,7 @@ class RemoteController extends events_1.EventEmitter {
549
570
  callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);
550
571
  return;
551
572
  }
552
- debug("Remote with activeTarget '%s' (%d) was set to %s", activeTarget.targetName, this.activeIdentifier, value ? "ACTIVE" : "INACTIVE");
573
+ debug('Remote with activeTarget \'%s\' (%d) was set to %s', activeTarget.targetName, this.activeIdentifier, value ? 'ACTIVE' : 'INACTIVE');
553
574
  callback();
554
575
  this.emit("active-change" /* RemoteControllerEvents.ACTIVE_CHANGE */, value);
555
576
  }
@@ -560,27 +581,27 @@ class RemoteController extends events_1.EventEmitter {
560
581
  this.activeConnection.removeListener("closed" /* HAPConnectionEvent.CLOSED */, this.activeConnectionDisconnectListener);
561
582
  this.activeConnection = undefined;
562
583
  this.activeConnectionDisconnectListener = undefined;
563
- this.targetControlService.getCharacteristic(Characteristic_1.Characteristic.Active).updateValue(false);
564
- debug("Remote was set to INACTIVE");
584
+ this.targetControlService.getCharacteristic(Characteristic.Active).updateValue(false);
585
+ debug('Remote was set to INACTIVE');
565
586
  setTimeout(() => this.emit("active-change" /* RemoteControllerEvents.ACTIVE_CHANGE */, false), 0);
566
587
  }
567
588
  handleActiveSessionDisconnected(connection) {
568
589
  if (connection !== this.activeConnection) {
569
590
  return;
570
591
  }
571
- debug("Active hap session disconnected!");
592
+ debug('Active hap session disconnected!');
572
593
  this.setInactive();
573
594
  }
574
595
  sendButtonEvent(button, buttonState) {
575
596
  const buttonID = this.buttons[button];
576
597
  if (buttonID === undefined || buttonID === 0) {
577
- throw new Error("Tried sending button event for unsupported button (" + button + ")");
598
+ throw new Error(`Tried sending button event for unsupported button (${button})`);
578
599
  }
579
600
  if (this.activeIdentifier === 0) { // cannot press button if no device is selected
580
- throw new Error("Tried sending button event although no target was selected");
601
+ throw new Error('Tried sending button event although no target was selected');
581
602
  }
582
603
  if (!this.isActive()) { // cannot press button if device is not active (aka no Apple TV is listening)
583
- throw new Error("Tried sending button event although target was not marked as active");
604
+ throw new Error('Tried sending button event although target was not marked as active');
584
605
  }
585
606
  if (button === 11 /* ButtonType.SIRI */ && this.audioSupported) {
586
607
  if (buttonState === 1 /* ButtonState.DOWN */) { // start streaming session
@@ -593,28 +614,31 @@ class RemoteController extends events_1.EventEmitter {
593
614
  }
594
615
  const buttonIdTlv = tlv.encode(1 /* ButtonEvent.BUTTON_ID */, buttonID);
595
616
  const buttonStateTlv = tlv.encode(2 /* ButtonEvent.BUTTON_STATE */, buttonState);
596
- const timestampTlv = tlv.encode(3 /* ButtonEvent.TIMESTAMP */, tlv.writeVariableUIntLE(new Date().getTime()));
617
+ const timestampTlv = tlv.encode(3 /* ButtonEvent.TIMESTAMP */, tlv.writeVariableUIntLE(Date.now()));
597
618
  const activeIdentifierTlv = tlv.encode(4 /* ButtonEvent.ACTIVE_IDENTIFIER */, tlv.writeUInt32(this.activeIdentifier));
598
619
  this.lastButtonEvent = Buffer.concat([
599
- buttonIdTlv, buttonStateTlv, timestampTlv, activeIdentifierTlv,
600
- ]).toString("base64");
601
- this.targetControlService.getCharacteristic(Characteristic_1.Characteristic.ButtonEvent).sendEventNotification(this.lastButtonEvent);
620
+ buttonIdTlv,
621
+ buttonStateTlv,
622
+ timestampTlv,
623
+ activeIdentifierTlv,
624
+ ]).toString('base64');
625
+ this.targetControlService.getCharacteristic(Characteristic.ButtonEvent).sendEventNotification(this.lastButtonEvent);
602
626
  }
603
627
  parseTargetConfigurationTLV(data) {
604
628
  const configTLV = tlv.decode(data);
605
629
  const identifier = tlv.readUInt32(configTLV[1 /* TargetConfigurationTypes.TARGET_IDENTIFIER */]);
606
- let name = undefined;
630
+ let name;
607
631
  if (configTLV[2 /* TargetConfigurationTypes.TARGET_NAME */]) {
608
632
  name = configTLV[2 /* TargetConfigurationTypes.TARGET_NAME */].toString();
609
633
  }
610
- let category = undefined;
634
+ let category;
611
635
  if (configTLV[3 /* TargetConfigurationTypes.TARGET_CATEGORY */]) {
612
636
  category = tlv.readUInt16(configTLV[3 /* TargetConfigurationTypes.TARGET_CATEGORY */]);
613
637
  }
614
638
  const buttonConfiguration = {};
615
639
  if (configTLV[4 /* TargetConfigurationTypes.BUTTON_CONFIGURATION */]) {
616
640
  const buttonConfigurationTLV = tlv.decodeList(configTLV[4 /* TargetConfigurationTypes.BUTTON_CONFIGURATION */], 1 /* ButtonConfigurationTypes.BUTTON_ID */);
617
- buttonConfigurationTLV.forEach(entry => {
641
+ buttonConfigurationTLV.forEach((entry) => {
618
642
  const buttonId = entry[1 /* ButtonConfigurationTypes.BUTTON_ID */][0];
619
643
  const buttonType = tlv.readUInt16(entry[2 /* ButtonConfigurationTypes.BUTTON_TYPE */]);
620
644
  let buttonName;
@@ -627,8 +651,8 @@ class RemoteController extends events_1.EventEmitter {
627
651
  }
628
652
  buttonConfiguration[buttonId] = {
629
653
  buttonID: buttonId,
630
- buttonType: buttonType,
631
- buttonName: buttonName,
654
+ buttonType,
655
+ buttonName,
632
656
  };
633
657
  });
634
658
  }
@@ -636,7 +660,7 @@ class RemoteController extends events_1.EventEmitter {
636
660
  targetIdentifier: identifier,
637
661
  targetName: name,
638
662
  targetCategory: category,
639
- buttonConfiguration: buttonConfiguration,
663
+ buttonConfiguration,
640
664
  };
641
665
  }
642
666
  updatedTargetConfiguration() {
@@ -657,55 +681,64 @@ class RemoteController extends events_1.EventEmitter {
657
681
  buttonConfigurationBuffers.push(tlvBuffer);
658
682
  }
659
683
  const buttonConfiguration = tlv.encode(4 /* TargetConfigurationTypes.BUTTON_CONFIGURATION */, Buffer.concat(buttonConfigurationBuffers));
660
- const targetConfiguration = Buffer.concat([targetIdentifier, targetName, targetCategory, buttonConfiguration]);
684
+ const targetConfiguration = Buffer.concat([
685
+ targetIdentifier,
686
+ targetName,
687
+ targetCategory,
688
+ buttonConfiguration,
689
+ ]);
661
690
  bufferList.push(targetConfiguration);
662
691
  }
663
692
  // targets are a tlv list, thus every entry is separated by an empty tlv
664
693
  this.targetConfigurationsString = bufferList.length === 0
665
- ? ""
666
- : tlv.encode(2 /* TargetControlList.TARGET_CONFIGURATION */, bufferList).toString("base64");
694
+ ? ''
695
+ : tlv.encode(2 /* TargetControlList.TARGET_CONFIGURATION */, bufferList).toString('base64');
667
696
  this.stateChangeDelegate?.();
668
697
  }
669
698
  buildTargetControlSupportedConfigurationTLV(configuration) {
670
699
  const maximumTargets = tlv.encode(1 /* TargetControlCommands.MAXIMUM_TARGETS */, configuration.maximumTargets);
671
700
  const ticksPerSecond = tlv.encode(2 /* TargetControlCommands.TICKS_PER_SECOND */, tlv.writeVariableUIntLE(configuration.ticksPerSecond));
672
701
  const supportedButtonConfigurationBuffers = [];
673
- configuration.supportedButtonConfiguration.forEach(value => {
702
+ configuration.supportedButtonConfiguration.forEach((value) => {
674
703
  const tlvBuffer = tlv.encode(1 /* SupportedButtonConfigurationTypes.BUTTON_ID */, value.buttonID, 2 /* SupportedButtonConfigurationTypes.BUTTON_TYPE */, tlv.writeUInt16(value.buttonType));
675
704
  supportedButtonConfigurationBuffers.push(tlvBuffer);
676
705
  });
677
706
  const supportedButtonConfiguration = tlv.encode(3 /* TargetControlCommands.SUPPORTED_BUTTON_CONFIGURATION */, Buffer.concat(supportedButtonConfigurationBuffers));
678
707
  const type = tlv.encode(4 /* TargetControlCommands.TYPE */, configuration.hardwareImplemented ? 1 : 0);
679
- return Buffer.concat([maximumTargets, ticksPerSecond, supportedButtonConfiguration, type]).toString("base64");
708
+ return Buffer.concat([
709
+ maximumTargets,
710
+ ticksPerSecond,
711
+ supportedButtonConfiguration,
712
+ type,
713
+ ]).toString('base64');
680
714
  }
681
715
  // --------------------------------- SIRI/DATA STREAM --------------------------------
682
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
683
716
  handleTargetControlWhoAmI(connection, message) {
684
717
  const targetIdentifier = message.identifier;
685
718
  this.dataStreamConnections.set(targetIdentifier, connection);
686
- debug("Discovered HDS connection for targetIdentifier %s", targetIdentifier);
719
+ debug('Discovered HDS connection for targetIdentifier %s', targetIdentifier);
687
720
  connection.addProtocolHandler("dataSend" /* Protocols.DATA_SEND */, this);
688
721
  }
689
722
  handleSiriAudioStart() {
690
723
  if (!this.audioSupported) {
691
- throw new Error("Cannot start siri stream on remote where siri is not supported");
724
+ throw new Error('Cannot start siri stream on remote where siri is not supported');
692
725
  }
693
726
  if (!this.isActive()) {
694
- debug("Tried opening Siri audio stream, however no controller is connected!");
727
+ debug('Tried opening Siri audio stream, however no controller is connected!');
695
728
  return;
696
729
  }
697
730
  if (this.activeAudioSession && (!this.activeAudioSession.isClosing() || this.nextAudioSession)) {
698
731
  // there is already a session running, which is not in closing state and/or there is even already a
699
732
  // nextAudioSession running. ignoring start request
700
- debug("Tried opening Siri audio stream, however there is already one in progress");
733
+ debug('Tried opening Siri audio stream, however there is already one in progress');
701
734
  return;
702
735
  }
703
736
  const connection = this.dataStreamConnections.get(this.activeIdentifier); // get connection for current target
704
737
  if (connection === undefined) { // target seems not connected, ignore it
705
- debug("Tried opening Siri audio stream however target is not connected via HDS");
738
+ debug('Tried opening Siri audio stream however target is not connected via HDS');
706
739
  return;
707
740
  }
708
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
741
+ // eslint-disable-next-line ts/no-use-before-define
709
742
  const audioSession = new SiriAudioSession(connection, this.selectedAudioConfiguration, this.audioProducerConstructor, this.audioProducerOptions);
710
743
  if (!this.activeAudioSession) {
711
744
  this.activeAudioSession = audioSession;
@@ -729,9 +762,8 @@ class RemoteController extends events_1.EventEmitter {
729
762
  return;
730
763
  }
731
764
  }
732
- debug("handleSiriAudioStop called although no audio session was started");
765
+ debug('handleSiriAudioStop called although no audio session was started');
733
766
  }
734
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
735
767
  handleDataSendAckEvent(message) {
736
768
  const streamId = message.streamId;
737
769
  const endOfStream = message.endOfStream;
@@ -742,10 +774,9 @@ class RemoteController extends events_1.EventEmitter {
742
774
  this.nextAudioSession.handleDataSendAckEvent(endOfStream);
743
775
  }
744
776
  else {
745
- debug("Received dataSend acknowledgment event for unknown streamId '%s'", streamId);
777
+ debug('Received dataSend acknowledgment event for unknown streamId \'%s\'', streamId);
746
778
  }
747
779
  }
748
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
749
780
  handleDataSendCloseEvent(message) {
750
781
  const streamId = message.streamId;
751
782
  const reason = message.reason;
@@ -756,7 +787,7 @@ class RemoteController extends events_1.EventEmitter {
756
787
  this.nextAudioSession.handleDataSendCloseEvent(reason);
757
788
  }
758
789
  else {
759
- debug("Received dataSend close event for unknown streamId '%s'", streamId);
790
+ debug('Received dataSend close event for unknown streamId \'%s\'', streamId);
760
791
  }
761
792
  }
762
793
  handleSiriAudioSessionClosed(session) {
@@ -771,16 +802,15 @@ class RemoteController extends events_1.EventEmitter {
771
802
  handleDataStreamConnectionClosed(connection) {
772
803
  for (const [targetIdentifier, connection0] of this.dataStreamConnections) {
773
804
  if (connection === connection0) {
774
- debug("HDS connection disconnected for targetIdentifier %s", targetIdentifier);
805
+ debug('HDS connection disconnected for targetIdentifier %s', targetIdentifier);
775
806
  this.dataStreamConnections.delete(targetIdentifier);
776
807
  break;
777
808
  }
778
809
  }
779
810
  }
780
811
  // ------------------------------- AUDIO CONFIGURATION -------------------------------
781
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
782
812
  handleSelectedAudioConfigurationWrite(value, callback) {
783
- const data = Buffer.from(value, "base64");
813
+ const data = Buffer.from(value, 'base64');
784
814
  const objects = tlv.decode(data);
785
815
  const selectedAudioStreamConfiguration = tlv.decode(objects[1 /* SelectedAudioInputStreamConfigurationTypes.SELECTED_AUDIO_INPUT_STREAM_CONFIGURATION */]);
786
816
  const codec = selectedAudioStreamConfiguration[1 /* AudioCodecConfigurationTypes.CODEC_TYPE */][0];
@@ -791,9 +821,9 @@ class RemoteController extends events_1.EventEmitter {
791
821
  this.selectedAudioConfiguration = {
792
822
  codecType: codec,
793
823
  parameters: {
794
- channels: channels,
795
- bitrate: bitrate,
796
- samplerate: samplerate,
824
+ channels,
825
+ bitrate,
826
+ samplerate,
797
827
  rtpTime: 20,
798
828
  },
799
829
  };
@@ -805,12 +835,12 @@ class RemoteController extends events_1.EventEmitter {
805
835
  static buildSupportedAudioConfigurationTLV(configuration) {
806
836
  const codecConfigurationTLV = RemoteController.buildCodecConfigurationTLV(configuration.audioCodecConfiguration);
807
837
  const supportedAudioStreamConfiguration = tlv.encode(1 /* SupportedAudioStreamConfigurationTypes.AUDIO_CODEC_CONFIGURATION */, codecConfigurationTLV);
808
- return supportedAudioStreamConfiguration.toString("base64");
838
+ return supportedAudioStreamConfiguration.toString('base64');
809
839
  }
810
840
  static buildSelectedAudioConfigurationTLV(configuration) {
811
841
  const codecConfigurationTLV = RemoteController.buildCodecConfigurationTLV(configuration.audioCodecConfiguration);
812
842
  const supportedAudioStreamConfiguration = tlv.encode(1 /* SelectedAudioInputStreamConfigurationTypes.SELECTED_AUDIO_INPUT_STREAM_CONFIGURATION */, codecConfigurationTLV);
813
- return supportedAudioStreamConfiguration.toString("base64");
843
+ return supportedAudioStreamConfiguration.toString('base64');
814
844
  }
815
845
  static buildCodecConfigurationTLV(codecConfiguration) {
816
846
  const parameters = codecConfiguration.parameters;
@@ -828,23 +858,23 @@ class RemoteController extends events_1.EventEmitter {
828
858
  * @private
829
859
  */
830
860
  constructServices() {
831
- this.targetControlManagementService = new Service_1.Service.TargetControlManagement("", "");
832
- this.targetControlManagementService.setCharacteristic(Characteristic_1.Characteristic.TargetControlSupportedConfiguration, this.supportedConfiguration);
833
- this.targetControlManagementService.setCharacteristic(Characteristic_1.Characteristic.TargetControlList, this.targetConfigurationsString);
861
+ this.targetControlManagementService = new Service.TargetControlManagement('', '');
862
+ this.targetControlManagementService.setCharacteristic(Characteristic.TargetControlSupportedConfiguration, this.supportedConfiguration);
863
+ this.targetControlManagementService.setCharacteristic(Characteristic.TargetControlList, this.targetConfigurationsString);
834
864
  this.targetControlManagementService.setPrimaryService();
835
865
  // you can also expose multiple TargetControl services to control multiple apple tvs simultaneously.
836
866
  // should we extend this class to support multiple TargetControl services or should users just create a second accessory?
837
- this.targetControlService = new Service_1.Service.TargetControl("", "");
838
- this.targetControlService.setCharacteristic(Characteristic_1.Characteristic.ActiveIdentifier, 0);
839
- this.targetControlService.setCharacteristic(Characteristic_1.Characteristic.Active, false);
840
- this.targetControlService.setCharacteristic(Characteristic_1.Characteristic.ButtonEvent, this.lastButtonEvent);
867
+ this.targetControlService = new Service.TargetControl('', '');
868
+ this.targetControlService.setCharacteristic(Characteristic.ActiveIdentifier, 0);
869
+ this.targetControlService.setCharacteristic(Characteristic.Active, false);
870
+ this.targetControlService.setCharacteristic(Characteristic.ButtonEvent, this.lastButtonEvent);
841
871
  if (this.audioSupported) {
842
- this.siriService = new Service_1.Service.Siri("", "");
843
- this.siriService.setCharacteristic(Characteristic_1.Characteristic.SiriInputType, Characteristic_1.Characteristic.SiriInputType.PUSH_BUTTON_TRIGGERED_APPLE_TV);
844
- this.audioStreamManagementService = new Service_1.Service.AudioStreamManagement("", "");
845
- this.audioStreamManagementService.setCharacteristic(Characteristic_1.Characteristic.SupportedAudioStreamConfiguration, this.supportedAudioConfiguration);
846
- this.audioStreamManagementService.setCharacteristic(Characteristic_1.Characteristic.SelectedAudioStreamConfiguration, this.selectedAudioConfigurationString);
847
- this.dataStreamManagement = new datastream_1.DataStreamManagement();
872
+ this.siriService = new Service.Siri('', '');
873
+ this.siriService.setCharacteristic(Characteristic.SiriInputType, Characteristic.SiriInputType.PUSH_BUTTON_TRIGGERED_APPLE_TV);
874
+ this.audioStreamManagementService = new Service.AudioStreamManagement('', '');
875
+ this.audioStreamManagementService.setCharacteristic(Characteristic.SupportedAudioStreamConfiguration, this.supportedAudioConfiguration);
876
+ this.audioStreamManagementService.setCharacteristic(Characteristic.SelectedAudioStreamConfiguration, this.selectedAudioConfigurationString);
877
+ this.dataStreamManagement = new DataStreamManagement();
848
878
  this.siriService.addLinkedService(this.dataStreamManagement.getService());
849
879
  this.siriService.addLinkedService(this.audioStreamManagementService);
850
880
  }
@@ -864,43 +894,43 @@ class RemoteController extends events_1.EventEmitter {
864
894
  this.targetControlService = serviceMap.targetControl;
865
895
  this.siriService = serviceMap.siri;
866
896
  this.audioStreamManagementService = serviceMap.audioStreamManagement;
867
- this.dataStreamManagement = new datastream_1.DataStreamManagement(serviceMap.dataStreamTransportManagement);
897
+ this.dataStreamManagement = new DataStreamManagement(serviceMap.dataStreamTransportManagement);
868
898
  }
869
899
  /**
870
900
  * @private
871
901
  */
872
902
  configureServices() {
873
903
  if (!this.targetControlManagementService || !this.targetControlService) {
874
- throw new Error("Unexpected state: Services not configured!"); // playing it save
904
+ throw new Error('Unexpected state: Services not configured!'); // playing it save
875
905
  }
876
- this.targetControlManagementService.getCharacteristic(Characteristic_1.Characteristic.TargetControlList)
877
- .on("get" /* CharacteristicEventTypes.GET */, callback => {
906
+ this.targetControlManagementService.getCharacteristic(Characteristic.TargetControlList)
907
+ .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
878
908
  callback(null, this.targetConfigurationsString);
879
909
  })
880
910
  .on("set" /* CharacteristicEventTypes.SET */, this.handleTargetControlWrite.bind(this));
881
- this.targetControlService.getCharacteristic(Characteristic_1.Characteristic.ActiveIdentifier)
882
- .on("get" /* CharacteristicEventTypes.GET */, callback => {
911
+ this.targetControlService.getCharacteristic(Characteristic.ActiveIdentifier)
912
+ .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
883
913
  callback(undefined, this.activeIdentifier);
884
914
  });
885
- this.targetControlService.getCharacteristic(Characteristic_1.Characteristic.Active)
886
- .on("get" /* CharacteristicEventTypes.GET */, callback => {
915
+ this.targetControlService.getCharacteristic(Characteristic.Active)
916
+ .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
887
917
  callback(undefined, this.isActive());
888
918
  })
889
919
  .on("set" /* CharacteristicEventTypes.SET */, (value, callback, context, connection) => {
890
920
  if (!connection) {
891
- debug("Set event handler for Remote.Active cannot be called from plugin. Connection undefined!");
921
+ debug('Set event handler for Remote.Active cannot be called from plugin. Connection undefined!');
892
922
  callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);
893
923
  return;
894
924
  }
895
925
  this.handleActiveWrite(value, callback, connection);
896
926
  });
897
- this.targetControlService.getCharacteristic(Characteristic_1.Characteristic.ButtonEvent)
927
+ this.targetControlService.getCharacteristic(Characteristic.ButtonEvent)
898
928
  .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
899
929
  callback(undefined, this.lastButtonEvent);
900
930
  });
901
931
  if (this.audioSupported) {
902
- this.audioStreamManagementService.getCharacteristic(Characteristic_1.Characteristic.SelectedAudioStreamConfiguration)
903
- .on("get" /* CharacteristicEventTypes.GET */, callback => {
932
+ this.audioStreamManagementService.getCharacteristic(Characteristic.SelectedAudioStreamConfiguration)
933
+ .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
904
934
  callback(null, this.selectedAudioConfigurationString);
905
935
  })
906
936
  .on("set" /* CharacteristicEventTypes.SET */, this.handleSelectedAudioConfigurationWrite.bind(this))
@@ -935,9 +965,9 @@ class RemoteController extends events_1.EventEmitter {
935
965
  * @private
936
966
  */
937
967
  handleFactoryReset() {
938
- debug("Running factory reset. Resetting targets...");
968
+ debug('Running factory reset. Resetting targets...');
939
969
  this.handleResetTargets(undefined);
940
- this.lastButtonEvent = "";
970
+ this.lastButtonEvent = '';
941
971
  }
942
972
  /**
943
973
  * @private
@@ -973,27 +1003,27 @@ class RemoteController extends events_1.EventEmitter {
973
1003
  this.stateChangeDelegate = delegate;
974
1004
  }
975
1005
  }
976
- exports.RemoteController = RemoteController;
977
1006
  /**
978
1007
  * @group Apple TV Remote
979
1008
  */
980
- var SiriAudioSessionEvents;
1009
+ // eslint-disable-next-line no-restricted-syntax
1010
+ export var SiriAudioSessionEvents;
981
1011
  (function (SiriAudioSessionEvents) {
982
1012
  SiriAudioSessionEvents["CLOSE"] = "close";
983
- })(SiriAudioSessionEvents || (exports.SiriAudioSessionEvents = SiriAudioSessionEvents = {}));
1013
+ })(SiriAudioSessionEvents || (SiriAudioSessionEvents = {}));
984
1014
  /**
985
1015
  * Represents an ongoing audio transmission
986
1016
  * @group Apple TV Remote
987
1017
  */
988
- // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
989
- class SiriAudioSession extends events_1.EventEmitter {
1018
+ // eslint-disable-next-line ts/no-unsafe-declaration-merging
1019
+ export class SiriAudioSession extends EventEmitter {
990
1020
  connection;
991
1021
  selectedAudioConfiguration;
992
1022
  producer;
993
1023
  producerRunning = false; // indicates if the producer is running
994
1024
  producerTimer; // producer has a 3s timeout to produce the first frame, otherwise transmission will be cancelled
995
1025
  /**
996
- * @private file private API
1026
+ * @private
997
1027
  */
998
1028
  state = 0 /* SiriAudioSessionState.STARTING */;
999
1029
  streamId; // present when state >= SENDING
@@ -1003,7 +1033,7 @@ class SiriAudioSession extends events_1.EventEmitter {
1003
1033
  sequenceNumber = 0;
1004
1034
  closeListener;
1005
1035
  constructor(connection, selectedAudioConfiguration, producerConstructor,
1006
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any
1036
+ // eslint-disable-next-line ts/explicit-module-boundary-types
1007
1037
  producerOptions) {
1008
1038
  super();
1009
1039
  this.connection = connection;
@@ -1015,24 +1045,24 @@ class SiriAudioSession extends events_1.EventEmitter {
1015
1045
  * Called when siri button is pressed
1016
1046
  */
1017
1047
  start() {
1018
- debug("Sending request to start siri audio stream");
1048
+ debug('Sending request to start siri audio stream');
1019
1049
  // opening dataSend
1020
1050
  this.connection.sendRequest("dataSend" /* Protocols.DATA_SEND */, "open" /* Topics.OPEN */, {
1021
- target: "controller",
1022
- type: "audio.siri",
1051
+ target: 'controller',
1052
+ type: 'audio.siri',
1023
1053
  }, (error, status, message) => {
1024
1054
  if (this.state === 3 /* SiriAudioSessionState.CLOSED */) {
1025
- debug("Ignoring dataSend open response as the session is already closed");
1055
+ debug('Ignoring dataSend open response as the session is already closed');
1026
1056
  return;
1027
1057
  }
1028
- assert_1.default.strictEqual(this.state, 0 /* SiriAudioSessionState.STARTING */);
1058
+ assert.strictEqual(this.state, 0 /* SiriAudioSessionState.STARTING */);
1029
1059
  this.state = 1 /* SiriAudioSessionState.SENDING */;
1030
1060
  if (error || status) {
1031
1061
  if (error) { // errors get produced by hap-nodejs
1032
- debug("Error occurred trying to start siri audio stream: %s", error.message);
1062
+ debug('Error occurred trying to start siri audio stream: %s', error.message);
1033
1063
  }
1034
1064
  else if (status) { // status codes are those returned by the hds response
1035
- debug("Controller responded with non-zero status code: %s", datastream_1.HDSStatus[status]);
1065
+ debug('Controller responded with non-zero status code: %s', HDSStatus[status]);
1036
1066
  }
1037
1067
  if (this.producerRunning) {
1038
1068
  this.stopAudioProducer();
@@ -1045,7 +1075,7 @@ class SiriAudioSession extends events_1.EventEmitter {
1045
1075
  this.sendDataSendCloseEvent(3 /* HDSProtocolSpecificErrorReason.CANCELLED */);
1046
1076
  }
1047
1077
  else {
1048
- debug("Successfully setup siri audio stream with streamId %d", this.streamId);
1078
+ debug('Successfully setup siri audio stream with streamId %d', this.streamId);
1049
1079
  }
1050
1080
  }
1051
1081
  });
@@ -1061,8 +1091,8 @@ class SiriAudioSession extends events_1.EventEmitter {
1061
1091
  * Called when siri button is released (or active identifier is changed to another device)
1062
1092
  */
1063
1093
  stop() {
1064
- (0, assert_1.default)(this.state <= 1 /* SiriAudioSessionState.SENDING */, "state was higher than SENDING");
1065
- debug("Stopping siri audio stream with streamId %d", this.streamId);
1094
+ assert(this.state <= 1 /* SiriAudioSessionState.SENDING */, 'state was higher than SENDING');
1095
+ debug('Stopping siri audio stream with streamId %d', this.streamId);
1066
1096
  this.endOfStream = true; // mark as endOfStream
1067
1097
  this.stopAudioProducer();
1068
1098
  if (this.state === 1 /* SiriAudioSessionState.SENDING */) {
@@ -1077,7 +1107,7 @@ class SiriAudioSession extends events_1.EventEmitter {
1077
1107
  this.producer.startAudioProduction(this.selectedAudioConfiguration);
1078
1108
  this.producerRunning = true;
1079
1109
  this.producerTimer = setTimeout(() => {
1080
- debug("Didn't receive any frames from audio producer for stream with streamId %s. Canceling the stream now.", this.streamId);
1110
+ debug('Didn\'t receive any frames from audio producer for stream with streamId %s. Canceling the stream now.', this.streamId);
1081
1111
  this.producerTimer = undefined;
1082
1112
  this.handleProducerError(3 /* HDSProtocolSpecificErrorReason.CANCELLED */);
1083
1113
  }, 3000);
@@ -1106,28 +1136,29 @@ class SiriAudioSession extends events_1.EventEmitter {
1106
1136
  return;
1107
1137
  }
1108
1138
  let queued;
1139
+ // eslint-disable-next-line no-cond-assign
1109
1140
  while ((queued = this.popSome()) !== null) { // send packets
1110
1141
  const packets = [];
1111
- queued.forEach(frame => {
1142
+ queued.forEach((frame) => {
1112
1143
  const packetData = {
1113
1144
  data: frame.data,
1114
1145
  metadata: {
1115
- rms: new datastream_1.Float32(frame.rms),
1116
- sequenceNumber: new datastream_1.Int64(this.sequenceNumber++),
1146
+ rms: new Float32(frame.rms),
1147
+ sequenceNumber: new Int64(this.sequenceNumber++),
1117
1148
  },
1118
1149
  };
1119
1150
  packets.push(packetData);
1120
1151
  });
1121
1152
  const message = {
1122
- packets: packets,
1123
- streamId: new datastream_1.Int64(this.streamId),
1153
+ packets,
1154
+ streamId: new Int64(this.streamId),
1124
1155
  endOfStream: this.endOfStream,
1125
1156
  };
1126
1157
  try {
1127
1158
  this.connection.sendEvent("dataSend" /* Protocols.DATA_SEND */, "data" /* Topics.DATA */, message);
1128
1159
  }
1129
1160
  catch (error) {
1130
- debug("Error occurred when trying to send audio frame of hds connection: %s", error.message);
1161
+ debug('Error occurred when trying to send audio frame of hds connection: %s', error.message);
1131
1162
  this.stopAudioProducer();
1132
1163
  this.closed();
1133
1164
  }
@@ -1146,29 +1177,29 @@ class SiriAudioSession extends events_1.EventEmitter {
1146
1177
  }
1147
1178
  }
1148
1179
  handleDataSendAckEvent(endOfStream) {
1149
- assert_1.default.strictEqual(endOfStream, true);
1150
- debug("Received acknowledgment for siri audio stream with streamId %s, closing it now", this.streamId);
1180
+ assert.strictEqual(endOfStream, true);
1181
+ debug('Received acknowledgment for siri audio stream with streamId %s, closing it now', this.streamId);
1151
1182
  this.sendDataSendCloseEvent(0 /* HDSProtocolSpecificErrorReason.NORMAL */);
1152
1183
  }
1153
1184
  handleDataSendCloseEvent(reason) {
1154
1185
  // @ts-expect-error: forceConsistentCasingInFileNames compiler option
1155
- debug("Received close event from controller with reason %s for stream with streamId %s", datastream_1.HDSProtocolSpecificErrorReason[reason], this.streamId);
1186
+ debug('Received close event from controller with reason %s for stream with streamId %s', HDSProtocolSpecificErrorReason[reason], this.streamId);
1156
1187
  if (this.state <= 1 /* SiriAudioSessionState.SENDING */) {
1157
1188
  this.stopAudioProducer();
1158
1189
  }
1159
1190
  this.closed();
1160
1191
  }
1161
1192
  sendDataSendCloseEvent(reason) {
1162
- (0, assert_1.default)(this.state >= 1 /* SiriAudioSessionState.SENDING */, "state was less than SENDING");
1163
- (0, assert_1.default)(this.state <= 2 /* SiriAudioSessionState.CLOSING */, "state was higher than CLOSING");
1193
+ assert(this.state >= 1 /* SiriAudioSessionState.SENDING */, 'state was less than SENDING');
1194
+ assert(this.state <= 2 /* SiriAudioSessionState.CLOSING */, 'state was higher than CLOSING');
1164
1195
  this.connection.sendEvent("dataSend" /* Protocols.DATA_SEND */, "close" /* Topics.CLOSE */, {
1165
- streamId: new datastream_1.Int64(this.streamId),
1166
- reason: new datastream_1.Int64(reason),
1196
+ streamId: new Int64(this.streamId),
1197
+ reason: new Int64(reason),
1167
1198
  });
1168
1199
  this.closed();
1169
1200
  }
1170
1201
  handleDataStreamConnectionClosed() {
1171
- debug("Closing audio session with streamId %d", this.streamId);
1202
+ debug('Closing audio session with streamId %d', this.streamId);
1172
1203
  if (this.state <= 1 /* SiriAudioSessionState.SENDING */) {
1173
1204
  this.stopAudioProducer();
1174
1205
  }
@@ -1196,5 +1227,4 @@ class SiriAudioSession extends events_1.EventEmitter {
1196
1227
  return result;
1197
1228
  }
1198
1229
  }
1199
- exports.SiriAudioSession = SiriAudioSession;
1200
1230
  //# sourceMappingURL=RemoteController.js.map