@zwave-js/cc 15.27.1 → 15.29.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 (327) hide show
  1. package/build/cjs/cc/AlarmSensorCC.js.map +2 -2
  2. package/build/cjs/cc/AssociationCC.js +6 -5
  3. package/build/cjs/cc/AssociationCC.js.map +2 -2
  4. package/build/cjs/cc/AssociationGroupInfoCC.js +5 -5
  5. package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
  6. package/build/cjs/cc/BarrierOperatorCC.js.map +2 -2
  7. package/build/cjs/cc/BasicCC.d.ts +4 -1
  8. package/build/cjs/cc/BasicCC.js +18 -0
  9. package/build/cjs/cc/BasicCC.js.map +3 -3
  10. package/build/cjs/cc/BasicWindowCoveringCC.js.map +2 -2
  11. package/build/cjs/cc/BatteryCC.js +18 -4
  12. package/build/cjs/cc/BatteryCC.js.map +2 -2
  13. package/build/cjs/cc/BinarySensorCC.js +5 -1
  14. package/build/cjs/cc/BinarySensorCC.js.map +2 -2
  15. package/build/cjs/cc/BinarySwitchCC.d.ts +4 -1
  16. package/build/cjs/cc/BinarySwitchCC.js +18 -0
  17. package/build/cjs/cc/BinarySwitchCC.js.map +3 -3
  18. package/build/cjs/cc/CRC16CC.d.ts +3 -2
  19. package/build/cjs/cc/CRC16CC.js +7 -1
  20. package/build/cjs/cc/CRC16CC.js.map +3 -3
  21. package/build/cjs/cc/CentralSceneCC.js.map +2 -2
  22. package/build/cjs/cc/ClimateControlScheduleCC.js.map +2 -2
  23. package/build/cjs/cc/ClockCC.js.map +2 -2
  24. package/build/cjs/cc/ColorSwitchCC.js +1 -4
  25. package/build/cjs/cc/ColorSwitchCC.js.map +2 -2
  26. package/build/cjs/cc/ConfigurationCC.js +16 -8
  27. package/build/cjs/cc/ConfigurationCC.js.map +2 -2
  28. package/build/cjs/cc/DeviceResetLocallyCC.js.map +2 -2
  29. package/build/cjs/cc/DoorLockCC.js +1 -1
  30. package/build/cjs/cc/DoorLockCC.js.map +2 -2
  31. package/build/cjs/cc/EntryControlCC.js.map +2 -2
  32. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +4 -16
  33. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +2 -2
  34. package/build/cjs/cc/HumidityControlSetpointCC.js +10 -4
  35. package/build/cjs/cc/HumidityControlSetpointCC.js.map +2 -2
  36. package/build/cjs/cc/IndicatorCC.js +5 -8
  37. package/build/cjs/cc/IndicatorCC.js.map +2 -2
  38. package/build/cjs/cc/IrrigationCC.js.map +2 -2
  39. package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
  40. package/build/cjs/cc/ManufacturerSpecificCC._validateArgs.d.ts +1 -0
  41. package/build/cjs/cc/ManufacturerSpecificCC._validateArgs.js +13 -0
  42. package/build/cjs/cc/ManufacturerSpecificCC._validateArgs.js.map +2 -2
  43. package/build/cjs/cc/ManufacturerSpecificCC.d.ts +6 -4
  44. package/build/cjs/cc/ManufacturerSpecificCC.js +41 -8
  45. package/build/cjs/cc/ManufacturerSpecificCC.js.map +2 -2
  46. package/build/cjs/cc/MeterCC.js +18 -29
  47. package/build/cjs/cc/MeterCC.js.map +2 -2
  48. package/build/cjs/cc/MultiChannelAssociationCC.js +11 -7
  49. package/build/cjs/cc/MultiChannelAssociationCC.js.map +2 -2
  50. package/build/cjs/cc/MultiChannelCC.d.ts +3 -1
  51. package/build/cjs/cc/MultiChannelCC.js +21 -10
  52. package/build/cjs/cc/MultiChannelCC.js.map +3 -3
  53. package/build/cjs/cc/MultilevelSensorCC.js.map +2 -2
  54. package/build/cjs/cc/MultilevelSwitchCC.d.ts +5 -1
  55. package/build/cjs/cc/MultilevelSwitchCC.js +30 -0
  56. package/build/cjs/cc/MultilevelSwitchCC.js.map +3 -3
  57. package/build/cjs/cc/NotificationCC.js +29 -11
  58. package/build/cjs/cc/NotificationCC.js.map +2 -2
  59. package/build/cjs/cc/PowerlevelCC.js.map +1 -1
  60. package/build/cjs/cc/ProtectionCC.js +2 -0
  61. package/build/cjs/cc/ProtectionCC.js.map +2 -2
  62. package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +2 -2
  63. package/build/cjs/cc/SceneControllerConfigurationCC.js.map +2 -2
  64. package/build/cjs/cc/ScheduleEntryLockCC.js.map +2 -2
  65. package/build/cjs/cc/Security2CC.d.ts +2 -1
  66. package/build/cjs/cc/Security2CC.js +31 -3
  67. package/build/cjs/cc/Security2CC.js.map +2 -2
  68. package/build/cjs/cc/SecurityCC.d.ts +3 -2
  69. package/build/cjs/cc/SecurityCC.js +7 -6
  70. package/build/cjs/cc/SecurityCC.js.map +2 -2
  71. package/build/cjs/cc/SoundSwitchCC.js +6 -6
  72. package/build/cjs/cc/SoundSwitchCC.js.map +2 -2
  73. package/build/cjs/cc/SupervisionCC.d.ts +2 -1
  74. package/build/cjs/cc/SupervisionCC.js +6 -0
  75. package/build/cjs/cc/SupervisionCC.js.map +3 -3
  76. package/build/cjs/cc/ThermostatFanModeCC.js.map +2 -2
  77. package/build/cjs/cc/ThermostatModeCC.js +1 -3
  78. package/build/cjs/cc/ThermostatModeCC.js.map +2 -2
  79. package/build/cjs/cc/ThermostatOperatingStateCC.js.map +2 -2
  80. package/build/cjs/cc/ThermostatSetpointCC.d.ts +4 -1
  81. package/build/cjs/cc/ThermostatSetpointCC.js +18 -0
  82. package/build/cjs/cc/ThermostatSetpointCC.js.map +3 -3
  83. package/build/cjs/cc/TimeCC.js.map +2 -2
  84. package/build/cjs/cc/TransportServiceCC.js.map +2 -2
  85. package/build/cjs/cc/UserCodeCC.js +3 -6
  86. package/build/cjs/cc/UserCodeCC.js.map +2 -2
  87. package/build/cjs/cc/UserCredentialCC.js +8 -6
  88. package/build/cjs/cc/UserCredentialCC.js.map +2 -2
  89. package/build/cjs/cc/VersionCC.js.map +2 -2
  90. package/build/cjs/cc/WindowCoveringCC.js +5 -1
  91. package/build/cjs/cc/WindowCoveringCC.js.map +2 -2
  92. package/build/cjs/cc/ZWaveProtocolCC.js +3 -11
  93. package/build/cjs/cc/ZWaveProtocolCC.js.map +2 -2
  94. package/build/cjs/cc/_CCValues.generated.d.ts +4 -4
  95. package/build/cjs/cc/_CCValues.generated.js +1 -1
  96. package/build/cjs/cc/_CCValues.generated.js.map +2 -2
  97. package/build/cjs/cc/index.d.ts +179 -179
  98. package/build/cjs/cc/index.js.map +1 -1
  99. package/build/cjs/cc/manufacturerProprietary/Decorators.js.map +2 -2
  100. package/build/cjs/lib/API.d.ts +3 -2
  101. package/build/cjs/lib/API.js.map +2 -2
  102. package/build/cjs/lib/CommandClass.d.ts +23 -1
  103. package/build/cjs/lib/CommandClass.js +63 -15
  104. package/build/cjs/lib/CommandClass.js.map +3 -3
  105. package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
  106. package/build/cjs/lib/EncapsulatingCommandClass.js.map +2 -2
  107. package/build/cjs/lib/NotificationEventPayload.js.map +2 -2
  108. package/build/cjs/lib/Security2/Extension.js +1 -4
  109. package/build/cjs/lib/Security2/Extension.js.map +2 -2
  110. package/build/cjs/lib/Security2/shared.js.map +2 -2
  111. package/build/cjs/lib/SetValueResult.js.map +1 -1
  112. package/build/cjs/lib/Values.d.ts +1 -1
  113. package/build/cjs/lib/Values.js.map +2 -2
  114. package/build/cjs/lib/_CCAPI.generated.js.map +1 -1
  115. package/build/cjs/lib/_Types.d.ts +34 -30
  116. package/build/cjs/lib/_Types.js +7 -0
  117. package/build/cjs/lib/_Types.js.map +3 -3
  118. package/build/cjs/lib/serializers.js +1 -4
  119. package/build/cjs/lib/serializers.js.map +2 -2
  120. package/build/cjs/lib/utils.js.map +2 -2
  121. package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
  122. package/build/esm/cc/AlarmSensorCC.js +1 -2
  123. package/build/esm/cc/AlarmSensorCC.js.map +1 -1
  124. package/build/esm/cc/AssociationCC.d.ts.map +1 -1
  125. package/build/esm/cc/AssociationCC.js +8 -7
  126. package/build/esm/cc/AssociationCC.js.map +1 -1
  127. package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  128. package/build/esm/cc/AssociationGroupInfoCC.js +11 -12
  129. package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
  130. package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
  131. package/build/esm/cc/BarrierOperatorCC.js +10 -9
  132. package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
  133. package/build/esm/cc/BasicCC.d.ts +4 -1
  134. package/build/esm/cc/BasicCC.d.ts.map +1 -1
  135. package/build/esm/cc/BasicCC.js +30 -7
  136. package/build/esm/cc/BasicCC.js.map +1 -1
  137. package/build/esm/cc/BasicWindowCoveringCC.d.ts.map +1 -1
  138. package/build/esm/cc/BasicWindowCoveringCC.js +2 -5
  139. package/build/esm/cc/BasicWindowCoveringCC.js.map +1 -1
  140. package/build/esm/cc/BatteryCC.d.ts.map +1 -1
  141. package/build/esm/cc/BatteryCC.js +17 -14
  142. package/build/esm/cc/BatteryCC.js.map +1 -1
  143. package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
  144. package/build/esm/cc/BinarySensorCC.js +12 -7
  145. package/build/esm/cc/BinarySensorCC.js.map +1 -1
  146. package/build/esm/cc/BinarySwitchCC.d.ts +4 -1
  147. package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
  148. package/build/esm/cc/BinarySwitchCC.js +31 -6
  149. package/build/esm/cc/BinarySwitchCC.js.map +1 -1
  150. package/build/esm/cc/CRC16CC.d.ts +3 -2
  151. package/build/esm/cc/CRC16CC.d.ts.map +1 -1
  152. package/build/esm/cc/CRC16CC.js +10 -4
  153. package/build/esm/cc/CRC16CC.js.map +1 -1
  154. package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
  155. package/build/esm/cc/CentralSceneCC.js +2 -1
  156. package/build/esm/cc/CentralSceneCC.js.map +1 -1
  157. package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
  158. package/build/esm/cc/ClimateControlScheduleCC.js +6 -2
  159. package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
  160. package/build/esm/cc/ClockCC.d.ts.map +1 -1
  161. package/build/esm/cc/ClockCC.js +6 -2
  162. package/build/esm/cc/ClockCC.js.map +1 -1
  163. package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
  164. package/build/esm/cc/ColorSwitchCC.js +17 -20
  165. package/build/esm/cc/ColorSwitchCC.js.map +1 -1
  166. package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
  167. package/build/esm/cc/ConfigurationCC.js +37 -33
  168. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  169. package/build/esm/cc/DeviceResetLocallyCC.d.ts.map +1 -1
  170. package/build/esm/cc/DeviceResetLocallyCC.js +1 -2
  171. package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
  172. package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
  173. package/build/esm/cc/DoorLockCC.js +26 -30
  174. package/build/esm/cc/DoorLockCC.js.map +1 -1
  175. package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
  176. package/build/esm/cc/EntryControlCC.js +10 -7
  177. package/build/esm/cc/EntryControlCC.js.map +1 -1
  178. package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
  179. package/build/esm/cc/FirmwareUpdateMetaDataCC.js +15 -27
  180. package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
  181. package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
  182. package/build/esm/cc/HumidityControlSetpointCC.js +8 -9
  183. package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
  184. package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
  185. package/build/esm/cc/IndicatorCC.js +27 -42
  186. package/build/esm/cc/IndicatorCC.js.map +1 -1
  187. package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
  188. package/build/esm/cc/IrrigationCC.js +8 -6
  189. package/build/esm/cc/IrrigationCC.js.map +1 -1
  190. package/build/esm/cc/ManufacturerProprietaryCC.d.ts.map +1 -1
  191. package/build/esm/cc/ManufacturerProprietaryCC.js +1 -2
  192. package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
  193. package/build/esm/cc/ManufacturerSpecificCC._validateArgs.d.ts +1 -0
  194. package/build/esm/cc/ManufacturerSpecificCC._validateArgs.d.ts.map +1 -1
  195. package/build/esm/cc/ManufacturerSpecificCC._validateArgs.js +10 -0
  196. package/build/esm/cc/ManufacturerSpecificCC._validateArgs.js.map +1 -1
  197. package/build/esm/cc/ManufacturerSpecificCC.d.ts +6 -4
  198. package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
  199. package/build/esm/cc/ManufacturerSpecificCC.js +54 -17
  200. package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
  201. package/build/esm/cc/MeterCC.d.ts.map +1 -1
  202. package/build/esm/cc/MeterCC.js +28 -38
  203. package/build/esm/cc/MeterCC.js.map +1 -1
  204. package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
  205. package/build/esm/cc/MultiChannelAssociationCC.js +15 -20
  206. package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
  207. package/build/esm/cc/MultiChannelCC.d.ts +3 -1
  208. package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
  209. package/build/esm/cc/MultiChannelCC.js +28 -22
  210. package/build/esm/cc/MultiChannelCC.js.map +1 -1
  211. package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
  212. package/build/esm/cc/MultilevelSensorCC.js +11 -11
  213. package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
  214. package/build/esm/cc/MultilevelSwitchCC.d.ts +5 -1
  215. package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
  216. package/build/esm/cc/MultilevelSwitchCC.js +56 -16
  217. package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
  218. package/build/esm/cc/NotificationCC.d.ts.map +1 -1
  219. package/build/esm/cc/NotificationCC.js +66 -55
  220. package/build/esm/cc/NotificationCC.js.map +1 -1
  221. package/build/esm/cc/PowerlevelCC.d.ts.map +1 -1
  222. package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
  223. package/build/esm/cc/ProtectionCC.js +13 -9
  224. package/build/esm/cc/ProtectionCC.js.map +1 -1
  225. package/build/esm/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
  226. package/build/esm/cc/SceneActuatorConfigurationCC.js +5 -8
  227. package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
  228. package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
  229. package/build/esm/cc/SceneControllerConfigurationCC.js +10 -16
  230. package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
  231. package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
  232. package/build/esm/cc/ScheduleEntryLockCC.js +13 -20
  233. package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
  234. package/build/esm/cc/Security2CC.d.ts +2 -1
  235. package/build/esm/cc/Security2CC.d.ts.map +1 -1
  236. package/build/esm/cc/Security2CC.js +68 -32
  237. package/build/esm/cc/Security2CC.js.map +1 -1
  238. package/build/esm/cc/SecurityCC.d.ts +3 -2
  239. package/build/esm/cc/SecurityCC.d.ts.map +1 -1
  240. package/build/esm/cc/SecurityCC.js +16 -11
  241. package/build/esm/cc/SecurityCC.js.map +1 -1
  242. package/build/esm/cc/SoundSwitchCC.js +2 -2
  243. package/build/esm/cc/SoundSwitchCC.js.map +1 -1
  244. package/build/esm/cc/SupervisionCC.d.ts +2 -1
  245. package/build/esm/cc/SupervisionCC.d.ts.map +1 -1
  246. package/build/esm/cc/SupervisionCC.js +13 -6
  247. package/build/esm/cc/SupervisionCC.js.map +1 -1
  248. package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
  249. package/build/esm/cc/ThermostatFanModeCC.js +1 -2
  250. package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
  251. package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
  252. package/build/esm/cc/ThermostatModeCC.js +1 -3
  253. package/build/esm/cc/ThermostatModeCC.js.map +1 -1
  254. package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
  255. package/build/esm/cc/ThermostatOperatingStateCC.js +1 -2
  256. package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
  257. package/build/esm/cc/ThermostatSetpointCC.d.ts +4 -1
  258. package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
  259. package/build/esm/cc/ThermostatSetpointCC.js +31 -19
  260. package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
  261. package/build/esm/cc/TimeCC.d.ts.map +1 -1
  262. package/build/esm/cc/TimeCC.js +6 -2
  263. package/build/esm/cc/TimeCC.js.map +1 -1
  264. package/build/esm/cc/TransportServiceCC.d.ts.map +1 -1
  265. package/build/esm/cc/TransportServiceCC.js +8 -8
  266. package/build/esm/cc/TransportServiceCC.js.map +1 -1
  267. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  268. package/build/esm/cc/UserCodeCC.js +23 -30
  269. package/build/esm/cc/UserCodeCC.js.map +1 -1
  270. package/build/esm/cc/UserCredentialCC.d.ts.map +1 -1
  271. package/build/esm/cc/UserCredentialCC.js +49 -60
  272. package/build/esm/cc/UserCredentialCC.js.map +1 -1
  273. package/build/esm/cc/VersionCC.js +3 -3
  274. package/build/esm/cc/VersionCC.js.map +1 -1
  275. package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
  276. package/build/esm/cc/WindowCoveringCC.js +10 -9
  277. package/build/esm/cc/WindowCoveringCC.js.map +1 -1
  278. package/build/esm/cc/ZWaveProtocolCC.d.ts.map +1 -1
  279. package/build/esm/cc/ZWaveProtocolCC.js +5 -26
  280. package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
  281. package/build/esm/cc/_CCValues.generated.d.ts +4 -4
  282. package/build/esm/cc/_CCValues.generated.d.ts.map +1 -1
  283. package/build/esm/cc/_CCValues.generated.js +638 -679
  284. package/build/esm/cc/_CCValues.generated.js.map +1 -1
  285. package/build/esm/cc/index.d.ts +179 -179
  286. package/build/esm/cc/index.d.ts.map +1 -1
  287. package/build/esm/cc/index.js +124 -124
  288. package/build/esm/cc/index.js.map +1 -1
  289. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts.map +1 -1
  290. package/build/esm/cc/manufacturerProprietary/Decorators.js.map +1 -1
  291. package/build/esm/lib/API.d.ts +3 -2
  292. package/build/esm/lib/API.d.ts.map +1 -1
  293. package/build/esm/lib/API.js +1 -1
  294. package/build/esm/lib/API.js.map +1 -1
  295. package/build/esm/lib/CommandClass.d.ts +23 -1
  296. package/build/esm/lib/CommandClass.d.ts.map +1 -1
  297. package/build/esm/lib/CommandClass.js +61 -20
  298. package/build/esm/lib/CommandClass.js.map +1 -1
  299. package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
  300. package/build/esm/lib/CommandClassDecorators.js +1 -2
  301. package/build/esm/lib/CommandClassDecorators.js.map +1 -1
  302. package/build/esm/lib/EncapsulatingCommandClass.d.ts.map +1 -1
  303. package/build/esm/lib/EncapsulatingCommandClass.js.map +1 -1
  304. package/build/esm/lib/NotificationEventPayload.d.ts.map +1 -1
  305. package/build/esm/lib/NotificationEventPayload.js.map +1 -1
  306. package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
  307. package/build/esm/lib/Security2/Extension.js +2 -6
  308. package/build/esm/lib/Security2/Extension.js.map +1 -1
  309. package/build/esm/lib/Security2/shared.d.ts.map +1 -1
  310. package/build/esm/lib/Security2/shared.js.map +1 -1
  311. package/build/esm/lib/SetValueResult.d.ts.map +1 -1
  312. package/build/esm/lib/Values.d.ts +1 -1
  313. package/build/esm/lib/Values.d.ts.map +1 -1
  314. package/build/esm/lib/Values.js.map +1 -1
  315. package/build/esm/lib/_CCAPI.generated.d.ts.map +1 -1
  316. package/build/esm/lib/_Types.d.ts +34 -30
  317. package/build/esm/lib/_Types.d.ts.map +1 -1
  318. package/build/esm/lib/_Types.js +5 -0
  319. package/build/esm/lib/_Types.js.map +1 -1
  320. package/build/esm/lib/serializers.d.ts.map +1 -1
  321. package/build/esm/lib/serializers.js +1 -4
  322. package/build/esm/lib/serializers.js.map +1 -1
  323. package/build/esm/lib/traits.d.ts.map +1 -1
  324. package/build/esm/lib/utils.d.ts.map +1 -1
  325. package/build/esm/lib/utils.js +25 -31
  326. package/build/esm/lib/utils.js.map +1 -1
  327. package/package.json +7 -7
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/lib/CommandClass.ts"],
4
- "sourcesContent": ["import type { GetDeviceConfig, LookupManufacturer } from \"@zwave-js/config\";\nimport {\n\ttype BroadcastCC,\n\ttype CCAddress,\n\ttype CCId,\n\tCommandClasses,\n\ttype ControlsCC,\n\tEncapsulationFlags,\n\ttype EndpointId,\n\ttype FrameType,\n\ttype GetAllEndpoints,\n\ttype GetCCs,\n\ttype GetEndpoint,\n\ttype GetNode,\n\ttype GetSupportedCCVersion,\n\ttype GetValueDB,\n\ttype HostIDs,\n\ttype ListenBehavior,\n\ttype LogNode,\n\ttype LogPayload,\n\ttype LogPayloadText,\n\ttype MessageOrCCLogEntry,\n\ttype MessagePriority,\n\ttype MessageRecord,\n\ttype ModifyCCs,\n\ttype MulticastCC,\n\ttype MulticastDestination,\n\tNODE_ID_BROADCAST,\n\tNODE_ID_BROADCAST_LR,\n\ttype NodeId,\n\ttype QueryNodeStatus,\n\ttype QuerySecurityClasses,\n\ttype SetSecurityClass,\n\ttype SinglecastCC,\n\ttype SupportsCC,\n\ttype ValueDB,\n\ttype ValueID,\n\ttype ValueMetadata,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tgetCCName,\n\tisZWaveError,\n\tlogBuffer,\n\tlogText,\n\tparseCCId,\n\ttoLogPayload,\n\tvalueIdToString,\n} from \"@zwave-js/core\";\nimport {\n\tBytes,\n\ttype BytesView,\n\ttype JSONObject,\n\tbuffer2hex,\n\tgetEnumMemberName,\n\tnum2hex,\n\tstaticExtends,\n} from \"@zwave-js/shared\";\nimport { isArray } from \"alcalzone-shared/typeguards\";\nimport type { CCAPIHost, CCAPINode, ValueIDProperties } from \"./API.js\";\nimport {\n\tgetCCCommand,\n\tgetCCCommandConstructor,\n\tgetCCConstructor,\n\tgetCCResponsePredicate,\n\tgetCCValueProperties,\n\tgetCCValues,\n\tgetCommandClass,\n\tgetExpectedCCResponse,\n\tgetImplementedVersion,\n} from \"./CommandClassDecorators.js\";\nimport {\n\ttype EncapsulatingCommandClass,\n\tisEncapsulatingCommandClass,\n\tisMultiEncapsulatingCommandClass,\n} from \"./EncapsulatingCommandClass.js\";\nimport {\n\ttype CCValue,\n\ttype DynamicCCValue,\n\ttype StaticCCValue,\n\tdefaultCCValueOptions,\n} from \"./Values.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"./traits.js\";\nimport type { GetInterviewOptions, ReportInterviewProgress } from \"./traits.js\";\n\nexport interface CommandClassOptions extends CCAddress {\n\tccId?: number; // Used to overwrite the declared CC ID\n\tccCommand?: number; // undefined = NoOp\n\tpayload?: BytesView;\n}\n\n// Defines the necessary traits an endpoint passed to a CC instance must have\nexport type CCEndpoint =\n\t& EndpointId\n\t& SupportsCC\n\t& ControlsCC\n\t& GetCCs\n\t& ModifyCCs;\n\n// Defines the necessary traits a node passed to a CC instance must have\nexport type CCNode =\n\t& NodeId\n\t& SupportsCC\n\t& ControlsCC\n\t& GetCCs\n\t& GetEndpoint<CCEndpoint>\n\t& GetAllEndpoints<CCEndpoint>\n\t& QuerySecurityClasses\n\t& SetSecurityClass\n\t& ListenBehavior\n\t& QueryNodeStatus;\n\nexport type InterviewContext =\n\t& CCAPIHost<\n\t\t& CCAPINode\n\t\t& GetCCs\n\t\t& SupportsCC\n\t\t& ControlsCC\n\t\t& QuerySecurityClasses\n\t\t& SetSecurityClass\n\t\t& ReportInterviewProgress\n\t\t& GetEndpoint<EndpointId & GetCCs & SupportsCC & ControlsCC & ModifyCCs>\n\t\t& GetAllEndpoints<EndpointId & SupportsCC & ControlsCC>\n\t>\n\t& GetInterviewOptions\n\t& LookupManufacturer;\n\nexport type RefreshValuesContext = CCAPIHost<\n\tCCAPINode & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n>;\n\nexport interface RefreshValuesOptions {\n\t/** The priority to use for the refresh value queries */\n\tpriority?: MessagePriority;\n\t/** An optional tag to identify the transactions created by the refresh value queries */\n\ttag?: any;\n\t/**\n\t * An optional callback to report fine-grained progress while refreshing values.\n\t */\n\tonProgress?: (completed: number, total: number) => void;\n}\n\nexport type PersistValuesContext =\n\t& HostIDs\n\t& GetValueDB\n\t& GetSupportedCCVersion\n\t& GetDeviceConfig\n\t& GetNode<\n\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t>\n\t& LogNode;\n\nexport function getEffectiveCCVersion(\n\tctx: GetSupportedCCVersion,\n\tcc: CCId,\n\tdefaultVersion?: number,\n): number {\n\t// For multicast and broadcast CCs, just use the highest implemented version to serialize\n\t// Older nodes will ignore the additional fields\n\tif (\n\t\ttypeof cc.nodeId !== \"number\"\n\t\t|| cc.nodeId === NODE_ID_BROADCAST\n\t\t|| cc.nodeId === NODE_ID_BROADCAST_LR\n\t) {\n\t\treturn getImplementedVersion(cc.ccId);\n\t}\n\t// For singlecast CCs, set the CC version as high as possible\n\treturn ctx.getSupportedCCVersion(cc.ccId, cc.nodeId, cc.endpointIndex)\n\t\t|| (defaultVersion ?? getImplementedVersion(cc.ccId));\n}\n\nexport class CCRaw {\n\tpublic constructor(\n\t\tpublic ccId: CommandClasses,\n\t\tpublic ccCommand: number | undefined,\n\t\tpublic payload: Bytes,\n\t) {}\n\n\tpublic static parse(data: BytesView): CCRaw {\n\t\tconst { ccId, bytesRead: ccIdLength } = parseCCId(data);\n\t\t// There are so few exceptions that we can handle them here manually\n\t\tif (ccId === CommandClasses[\"No Operation\"]) {\n\t\t\treturn new CCRaw(ccId, undefined, new Bytes());\n\t\t}\n\t\tlet ccCommand: number | undefined = data[ccIdLength];\n\t\tlet payload = Bytes.view(data.subarray(ccIdLength + 1));\n\t\tif (ccId === CommandClasses[\"Transport Service\"]) {\n\t\t\t// Transport Service only uses the higher 5 bits for the command\n\t\t\t// and re-uses the lower 3 bits of the ccCommand as payload\n\t\t\tpayload = Bytes.concat([\n\t\t\t\t[ccCommand & 0b111],\n\t\t\t\tpayload,\n\t\t\t]);\n\t\t\tccCommand = ccCommand & 0b11111_000;\n\t\t} else if (ccId === CommandClasses[\"Manufacturer Proprietary\"]) {\n\t\t\t// ManufacturerProprietaryCC has no CC command, so the first\n\t\t\t// payload byte is stored in ccCommand.\n\t\t\tpayload = Bytes.concat([\n\t\t\t\t[ccCommand],\n\t\t\t\tpayload,\n\t\t\t]);\n\t\t\tccCommand = undefined;\n\t\t}\n\n\t\treturn new CCRaw(ccId, ccCommand, payload);\n\t}\n\n\tpublic withPayload(payload: Bytes): CCRaw {\n\t\treturn new CCRaw(this.ccId, this.ccCommand, payload);\n\t}\n}\n\n// @publicAPI\nexport class CommandClass implements CCId {\n\t// empty constructor to parse messages\n\tpublic constructor(options: CommandClassOptions) {\n\t\tconst {\n\t\t\tnodeId,\n\t\t\tendpointIndex = 0,\n\t\t\tccId = getCommandClass(this),\n\t\t\tccCommand = getCCCommand(this),\n\t\t\tpayload = new Uint8Array(),\n\t\t} = options;\n\n\t\tthis.nodeId = nodeId;\n\t\tthis.endpointIndex = endpointIndex;\n\t\tthis.ccId = ccId;\n\t\tthis.ccCommand = ccCommand;\n\t\tthis.payload = Bytes.view(payload);\n\t}\n\n\tpublic static async parse(\n\t\tdata: BytesView,\n\t\tctx: CCParsingContext,\n\t): Promise<CommandClass> {\n\t\tconst raw = CCRaw.parse(data);\n\n\t\t// Find the correct subclass constructor to invoke\n\t\tconst CCConstructor = getCCConstructor(raw.ccId);\n\t\tif (!CCConstructor) {\n\t\t\t// None -> fall back to the default constructor\n\t\t\treturn await CommandClass.from(raw, ctx);\n\t\t}\n\n\t\tlet CommandConstructor: CCConstructor<CommandClass> | undefined;\n\t\tif (raw.ccCommand != undefined) {\n\t\t\tCommandConstructor = getCCCommandConstructor(\n\t\t\t\traw.ccId,\n\t\t\t\traw.ccCommand,\n\t\t\t);\n\t\t}\n\t\t// Not every CC has a constructor for its commands. In that case,\n\t\t// call the CC constructor directly\n\t\ttry {\n\t\t\treturn await (CommandConstructor ?? CCConstructor).from(raw, ctx);\n\t\t} catch (e) {\n\t\t\t// Indicate invalid payloads with a special CC type\n\t\t\tif (\n\t\t\t\tisZWaveError(e)\n\t\t\t\t&& e.code === ZWaveErrorCodes.PacketFormat_InvalidPayload\n\t\t\t) {\n\t\t\t\tconst ccName = CommandConstructor?.name\n\t\t\t\t\t?? `${getCCName(raw.ccId)} CC`;\n\n\t\t\t\t// Preserve why the command was invalid\n\t\t\t\tlet reason: string | ZWaveErrorCodes | undefined;\n\t\t\t\tif (\n\t\t\t\t\ttypeof e.context === \"string\"\n\t\t\t\t\t|| (typeof e.context === \"number\"\n\t\t\t\t\t\t&& ZWaveErrorCodes[e.context] != undefined)\n\t\t\t\t) {\n\t\t\t\t\treason = e.context;\n\t\t\t\t}\n\n\t\t\t\tconst ret = new InvalidCC({\n\t\t\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\t\t\tccId: raw.ccId,\n\t\t\t\t\tccCommand: raw.ccCommand,\n\t\t\t\t\tccName,\n\t\t\t\t\treason,\n\t\t\t\t});\n\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): CommandClass | Promise<CommandClass> {\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tccId: raw.ccId,\n\t\t\tccCommand: raw.ccCommand,\n\t\t\tpayload: raw.payload,\n\t\t});\n\t}\n\n\t/** This CC's identifier */\n\tpublic ccId!: CommandClasses;\n\tpublic ccCommand?: number;\n\tpublic get ccName(): string {\n\t\treturn getCCName(this.ccId);\n\t}\n\n\t/** The ID of the target node(s) */\n\tpublic nodeId!: number | MulticastDestination;\n\n\tpublic payload: Bytes;\n\n\t/** Which endpoint of the node this CC belongs to. 0 for the root device. */\n\tpublic endpointIndex: number;\n\n\t/**\n\t * Which encapsulation CCs this CC is/was/should be encapsulated with.\n\t *\n\t * Don't use this directly, this is used internally.\n\t */\n\tpublic encapsulationFlags: EncapsulationFlags = EncapsulationFlags.None;\n\n\t/** Activates or deactivates the given encapsulation flag(s) */\n\tpublic toggleEncapsulationFlag(\n\t\tflag: EncapsulationFlags,\n\t\tactive: boolean,\n\t): void {\n\t\tif (active) {\n\t\t\tthis.encapsulationFlags |= flag;\n\t\t} else {\n\t\t\tthis.encapsulationFlags &= ~flag;\n\t\t}\n\t}\n\n\t/** Contains a reference to the encapsulating CC if this CC is encapsulated */\n\tpublic encapsulatingCC?: EncapsulatingCommandClass;\n\n\t/** The type of Z-Wave frame this CC was sent with */\n\tpublic readonly frameType?: FrameType;\n\n\t/** Returns true if this CC is an extended CC (0xF100..0xFFFF) */\n\tpublic isExtended(): boolean {\n\t\treturn this.ccId >= 0xf100;\n\t}\n\n\t/** Whether the interview for this CC was previously completed */\n\tpublic isInterviewComplete(host: GetValueDB): boolean {\n\t\treturn !!this.getValueDB(host).getValue<boolean>({\n\t\t\tcommandClass: this.ccId,\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tproperty: \"interviewComplete\",\n\t\t});\n\t}\n\n\t/** Marks the interview for this CC as complete or not */\n\tpublic setInterviewComplete(\n\t\thost: GetValueDB,\n\t\tcomplete: boolean,\n\t): void {\n\t\tthis.getValueDB(host).setValue(\n\t\t\t{\n\t\t\t\tcommandClass: this.ccId,\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tproperty: \"interviewComplete\",\n\t\t\t},\n\t\t\tcomplete,\n\t\t);\n\t}\n\n\t/**\n\t * Serializes this CommandClass to be embedded in a message payload or another CC\n\t */\n\t// oxlint-disable-next-line no-unused-vars, @typescript-eslint/require-await\n\tpublic async serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\t// NoOp CCs have no command and no payload\n\t\tif (this.ccId === CommandClasses[\"No Operation\"]) {\n\t\t\treturn Bytes.from([this.ccId]);\n\t\t} else if (this.ccCommand == undefined) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"Cannot serialize a Command Class without a command\",\n\t\t\t\tZWaveErrorCodes.CC_Invalid,\n\t\t\t);\n\t\t}\n\n\t\tconst payloadLength = this.payload.length;\n\t\tconst ccIdLength = this.isExtended() ? 2 : 1;\n\t\tconst data = new Bytes(ccIdLength + 1 + payloadLength);\n\t\tdata.writeUIntBE(this.ccId, 0, ccIdLength);\n\t\tdata[ccIdLength] = this.ccCommand;\n\t\tif (payloadLength > 0 /* implies payload != undefined */) {\n\t\t\tdata.set(this.payload, 1 + ccIdLength);\n\t\t}\n\t\treturn data;\n\t}\n\n\tpublic prepareRetransmission(): void {\n\t\t// Do nothing by default\n\t}\n\n\t/**\n\t * Create an instance of the given CC without checking whether it is supported.\n\t * If the CC is implemented, this returns an instance of the given CC which is linked to the given endpoint.\n\t *\n\t * **INTERNAL:** Applications should not use this directly.\n\t */\n\tpublic static createInstanceUnchecked<T extends CommandClass>(\n\t\tendpoint: EndpointId,\n\t\tcc: CommandClasses | CCConstructor<T>,\n\t): T | undefined {\n\t\tconst Constructor = typeof cc === \"number\" ? getCCConstructor(cc) : cc;\n\t\tif (Constructor) {\n\t\t\treturn new Constructor({\n\t\t\t\tnodeId: endpoint.nodeId,\n\t\t\t\tendpointIndex: endpoint.index,\n\t\t\t}) as T;\n\t\t}\n\t}\n\n\t/** Generates a representation of this CC for the log */\n\tpublic toLogEntry(_ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tlet tag = this.constructor.name;\n\t\tconst message: MessageRecord = {};\n\t\tif (this.constructor === CommandClass) {\n\t\t\ttag = `${\n\t\t\t\tgetEnumMemberName(\n\t\t\t\t\tCommandClasses,\n\t\t\t\t\tthis.ccId,\n\t\t\t\t)\n\t\t\t} CC (not implemented)`;\n\t\t\tif (this.ccCommand != undefined) {\n\t\t\t\tmessage.command = num2hex(this.ccCommand);\n\t\t\t}\n\t\t}\n\t\tmessage.payload = logBuffer(this.payload);\n\t\treturn {\n\t\t\ttags: [tag],\n\t\t\tmessage,\n\t\t};\n\t}\n\n\t/** Generates the JSON representation of this CC */\n\tpublic toJSON(): JSONObject {\n\t\treturn this.toJSONInternal();\n\t}\n\n\tprivate toJSONInternal(): JSONObject {\n\t\tconst ret: JSONObject = {\n\t\t\tnodeId: this.nodeId,\n\t\t\tccId: CommandClasses[this.ccId] || num2hex(this.ccId),\n\t\t};\n\t\tif (this.ccCommand != undefined) {\n\t\t\tret.ccCommand = num2hex(this.ccCommand);\n\t\t}\n\t\tif (this.payload.length > 0) {\n\t\t\tret.payload = buffer2hex(this.payload);\n\t\t}\n\t\treturn ret;\n\t}\n\n\tprotected throwMissingCriticalInterviewResponse(): never {\n\t\tthrow new ZWaveError(\n\t\t\t`The node did not respond to a critical interview query in time.`,\n\t\t\tZWaveErrorCodes.Controller_NodeTimeout,\n\t\t);\n\t}\n\n\t/**\n\t * Performs the interview procedure for this CC according to SDS14223\n\t */\n\tpublic async interview(_ctx: InterviewContext): Promise<void> {\n\t\t// This needs to be overwritten per command class. In the default implementation, don't do anything\n\t}\n\n\t/**\n\t * Refreshes all dynamic values of this CC\n\t */\n\tpublic async refreshValues(\n\t\t_ctx: RefreshValuesContext,\n\t\t_options?: RefreshValuesOptions,\n\t): Promise<void> {\n\t\t// This needs to be overwritten per command class. In the default implementation, don't do anything\n\t}\n\n\t/**\n\t * Checks if the CC values need to be manually refreshed.\n\t * This should be called regularly and when sleeping nodes wake up\n\t */\n\tpublic shouldRefreshValues(\n\t\tthis: SinglecastCC<this>,\n\t\t_ctx:\n\t\t\t& GetValueDB\n\t\t\t& GetSupportedCCVersion\n\t\t\t& GetDeviceConfig\n\t\t\t& GetNode<\n\t\t\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t>,\n\t): boolean {\n\t\t// This needs to be overwritten per command class.\n\t\t// In the default implementation, don't require a refresh\n\t\treturn false;\n\t}\n\n\t/** Determines which CC interviews must be performed before this CC can be interviewed */\n\tpublic determineRequiredCCInterviews(): readonly CommandClasses[] {\n\t\t// By default, all CCs require the VersionCC interview\n\n\t\t// There are two exceptions to this rule:\n\t\t// * ManufacturerSpecific must be interviewed first\n\t\t// * VersionCC itself must be done after that\n\t\t// These exceptions are defined in the overrides of this method of each corresponding CC\n\n\t\treturn [CommandClasses.Version];\n\t}\n\n\t/**\n\t * Whether the endpoint interview may be skipped by a CC. Can be overwritten by a subclass.\n\t */\n\tpublic skipEndpointInterview(): boolean {\n\t\t// By default no interview may be skipped\n\t\treturn false;\n\t}\n\n\t/**\n\t * Maps a BasicCC value to a more specific CC implementation. Returns true if the value was mapped, false otherwise.\n\t * @param _value The value of the received BasicCC\n\t */\n\tpublic setMappedBasicValue(\n\t\t_ctx: GetValueDB,\n\t\t_value: number,\n\t): boolean {\n\t\t// By default, don't map\n\t\treturn false;\n\t}\n\n\tpublic isSinglecast(): this is SinglecastCC<this> {\n\t\treturn (\n\t\t\t// received\n\t\t\tthis.frameType === \"singlecast\"\n\t\t\t// transmitted\n\t\t\t|| (this.frameType == undefined\n\t\t\t\t&& typeof this.nodeId === \"number\"\n\t\t\t\t&& this.nodeId !== NODE_ID_BROADCAST\n\t\t\t\t&& this.nodeId !== NODE_ID_BROADCAST_LR)\n\t\t);\n\t}\n\n\tpublic isMulticast(): this is MulticastCC<this> {\n\t\treturn (\n\t\t\t// received\n\t\t\tthis.frameType === \"multicast\"\n\t\t\t// transmitted\n\t\t\t|| (this.frameType == undefined && isArray(this.nodeId))\n\t\t);\n\t}\n\n\tpublic isBroadcast(): this is BroadcastCC<this> {\n\t\treturn (\n\t\t\t// received\n\t\t\tthis.frameType === \"broadcast\"\n\t\t\t// transmitted\n\t\t\t|| (this.frameType == undefined\n\t\t\t\t&& (this.nodeId === NODE_ID_BROADCAST\n\t\t\t\t\t|| this.nodeId === NODE_ID_BROADCAST_LR))\n\t\t);\n\t}\n\n\t/**\n\t * Returns the node this CC is linked to. Throws if the controller is not yet ready.\n\t */\n\tpublic getNode<T extends NodeId>(\n\t\tctx: GetNode<T>,\n\t): T | undefined {\n\t\tif (this.isSinglecast()) {\n\t\t\treturn ctx.getNode(this.nodeId);\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t * Returns the node this CC is linked to (or undefined if the node doesn't exist)\n\t */\n\tpublic tryGetNode<T extends NodeId>(\n\t\tctx: GetNode<T>,\n\t): T | undefined {\n\t\ttry {\n\t\t\treturn this.getNode(ctx);\n\t\t} catch (e) {\n\t\t\t// This was expected\n\t\t\tif (isZWaveError(e) && e.code === ZWaveErrorCodes.Driver_NotReady) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\t// Something else happened\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tpublic getEndpoint<T extends EndpointId>(\n\t\tctx: GetNode<NodeId & GetEndpoint<T>>,\n\t): T | undefined {\n\t\treturn this.getNode(ctx)?.getEndpoint(this.endpointIndex);\n\t}\n\n\t/** Returns the value DB for this CC's node */\n\tprotected getValueDB(ctx: GetValueDB): ValueDB {\n\t\tif (this.isSinglecast()) {\n\t\t\ttry {\n\t\t\t\treturn ctx.getValueDB(this.nodeId);\n\t\t\t} catch {\n\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t\"The node for this CC does not exist or the driver is not ready yet\",\n\t\t\t\t\tZWaveErrorCodes.Driver_NotReady,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tthrow new ZWaveError(\n\t\t\t\"Cannot retrieve the value DB for non-singlecast CCs\",\n\t\t\tZWaveErrorCodes.CC_NoNodeID,\n\t\t);\n\t}\n\n\t/**\n\t * Ensures that the metadata for the given CC value exists in the Value DB or creates it if it does not.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t * @param meta Will be used in place of the predefined metadata when given\n\t */\n\tprotected ensureMetadata(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t\tmeta?: ValueMetadata,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tif (!valueDB.hasMetadata(valueId)) {\n\t\t\tvalueDB.setMetadata(valueId, meta ?? ccValue.meta);\n\t\t}\n\t}\n\n\t/**\n\t * Removes the metadata for the given CC value from the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected removeMetadata(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tvalueDB.setMetadata(valueId, undefined);\n\t}\n\n\t/**\n\t * Writes the metadata for the given CC value into the Value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t * @param meta Will be used in place of the predefined metadata when given\n\t */\n\tprotected setMetadata(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t\tmeta?: ValueMetadata,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tvalueDB.setMetadata(valueId, meta ?? ccValue.meta);\n\t}\n\n\t/**\n\t * Reads the metadata for the given CC value from the Value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected getMetadata<T extends ValueMetadata>(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): T | undefined {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\treturn valueDB.getMetadata(valueId) as any;\n\t}\n\n\t/**\n\t * Stores the given value under the value ID for the given CC value in the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected setValue(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t\tvalue: unknown,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tvalueDB.setValue(valueId, value);\n\t}\n\n\t/**\n\t * Removes the value for the given CC value from the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected removeValue(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tvalueDB.removeValue(valueId);\n\t}\n\n\t/**\n\t * Reads the value stored for the value ID of the given CC value from the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected getValue<T>(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): T | undefined {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\treturn valueDB.getValue(valueId);\n\t}\n\n\t/**\n\t * Reads when the value stored for the value ID of the given CC value was last updated in the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected getValueTimestamp(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): number | undefined {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\treturn valueDB.getTimestamp(valueId);\n\t}\n\n\t/** Returns the CC value definition for the current CC which matches the given value ID */\n\tprotected getCCValue(\n\t\tvalueId: ValueID,\n\t): StaticCCValue | DynamicCCValue | undefined {\n\t\tconst ccValues = getCCValues(this);\n\t\tif (!ccValues) return;\n\n\t\tfor (const value of Object.values(ccValues)) {\n\t\t\tif (value?.is(valueId)) {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate getAllCCValues(): (StaticCCValue | DynamicCCValue)[] {\n\t\treturn Object.values(getCCValues(this) ?? {}) as (\n\t\t\t| StaticCCValue\n\t\t\t| DynamicCCValue\n\t\t)[];\n\t}\n\n\tprivate getCCValueForValueId(\n\t\tproperties: ValueIDProperties,\n\t): StaticCCValue | DynamicCCValue | undefined {\n\t\treturn this.getAllCCValues().find((value) =>\n\t\t\tvalue.is({\n\t\t\t\tcommandClass: this.ccId,\n\t\t\t\t...properties,\n\t\t\t})\n\t\t);\n\t}\n\n\tprivate shouldAutoCreateValue(\n\t\tctx: GetValueDB & GetDeviceConfig,\n\t\tvalue: StaticCCValue,\n\t): boolean {\n\t\treturn (\n\t\t\tvalue.options.autoCreate === true\n\t\t\t|| (typeof value.options.autoCreate === \"function\"\n\t\t\t\t&& value.options.autoCreate(\n\t\t\t\t\tctx,\n\t\t\t\t\t{\n\t\t\t\t\t\tvirtual: false,\n\t\t\t\t\t\tnodeId: this.nodeId as number,\n\t\t\t\t\t\tindex: this.endpointIndex,\n\t\t\t\t\t},\n\t\t\t\t))\n\t\t);\n\t}\n\n\t/** Returns a list of all value names that are defined for this CommandClass */\n\tpublic getDefinedValueIDs(\n\t\tctx:\n\t\t\t& GetValueDB\n\t\t\t& GetSupportedCCVersion\n\t\t\t& GetDeviceConfig\n\t\t\t& GetNode<\n\t\t\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t>,\n\t\tincludeInternal: boolean = false,\n\t): ValueID[] {\n\t\t// In order to compare value ids, we need them to be strings\n\t\tconst ret = new Map<string, ValueID>();\n\n\t\tconst addValueId = (\n\t\t\tproperty: string | number,\n\t\t\tpropertyKey?: string | number,\n\t\t): void => {\n\t\t\tconst valueId: ValueID = {\n\t\t\t\tcommandClass: this.ccId,\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tproperty,\n\t\t\t\tpropertyKey,\n\t\t\t};\n\t\t\tconst dbKey = valueIdToString(valueId);\n\t\t\tif (!ret.has(dbKey)) ret.set(dbKey, valueId);\n\t\t};\n\n\t\t// Return all value IDs for this CC...\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\t// ...which either have metadata or a value\n\t\tconst existingValueIds: ValueID[] = [\n\t\t\t...valueDB.getValues(this.ccId),\n\t\t\t...valueDB.getAllMetadata(this.ccId),\n\t\t];\n\n\t\t// To determine which value IDs to expose, we need to know the CC version\n\t\t// that we're doing this for\n\t\tconst supportedVersion = typeof this.nodeId === \"number\"\n\t\t\t\t&& this.nodeId !== NODE_ID_BROADCAST\n\t\t\t\t&& this.nodeId !== NODE_ID_BROADCAST_LR\n\t\t\t// On singlecast CCs, use the version the node reported support for,\n\t\t\t? ctx.getSupportedCCVersion(\n\t\t\t\tthis.ccId,\n\t\t\t\tthis.nodeId,\n\t\t\t\tthis.endpointIndex,\n\t\t\t)\n\t\t\t// on multicast/broadcast, use the highest version we implement\n\t\t\t: getImplementedVersion(this.ccId);\n\n\t\t// ...or which are statically defined using @ccValues(...)\n\t\tfor (const value of Object.values(getCCValues(this) ?? {})) {\n\t\t\t// Skip dynamic CC values - they need a specific subclass instance to be evaluated\n\t\t\tif (!value || typeof value === \"function\") continue;\n\n\t\t\t// Skip those values that are only supported in higher versions of the CC\n\t\t\tif (\n\t\t\t\tvalue.options.minVersion != undefined\n\t\t\t\t&& value.options.minVersion > supportedVersion\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Skip internal values\n\t\t\tif (value.options.internal && !includeInternal) continue;\n\n\t\t\t// And determine if this value should be automatically \"created\"\n\t\t\tif (!this.shouldAutoCreateValue(ctx, value)) continue;\n\n\t\t\texistingValueIds.push(value.endpoint(this.endpointIndex));\n\t\t}\n\n\t\t// TODO: this is a bit awkward for the statically defined ones\n\t\tconst ccValues = this.getAllCCValues();\n\t\tfor (const valueId of existingValueIds) {\n\t\t\t// ...belonging to the current endpoint\n\t\t\tif ((valueId.endpoint ?? 0) !== this.endpointIndex) continue;\n\n\t\t\t// Hard-coded: interviewComplete is always internal\n\t\t\tif (valueId.property === \"interviewComplete\") continue;\n\n\t\t\t// ... which don't have a CC value definition\n\t\t\t// ... or one that does not mark the value ID as internal\n\t\t\tconst ccValue = ccValues.find((value) => value.is(valueId));\n\t\t\tif (!ccValue || !ccValue.options.internal || includeInternal) {\n\t\t\t\taddValueId(valueId.property, valueId.propertyKey);\n\t\t\t}\n\t\t}\n\n\t\treturn [...ret.values()];\n\t}\n\n\t/** Determines if the given value is an internal value */\n\tpublic isInternalValue(properties: ValueIDProperties): boolean {\n\t\t// Hard-coded: interviewComplete is always internal\n\t\tif (properties.property === \"interviewComplete\") return true;\n\n\t\tconst ccValue = this.getCCValueForValueId(properties);\n\t\treturn ccValue?.options.internal ?? defaultCCValueOptions.internal;\n\t}\n\n\t/** Determines if the given value is an secret value */\n\tpublic isSecretValue(properties: ValueIDProperties): boolean {\n\t\tconst ccValue = this.getCCValueForValueId(properties);\n\t\treturn ccValue?.options.secret ?? defaultCCValueOptions.secret;\n\t}\n\n\t/** Determines if the given value should be persisted or represents an event */\n\tpublic isStatefulValue(properties: ValueIDProperties): boolean {\n\t\tconst ccValue = this.getCCValueForValueId(properties);\n\t\treturn ccValue?.options.stateful ?? defaultCCValueOptions.stateful;\n\t}\n\n\t/**\n\t * Persists all values for this CC instance into the value DB which are annotated with @ccValue.\n\t * Returns `true` if the process succeeded, `false` if the value DB cannot be accessed.\n\t */\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tlet valueDB: ValueDB;\n\t\ttry {\n\t\t\tvalueDB = this.getValueDB(ctx);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\n\t\t// To determine which value IDs to expose, we need to know the CC version\n\t\t// that we're doing this for\n\t\tconst supportedVersion = ctx.getSupportedCCVersion(\n\t\t\tthis.ccId,\n\t\t\t// Values are only persisted for singlecast, so we know nodeId is a number\n\t\t\tthis.nodeId as number,\n\t\t\tthis.endpointIndex,\n\t\t\t// If the version isn't known yet, limit the created values to V1\n\t\t) || 1;\n\n\t\t// Get all properties of this CC which are annotated with a @ccValue decorator and store them.\n\t\tfor (const [prop, _value] of getCCValueProperties(this)) {\n\t\t\t// Evaluate dynamic CC values first\n\t\t\tconst value = typeof _value === \"function\" ? _value(this) : _value;\n\n\t\t\t// Skip those values that are only supported in higher versions of the CC\n\t\t\tif (\n\t\t\t\tvalue.options.minVersion != undefined\n\t\t\t\t&& value.options.minVersion > supportedVersion\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst valueId: ValueID = value.endpoint(this.endpointIndex);\n\t\t\tconst sourceValue = this[prop as keyof this];\n\n\t\t\t// Metadata gets created for non-internal values...\n\t\t\tconst createMetadata = !value.options.internal\n\t\t\t\t// ... but only if the value is included in the report we are persisting\n\t\t\t\t&& (sourceValue != undefined\n\t\t\t\t\t// ... or if we know which CC version the node supports\n\t\t\t\t\t// and the value may be automatically created\n\t\t\t\t\t|| (supportedVersion >= value.options.minVersion\n\t\t\t\t\t\t&& this.shouldAutoCreateValue(ctx, value)));\n\n\t\t\tif (createMetadata && !valueDB.hasMetadata(valueId)) {\n\t\t\t\tvalueDB.setMetadata(valueId, value.meta);\n\t\t\t}\n\n\t\t\t// The value only gets written if it is not undefined. null is a valid value!\n\t\t\tif (sourceValue === undefined) continue;\n\n\t\t\tvalueDB.setValue(valueId, sourceValue, {\n\t\t\t\tstateful: value.options.stateful,\n\t\t\t});\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * When a CC supports to be split into multiple partial CCs, this can be used to identify the\n\t * session the partial CCs belong to.\n\t * If a CC expects `mergePartialCCs` to be always called, you should return an empty object here.\n\t */\n\tpublic getPartialCCSessionId(): Record<string, any> | undefined {\n\t\treturn undefined; // Only select CCs support to be split\n\t}\n\n\t/**\n\t * When a CC supports to be split into multiple partial CCs, this returns how many\n\t * more segments are expected after this one (e.g. the value of a \"reports to follow\" field).\n\t * The counter doubles as the segment's position within the session, which is used\n\t * to detect missing, duplicated and reordered segments.\n\t */\n\tpublic getRemainingSegments(): number | undefined {\n\t\treturn undefined; // By default, all CCs are monolithic\n\t}\n\n\t/**\n\t * Include previously received partial responses into a final CC.\n\t * The partials are deduplicated and ordered like they were transmitted by the node.\n\t */\n\tpublic async mergePartialCCs(\n\t\t_partials: CommandClass[],\n\t\t_ctx: CCParsingContext,\n\t): Promise<void> {\n\t\t// This is highly CC dependent\n\t\t// Overwrite this in derived classes, by default do nothing\n\t}\n\n\t/** Tests whether this CC expects at least one command in return */\n\tpublic expectsCCResponse(ctx: GetNode<NodeId & SupportsCC>): boolean {\n\t\tlet expected:\n\t\t\t| DynamicCCResponse<this>\n\t\t\t| ReturnType<DynamicCCResponse<this>> = getExpectedCCResponse(this);\n\n\t\t// Evaluate dynamic CC responses\n\t\tif (\n\t\t\ttypeof expected === \"function\"\n\t\t\t&& !staticExtends(expected, CommandClass)\n\t\t) {\n\t\t\texpected = expected(ctx, this);\n\t\t}\n\t\tif (expected === undefined) return false;\n\t\tif (isArray(expected)) {\n\t\t\treturn expected.every((cc) => staticExtends(cc, CommandClass));\n\t\t} else {\n\t\t\treturn staticExtends(expected, CommandClass);\n\t\t}\n\t}\n\n\tpublic isExpectedCCResponse(\n\t\tctx: GetNode<NodeId & SupportsCC>,\n\t\treceived: CommandClass,\n\t): boolean {\n\t\tif (received.nodeId !== this.nodeId) return false;\n\n\t\tlet expected:\n\t\t\t| DynamicCCResponse<this>\n\t\t\t| ReturnType<DynamicCCResponse<this>> = getExpectedCCResponse(this);\n\n\t\t// Evaluate dynamic CC responses\n\t\tif (\n\t\t\ttypeof expected === \"function\"\n\t\t\t&& !staticExtends(expected, CommandClass)\n\t\t) {\n\t\t\texpected = expected(ctx, this);\n\t\t}\n\n\t\tif (expected == undefined) {\n\t\t\t// Fallback, should not happen if the expected response is defined correctly\n\t\t\treturn false;\n\t\t} else if (\n\t\t\tisArray(expected)\n\t\t\t&& expected.every((cc) => staticExtends(cc, CommandClass))\n\t\t) {\n\t\t\t// The CC always expects a response from the given list, check if the received\n\t\t\t// message is in that list\n\t\t\tif (expected.every((base) => !(received instanceof base))) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else if (staticExtends(expected, CommandClass)) {\n\t\t\t// The CC always expects the same single response, check if this is the one\n\t\t\tif (!(received instanceof expected)) return false;\n\t\t}\n\n\t\t// If the CC wants to test the response, let it\n\t\tconst predicate = getCCResponsePredicate(this);\n\t\tconst ret = predicate?.(this, received) ?? true;\n\n\t\tif (ret === \"checkEncapsulated\") {\n\t\t\tif (\n\t\t\t\tisEncapsulatingCommandClass(this)\n\t\t\t\t&& isEncapsulatingCommandClass(received)\n\t\t\t) {\n\t\t\t\treturn this.encapsulated.isExpectedCCResponse(\n\t\t\t\t\tctx,\n\t\t\t\t\treceived.encapsulated,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Fallback, should not happen if the expected response is defined correctly\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t}\n\n\t/**\n\t * Translates a property identifier into a speaking name for use in an external API\n\t * @param property The property identifier that should be translated\n\t * @param _propertyKey The (optional) property key the translated name may depend on\n\t */\n\tpublic translateProperty(\n\t\t_ctx: GetValueDB,\n\t\tproperty: string | number,\n\t\t_propertyKey?: string | number,\n\t): string {\n\t\t// Overwrite this in derived classes, by default just return the property key\n\t\treturn property.toString();\n\t}\n\n\t/**\n\t * Translates a property key into a speaking name for use in an external API\n\t * @param _property The property the key in question belongs to\n\t * @param propertyKey The property key for which the speaking name should be retrieved\n\t */\n\tpublic translatePropertyKey(\n\t\t_ctx: GetValueDB,\n\t\t_property: string | number,\n\t\tpropertyKey: string | number,\n\t): string | undefined {\n\t\t// Overwrite this in derived classes, by default just return the property key\n\t\treturn propertyKey.toString();\n\t}\n\n\t/** Returns the number of bytes that are added to the payload by this CC */\n\tprotected computeEncapsulationOverhead(): number {\n\t\t// Default is ccId (+ ccCommand):\n\t\treturn (this.isExtended() ? 2 : 1) + 1;\n\t}\n\n\t/** Computes the maximum net payload size that can be transmitted inside this CC */\n\tpublic getMaxPayloadLength(baseLength: number): number {\n\t\tlet ret = baseLength;\n\t\tlet cur: CommandClass | undefined = this;\n\t\twhile (cur) {\n\t\t\tret -= cur.computeEncapsulationOverhead();\n\t\t\tcur = isEncapsulatingCommandClass(cur)\n\t\t\t\t? cur.encapsulated\n\t\t\t\t: undefined;\n\t\t}\n\t\treturn ret;\n\t}\n\n\t/** Checks whether this CC is encapsulated with one that has the given CC id and (optionally) CC Command */\n\tpublic isEncapsulatedWith(\n\t\tccId: CommandClasses,\n\t\tccCommand?: number,\n\t): boolean {\n\t\tlet cc: CommandClass = this;\n\t\t// Check whether there was a S0 encapsulation\n\t\twhile (cc.encapsulatingCC) {\n\t\t\tcc = cc.encapsulatingCC;\n\t\t\tif (\n\t\t\t\tcc.ccId === ccId\n\t\t\t\t&& (ccCommand === undefined || cc.ccCommand === ccCommand)\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/** Traverses the encapsulation stack of this CC outwards and returns the one that has the given CC id and (optionally) CC Command if that exists. */\n\tpublic getEncapsulatingCC(\n\t\tccId: CommandClasses,\n\t\tccCommand?: number,\n\t): CommandClass | undefined {\n\t\tlet cc: CommandClass = this;\n\t\twhile (cc.encapsulatingCC) {\n\t\t\tcc = cc.encapsulatingCC;\n\t\t\tif (\n\t\t\t\tcc.ccId === ccId\n\t\t\t\t&& (ccCommand === undefined || cc.ccCommand === ccCommand)\n\t\t\t) {\n\t\t\t\treturn cc;\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Traverses the encapsulation stack of this CC inwards and returns the one that has the given CC id and (optionally) CC Command if that exists. */\n\tpublic getEncapsulatedCC(\n\t\tccId: CommandClasses,\n\t\tccCommand?: number,\n\t): CommandClass | undefined {\n\t\tconst predicate = (cc: CommandClass): boolean =>\n\t\t\tcc.ccId === ccId\n\t\t\t&& (ccCommand === undefined || cc.ccCommand === ccCommand);\n\n\t\tif (isEncapsulatingCommandClass(this)) {\n\t\t\tif (predicate(this.encapsulated)) return this.encapsulated;\n\t\t\treturn this.encapsulated.getEncapsulatedCC(ccId, ccCommand);\n\t\t} else if (isMultiEncapsulatingCommandClass(this)) {\n\t\t\tfor (const encapsulated of this.encapsulated) {\n\t\t\t\tif (predicate(encapsulated)) return encapsulated;\n\t\t\t\tconst ret = encapsulated.getEncapsulatedCC(ccId, ccCommand);\n\t\t\t\tif (ret) return ret;\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport interface InvalidCCOptions extends CommandClassOptions {\n\tccName: string;\n\treason?: string | ZWaveErrorCodes;\n}\n\nexport class InvalidCC extends CommandClass {\n\tpublic constructor(options: InvalidCCOptions) {\n\t\tsuper(options);\n\t\tthis._ccName = options.ccName;\n\t\t// Numeric reasons are used internally to communicate problems with a CC\n\t\t// without ignoring them entirely\n\t\tthis.reason = options.reason;\n\t}\n\n\tprivate _ccName: string;\n\tpublic get ccName(): string {\n\t\treturn this._ccName;\n\t}\n\tpublic readonly reason?: string | ZWaveErrorCodes;\n\n\tpublic toLogEntry(_ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\ttags: [this.ccName, \"INVALID\"],\n\t\t\tmessage: this.reason != undefined\n\t\t\t\t? {\n\t\t\t\t\terror: typeof this.reason === \"string\"\n\t\t\t\t\t\t? this.reason\n\t\t\t\t\t\t: getEnumMemberName(\n\t\t\t\t\t\t\tZWaveErrorCodes,\n\t\t\t\t\t\t\tthis.reason,\n\t\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t};\n\t}\n}\n\n/** Renders a CC and its encapsulated CC(s) into a tree-shaped log payload */\nexport function ccToLogPayload(\n\tcc: CommandClass,\n\tctx?: GetValueDB,\n): LogPayloadText {\n\tconst entry = cc.toLogEntry(ctx);\n\tconst nested: LogPayload[] = [];\n\tif (entry.message) {\n\t\tconst message = toLogPayload(entry.message);\n\t\t// Hoist tagged payloads nested inside the message dict (e.g. S2 extensions)\n\t\t// into the CC's children, so they render as tree siblings\n\t\tif (message.type === \"dict\" && message.nested) {\n\t\t\tnested.push({ ...message, nested: undefined });\n\t\t\tnested.push(\n\t\t\t\t...(isArray(message.nested)\n\t\t\t\t\t? message.nested\n\t\t\t\t\t: [message.nested]),\n\t\t\t);\n\t\t} else {\n\t\t\tnested.push(message);\n\t\t}\n\t}\n\tif (isEncapsulatingCommandClass(cc)) {\n\t\tnested.push(ccToLogPayload(cc.encapsulated, ctx));\n\t} else if (isMultiEncapsulatingCommandClass(cc)) {\n\t\tfor (const encap of cc.encapsulated) {\n\t\t\tnested.push(ccToLogPayload(encap, ctx));\n\t\t}\n\t}\n\treturn logText([], { tags: entry.tags, nested });\n}\n\nexport type CCConstructor<T extends CommandClass> = typeof CommandClass & {\n\t// I don't like the any, but we need it to support half-implemented CCs (e.g. report classes)\n\tnew (options: any): T;\n};\n\n/**\n * @publicAPI\n * May be used to define different expected CC responses depending on the sent CC\n */\nexport type DynamicCCResponse<\n\tTSent extends CommandClass,\n\tTReceived extends CommandClass = CommandClass,\n> = (\n\tctx: GetNode<NodeId & SupportsCC>,\n\tsentCC: TSent,\n) => CCConstructor<TReceived> | CCConstructor<TReceived>[] | undefined;\n\n/** @publicAPI */\nexport type CCResponseRole =\n\t| boolean // The response was either expected or unexpected\n\t| \"checkEncapsulated\"; // The response role depends on the encapsulated CC\n\n/**\n * @publicAPI\n * A predicate function to test if a received CC matches the sent CC\n */\nexport type CCResponsePredicate<\n\tTSent extends CommandClass,\n\tTReceived extends CommandClass = CommandClass,\n> = (sentCommand: TSent, receivedCommand: TReceived) => CCResponseRole;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AACA;;;;;;;;;AAAA,kBA8CO;AACP,oBAQO;AACP,wBAAwB;AAExB,oCAUO;AACP,uCAIO;AACP,oBAKO;AAuED,SAAU,sBACf,KACA,IACA,gBAAuB;AAIvB,MACC,OAAO,GAAG,WAAW,YAClB,GAAG,WAAW,iCACd,GAAG,WAAW,kCAChB;AACD,eAAO,qDAAsB,GAAG,IAAI;EACrC;AAEA,SAAO,IAAI,sBAAsB,GAAG,MAAM,GAAG,QAAQ,GAAG,aAAa,MAChE,sBAAkB,qDAA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BAAQ,QAAQ,MAAM,IACvB,QAAQ,SACR,CAAC,QAAQ,MAAM,CAAE;IAEtB,OAAO;AACN,aAAO,KAAK,OAAO;IACpB;EACD;AACA,UAAI,8DAA4B,EAAE,GAAG;AACpC,WAAO,KAAK,eAAe,GAAG,cAAc,GAAG,CAAC;EACjD,eAAW,mEAAiC,EAAE,GAAG;AAChD,eAAW,SAAS,GAAG,cAAc;AACpC,aAAO,KAAK,eAAe,OAAO,GAAG,CAAC;IACvC;EACD;AACA,aAAO,qBAAQ,CAAA,GAAI,EAAE,MAAM,MAAM,MAAM,OAAM,CAAE;AAChD;AA7BgB;",
6
- "names": []
4
+ "sourcesContent": ["import type { GetDeviceConfig, LookupManufacturer } from \"@zwave-js/config\";\nimport {\n\ttype BroadcastCC,\n\ttype CCAddress,\n\ttype CCId,\n\tCommandClasses,\n\ttype ControlsCC,\n\tEncapsulationFlags,\n\ttype EndpointId,\n\ttype FrameType,\n\ttype GetAllEndpoints,\n\ttype GetCCs,\n\ttype GetEndpoint,\n\ttype GetNode,\n\ttype GetSupportedCCVersion,\n\ttype GetValueDB,\n\ttype HostIDs,\n\ttype ListenBehavior,\n\ttype LogNode,\n\ttype LogPayload,\n\ttype LogPayloadText,\n\ttype MessageOrCCLogEntry,\n\ttype MessagePriority,\n\ttype MessageRecord,\n\ttype ModifyCCs,\n\ttype MulticastCC,\n\ttype MulticastDestination,\n\tNODE_ID_BROADCAST,\n\tNODE_ID_BROADCAST_LR,\n\ttype NodeId,\n\ttype QueryNodeStatus,\n\ttype QuerySecurityClasses,\n\ttype SetSecurityClass,\n\ttype SinglecastCC,\n\ttype SupportsCC,\n\ttype ValueDB,\n\ttype ValueID,\n\ttype ValueMetadata,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tgetCCName,\n\tisZWaveError,\n\tlogBuffer,\n\tlogText,\n\tparseCCId,\n\ttoLogPayload,\n\tvalueIdToString,\n} from \"@zwave-js/core\";\nimport {\n\tBytes,\n\ttype BytesView,\n\ttype JSONObject,\n\tbuffer2hex,\n\tgetEnumMemberName,\n\tnum2hex,\n\tstaticExtends,\n} from \"@zwave-js/shared\";\nimport { isArray } from \"alcalzone-shared/typeguards\";\n\nimport type { CCAPIHost, CCAPINode, ValueIDProperties } from \"./API.js\";\nimport {\n\tgetCCCommand,\n\tgetCCCommandConstructor,\n\tgetCCConstructor,\n\tgetCCResponsePredicate,\n\tgetCCValueProperties,\n\tgetCCValues,\n\tgetCommandClass,\n\tgetExpectedCCResponse,\n\tgetImplementedVersion,\n} from \"./CommandClassDecorators.js\";\nimport {\n\ttype EncapsulatingCommandClass,\n\tisEncapsulatingCommandClass,\n\tisMultiEncapsulatingCommandClass,\n} from \"./EncapsulatingCommandClass.js\";\nimport {\n\ttype CCValue,\n\ttype DynamicCCValue,\n\ttype StaticCCValue,\n\tdefaultCCValueOptions,\n} from \"./Values.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"./traits.js\";\nimport type { GetInterviewOptions, ReportInterviewProgress } from \"./traits.js\";\n\nexport interface CommandClassOptions extends CCAddress {\n\tccId?: number; // Used to overwrite the declared CC ID\n\tccCommand?: number; // undefined = NoOp\n\tpayload?: BytesView;\n}\n\nexport enum CommandRelation {\n\tUnrelated,\n\tRedundant,\n\tSupersedes,\n}\n\n/**\n * Compares command destinations. Single targets must match exactly.\n * Multi-targets must contain the same IDs regardless of order.\n */\nexport function haveSameDestination(\n\tfirst: number | readonly number[],\n\tsecond: number | readonly number[],\n): boolean {\n\tif (typeof first === \"number\" || typeof second === \"number\") {\n\t\treturn first === second;\n\t}\n\tconst firstTargets = new Set(first);\n\tconst secondTargets = new Set(second);\n\treturn (\n\t\tfirstTargets.size === secondTargets.size\n\t\t&& [...firstTargets].every((target) => secondTargets.has(target))\n\t);\n}\n\nexport function getCommandRelation(\n\tnewer: CommandClass,\n\tolder: CommandClass,\n): CommandRelation {\n\treturn newer.getRelationTo(older);\n}\n\n// Defines the necessary traits an endpoint passed to a CC instance must have\nexport type CCEndpoint = EndpointId\n\t& SupportsCC\n\t& ControlsCC\n\t& GetCCs\n\t& ModifyCCs;\n\n// Defines the necessary traits a node passed to a CC instance must have\nexport type CCNode = NodeId\n\t& SupportsCC\n\t& ControlsCC\n\t& GetCCs\n\t& GetEndpoint<CCEndpoint>\n\t& GetAllEndpoints<CCEndpoint>\n\t& QuerySecurityClasses\n\t& SetSecurityClass\n\t& ListenBehavior\n\t& QueryNodeStatus;\n\nexport type InterviewContext = CCAPIHost<\n\tCCAPINode\n\t\t& GetCCs\n\t\t& SupportsCC\n\t\t& ControlsCC\n\t\t& QuerySecurityClasses\n\t\t& SetSecurityClass\n\t\t& ReportInterviewProgress\n\t\t& GetEndpoint<EndpointId & GetCCs & SupportsCC & ControlsCC & ModifyCCs>\n\t\t& GetAllEndpoints<EndpointId & SupportsCC & ControlsCC>\n>\n\t& GetInterviewOptions\n\t& LookupManufacturer;\n\nexport type RefreshValuesContext = CCAPIHost<\n\tCCAPINode & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n>;\n\nexport interface RefreshValuesOptions {\n\t/** The priority to use for the refresh value queries */\n\tpriority?: MessagePriority;\n\t/** An optional tag to identify the transactions created by the refresh value queries */\n\ttag?: any;\n\t/**\n\t * An optional callback to report fine-grained progress while refreshing values.\n\t */\n\tonProgress?: (completed: number, total: number) => void;\n}\n\nexport type PersistValuesContext = HostIDs\n\t& GetValueDB\n\t& GetSupportedCCVersion\n\t& GetDeviceConfig\n\t& GetNode<NodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>>\n\t& LogNode;\n\nexport function getEffectiveCCVersion(\n\tctx: GetSupportedCCVersion,\n\tcc: CCId,\n\tdefaultVersion?: number,\n): number {\n\t// For multicast and broadcast CCs, just use the highest implemented version to serialize\n\t// Older nodes will ignore the additional fields\n\tif (\n\t\ttypeof cc.nodeId !== \"number\"\n\t\t|| cc.nodeId === NODE_ID_BROADCAST\n\t\t|| cc.nodeId === NODE_ID_BROADCAST_LR\n\t) {\n\t\treturn getImplementedVersion(cc.ccId);\n\t}\n\t// For singlecast CCs, set the CC version as high as possible\n\treturn (\n\t\tctx.getSupportedCCVersion(cc.ccId, cc.nodeId, cc.endpointIndex)\n\t\t|| (defaultVersion ?? getImplementedVersion(cc.ccId))\n\t);\n}\n\nexport class CCRaw {\n\tpublic constructor(\n\t\tpublic ccId: CommandClasses,\n\t\tpublic ccCommand: number | undefined,\n\t\tpublic payload: Bytes,\n\t) {}\n\n\tpublic static parse(data: BytesView): CCRaw {\n\t\tconst { ccId, bytesRead: ccIdLength } = parseCCId(data);\n\t\t// There are so few exceptions that we can handle them here manually\n\t\tif (ccId === CommandClasses[\"No Operation\"]) {\n\t\t\treturn new CCRaw(ccId, undefined, new Bytes());\n\t\t}\n\t\tlet ccCommand: number | undefined = data[ccIdLength];\n\t\tlet payload = Bytes.view(data.subarray(ccIdLength + 1));\n\t\tif (ccId === CommandClasses[\"Transport Service\"]) {\n\t\t\t// Transport Service only uses the higher 5 bits for the command\n\t\t\t// and re-uses the lower 3 bits of the ccCommand as payload\n\t\t\tpayload = Bytes.concat([[ccCommand & 0b111], payload]);\n\t\t\tccCommand = ccCommand & 0b11111_000;\n\t\t} else if (ccId === CommandClasses[\"Manufacturer Proprietary\"]) {\n\t\t\t// ManufacturerProprietaryCC has no CC command, so the first\n\t\t\t// payload byte is stored in ccCommand.\n\t\t\tpayload = Bytes.concat([[ccCommand], payload]);\n\t\t\tccCommand = undefined;\n\t\t}\n\n\t\treturn new CCRaw(ccId, ccCommand, payload);\n\t}\n\n\tpublic withPayload(payload: Bytes): CCRaw {\n\t\treturn new CCRaw(this.ccId, this.ccCommand, payload);\n\t}\n}\n\n// @publicAPI\nexport class CommandClass implements CCId {\n\t// empty constructor to parse messages\n\tpublic constructor(options: CommandClassOptions) {\n\t\tconst {\n\t\t\tnodeId,\n\t\t\tendpointIndex = 0,\n\t\t\tccId = getCommandClass(this),\n\t\t\tccCommand = getCCCommand(this),\n\t\t\tpayload = new Uint8Array(),\n\t\t} = options;\n\n\t\tthis.nodeId = nodeId;\n\t\tthis.endpointIndex = endpointIndex;\n\t\tthis.ccId = ccId;\n\t\tthis.ccCommand = ccCommand;\n\t\tthis.payload = Bytes.view(payload);\n\t}\n\n\tpublic static async parse(\n\t\tdata: BytesView,\n\t\tctx: CCParsingContext,\n\t): Promise<CommandClass> {\n\t\tconst raw = CCRaw.parse(data);\n\n\t\t// Find the correct subclass constructor to invoke\n\t\tconst CCConstructor = getCCConstructor(raw.ccId);\n\t\tif (!CCConstructor) {\n\t\t\t// None -> fall back to the default constructor\n\t\t\treturn CommandClass.withFrameType(\n\t\t\t\tawait CommandClass.from(raw, ctx),\n\t\t\t\tctx.frameType,\n\t\t\t);\n\t\t}\n\n\t\tlet CommandConstructor: CCConstructor<CommandClass> | undefined;\n\t\tif (raw.ccCommand != undefined) {\n\t\t\tCommandConstructor = getCCCommandConstructor(\n\t\t\t\traw.ccId,\n\t\t\t\traw.ccCommand,\n\t\t\t);\n\t\t}\n\t\t// Not every CC has a constructor for its commands. In that case,\n\t\t// call the CC constructor directly\n\t\ttry {\n\t\t\treturn CommandClass.withFrameType(\n\t\t\t\tawait (CommandConstructor ?? CCConstructor).from(raw, ctx),\n\t\t\t\tctx.frameType,\n\t\t\t);\n\t\t} catch (e) {\n\t\t\t// Indicate invalid payloads with a special CC type\n\t\t\tif (\n\t\t\t\tisZWaveError(e)\n\t\t\t\t&& e.code === ZWaveErrorCodes.PacketFormat_InvalidPayload\n\t\t\t) {\n\t\t\t\tconst ccName =\n\t\t\t\t\tCommandConstructor?.name ?? `${getCCName(raw.ccId)} CC`;\n\n\t\t\t\t// Preserve why the command was invalid\n\t\t\t\tlet reason: string | ZWaveErrorCodes | undefined;\n\t\t\t\tif (\n\t\t\t\t\ttypeof e.context === \"string\"\n\t\t\t\t\t|| (typeof e.context === \"number\"\n\t\t\t\t\t\t&& ZWaveErrorCodes[e.context] != undefined)\n\t\t\t\t) {\n\t\t\t\t\treason = e.context;\n\t\t\t\t}\n\n\t\t\t\tconst ret = new InvalidCC({\n\t\t\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\t\t\tccId: raw.ccId,\n\t\t\t\t\tccCommand: raw.ccCommand,\n\t\t\t\t\tccName,\n\t\t\t\t\treason,\n\t\t\t\t});\n\n\t\t\t\treturn CommandClass.withFrameType(ret, ctx.frameType);\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tprivate static withFrameType<T extends CommandClass>(\n\t\tcc: T,\n\t\tframeType: FrameType,\n\t): T {\n\t\tcc._frameType = frameType;\n\t\treturn cc;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): CommandClass | Promise<CommandClass> {\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tccId: raw.ccId,\n\t\t\tccCommand: raw.ccCommand,\n\t\t\tpayload: raw.payload,\n\t\t});\n\t}\n\n\t/** This CC's identifier */\n\tpublic ccId!: CommandClasses;\n\tpublic ccCommand?: number;\n\tpublic get ccName(): string {\n\t\treturn getCCName(this.ccId);\n\t}\n\n\t/** The ID of the target node(s) */\n\tpublic nodeId!: number | MulticastDestination;\n\n\tpublic payload: Bytes;\n\n\t/** Which endpoint of the node this CC belongs to. 0 for the root device. */\n\tpublic endpointIndex: number;\n\n\t/**\n\t * Which encapsulation CCs this CC is/was/should be encapsulated with.\n\t *\n\t * Don't use this directly, this is used internally.\n\t */\n\tpublic encapsulationFlags: EncapsulationFlags = EncapsulationFlags.None;\n\n\t/** Activates or deactivates the given encapsulation flag(s) */\n\tpublic toggleEncapsulationFlag(\n\t\tflag: EncapsulationFlags,\n\t\tactive: boolean,\n\t): void {\n\t\tif (active) {\n\t\t\tthis.encapsulationFlags |= flag;\n\t\t} else {\n\t\t\tthis.encapsulationFlags &= ~flag;\n\t\t}\n\t}\n\n\t/** Contains a reference to the encapsulating CC if this CC is encapsulated */\n\tpublic encapsulatingCC?: EncapsulatingCommandClass;\n\n\tprivate _frameType?: FrameType;\n\t/** The type of Z-Wave frame this CC was sent with */\n\tpublic get frameType(): FrameType | undefined {\n\t\treturn this._frameType;\n\t}\n\n\t/** Returns true if this CC is an extended CC (0xF100..0xFFFF) */\n\tpublic isExtended(): boolean {\n\t\treturn this.ccId >= 0xf100;\n\t}\n\n\t/** Whether the interview for this CC was previously completed */\n\tpublic isInterviewComplete(host: GetValueDB): boolean {\n\t\treturn !!this.getValueDB(host).getValue<boolean>({\n\t\t\tcommandClass: this.ccId,\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tproperty: \"interviewComplete\",\n\t\t});\n\t}\n\n\t/** Marks the interview for this CC as complete or not */\n\tpublic setInterviewComplete(host: GetValueDB, complete: boolean): void {\n\t\tthis.getValueDB(host).setValue(\n\t\t\t{\n\t\t\t\tcommandClass: this.ccId,\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tproperty: \"interviewComplete\",\n\t\t\t},\n\t\t\tcomplete,\n\t\t);\n\t}\n\n\t/**\n\t * Serializes this CommandClass to be embedded in a message payload or another CC\n\t */\n\t// oxlint-disable-next-line no-unused-vars, @typescript-eslint/require-await\n\tpublic async serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\t// NoOp CCs have no command and no payload\n\t\tif (this.ccId === CommandClasses[\"No Operation\"]) {\n\t\t\treturn Bytes.from([this.ccId]);\n\t\t} else if (this.ccCommand == undefined) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"Cannot serialize a Command Class without a command\",\n\t\t\t\tZWaveErrorCodes.CC_Invalid,\n\t\t\t);\n\t\t}\n\n\t\tconst payloadLength = this.payload.length;\n\t\tconst ccIdLength = this.isExtended() ? 2 : 1;\n\t\tconst data = new Bytes(ccIdLength + 1 + payloadLength);\n\t\tdata.writeUIntBE(this.ccId, 0, ccIdLength);\n\t\tdata[ccIdLength] = this.ccCommand;\n\t\tif (payloadLength > 0 /* implies payload != undefined */) {\n\t\t\tdata.set(this.payload, 1 + ccIdLength);\n\t\t}\n\t\treturn data;\n\t}\n\n\tpublic prepareRetransmission(): void {\n\t\t// Do nothing by default\n\t}\n\n\t/**\n\t * Determines this command's relation to an older command. Shared command\n\t * context must match before command-specific relation logic runs.\n\t */\n\tpublic getRelationTo(other: CommandClass): CommandRelation {\n\t\tif (\n\t\t\tthis.ccId !== other.ccId\n\t\t\t|| !haveSameDestination(this.nodeId, other.nodeId)\n\t\t\t|| this.endpointIndex !== other.endpointIndex\n\t\t\t|| this.encapsulationFlags !== other.encapsulationFlags\n\t\t) {\n\t\t\treturn CommandRelation.Unrelated;\n\t\t}\n\t\treturn this.determineRelation(other);\n\t}\n\n\t/**\n\t * Subclasses override this to determine additional command-specific relations.\n\t */\n\tprotected determineRelation(_other: CommandClass): CommandRelation {\n\t\treturn CommandRelation.Unrelated;\n\t}\n\n\t/**\n\t * Create an instance of the given CC without checking whether it is supported.\n\t * If the CC is implemented, this returns an instance of the given CC which is linked to the given endpoint.\n\t *\n\t * **INTERNAL:** Applications should not use this directly.\n\t */\n\tpublic static createInstanceUnchecked<T extends CommandClass>(\n\t\tendpoint: EndpointId,\n\t\tcc: CommandClasses | CCConstructor<T>,\n\t): T | undefined {\n\t\tconst Constructor = typeof cc === \"number\" ? getCCConstructor(cc) : cc;\n\t\tif (Constructor) {\n\t\t\treturn new Constructor({\n\t\t\t\tnodeId: endpoint.nodeId,\n\t\t\t\tendpointIndex: endpoint.index,\n\t\t\t}) as T;\n\t\t}\n\t}\n\n\t/** Generates a representation of this CC for the log */\n\tpublic toLogEntry(_ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tlet tag = this.constructor.name;\n\t\tconst message: MessageRecord = {};\n\t\tif (this.constructor === CommandClass) {\n\t\t\ttag = `${getEnumMemberName(\n\t\t\t\tCommandClasses,\n\t\t\t\tthis.ccId,\n\t\t\t)} CC (not implemented)`;\n\t\t\tif (this.ccCommand != undefined) {\n\t\t\t\tmessage.command = num2hex(this.ccCommand);\n\t\t\t}\n\t\t}\n\t\tmessage.payload = logBuffer(this.payload);\n\t\treturn {\n\t\t\ttags: [tag],\n\t\t\tmessage,\n\t\t};\n\t}\n\n\t/** Generates the JSON representation of this CC */\n\tpublic toJSON(): JSONObject {\n\t\treturn this.toJSONInternal();\n\t}\n\n\tprivate toJSONInternal(): JSONObject {\n\t\tconst ret: JSONObject = {\n\t\t\tnodeId: this.nodeId,\n\t\t\tccId: CommandClasses[this.ccId] || num2hex(this.ccId),\n\t\t};\n\t\tif (this.ccCommand != undefined) {\n\t\t\tret.ccCommand = num2hex(this.ccCommand);\n\t\t}\n\t\tif (this.payload.length > 0) {\n\t\t\tret.payload = buffer2hex(this.payload);\n\t\t}\n\t\treturn ret;\n\t}\n\n\tprotected throwMissingCriticalInterviewResponse(): never {\n\t\tthrow new ZWaveError(\n\t\t\t`The node did not respond to a critical interview query in time.`,\n\t\t\tZWaveErrorCodes.Controller_NodeTimeout,\n\t\t);\n\t}\n\n\t/**\n\t * Performs the interview procedure for this CC according to SDS14223\n\t */\n\tpublic async interview(_ctx: InterviewContext): Promise<void> {\n\t\t// This needs to be overwritten per command class. In the default implementation, don't do anything\n\t}\n\n\t/**\n\t * Refreshes all dynamic values of this CC\n\t */\n\tpublic async refreshValues(\n\t\t_ctx: RefreshValuesContext,\n\t\t_options?: RefreshValuesOptions,\n\t): Promise<void> {\n\t\t// This needs to be overwritten per command class. In the default implementation, don't do anything\n\t}\n\n\t/**\n\t * Checks if the CC values need to be manually refreshed.\n\t * This should be called regularly and when sleeping nodes wake up\n\t */\n\tpublic shouldRefreshValues(\n\t\tthis: SinglecastCC<this>,\n\t\t_ctx: GetValueDB\n\t\t\t& GetSupportedCCVersion\n\t\t\t& GetDeviceConfig\n\t\t\t& GetNode<\n\t\t\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t>,\n\t): boolean {\n\t\t// This needs to be overwritten per command class.\n\t\t// In the default implementation, don't require a refresh\n\t\treturn false;\n\t}\n\n\t/** Determines which CC interviews must be performed before this CC can be interviewed */\n\tpublic determineRequiredCCInterviews(): readonly CommandClasses[] {\n\t\t// By default, all CCs require the VersionCC interview\n\n\t\t// There are two exceptions to this rule:\n\t\t// * ManufacturerSpecific must be interviewed first\n\t\t// * VersionCC itself must be done after that\n\t\t// These exceptions are defined in the overrides of this method of each corresponding CC\n\n\t\treturn [CommandClasses.Version];\n\t}\n\n\t/**\n\t * Whether the endpoint interview may be skipped by a CC. Can be overwritten by a subclass.\n\t */\n\tpublic skipEndpointInterview(): boolean {\n\t\t// By default no interview may be skipped\n\t\treturn false;\n\t}\n\n\t/**\n\t * Maps a BasicCC value to a more specific CC implementation. Returns true if the value was mapped, false otherwise.\n\t * @param _value The value of the received BasicCC\n\t */\n\tpublic setMappedBasicValue(_ctx: GetValueDB, _value: number): boolean {\n\t\t// By default, don't map\n\t\treturn false;\n\t}\n\n\tpublic isSinglecast(): this is SinglecastCC<this> {\n\t\treturn (\n\t\t\t// received\n\t\t\tthis.frameType === \"singlecast\"\n\t\t\t// transmitted\n\t\t\t|| (this.frameType == undefined\n\t\t\t\t&& typeof this.nodeId === \"number\"\n\t\t\t\t&& this.nodeId !== NODE_ID_BROADCAST\n\t\t\t\t&& this.nodeId !== NODE_ID_BROADCAST_LR)\n\t\t);\n\t}\n\n\tpublic isMulticast(): this is MulticastCC<this> {\n\t\treturn (\n\t\t\t// received\n\t\t\tthis.frameType === \"multicast\"\n\t\t\t// transmitted\n\t\t\t|| (this.frameType == undefined && isArray(this.nodeId))\n\t\t);\n\t}\n\n\tpublic isBroadcast(): this is BroadcastCC<this> {\n\t\treturn (\n\t\t\t// received\n\t\t\tthis.frameType === \"broadcast\"\n\t\t\t// transmitted\n\t\t\t|| (this.frameType == undefined\n\t\t\t\t&& (this.nodeId === NODE_ID_BROADCAST\n\t\t\t\t\t|| this.nodeId === NODE_ID_BROADCAST_LR))\n\t\t);\n\t}\n\n\t/**\n\t * Returns the node this CC is linked to. Throws if the controller is not yet ready.\n\t */\n\tpublic getNode<T extends NodeId>(ctx: GetNode<T>): T | undefined {\n\t\tif (this.isSinglecast()) {\n\t\t\treturn ctx.getNode(this.nodeId);\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t * Returns the node this CC is linked to (or undefined if the node doesn't exist)\n\t */\n\tpublic tryGetNode<T extends NodeId>(ctx: GetNode<T>): T | undefined {\n\t\ttry {\n\t\t\treturn this.getNode(ctx);\n\t\t} catch (e) {\n\t\t\t// This was expected\n\t\t\tif (isZWaveError(e) && e.code === ZWaveErrorCodes.Driver_NotReady) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\t// Something else happened\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tpublic getEndpoint<T extends EndpointId>(\n\t\tctx: GetNode<NodeId & GetEndpoint<T>>,\n\t): T | undefined {\n\t\treturn this.getNode(ctx)?.getEndpoint(this.endpointIndex);\n\t}\n\n\t/** Returns the value DB for this CC's node */\n\tprotected getValueDB(ctx: GetValueDB): ValueDB {\n\t\tif (this.isSinglecast()) {\n\t\t\ttry {\n\t\t\t\treturn ctx.getValueDB(this.nodeId);\n\t\t\t} catch {\n\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t\"The node for this CC does not exist or the driver is not ready yet\",\n\t\t\t\t\tZWaveErrorCodes.Driver_NotReady,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tthrow new ZWaveError(\n\t\t\t\"Cannot retrieve the value DB for non-singlecast CCs\",\n\t\t\tZWaveErrorCodes.CC_NoNodeID,\n\t\t);\n\t}\n\n\t/**\n\t * Ensures that the metadata for the given CC value exists in the Value DB or creates it if it does not.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t * @param meta Will be used in place of the predefined metadata when given\n\t */\n\tprotected ensureMetadata(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t\tmeta?: ValueMetadata,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tif (!valueDB.hasMetadata(valueId)) {\n\t\t\tvalueDB.setMetadata(valueId, meta ?? ccValue.meta);\n\t\t}\n\t}\n\n\t/**\n\t * Removes the metadata for the given CC value from the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected removeMetadata(ctx: GetValueDB, ccValue: CCValue): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tvalueDB.setMetadata(valueId, undefined);\n\t}\n\n\t/**\n\t * Writes the metadata for the given CC value into the Value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t * @param meta Will be used in place of the predefined metadata when given\n\t */\n\tprotected setMetadata(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t\tmeta?: ValueMetadata,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tvalueDB.setMetadata(valueId, meta ?? ccValue.meta);\n\t}\n\n\t/**\n\t * Reads the metadata for the given CC value from the Value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected getMetadata<T extends ValueMetadata>(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): T | undefined {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\treturn valueDB.getMetadata(valueId) as any;\n\t}\n\n\t/**\n\t * Stores the given value under the value ID for the given CC value in the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected setValue(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t\tvalue: unknown,\n\t): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tvalueDB.setValue(valueId, value);\n\t}\n\n\t/**\n\t * Removes the value for the given CC value from the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected removeValue(ctx: GetValueDB, ccValue: CCValue): void {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\tvalueDB.removeValue(valueId);\n\t}\n\n\t/**\n\t * Reads the value stored for the value ID of the given CC value from the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected getValue<T>(ctx: GetValueDB, ccValue: CCValue): T | undefined {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\treturn valueDB.getValue(valueId);\n\t}\n\n\t/**\n\t * Reads when the value stored for the value ID of the given CC value was last updated in the value DB.\n\t * The endpoint index of the current CC instance is automatically taken into account.\n\t */\n\tprotected getValueTimestamp(\n\t\tctx: GetValueDB,\n\t\tccValue: CCValue,\n\t): number | undefined {\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\tconst valueId = ccValue.endpoint(this.endpointIndex);\n\t\treturn valueDB.getTimestamp(valueId);\n\t}\n\n\t/** Returns the CC value definition for the current CC which matches the given value ID */\n\tprotected getCCValue(\n\t\tvalueId: ValueID,\n\t): StaticCCValue | DynamicCCValue | undefined {\n\t\tconst ccValues = getCCValues(this);\n\t\tif (!ccValues) return;\n\n\t\tfor (const value of Object.values(ccValues)) {\n\t\t\tif (value?.is(valueId)) {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate getAllCCValues(): (StaticCCValue | DynamicCCValue)[] {\n\t\treturn Object.values(getCCValues(this) ?? {}) as (\n\t\t\t| StaticCCValue\n\t\t\t| DynamicCCValue\n\t\t)[];\n\t}\n\n\tprivate getCCValueForValueId(\n\t\tproperties: ValueIDProperties,\n\t): StaticCCValue | DynamicCCValue | undefined {\n\t\treturn this.getAllCCValues().find((value) =>\n\t\t\tvalue.is({\n\t\t\t\tcommandClass: this.ccId,\n\t\t\t\t...properties,\n\t\t\t}),\n\t\t);\n\t}\n\n\tprivate shouldAutoCreateValue(\n\t\tctx: GetValueDB & GetDeviceConfig,\n\t\tvalue: StaticCCValue,\n\t): boolean {\n\t\treturn (\n\t\t\tvalue.options.autoCreate === true\n\t\t\t|| (typeof value.options.autoCreate === \"function\"\n\t\t\t\t&& value.options.autoCreate(ctx, {\n\t\t\t\t\tvirtual: false,\n\t\t\t\t\tnodeId: this.nodeId as number,\n\t\t\t\t\tindex: this.endpointIndex,\n\t\t\t\t}))\n\t\t);\n\t}\n\n\t/** Returns a list of all value names that are defined for this CommandClass */\n\tpublic getDefinedValueIDs(\n\t\tctx: GetValueDB\n\t\t\t& GetSupportedCCVersion\n\t\t\t& GetDeviceConfig\n\t\t\t& GetNode<\n\t\t\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t>,\n\t\tincludeInternal: boolean = false,\n\t): ValueID[] {\n\t\t// In order to compare value ids, we need them to be strings\n\t\tconst ret = new Map<string, ValueID>();\n\n\t\tconst addValueId = (\n\t\t\tproperty: string | number,\n\t\t\tpropertyKey?: string | number,\n\t\t): void => {\n\t\t\tconst valueId: ValueID = {\n\t\t\t\tcommandClass: this.ccId,\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tproperty,\n\t\t\t\tpropertyKey,\n\t\t\t};\n\t\t\tconst dbKey = valueIdToString(valueId);\n\t\t\tif (!ret.has(dbKey)) ret.set(dbKey, valueId);\n\t\t};\n\n\t\t// Return all value IDs for this CC...\n\t\tconst valueDB = this.getValueDB(ctx);\n\t\t// ...which either have metadata or a value\n\t\tconst existingValueIds: ValueID[] = [\n\t\t\t...valueDB.getValues(this.ccId),\n\t\t\t...valueDB.getAllMetadata(this.ccId),\n\t\t];\n\n\t\t// To determine which value IDs to expose, we need to know the CC version\n\t\t// that we're doing this for\n\t\tconst supportedVersion =\n\t\t\ttypeof this.nodeId === \"number\"\n\t\t\t&& this.nodeId !== NODE_ID_BROADCAST\n\t\t\t&& this.nodeId !== NODE_ID_BROADCAST_LR\n\t\t\t\t? // On singlecast CCs, use the version the node reported support for,\n\t\t\t\t\tctx.getSupportedCCVersion(\n\t\t\t\t\t\tthis.ccId,\n\t\t\t\t\t\tthis.nodeId,\n\t\t\t\t\t\tthis.endpointIndex,\n\t\t\t\t\t)\n\t\t\t\t: // on multicast/broadcast, use the highest version we implement\n\t\t\t\t\tgetImplementedVersion(this.ccId);\n\n\t\t// ...or which are statically defined using @ccValues(...)\n\t\tfor (const value of Object.values(getCCValues(this) ?? {})) {\n\t\t\t// Skip dynamic CC values - they need a specific subclass instance to be evaluated\n\t\t\tif (!value || typeof value === \"function\") continue;\n\n\t\t\t// Skip those values that are only supported in higher versions of the CC\n\t\t\tif (\n\t\t\t\tvalue.options.minVersion != undefined\n\t\t\t\t&& value.options.minVersion > supportedVersion\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Skip internal values\n\t\t\tif (value.options.internal && !includeInternal) continue;\n\n\t\t\t// And determine if this value should be automatically \"created\"\n\t\t\tif (!this.shouldAutoCreateValue(ctx, value)) continue;\n\n\t\t\texistingValueIds.push(value.endpoint(this.endpointIndex));\n\t\t}\n\n\t\t// TODO: this is a bit awkward for the statically defined ones\n\t\tconst ccValues = this.getAllCCValues();\n\t\tfor (const valueId of existingValueIds) {\n\t\t\t// ...belonging to the current endpoint\n\t\t\tif ((valueId.endpoint ?? 0) !== this.endpointIndex) continue;\n\n\t\t\t// Hard-coded: interviewComplete is always internal\n\t\t\tif (valueId.property === \"interviewComplete\") continue;\n\n\t\t\t// ... which don't have a CC value definition\n\t\t\t// ... or one that does not mark the value ID as internal\n\t\t\tconst ccValue = ccValues.find((value) => value.is(valueId));\n\t\t\tif (!ccValue || !ccValue.options.internal || includeInternal) {\n\t\t\t\taddValueId(valueId.property, valueId.propertyKey);\n\t\t\t}\n\t\t}\n\n\t\treturn [...ret.values()];\n\t}\n\n\t/** Determines if the given value is an internal value */\n\tpublic isInternalValue(properties: ValueIDProperties): boolean {\n\t\t// Hard-coded: interviewComplete is always internal\n\t\tif (properties.property === \"interviewComplete\") return true;\n\n\t\tconst ccValue = this.getCCValueForValueId(properties);\n\t\treturn ccValue?.options.internal ?? defaultCCValueOptions.internal;\n\t}\n\n\t/** Determines if the given value is an secret value */\n\tpublic isSecretValue(properties: ValueIDProperties): boolean {\n\t\tconst ccValue = this.getCCValueForValueId(properties);\n\t\treturn ccValue?.options.secret ?? defaultCCValueOptions.secret;\n\t}\n\n\t/** Determines if the given value should be persisted or represents an event */\n\tpublic isStatefulValue(properties: ValueIDProperties): boolean {\n\t\tconst ccValue = this.getCCValueForValueId(properties);\n\t\treturn ccValue?.options.stateful ?? defaultCCValueOptions.stateful;\n\t}\n\n\t/**\n\t * Persists all values for this CC instance into the value DB which are annotated with @ccValue.\n\t * Returns `true` if the process succeeded, `false` if the value DB cannot be accessed.\n\t */\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tlet valueDB: ValueDB;\n\t\ttry {\n\t\t\tvalueDB = this.getValueDB(ctx);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\n\t\t// To determine which value IDs to expose, we need to know the CC version\n\t\t// that we're doing this for\n\t\tconst supportedVersion =\n\t\t\tctx.getSupportedCCVersion(\n\t\t\t\tthis.ccId,\n\t\t\t\t// Values are only persisted for singlecast, so we know nodeId is a number\n\t\t\t\tthis.nodeId as number,\n\t\t\t\tthis.endpointIndex,\n\t\t\t\t// If the version isn't known yet, limit the created values to V1\n\t\t\t) || 1;\n\n\t\t// Get all properties of this CC which are annotated with a @ccValue decorator and store them.\n\t\tfor (const [prop, _value] of getCCValueProperties(this)) {\n\t\t\t// Evaluate dynamic CC values first\n\t\t\tconst value = typeof _value === \"function\" ? _value(this) : _value;\n\n\t\t\t// Skip those values that are only supported in higher versions of the CC\n\t\t\tif (\n\t\t\t\tvalue.options.minVersion != undefined\n\t\t\t\t&& value.options.minVersion > supportedVersion\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst valueId: ValueID = value.endpoint(this.endpointIndex);\n\t\t\tconst sourceValue = this[prop as keyof this];\n\n\t\t\t// Metadata gets created for non-internal values...\n\t\t\tconst createMetadata =\n\t\t\t\t!value.options.internal\n\t\t\t\t// ... but only if the value is included in the report we are persisting\n\t\t\t\t&& (sourceValue != undefined\n\t\t\t\t\t// ... or if we know which CC version the node supports\n\t\t\t\t\t// and the value may be automatically created\n\t\t\t\t\t|| (supportedVersion >= value.options.minVersion\n\t\t\t\t\t\t&& this.shouldAutoCreateValue(ctx, value)));\n\n\t\t\tif (createMetadata && !valueDB.hasMetadata(valueId)) {\n\t\t\t\tvalueDB.setMetadata(valueId, value.meta);\n\t\t\t}\n\n\t\t\t// The value only gets written if it is not undefined. null is a valid value!\n\t\t\tif (sourceValue === undefined) continue;\n\n\t\t\tvalueDB.setValue(valueId, sourceValue, {\n\t\t\t\tstateful: value.options.stateful,\n\t\t\t});\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * When a CC supports to be split into multiple partial CCs, this can be used to identify the\n\t * session the partial CCs belong to.\n\t * If a CC expects `mergePartialCCs` to be always called, you should return an empty object here.\n\t */\n\tpublic getPartialCCSessionId(): Record<string, any> | undefined {\n\t\treturn undefined; // Only select CCs support to be split\n\t}\n\n\t/**\n\t * When a CC supports to be split into multiple partial CCs, this returns how many\n\t * more segments are expected after this one (e.g. the value of a \"reports to follow\" field).\n\t * The counter doubles as the segment's position within the session, which is used\n\t * to detect missing, duplicated and reordered segments.\n\t */\n\tpublic getRemainingSegments(): number | undefined {\n\t\treturn undefined; // By default, all CCs are monolithic\n\t}\n\n\t/**\n\t * Include previously received partial responses into a final CC.\n\t * The partials are deduplicated and ordered like they were transmitted by the node.\n\t */\n\tpublic async mergePartialCCs(\n\t\t_partials: CommandClass[],\n\t\t_ctx: CCParsingContext,\n\t): Promise<void> {\n\t\t// This is highly CC dependent\n\t\t// Overwrite this in derived classes, by default do nothing\n\t}\n\n\t/** Tests whether this CC expects at least one command in return */\n\tpublic expectsCCResponse(ctx: GetNode<NodeId & SupportsCC>): boolean {\n\t\tlet expected:\n\t\t\t| DynamicCCResponse<this>\n\t\t\t| ReturnType<DynamicCCResponse<this>> = getExpectedCCResponse(this);\n\n\t\t// Evaluate dynamic CC responses\n\t\tif (\n\t\t\ttypeof expected === \"function\"\n\t\t\t&& !staticExtends(expected, CommandClass)\n\t\t) {\n\t\t\texpected = expected(ctx, this);\n\t\t}\n\t\tif (expected === undefined) return false;\n\t\tif (isArray(expected)) {\n\t\t\treturn expected.every((cc) => staticExtends(cc, CommandClass));\n\t\t} else {\n\t\t\treturn staticExtends(expected, CommandClass);\n\t\t}\n\t}\n\n\tpublic isExpectedCCResponse(\n\t\tctx: GetNode<NodeId & SupportsCC>,\n\t\treceived: CommandClass,\n\t): boolean {\n\t\tif (received.nodeId !== this.nodeId) return false;\n\n\t\tlet expected:\n\t\t\t| DynamicCCResponse<this>\n\t\t\t| ReturnType<DynamicCCResponse<this>> = getExpectedCCResponse(this);\n\n\t\t// Evaluate dynamic CC responses\n\t\tif (\n\t\t\ttypeof expected === \"function\"\n\t\t\t&& !staticExtends(expected, CommandClass)\n\t\t) {\n\t\t\texpected = expected(ctx, this);\n\t\t}\n\n\t\tif (expected == undefined) {\n\t\t\t// Fallback, should not happen if the expected response is defined correctly\n\t\t\treturn false;\n\t\t} else if (\n\t\t\tisArray(expected)\n\t\t\t&& expected.every((cc) => staticExtends(cc, CommandClass))\n\t\t) {\n\t\t\t// The CC always expects a response from the given list, check if the received\n\t\t\t// message is in that list\n\t\t\tif (expected.every((base) => !(received instanceof base))) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else if (staticExtends(expected, CommandClass)) {\n\t\t\t// The CC always expects the same single response, check if this is the one\n\t\t\tif (!(received instanceof expected)) return false;\n\t\t}\n\n\t\t// If the CC wants to test the response, let it\n\t\tconst predicate = getCCResponsePredicate(this);\n\t\tconst ret = predicate?.(this, received) ?? true;\n\n\t\tif (ret === \"checkEncapsulated\") {\n\t\t\tif (\n\t\t\t\tisEncapsulatingCommandClass(this)\n\t\t\t\t&& isEncapsulatingCommandClass(received)\n\t\t\t) {\n\t\t\t\treturn this.encapsulated.isExpectedCCResponse(\n\t\t\t\t\tctx,\n\t\t\t\t\treceived.encapsulated,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Fallback, should not happen if the expected response is defined correctly\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t}\n\n\t/**\n\t * Translates a property identifier into a speaking name for use in an external API\n\t * @param property The property identifier that should be translated\n\t * @param _propertyKey The (optional) property key the translated name may depend on\n\t */\n\tpublic translateProperty(\n\t\t_ctx: GetValueDB,\n\t\tproperty: string | number,\n\t\t_propertyKey?: string | number,\n\t): string {\n\t\t// Overwrite this in derived classes, by default just return the property key\n\t\treturn property.toString();\n\t}\n\n\t/**\n\t * Translates a property key into a speaking name for use in an external API\n\t * @param _property The property the key in question belongs to\n\t * @param propertyKey The property key for which the speaking name should be retrieved\n\t */\n\tpublic translatePropertyKey(\n\t\t_ctx: GetValueDB,\n\t\t_property: string | number,\n\t\tpropertyKey: string | number,\n\t): string | undefined {\n\t\t// Overwrite this in derived classes, by default just return the property key\n\t\treturn propertyKey.toString();\n\t}\n\n\t/** Returns the number of bytes that are added to the payload by this CC */\n\tprotected computeEncapsulationOverhead(): number {\n\t\t// Default is ccId (+ ccCommand):\n\t\treturn (this.isExtended() ? 2 : 1) + 1;\n\t}\n\n\t/** Computes the maximum net payload size that can be transmitted inside this CC */\n\tpublic getMaxPayloadLength(baseLength: number): number {\n\t\tlet ret = baseLength;\n\t\tlet cur: CommandClass | undefined = this;\n\t\twhile (cur) {\n\t\t\tret -= cur.computeEncapsulationOverhead();\n\t\t\tcur = isEncapsulatingCommandClass(cur)\n\t\t\t\t? cur.encapsulated\n\t\t\t\t: undefined;\n\t\t}\n\t\treturn ret;\n\t}\n\n\t/** Checks whether this CC is encapsulated with one that has the given CC id and (optionally) CC Command */\n\tpublic isEncapsulatedWith(\n\t\tccId: CommandClasses,\n\t\tccCommand?: number,\n\t): boolean {\n\t\tlet cc: CommandClass = this;\n\t\t// Check whether there was a S0 encapsulation\n\t\twhile (cc.encapsulatingCC) {\n\t\t\tcc = cc.encapsulatingCC;\n\t\t\tif (\n\t\t\t\tcc.ccId === ccId\n\t\t\t\t&& (ccCommand === undefined || cc.ccCommand === ccCommand)\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/** Traverses the encapsulation stack of this CC outwards and returns the one that has the given CC id and (optionally) CC Command if that exists. */\n\tpublic getEncapsulatingCC(\n\t\tccId: CommandClasses,\n\t\tccCommand?: number,\n\t): CommandClass | undefined {\n\t\tlet cc: CommandClass = this;\n\t\twhile (cc.encapsulatingCC) {\n\t\t\tcc = cc.encapsulatingCC;\n\t\t\tif (\n\t\t\t\tcc.ccId === ccId\n\t\t\t\t&& (ccCommand === undefined || cc.ccCommand === ccCommand)\n\t\t\t) {\n\t\t\t\treturn cc;\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Traverses the encapsulation stack of this CC inwards and returns the one that has the given CC id and (optionally) CC Command if that exists. */\n\tpublic getEncapsulatedCC(\n\t\tccId: CommandClasses,\n\t\tccCommand?: number,\n\t): CommandClass | undefined {\n\t\tconst predicate = (cc: CommandClass): boolean =>\n\t\t\tcc.ccId === ccId\n\t\t\t&& (ccCommand === undefined || cc.ccCommand === ccCommand);\n\n\t\tif (isEncapsulatingCommandClass(this)) {\n\t\t\tif (predicate(this.encapsulated)) return this.encapsulated;\n\t\t\treturn this.encapsulated.getEncapsulatedCC(ccId, ccCommand);\n\t\t} else if (isMultiEncapsulatingCommandClass(this)) {\n\t\t\tfor (const encapsulated of this.encapsulated) {\n\t\t\t\tif (predicate(encapsulated)) return encapsulated;\n\t\t\t\tconst ret = encapsulated.getEncapsulatedCC(ccId, ccCommand);\n\t\t\t\tif (ret) return ret;\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport interface InvalidCCOptions extends CommandClassOptions {\n\tccName: string;\n\treason?: string | ZWaveErrorCodes;\n}\n\nexport class InvalidCC extends CommandClass {\n\tpublic constructor(options: InvalidCCOptions) {\n\t\tsuper(options);\n\t\tthis._ccName = options.ccName;\n\t\t// Numeric reasons are used internally to communicate problems with a CC\n\t\t// without ignoring them entirely\n\t\tthis.reason = options.reason;\n\t}\n\n\tprivate _ccName: string;\n\tpublic get ccName(): string {\n\t\treturn this._ccName;\n\t}\n\tpublic readonly reason?: string | ZWaveErrorCodes;\n\n\tpublic toLogEntry(_ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\ttags: [this.ccName, \"INVALID\"],\n\t\t\tmessage:\n\t\t\t\tthis.reason != undefined\n\t\t\t\t\t? {\n\t\t\t\t\t\t\terror:\n\t\t\t\t\t\t\t\ttypeof this.reason === \"string\"\n\t\t\t\t\t\t\t\t\t? this.reason\n\t\t\t\t\t\t\t\t\t: getEnumMemberName(\n\t\t\t\t\t\t\t\t\t\t\tZWaveErrorCodes,\n\t\t\t\t\t\t\t\t\t\t\tthis.reason,\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t};\n\t}\n}\n\n/** Renders a CC and its encapsulated CC(s) into a tree-shaped log payload */\nexport function ccToLogPayload(\n\tcc: CommandClass,\n\tctx?: GetValueDB,\n): LogPayloadText {\n\tconst entry = cc.toLogEntry(ctx);\n\tconst nested: LogPayload[] = [];\n\tif (entry.message) {\n\t\tconst message = toLogPayload(entry.message);\n\t\t// Hoist tagged payloads nested inside the message dict (e.g. S2 extensions)\n\t\t// into the CC's children, so they render as tree siblings\n\t\tif (message.type === \"dict\" && message.nested) {\n\t\t\tnested.push({ ...message, nested: undefined });\n\t\t\tnested.push(\n\t\t\t\t...(isArray(message.nested)\n\t\t\t\t\t? message.nested\n\t\t\t\t\t: [message.nested]),\n\t\t\t);\n\t\t} else {\n\t\t\tnested.push(message);\n\t\t}\n\t}\n\tif (isEncapsulatingCommandClass(cc)) {\n\t\tnested.push(ccToLogPayload(cc.encapsulated, ctx));\n\t} else if (isMultiEncapsulatingCommandClass(cc)) {\n\t\tfor (const encap of cc.encapsulated) {\n\t\t\tnested.push(ccToLogPayload(encap, ctx));\n\t\t}\n\t}\n\treturn logText([], { tags: entry.tags, nested });\n}\n\nexport type CCConstructor<T extends CommandClass> = typeof CommandClass & {\n\t// I don't like the any, but we need it to support half-implemented CCs (e.g. report classes)\n\tnew (options: any): T;\n};\n\n/**\n * @publicAPI\n * May be used to define different expected CC responses depending on the sent CC\n */\nexport type DynamicCCResponse<\n\tTSent extends CommandClass,\n\tTReceived extends CommandClass = CommandClass,\n> = (\n\tctx: GetNode<NodeId & SupportsCC>,\n\tsentCC: TSent,\n) => CCConstructor<TReceived> | CCConstructor<TReceived>[] | undefined;\n\n/** @publicAPI */\nexport type CCResponseRole =\n\t| boolean // The response was either expected or unexpected\n\t| \"checkEncapsulated\"; // The response role depends on the encapsulated CC\n\n/**\n * @publicAPI\n * A predicate function to test if a received CC matches the sent CC\n */\nexport type CCResponsePredicate<\n\tTSent extends CommandClass,\n\tTReceived extends CommandClass = CommandClass,\n> = (sentCommand: TSent, receivedCommand: TReceived) => CCResponseRole;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AACA;;;;;;;;;;;;AAAA,kBA8CO;AACP,oBAQO;AACP,wBAAwB;AAGxB,oCAUO;AACP,uCAIO;AACP,oBAKO;AAUP,IAAY;CAAZ,SAAYA,kBAAe;AAC1B,EAAAA,iBAAAA,iBAAA,WAAA,IAAA,CAAA,IAAA;AACA,EAAAA,iBAAAA,iBAAA,WAAA,IAAA,CAAA,IAAA;AACA,EAAAA,iBAAAA,iBAAA,YAAA,IAAA,CAAA,IAAA;AACD,GAJY,oBAAA,kBAAe,CAAA,EAAA;AAUrB,SAAU,oBACf,OACA,QAAkC;AAElC,MAAI,OAAO,UAAU,YAAY,OAAO,WAAW,UAAU;AAC5D,WAAO,UAAU;EAClB;AACA,QAAM,eAAe,IAAI,IAAI,KAAK;AAClC,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,eAAe,OAAO,GAAG,CAAC;IACvC;EACD;AACA,aAAO,qBAAQ,CAAA,GAAI,EAAE,MAAM,MAAM,MAAM,OAAM,CAAE;AAChD;AA7BgB;",
6
+ "names": ["CommandRelation"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/lib/CommandClassDecorators.ts"],
4
- "sourcesContent": ["import {\n\ttype CommandClasses,\n\tZWaveError,\n\tZWaveErrorCodes,\n} from \"@zwave-js/core\";\nimport {\n\tcreateReflectionDecorator,\n\tcreateReflectionDecoratorPair,\n\tcreateValuelessReflectionDecorator,\n} from \"@zwave-js/core/reflection\";\nimport type { TypedClassDecorator } from \"@zwave-js/shared\";\nimport type { APIConstructor, CCAPI } from \"./API.js\";\nimport type {\n\tCCConstructor,\n\tCCResponsePredicate,\n\tCommandClass,\n\tDynamicCCResponse,\n} from \"./CommandClass.js\";\nimport type {\n\tDynamicCCValue,\n\tStaticCCValue,\n\tStaticCCValueFactory,\n} from \"./Values.js\";\n\nconst CCAndCommandDecorator = createReflectionDecoratorPair<\n\ttypeof CommandClass,\n\t[ccId: CommandClasses],\n\t[ccCommand: number],\n\tCCConstructor<CommandClass>\n>({ superName: \"ccId\", subName: \"ccCommand\" });\n\n/**\n * @publicAPI\n * Defines the CC ID associated with a Z-Wave Command Class\n */\nexport const commandClass = CCAndCommandDecorator.superDecorator;\n\n/**\n * @publicAPI\n * Looks up the command class constructor for a given CC ID\n */\nexport const getCCConstructor = CCAndCommandDecorator.lookupSuperConstructor;\n\n/**\n * @publicAPI\n * Defines the CC command a subclass of a CC implements\n */\nexport const CCCommand = CCAndCommandDecorator.subDecorator;\n\n/**\n * @publicAPI\n * Retrieves the CC command a subclass of a CC implements\n */\nexport const getCCCommand = CCAndCommandDecorator.lookupSubValue;\n\n/**\n * @publicAPI\n * Looks up the command class constructor for a given CC ID and command\n */\nexport const getCCCommandConstructor =\n\tCCAndCommandDecorator.lookupSubConstructor;\n\n/**\n * @publicAPI\n * Retrieves the CC ID defined for a Z-Wave Command Class\n */\nexport function getCommandClassStatic(\n\tclassConstructor: CCConstructor<CommandClass>,\n): CommandClasses {\n\t// retrieve the current metadata\n\tconst ret = CCAndCommandDecorator.lookupSuperValueStatic(classConstructor);\n\tif (ret == undefined) {\n\t\tthrow new ZWaveError(\n\t\t\t`No command class defined for ${classConstructor.name}!`,\n\t\t\tZWaveErrorCodes.CC_Invalid,\n\t\t);\n\t}\n\treturn ret;\n}\n\nconst apiDecorator = createReflectionDecorator<\n\ttypeof CCAPI,\n\t[cc: CommandClasses],\n\tCommandClasses,\n\tAPIConstructor\n>({\n\tname: \"API\",\n\tvalueFromArgs: (cc) => cc,\n});\n\n/**\n * @publicAPI\n * Defines the CC ID a CC API implementation belongs to\n */\nexport const API = apiDecorator.decorator;\n\n/**\n * @publicAPI\n * Retrieves the CC API constructor that is defined for a Z-Wave CC ID\n */\nexport function getAPI(cc: CommandClasses): APIConstructor | undefined {\n\treturn apiDecorator.lookupConstructorByValue(cc);\n}\n\n/**\n * @publicAPI\n * Retrieves the CC ID associated with a Z-Wave Command Class or CC API\n */\nexport function getCommandClass(cc: CommandClass | CCAPI): CommandClasses {\n\t// get the class constructor\n\tconst constr = cc.constructor;\n\t// retrieve the current metadata\n\tconst ret = CCAndCommandDecorator.lookupSuperValueStatic(\n\t\tconstr as typeof CommandClass,\n\t)\n\t\t?? apiDecorator.lookupValueStatic(constr as typeof CCAPI);\n\n\tif (ret == undefined) {\n\t\tthrow new ZWaveError(\n\t\t\t`No command class defined for ${constr.name}!`,\n\t\t\tZWaveErrorCodes.CC_Invalid,\n\t\t);\n\t}\n\treturn ret;\n}\n\nconst implementedVersionDecorator = createReflectionDecorator<\n\ttypeof CommandClass,\n\t[version: number],\n\tnumber\n>({\n\tname: \"implementedVersion\",\n\tvalueFromArgs: (version) => version,\n\tconstructorLookupKey: false,\n});\n\n/**\n * @publicAPI\n * Defines the implemented version of a Z-Wave command class\n */\nexport const implementedVersion = implementedVersionDecorator.decorator;\n\n/**\n * @publicAPI\n * Retrieves the implemented version defined for a Z-Wave command class\n */\nexport function getImplementedVersion(\n\tcc: CommandClass | CommandClasses,\n): number {\n\t// get the class constructor\n\tlet constr: CCConstructor<CommandClass> | undefined;\n\tif (typeof cc === \"number\") {\n\t\tconstr = getCCConstructor(cc);\n\t} else {\n\t\tconstr = cc.constructor as CCConstructor<CommandClass>;\n\t}\n\n\tif (!constr) return 0;\n\treturn implementedVersionDecorator.lookupValueStatic(constr) ?? 0;\n}\n\n/**\n * @publicAPI\n * Retrieves the implemented version defined for a Z-Wave command class\n */\nexport function getImplementedVersionStatic(\n\tclassConstructor: CCConstructor<CommandClass>,\n): number {\n\treturn implementedVersionDecorator.lookupValueStatic(classConstructor) ?? 0;\n}\n\nconst expectedCCResponseDecorator = createReflectionDecorator<\n\ttypeof CommandClass,\n\t[\n\t\tcc:\n\t\t\t| CCConstructor<CommandClass>\n\t\t\t| DynamicCCResponse<CommandClass, CommandClass>,\n\t\tpredicate?: CCResponsePredicate<CommandClass, CommandClass>,\n\t],\n\t{\n\t\tcc:\n\t\t\t| CCConstructor<CommandClass>\n\t\t\t| DynamicCCResponse<CommandClass, CommandClass>;\n\t\tpredicate?: CCResponsePredicate<CommandClass, CommandClass>;\n\t}\n>({\n\tname: \"expectedCCResponse\",\n\tvalueFromArgs: (cc, predicate) => ({ cc, predicate }),\n\t// We don't need reverse lookup\n\tconstructorLookupKey: false,\n});\n\n/**\n * @publicAPI\n * Defines the expected response associated with a Z-Wave message\n */\nexport function expectedCCResponse<\n\tTTarget extends typeof CommandClass,\n\tTSent extends CommandClass,\n\tTReceived extends CommandClass,\n>(\n\tcc: CCConstructor<TReceived> | DynamicCCResponse<TSent, TReceived>,\n\tpredicate?: CCResponsePredicate<TSent, TReceived>,\n): TypedClassDecorator<TTarget> {\n\treturn expectedCCResponseDecorator.decorator(cc as any, predicate as any);\n}\n\n/**\n * @publicAPI\n * Retrieves the expected response (static or dynamic) defined for a Z-Wave message class\n */\nexport function getExpectedCCResponse<T extends CommandClass>(\n\tccClass: T,\n): typeof CommandClass | DynamicCCResponse<T> | undefined {\n\treturn expectedCCResponseDecorator.lookupValue(ccClass)?.cc;\n}\n\n/**\n * @publicAPI\n * Retrieves the CC response predicate defined for a Z-Wave message class\n */\nexport function getCCResponsePredicate<T extends CommandClass>(\n\tccClass: T,\n): CCResponsePredicate<T> | undefined {\n\treturn expectedCCResponseDecorator.lookupValue(ccClass)?.predicate;\n}\n\nconst ccValuesDecorator = createReflectionDecorator<\n\ttypeof CommandClass,\n\t[valueDefinition: Record<string, StaticCCValue | DynamicCCValue>],\n\tRecord<string, StaticCCValue | DynamicCCValue | undefined>\n>({\n\tname: \"ccValues\",\n\tvalueFromArgs: (valueDefinition) => valueDefinition,\n\t// We don't need reverse lookup\n\tconstructorLookupKey: false,\n});\n\n/**\n * @publicAPI\n * Defines which CC value definitions belong to a Z-Wave command class\n */\nexport const ccValues = ccValuesDecorator.decorator;\n\n/**\n * @publicAPI\n * Retrieves the CC value definitions which belong to a Z-Wave command class\n */\nexport function getCCValues(\n\tcc: CommandClass | CommandClasses,\n): Record<string, StaticCCValue | DynamicCCValue | undefined> | undefined {\n\t// get the class constructor\n\tlet constr: CCConstructor<CommandClass> | undefined;\n\tif (typeof cc === \"number\") {\n\t\tconstr = getCCConstructor(cc);\n\t} else {\n\t\tconstr = cc.constructor as CCConstructor<CommandClass>;\n\t}\n\n\tif (constr) return ccValuesDecorator.lookupValueStatic(constr);\n}\n\nconst ccValue_METADATA = Symbol.for(`METADATA_ccValue`);\n\n// /**\n// * @publicAPI\n// * Defines which CC value a Z-Wave command class property belongs to\n// */\n// export function ccValue<TTarget extends CommandClass>(\n// \tvalue: StaticCCValue,\n// ): TypedPropertyDecorator<TTarget>;\n\n// export function ccValue<TTarget extends CommandClass, TArgs extends any[]>(\n// \tvalue: DynamicCCValue<TArgs>,\n// \tgetArgs: (self: TTarget) => Readonly<TArgs>,\n// ): TypedPropertyDecorator<TTarget>;\n\n// // Ideally this should use the PropertyReflectionDecorator, but we cannot reuse the\n// // target type in the getArgs function then.\n// export function ccValue<TTarget extends CommandClass, TArgs extends any[]>(\n// \t...args:\n// \t\t| [value: StaticCCValue]\n// \t\t| [value: DynamicCCValue<TArgs>, getArgs: (self: TTarget) => TArgs]\n// ): TypedPropertyDecorator<TTarget> {\n// \t// Normalize the arguments to the expected format\n// \tdebugger;\n// \tlet valueOrFactory: StaticCCValue | StaticCCValueFactory<TTarget>;\n// \tif (args.length === 1) {\n// \t\tvalueOrFactory = args[0];\n// \t} else {\n// \t\tconst [value, getArgs] = args;\n// \t\tvalueOrFactory = (self: TTarget) => {\n// \t\t\tconst args = getArgs(self);\n// \t\t\tconst base = value(...args);\n// \t\t\treturn {\n// \t\t\t\t...base,\n// \t\t\t\tis: value.is,\n// \t\t\t\toptions: value.options,\n// \t\t\t};\n// \t\t};\n// \t}\n\n// \treturn function decoratorBody_ccValue(\n// \t\ttarget: TTarget,\n// \t\tproperty: string | number | symbol,\n// \t): void {\n// \t\t// get the class constructor\n// \t\tconst constr = target.constructor;\n\n// \t\t// retrieve the current metadata\n// \t\tconst metadata: Map<\n// \t\t\tstring | number,\n// \t\t\tStaticCCValue | StaticCCValueFactory<TTarget>\n// \t\t> = Reflect.getMetadata(ccValue_METADATA, constr) ?? new Map();\n\n// \t\t// Add the variable\n// \t\tmetadata.set(property as string | number, valueOrFactory);\n\n// \t\t// And store it back\n// \t\tReflect.defineMetadata(ccValue_METADATA, metadata, constr);\n// \t};\n// }\n\nexport function ccValueProperty<\n\tClass extends abstract new (...args: any) => any,\n>(\n\tproperty: keyof InstanceType<Class>,\n\tvalue: StaticCCValue,\n): TypedClassDecorator<Class>;\n\nexport function ccValueProperty<\n\tClass extends abstract new (...args: any) => any,\n\tconst TArgs extends any[],\n>(\n\tproperty: keyof InstanceType<Class>,\n\tvalue: DynamicCCValue<TArgs>,\n\tgetArgs: (self: InstanceType<Class>) => TArgs,\n): TypedClassDecorator<Class>;\n\n/**\n * @publicAPI\n * Defines which CC values the properties of a Z-Wave Command Class correspond to\n */\nexport function ccValueProperty<\n\tClass extends abstract new (...args: any) => any,\n\tconst TArgs extends any[],\n>(\n\tproperty: keyof InstanceType<Class>,\n\t...args:\n\t\t| [value: StaticCCValue]\n\t\t| [\n\t\t\tvalue: DynamicCCValue<TArgs>,\n\t\t\tgetArgs: (self: InstanceType<Class>) => TArgs,\n\t\t]\n): TypedClassDecorator<Class> {\n\treturn function decorator_ccValueProperty(constr: Class): void {\n\t\t// retrieve the current metadata\n\t\tconst metadata: Map<\n\t\t\tstring | number,\n\t\t\tStaticCCValue | StaticCCValueFactory<InstanceType<Class>>\n\t\t> = Reflect.getMetadata(ccValue_METADATA, constr) ?? new Map();\n\n\t\t// Determine the correct metadata\n\t\tlet valueOrFactory:\n\t\t\t| StaticCCValue\n\t\t\t| StaticCCValueFactory<InstanceType<Class>>;\n\t\tif (args.length === 1) {\n\t\t\tvalueOrFactory = args[0];\n\t\t} else {\n\t\t\tconst [value, getArgs] = args;\n\t\t\tvalueOrFactory = (self: InstanceType<Class>) => {\n\t\t\t\tconst args = getArgs(self);\n\t\t\t\tconst base = value(...args);\n\t\t\t\treturn {\n\t\t\t\t\t...base,\n\t\t\t\t\tis: value.is,\n\t\t\t\t\toptions: value.options,\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\n\t\t// Add the metadata\n\t\tmetadata.set(property as string | number, valueOrFactory);\n\n\t\t// And store it back\n\t\tReflect.defineMetadata(ccValue_METADATA, metadata, constr);\n\t};\n}\n\n/**\n * @publicAPI\n * Retrieves the defined mapping between properties and CC values of a Z-Wave command class instance\n */\nexport function getCCValueProperties<TTarget extends CommandClass>(\n\ttarget: TTarget,\n): ReadonlyMap<string | number, StaticCCValue | StaticCCValueFactory<TTarget>> {\n\treturn (\n\t\tReflect.getMetadata(ccValue_METADATA, target.constructor) ?? new Map()\n\t);\n}\n\n// const ccValueDecorator = createPropertyReflectionDecorator<\n// \tCommandClass,\n// \t[value: StaticCCValue | StaticCCValueFactory<CommandClass>],\n// \tStaticCCValue | StaticCCValueFactory<CommandClass>\n// >({\n// \tname: \"ccValue\",\n// \tvalueFromArgs: (valueDefinition) => valueDefinition,\n// });\n\n// /**\n// * @publicAPI\n// * Defines which CC value a Z-Wave command class property belongs to\n// */\n// export const ccValue = ccValueDecorator.decorator;\n\n// /**\n// * @publicAPI\n// * Retrieves the defined mapping between properties and CC values of a Z-Wave command class instance\n// */\n// export const getCCValueDefinitions = ccValueDecorator.lookupValues;\n\nconst supervisionDecorator = createValuelessReflectionDecorator<\n\ttypeof CommandClass\n>({\n\tname: \"useSupervision\",\n});\n\n/**\n * @publicAPI\n * Defines that this CC may be sent supervised\n */\nexport const useSupervision = supervisionDecorator.decorator;\n\n/**\n * @publicAPI\n * Checks if the given CC may be sent supervised\n */\nexport const shouldUseSupervision = supervisionDecorator.isDecorated;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAIO;AACP,wBAIO;AAeP,MAAM,4BAAwB,iDAK5B,EAAE,WAAW,QAAQ,SAAS,YAAW,CAAE;AAMtC,MAAM,eAAe,sBAAsB;AAM3C,MAAM,mBAAmB,sBAAsB;AAM/C,MAAM,YAAY,sBAAsB;AAMxC,MAAM,eAAe,sBAAsB;AAM3C,MAAM,0BACZ,sBAAsB;AAMjB,SAAU,sBACf,kBAA6C;AAG7C,QAAM,MAAM,sBAAsB,uBAAuB,gBAAgB;AACzE,MAAI,OAAO,QAAW;AACrB,UAAM,IAAI,uBACT,gCAAgC,iBAAiB,IAAI,KACrD,4BAAgB,UAAU;EAE5B;AACA,SAAO;AACR;AAZgB;AAchB,MAAM,mBAAe,6CAKnB;EACD,MAAM;EACN,eAAe,wBAAC,OAAO,IAAR;CACf;AAMM,MAAM,MAAM,aAAa;AAM1B,SAAU,OAAO,IAAkB;AACxC,SAAO,aAAa,yBAAyB,EAAE;AAChD;AAFgB;AA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iB,EAAE;EAC7B,OAAO;AACN,aAAS,GAAG;EACb;AAEA,MAAI;AAAQ,WAAO,kBAAkB,kBAAkB,MAAM;AAC9D;AAZgB;AAchB,MAAM,mBAAmB,OAAO,IAAI,kBAAkB;AAiFhD,SAAU,gBAIf,aACG,MAKD;AAEF,SAAO,gCAAS,0BAA0B,QAAa;AAEtD,UAAM,WAGF,QAAQ,YAAY,kBAAkB,MAAM,KAAK,oBAAI,IAAG;AAG5D,QAAI;AAGJ,QAAI,KAAK,WAAW,GAAG;AACtB,uBAAiB,KAAK,CAAC;IACxB,OAAO;AACN,YAAM,CAAC,OAAO,OAAO,IAAI;AACzB,uBAAiB,wBAAC,SAA6B;AAC9C,cAAMA,QAAO,QAAQ,IAAI;AACzB,cAAM,OAAO,MAAM,GAAGA,KAAI;AAC1B,eAAO;UACN,GAAG;UACH,IAAI,MAAM;UACV,SAAS,MAAM;;MAEjB,GARiB;IASlB;AAGA,aAAS,IAAI,UAA6B,cAAc;AAGxD,YAAQ,eAAe,kBAAkB,UAAU,MAAM;EAC1D,GA/BO;AAgCR;AA5CgB;AAkDV,SAAU,qBACf,QAAe;AAEf,SACC,QAAQ,YAAY,kBAAkB,OAAO,WAAW,KAAK,oBAAI,IAAG;AAEtE;AANgB;AA6BhB,MAAM,2BAAuB,sDAE3B;EACD,MAAM;CACN;AAMM,MAAM,iBAAiB,qBAAqB;AAM5C,MAAM,uBAAuB,qBAAqB;",
4
+ "sourcesContent": ["import {\n\ttype CommandClasses,\n\tZWaveError,\n\tZWaveErrorCodes,\n} from \"@zwave-js/core\";\nimport {\n\tcreateReflectionDecorator,\n\tcreateReflectionDecoratorPair,\n\tcreateValuelessReflectionDecorator,\n} from \"@zwave-js/core/reflection\";\nimport type { TypedClassDecorator } from \"@zwave-js/shared\";\n\nimport type { APIConstructor, CCAPI } from \"./API.js\";\nimport type {\n\tCCConstructor,\n\tCCResponsePredicate,\n\tCommandClass,\n\tDynamicCCResponse,\n} from \"./CommandClass.js\";\nimport type {\n\tDynamicCCValue,\n\tStaticCCValue,\n\tStaticCCValueFactory,\n} from \"./Values.js\";\n\nconst CCAndCommandDecorator = createReflectionDecoratorPair<\n\ttypeof CommandClass,\n\t[ccId: CommandClasses],\n\t[ccCommand: number],\n\tCCConstructor<CommandClass>\n>({ superName: \"ccId\", subName: \"ccCommand\" });\n\n/**\n * @publicAPI\n * Defines the CC ID associated with a Z-Wave Command Class\n */\nexport const commandClass = CCAndCommandDecorator.superDecorator;\n\n/**\n * @publicAPI\n * Looks up the command class constructor for a given CC ID\n */\nexport const getCCConstructor = CCAndCommandDecorator.lookupSuperConstructor;\n\n/**\n * @publicAPI\n * Defines the CC command a subclass of a CC implements\n */\nexport const CCCommand = CCAndCommandDecorator.subDecorator;\n\n/**\n * @publicAPI\n * Retrieves the CC command a subclass of a CC implements\n */\nexport const getCCCommand = CCAndCommandDecorator.lookupSubValue;\n\n/**\n * @publicAPI\n * Looks up the command class constructor for a given CC ID and command\n */\nexport const getCCCommandConstructor =\n\tCCAndCommandDecorator.lookupSubConstructor;\n\n/**\n * @publicAPI\n * Retrieves the CC ID defined for a Z-Wave Command Class\n */\nexport function getCommandClassStatic(\n\tclassConstructor: CCConstructor<CommandClass>,\n): CommandClasses {\n\t// retrieve the current metadata\n\tconst ret = CCAndCommandDecorator.lookupSuperValueStatic(classConstructor);\n\tif (ret == undefined) {\n\t\tthrow new ZWaveError(\n\t\t\t`No command class defined for ${classConstructor.name}!`,\n\t\t\tZWaveErrorCodes.CC_Invalid,\n\t\t);\n\t}\n\treturn ret;\n}\n\nconst apiDecorator = createReflectionDecorator<\n\ttypeof CCAPI,\n\t[cc: CommandClasses],\n\tCommandClasses,\n\tAPIConstructor\n>({\n\tname: \"API\",\n\tvalueFromArgs: (cc) => cc,\n});\n\n/**\n * @publicAPI\n * Defines the CC ID a CC API implementation belongs to\n */\nexport const API = apiDecorator.decorator;\n\n/**\n * @publicAPI\n * Retrieves the CC API constructor that is defined for a Z-Wave CC ID\n */\nexport function getAPI(cc: CommandClasses): APIConstructor | undefined {\n\treturn apiDecorator.lookupConstructorByValue(cc);\n}\n\n/**\n * @publicAPI\n * Retrieves the CC ID associated with a Z-Wave Command Class or CC API\n */\nexport function getCommandClass(cc: CommandClass | CCAPI): CommandClasses {\n\t// get the class constructor\n\tconst constr = cc.constructor;\n\t// retrieve the current metadata\n\tconst ret =\n\t\tCCAndCommandDecorator.lookupSuperValueStatic(\n\t\t\tconstr as typeof CommandClass,\n\t\t) ?? apiDecorator.lookupValueStatic(constr as typeof CCAPI);\n\n\tif (ret == undefined) {\n\t\tthrow new ZWaveError(\n\t\t\t`No command class defined for ${constr.name}!`,\n\t\t\tZWaveErrorCodes.CC_Invalid,\n\t\t);\n\t}\n\treturn ret;\n}\n\nconst implementedVersionDecorator = createReflectionDecorator<\n\ttypeof CommandClass,\n\t[version: number],\n\tnumber\n>({\n\tname: \"implementedVersion\",\n\tvalueFromArgs: (version) => version,\n\tconstructorLookupKey: false,\n});\n\n/**\n * @publicAPI\n * Defines the implemented version of a Z-Wave command class\n */\nexport const implementedVersion = implementedVersionDecorator.decorator;\n\n/**\n * @publicAPI\n * Retrieves the implemented version defined for a Z-Wave command class\n */\nexport function getImplementedVersion(\n\tcc: CommandClass | CommandClasses,\n): number {\n\t// get the class constructor\n\tlet constr: CCConstructor<CommandClass> | undefined;\n\tif (typeof cc === \"number\") {\n\t\tconstr = getCCConstructor(cc);\n\t} else {\n\t\tconstr = cc.constructor as CCConstructor<CommandClass>;\n\t}\n\n\tif (!constr) return 0;\n\treturn implementedVersionDecorator.lookupValueStatic(constr) ?? 0;\n}\n\n/**\n * @publicAPI\n * Retrieves the implemented version defined for a Z-Wave command class\n */\nexport function getImplementedVersionStatic(\n\tclassConstructor: CCConstructor<CommandClass>,\n): number {\n\treturn implementedVersionDecorator.lookupValueStatic(classConstructor) ?? 0;\n}\n\nconst expectedCCResponseDecorator = createReflectionDecorator<\n\ttypeof CommandClass,\n\t[\n\t\tcc:\n\t\t\t| CCConstructor<CommandClass>\n\t\t\t| DynamicCCResponse<CommandClass, CommandClass>,\n\t\tpredicate?: CCResponsePredicate<CommandClass, CommandClass>,\n\t],\n\t{\n\t\tcc:\n\t\t\t| CCConstructor<CommandClass>\n\t\t\t| DynamicCCResponse<CommandClass, CommandClass>;\n\t\tpredicate?: CCResponsePredicate<CommandClass, CommandClass>;\n\t}\n>({\n\tname: \"expectedCCResponse\",\n\tvalueFromArgs: (cc, predicate) => ({ cc, predicate }),\n\t// We don't need reverse lookup\n\tconstructorLookupKey: false,\n});\n\n/**\n * @publicAPI\n * Defines the expected response associated with a Z-Wave message\n */\nexport function expectedCCResponse<\n\tTTarget extends typeof CommandClass,\n\tTSent extends CommandClass,\n\tTReceived extends CommandClass,\n>(\n\tcc: CCConstructor<TReceived> | DynamicCCResponse<TSent, TReceived>,\n\tpredicate?: CCResponsePredicate<TSent, TReceived>,\n): TypedClassDecorator<TTarget> {\n\treturn expectedCCResponseDecorator.decorator(cc as any, predicate as any);\n}\n\n/**\n * @publicAPI\n * Retrieves the expected response (static or dynamic) defined for a Z-Wave message class\n */\nexport function getExpectedCCResponse<T extends CommandClass>(\n\tccClass: T,\n): typeof CommandClass | DynamicCCResponse<T> | undefined {\n\treturn expectedCCResponseDecorator.lookupValue(ccClass)?.cc;\n}\n\n/**\n * @publicAPI\n * Retrieves the CC response predicate defined for a Z-Wave message class\n */\nexport function getCCResponsePredicate<T extends CommandClass>(\n\tccClass: T,\n): CCResponsePredicate<T> | undefined {\n\treturn expectedCCResponseDecorator.lookupValue(ccClass)?.predicate;\n}\n\nconst ccValuesDecorator = createReflectionDecorator<\n\ttypeof CommandClass,\n\t[valueDefinition: Record<string, StaticCCValue | DynamicCCValue>],\n\tRecord<string, StaticCCValue | DynamicCCValue | undefined>\n>({\n\tname: \"ccValues\",\n\tvalueFromArgs: (valueDefinition) => valueDefinition,\n\t// We don't need reverse lookup\n\tconstructorLookupKey: false,\n});\n\n/**\n * @publicAPI\n * Defines which CC value definitions belong to a Z-Wave command class\n */\nexport const ccValues = ccValuesDecorator.decorator;\n\n/**\n * @publicAPI\n * Retrieves the CC value definitions which belong to a Z-Wave command class\n */\nexport function getCCValues(\n\tcc: CommandClass | CommandClasses,\n): Record<string, StaticCCValue | DynamicCCValue | undefined> | undefined {\n\t// get the class constructor\n\tlet constr: CCConstructor<CommandClass> | undefined;\n\tif (typeof cc === \"number\") {\n\t\tconstr = getCCConstructor(cc);\n\t} else {\n\t\tconstr = cc.constructor as CCConstructor<CommandClass>;\n\t}\n\n\tif (constr) return ccValuesDecorator.lookupValueStatic(constr);\n}\n\nconst ccValue_METADATA = Symbol.for(`METADATA_ccValue`);\n\n// /**\n// * @publicAPI\n// * Defines which CC value a Z-Wave command class property belongs to\n// */\n// export function ccValue<TTarget extends CommandClass>(\n// \tvalue: StaticCCValue,\n// ): TypedPropertyDecorator<TTarget>;\n\n// export function ccValue<TTarget extends CommandClass, TArgs extends any[]>(\n// \tvalue: DynamicCCValue<TArgs>,\n// \tgetArgs: (self: TTarget) => Readonly<TArgs>,\n// ): TypedPropertyDecorator<TTarget>;\n\n// // Ideally this should use the PropertyReflectionDecorator, but we cannot reuse the\n// // target type in the getArgs function then.\n// export function ccValue<TTarget extends CommandClass, TArgs extends any[]>(\n// \t...args:\n// \t\t| [value: StaticCCValue]\n// \t\t| [value: DynamicCCValue<TArgs>, getArgs: (self: TTarget) => TArgs]\n// ): TypedPropertyDecorator<TTarget> {\n// \t// Normalize the arguments to the expected format\n// \tdebugger;\n// \tlet valueOrFactory: StaticCCValue | StaticCCValueFactory<TTarget>;\n// \tif (args.length === 1) {\n// \t\tvalueOrFactory = args[0];\n// \t} else {\n// \t\tconst [value, getArgs] = args;\n// \t\tvalueOrFactory = (self: TTarget) => {\n// \t\t\tconst args = getArgs(self);\n// \t\t\tconst base = value(...args);\n// \t\t\treturn {\n// \t\t\t\t...base,\n// \t\t\t\tis: value.is,\n// \t\t\t\toptions: value.options,\n// \t\t\t};\n// \t\t};\n// \t}\n\n// \treturn function decoratorBody_ccValue(\n// \t\ttarget: TTarget,\n// \t\tproperty: string | number | symbol,\n// \t): void {\n// \t\t// get the class constructor\n// \t\tconst constr = target.constructor;\n\n// \t\t// retrieve the current metadata\n// \t\tconst metadata: Map<\n// \t\t\tstring | number,\n// \t\t\tStaticCCValue | StaticCCValueFactory<TTarget>\n// \t\t> = Reflect.getMetadata(ccValue_METADATA, constr) ?? new Map();\n\n// \t\t// Add the variable\n// \t\tmetadata.set(property as string | number, valueOrFactory);\n\n// \t\t// And store it back\n// \t\tReflect.defineMetadata(ccValue_METADATA, metadata, constr);\n// \t};\n// }\n\nexport function ccValueProperty<\n\tClass extends abstract new (...args: any) => any,\n>(\n\tproperty: keyof InstanceType<Class>,\n\tvalue: StaticCCValue,\n): TypedClassDecorator<Class>;\n\nexport function ccValueProperty<\n\tClass extends abstract new (...args: any) => any,\n\tconst TArgs extends any[],\n>(\n\tproperty: keyof InstanceType<Class>,\n\tvalue: DynamicCCValue<TArgs>,\n\tgetArgs: (self: InstanceType<Class>) => TArgs,\n): TypedClassDecorator<Class>;\n\n/**\n * @publicAPI\n * Defines which CC values the properties of a Z-Wave Command Class correspond to\n */\nexport function ccValueProperty<\n\tClass extends abstract new (...args: any) => any,\n\tconst TArgs extends any[],\n>(\n\tproperty: keyof InstanceType<Class>,\n\t...args:\n\t\t| [value: StaticCCValue]\n\t\t| [\n\t\t\t\tvalue: DynamicCCValue<TArgs>,\n\t\t\t\tgetArgs: (self: InstanceType<Class>) => TArgs,\n\t\t ]\n): TypedClassDecorator<Class> {\n\treturn function decorator_ccValueProperty(constr: Class): void {\n\t\t// retrieve the current metadata\n\t\tconst metadata: Map<\n\t\t\tstring | number,\n\t\t\tStaticCCValue | StaticCCValueFactory<InstanceType<Class>>\n\t\t> = Reflect.getMetadata(ccValue_METADATA, constr) ?? new Map();\n\n\t\t// Determine the correct metadata\n\t\tlet valueOrFactory:\n\t\t\t| StaticCCValue\n\t\t\t| StaticCCValueFactory<InstanceType<Class>>;\n\t\tif (args.length === 1) {\n\t\t\tvalueOrFactory = args[0];\n\t\t} else {\n\t\t\tconst [value, getArgs] = args;\n\t\t\tvalueOrFactory = (self: InstanceType<Class>) => {\n\t\t\t\tconst args = getArgs(self);\n\t\t\t\tconst base = value(...args);\n\t\t\t\treturn {\n\t\t\t\t\t...base,\n\t\t\t\t\tis: value.is,\n\t\t\t\t\toptions: value.options,\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\n\t\t// Add the metadata\n\t\tmetadata.set(property as string | number, valueOrFactory);\n\n\t\t// And store it back\n\t\tReflect.defineMetadata(ccValue_METADATA, metadata, constr);\n\t};\n}\n\n/**\n * @publicAPI\n * Retrieves the defined mapping between properties and CC values of a Z-Wave command class instance\n */\nexport function getCCValueProperties<TTarget extends CommandClass>(\n\ttarget: TTarget,\n): ReadonlyMap<string | number, StaticCCValue | StaticCCValueFactory<TTarget>> {\n\treturn (\n\t\tReflect.getMetadata(ccValue_METADATA, target.constructor) ?? new Map()\n\t);\n}\n\n// const ccValueDecorator = createPropertyReflectionDecorator<\n// \tCommandClass,\n// \t[value: StaticCCValue | StaticCCValueFactory<CommandClass>],\n// \tStaticCCValue | StaticCCValueFactory<CommandClass>\n// >({\n// \tname: \"ccValue\",\n// \tvalueFromArgs: (valueDefinition) => valueDefinition,\n// });\n\n// /**\n// * @publicAPI\n// * Defines which CC value a Z-Wave command class property belongs to\n// */\n// export const ccValue = ccValueDecorator.decorator;\n\n// /**\n// * @publicAPI\n// * Retrieves the defined mapping between properties and CC values of a Z-Wave command class instance\n// */\n// export const getCCValueDefinitions = ccValueDecorator.lookupValues;\n\nconst supervisionDecorator = createValuelessReflectionDecorator<\n\ttypeof CommandClass\n>({\n\tname: \"useSupervision\",\n});\n\n/**\n * @publicAPI\n * Defines that this CC may be sent supervised\n */\nexport const useSupervision = supervisionDecorator.decorator;\n\n/**\n * @publicAPI\n * Checks if the given CC may be sent supervised\n */\nexport const shouldUseSupervision = supervisionDecorator.isDecorated;\n"],
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,GARiB;IASlB;AAGA,aAAS,IAAI,UAA6B,cAAc;AAGxD,YAAQ,eAAe,kBAAkB,UAAU,MAAM;EAC1D,GA/BO;AAgCR;AA5CgB;AAkDV,SAAU,qBACf,QAAe;AAEf,SACC,QAAQ,YAAY,kBAAkB,OAAO,WAAW,KAAK,oBAAI,IAAG;AAEtE;AANgB;AA6BhB,MAAM,2BAAuB,sDAE3B;EACD,MAAM;CACN;AAMM,MAAM,iBAAiB,qBAAqB;AAM5C,MAAM,uBAAuB,qBAAqB;",
6
6
  "names": ["args"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/lib/EncapsulatingCommandClass.ts"],
4
- "sourcesContent": ["import { isArray } from \"alcalzone-shared/typeguards\";\nimport { CommandClass } from \"./CommandClass.js\";\n\nexport type EncapsulatedCommandClass = CommandClass & {\n\tencapsulatingCC: EncapsulatingCommandClass;\n};\n\nexport type EncapsulatingCommandClass = CommandClass & {\n\tencapsulated: EncapsulatedCommandClass;\n};\n\n/**\n * Tests if a given CC statically implements the EncapsulatingCommandClassStatic interface\n * @param cc The command class instance to test\n */\nexport function isEncapsulatingCommandClass(\n\tcc: any,\n): cc is CommandClass & EncapsulatingCommandClass {\n\t// To satisfy the criterion, cc must be a CommandClass\n\tif (!(cc instanceof CommandClass)) return false;\n\t// The encapsulated property must be a CommandClass\n\tif (!((cc as any).encapsulated instanceof CommandClass)) {\n\t\treturn false;\n\t}\n\n\t// Walk up the static side of the prototype chain to see if it has the required methods\n\tlet proto: any = Object.getPrototypeOf(cc.constructor);\n\twhile (proto) {\n\t\tif (typeof proto.encapsulate === \"function\") {\n\t\t\treturn true;\n\t\t}\n\t\tproto = Object.getPrototypeOf(proto);\n\t}\n\treturn false;\n}\n\nexport function getInnermostCommandClass(cc: CommandClass): CommandClass {\n\tif (isEncapsulatingCommandClass(cc)) {\n\t\treturn getInnermostCommandClass(cc.encapsulated);\n\t} else {\n\t\treturn cc;\n\t}\n}\n\nexport interface MultiEncapsulatingCommandClass {\n\tencapsulated: EncapsulatedCommandClass[];\n}\n\n/**\n * Tests if a given CC statically implements the EncapsulatingCommandClassStatic interface\n * @param cc The command class instance to test\n */\nexport function isMultiEncapsulatingCommandClass(\n\tcc: any,\n): cc is CommandClass & MultiEncapsulatingCommandClass {\n\t// To satisfy the criterion, cc must be a CommandClass\n\tif (!(cc instanceof CommandClass)) return false;\n\t// The encapsulated property must array of CCs\n\tif (\n\t\t!(\n\t\t\tisArray((cc as any).encapsulated)\n\t\t\t&& (cc as any).encapsulated.every(\n\t\t\t\t(item: any) => item instanceof CommandClass,\n\t\t\t)\n\t\t)\n\t) {\n\t\treturn false;\n\t}\n\n\t// Walk up the static side of the prototype chain to see if it has the required methods\n\tlet proto: any = Object.getPrototypeOf(cc.constructor);\n\twhile (proto) {\n\t\tif (typeof proto.encapsulate === \"function\") {\n\t\t\treturn true;\n\t\t}\n\t\tproto = Object.getPrototypeOf(proto);\n\t}\n\treturn false;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAAA,wBAAwB;AACxB,0BAA6B;AAcvB,SAAU,4BACf,IAAO;AAGP,MAAI,EAAE,cAAc;AAAe,WAAO;AAE1C,MAAI,EAAG,GAAW,wBAAwB,mCAAe;AACxD,WAAO;EACR;AAGA,MAAI,QAAa,OAAO,eAAe,GAAG,WAAW;AACrD,SAAO,OAAO;AACb,QAAI,OAAO,MAAM,gBAAgB,YAAY;AAC5C,aAAO;IACR;AACA,YAAQ,OAAO,eAAe,KAAK;EACpC;AACA,SAAO;AACR;AAnBgB;AAqBV,SAAU,yBAAyB,IAAgB;AACxD,MAAI,4BAA4B,EAAE,GAAG;AACpC,WAAO,yBAAyB,GAAG,YAAY;EAChD,OAAO;AACN,WAAO;EACR;AACD;AANgB;AAgBV,SAAU,iCACf,IAAO;AAGP,MAAI,EAAE,cAAc;AAAe,WAAO;AAE1C,MACC,MACC,2BAAS,GAAW,YAAY,KAC5B,GAAW,aAAa,MAC3B,CAAC,SAAc,gBAAgB,gCAAY,IAG5C;AACD,WAAO;EACR;AAGA,MAAI,QAAa,OAAO,eAAe,GAAG,WAAW;AACrD,SAAO,OAAO;AACb,QAAI,OAAO,MAAM,gBAAgB,YAAY;AAC5C,aAAO;IACR;AACA,YAAQ,OAAO,eAAe,KAAK;EACpC;AACA,SAAO;AACR;AA1BgB;",
4
+ "sourcesContent": ["import { isArray } from \"alcalzone-shared/typeguards\";\n\nimport { CommandClass } from \"./CommandClass.js\";\n\nexport type EncapsulatedCommandClass = CommandClass & {\n\tencapsulatingCC: EncapsulatingCommandClass;\n};\n\nexport type EncapsulatingCommandClass = CommandClass & {\n\tencapsulated: EncapsulatedCommandClass;\n};\n\n/**\n * Tests if a given CC statically implements the EncapsulatingCommandClassStatic interface\n * @param cc The command class instance to test\n */\nexport function isEncapsulatingCommandClass(\n\tcc: any,\n): cc is CommandClass & EncapsulatingCommandClass {\n\t// To satisfy the criterion, cc must be a CommandClass\n\tif (!(cc instanceof CommandClass)) return false;\n\t// The encapsulated property must be a CommandClass\n\tif (!((cc as any).encapsulated instanceof CommandClass)) {\n\t\treturn false;\n\t}\n\n\t// Walk up the static side of the prototype chain to see if it has the required methods\n\tlet proto: any = Object.getPrototypeOf(cc.constructor);\n\twhile (proto) {\n\t\tif (typeof proto.encapsulate === \"function\") {\n\t\t\treturn true;\n\t\t}\n\t\tproto = Object.getPrototypeOf(proto);\n\t}\n\treturn false;\n}\n\nexport function getInnermostCommandClass(cc: CommandClass): CommandClass {\n\tif (isEncapsulatingCommandClass(cc)) {\n\t\treturn getInnermostCommandClass(cc.encapsulated);\n\t} else {\n\t\treturn cc;\n\t}\n}\n\nexport interface MultiEncapsulatingCommandClass {\n\tencapsulated: EncapsulatedCommandClass[];\n}\n\n/**\n * Tests if a given CC statically implements the EncapsulatingCommandClassStatic interface\n * @param cc The command class instance to test\n */\nexport function isMultiEncapsulatingCommandClass(\n\tcc: any,\n): cc is CommandClass & MultiEncapsulatingCommandClass {\n\t// To satisfy the criterion, cc must be a CommandClass\n\tif (!(cc instanceof CommandClass)) return false;\n\t// The encapsulated property must array of CCs\n\tif (\n\t\t!(\n\t\t\tisArray((cc as any).encapsulated)\n\t\t\t&& (cc as any).encapsulated.every(\n\t\t\t\t(item: any) => item instanceof CommandClass,\n\t\t\t)\n\t\t)\n\t) {\n\t\treturn false;\n\t}\n\n\t// Walk up the static side of the prototype chain to see if it has the required methods\n\tlet proto: any = Object.getPrototypeOf(cc.constructor);\n\twhile (proto) {\n\t\tif (typeof proto.encapsulate === \"function\") {\n\t\t\treturn true;\n\t\t}\n\t\tproto = Object.getPrototypeOf(proto);\n\t}\n\treturn false;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAAA,wBAAwB;AAExB,0BAA6B;AAcvB,SAAU,4BACf,IAAO;AAGP,MAAI,EAAE,cAAc;AAAe,WAAO;AAE1C,MAAI,EAAG,GAAW,wBAAwB,mCAAe;AACxD,WAAO;EACR;AAGA,MAAI,QAAa,OAAO,eAAe,GAAG,WAAW;AACrD,SAAO,OAAO;AACb,QAAI,OAAO,MAAM,gBAAgB,YAAY;AAC5C,aAAO;IACR;AACA,YAAQ,OAAO,eAAe,KAAK;EACpC;AACA,SAAO;AACR;AAnBgB;AAqBV,SAAU,yBAAyB,IAAgB;AACxD,MAAI,4BAA4B,EAAE,GAAG;AACpC,WAAO,yBAAyB,GAAG,YAAY;EAChD,OAAO;AACN,WAAO;EACR;AACD;AANgB;AAgBV,SAAU,iCACf,IAAO;AAGP,MAAI,EAAE,cAAc;AAAe,WAAO;AAE1C,MACC,MACC,2BAAS,GAAW,YAAY,KAC5B,GAAW,aAAa,MAC3B,CAAC,SAAc,gBAAgB,gCAAY,IAG5C;AACD,WAAO;EACR;AAGA,MAAI,QAAa,OAAO,eAAe,GAAG,WAAW;AACrD,SAAO,OAAO;AACb,QAAI,OAAO,MAAM,gBAAgB,YAAY;AAC5C,aAAO;IACR;AACA,YAAQ,OAAO,eAAe,KAAK;EACpC;AACA,SAAO;AACR;AA1BgB;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/lib/NotificationEventPayload.ts"],
4
- "sourcesContent": ["import type { Duration } from \"@zwave-js/core\";\nimport type { BytesView } from \"@zwave-js/shared\";\nimport type { CommandClass } from \"./CommandClass.js\";\n\nexport interface NotificationEventPayload {\n\ttoNotificationEventParameters():\n\t\t| BytesView\n\t\t| Duration\n\t\t| Record<string, number>;\n}\n\n/**\n * Tests if the given message contains a CC\n */\nexport function isNotificationEventPayload<T extends CommandClass>(\n\tmsg: T,\n): msg is T & NotificationEventPayload {\n\treturn typeof (msg as any).toNotificationEventParameters === \"function\";\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAWA;;;;;AAGM,SAAU,2BACf,KAAM;AAEN,SAAO,OAAQ,IAAY,kCAAkC;AAC9D;AAJgB;",
4
+ "sourcesContent": ["import type { Duration } from \"@zwave-js/core\";\nimport type { BytesView } from \"@zwave-js/shared\";\n\nimport type { CommandClass } from \"./CommandClass.js\";\n\nexport interface NotificationEventPayload {\n\ttoNotificationEventParameters():\n\t\t| BytesView\n\t\t| Duration\n\t\t| Record<string, number>;\n}\n\n/**\n * Tests if the given message contains a CC\n */\nexport function isNotificationEventPayload<T extends CommandClass>(\n\tmsg: T,\n): msg is T & NotificationEventPayload {\n\treturn typeof (msg as any).toNotificationEventParameters === \"function\";\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAYA;;;;;AAGM,SAAU,2BACf,KAAM;AAEN,SAAO,OAAQ,IAAY,kCAAkC;AAC9D;AAJgB;",
6
6
  "names": []
7
7
  }
@@ -296,10 +296,7 @@ let MPANExtension = (() => {
296
296
  }
297
297
  static expectedLength = 19;
298
298
  serialize(moreToFollow) {
299
- this.payload = import_shared.Bytes.concat([
300
- [this.groupId],
301
- this.innerMPANState
302
- ]);
299
+ this.payload = import_shared.Bytes.concat([[this.groupId], this.innerMPANState]);
303
300
  return super.serialize(moreToFollow);
304
301
  }
305
302
  toLogEntryDict() {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src_gen/lib/Security2/Extension.ts"],
4
- "sourcesContent": ["import {\n\ttype LogPayloadText,\n\ttype MessageRecord,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tlogBuffer,\n\tlogDict,\n\tlogText,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport { createSimpleReflectionDecorator } from \"@zwave-js/core/reflection\";\nimport {\n\tBytes,\n\ttype BytesView,\n\tbuffer2hex,\n\tgetEnumMemberName,\n\tgetenv,\n} from \"@zwave-js/shared\";\n\nenum S2ExtensionType {\n\tSPAN = 0x01,\n\tMPAN = 0x02,\n\tMGRP = 0x03,\n\tMOS = 0x04,\n}\n\nconst extensionTypeDecorator = createSimpleReflectionDecorator<\n\ttypeof Security2Extension,\n\t[type: S2ExtensionType],\n\tSecurity2ExtensionConstructor<Security2Extension>\n>({\n\tname: \"extensionType\",\n});\n\n/** Defines which S2 extension type a subclass of S2Extension has */\nexport const extensionType = extensionTypeDecorator.decorator;\n\n/** Returns which S2 extension type a subclass of S2Extension has */\nexport const getExtensionType = extensionTypeDecorator.lookupValue;\n\n/**\n * Looks up the S2 extension constructor for a given S2 extension type\n */\nexport const getS2ExtensionConstructor =\n\textensionTypeDecorator.lookupConstructor;\n\nexport type Security2ExtensionConstructor<T extends Security2Extension> =\n\t& typeof Security2Extension\n\t& {\n\t\tnew (options: Security2ExtensionOptions): T;\n\t};\n\nexport enum ValidateS2ExtensionResult {\n\tOK,\n\tDiscardExtension,\n\tDiscardCommand,\n}\n\n/** Tests if the extension may be accepted */\nexport function validateS2Extension(\n\text: Security2Extension,\n\twasEncrypted: boolean,\n): ValidateS2ExtensionResult {\n\tif (ext instanceof InvalidExtension) {\n\t\t// The extension could not be parsed, ignore it\n\t\treturn ValidateS2ExtensionResult.DiscardExtension;\n\t}\n\n\tif (ext.critical && !(ext.type in S2ExtensionType)) {\n\t\t// A receiving node MUST discard the entire command if the Critical flag\n\t\t// is set to \u20181\u2019 and the Type field advertises a value that the\n\t\t// receiving node does not support.\n\t\treturn ValidateS2ExtensionResult.DiscardCommand;\n\t}\n\n\t// Check if the extension is correctly encrypted or not encrypted\n\tswitch (ext.type) {\n\t\tcase S2ExtensionType.MPAN:\n\t\t\tif (!wasEncrypted) {\n\t\t\t\treturn ValidateS2ExtensionResult.DiscardExtension;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase S2ExtensionType.SPAN:\n\t\tcase S2ExtensionType.MGRP:\n\t\tcase S2ExtensionType.MOS:\n\t\t\tif (wasEncrypted) {\n\t\t\t\treturn ValidateS2ExtensionResult.DiscardExtension;\n\t\t\t}\n\t\t\tbreak;\n\t}\n\n\treturn ValidateS2ExtensionResult.OK;\n}\n\nexport class Security2ExtensionRaw {\n\tpublic constructor(\n\t\tpublic type: S2ExtensionType,\n\t\tpublic critical: boolean,\n\t\tpublic readonly moreToFollow: boolean,\n\t\tpublic payload: BytesView,\n\t) {}\n\n\tpublic static parse(data: BytesView): Security2ExtensionRaw {\n\t\tvalidatePayload(data.length >= 2);\n\t\tconst totalLength = data[0];\n\t\tconst moreToFollow = !!(data[1] & 0b1000_0000);\n\t\tconst critical = !!(data[1] & 0b0100_0000);\n\t\tconst type = data[1] & 0b11_1111;\n\t\tconst payload = data.subarray(2, totalLength);\n\n\t\treturn new Security2ExtensionRaw(type, critical, moreToFollow, payload);\n\t}\n\n\tpublic withPayload(payload: Bytes): Security2ExtensionRaw {\n\t\treturn new Security2ExtensionRaw(\n\t\t\tthis.type,\n\t\t\tthis.critical,\n\t\t\tthis.moreToFollow,\n\t\t\tpayload,\n\t\t);\n\t}\n}\n\ninterface Security2ExtensionBaseOptions {\n\tcritical?: boolean;\n\tmoreToFollow?: boolean;\n}\n\ninterface Security2ExtensionOptions extends Security2ExtensionBaseOptions {\n\ttype?: S2ExtensionType;\n\tpayload?: BytesView;\n}\n\nexport class Security2Extension {\n\tpublic constructor(options: Security2ExtensionOptions) {\n\t\tconst {\n\t\t\t// Try to determine the extension type if none is given\n\t\t\ttype = getExtensionType(this),\n\t\t\tcritical = false,\n\t\t\tmoreToFollow = false,\n\t\t\tpayload = new Uint8Array(),\n\t\t} = options;\n\n\t\tif (type == undefined) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"A Security2Extension must have a given or predefined extension type\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\n\t\tthis.type = type;\n\t\tthis.critical = critical;\n\t\tthis.moreToFollow = moreToFollow;\n\t\tthis.payload = payload;\n\t}\n\n\tpublic static parse(\n\t\tdata: BytesView,\n\t): Security2Extension {\n\t\tconst raw = Security2ExtensionRaw.parse(data);\n\t\tconst Constructor = getS2ExtensionConstructor(raw.type)\n\t\t\t?? Security2Extension;\n\t\treturn Constructor.from(raw);\n\t}\n\n\t/** Creates an instance of the message that is serialized in the given buffer */\n\tpublic static from(\n\t\traw: Security2ExtensionRaw,\n\t): Security2Extension {\n\t\treturn new this({\n\t\t\ttype: raw.type,\n\t\t\tcritical: raw.critical,\n\t\t\tmoreToFollow: raw.moreToFollow,\n\t\t\tpayload: raw.payload,\n\t\t});\n\t}\n\n\tpublic type: S2ExtensionType;\n\tpublic critical: boolean;\n\tpublic readonly moreToFollow?: boolean;\n\tpublic payload: BytesView;\n\n\tpublic isEncrypted(): boolean {\n\t\treturn false;\n\t}\n\n\tpublic serialize(moreToFollow: boolean): Bytes {\n\t\treturn Bytes.concat([\n\t\t\t[\n\t\t\t\t2 + this.payload.length,\n\t\t\t\t(moreToFollow ? 0b1000_0000 : 0)\n\t\t\t\t| (this.critical ? 0b0100_0000 : 0)\n\t\t\t\t| (this.type & 0b11_1111),\n\t\t\t],\n\t\t\tthis.payload,\n\t\t]);\n\t}\n\n\t/** Returns the number of bytes the first extension in the buffer occupies */\n\tpublic static getExtensionLength(\n\t\tdata: BytesView,\n\t): { expected?: number; actual: number } {\n\t\tconst actual = data[0];\n\t\tlet expected: number | undefined;\n\n\t\t// For known extensions, return the expected length\n\t\tconst type = data[1] & 0b11_1111;\n\t\tswitch (type) {\n\t\t\tcase S2ExtensionType.SPAN:\n\t\t\t\texpected = SPANExtension.expectedLength;\n\t\t\t\tbreak;\n\t\t\tcase S2ExtensionType.MPAN:\n\t\t\t\texpected = MPANExtension.expectedLength;\n\t\t\t\tbreak;\n\t\t\tcase S2ExtensionType.MGRP:\n\t\t\t\texpected = MGRPExtension.expectedLength;\n\t\t\t\tbreak;\n\t\t\tcase S2ExtensionType.MOS:\n\t\t\t\texpected = MOSExtension.expectedLength;\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn { expected, actual };\n\t}\n\n\t/** Returns the number of bytes the serialized extension will occupy */\n\tpublic computeLength(): number {\n\t\treturn 2 + this.payload.length;\n\t}\n\n\tpublic toLogEntry(): LogPayloadText {\n\t\treturn logText([], {\n\t\t\ttags: [getEnumMemberName(S2ExtensionType, this.type)],\n\t\t\tnested: logDict(this.toLogEntryDict()),\n\t\t});\n\t}\n\n\tprotected toLogEntryDict(): MessageRecord {\n\t\treturn {\n\t\t\tpayload: logBuffer(this.payload),\n\t\t};\n\t}\n}\n\nexport class InvalidExtension extends Security2Extension {\n}\n\ninterface SPANExtensionOptions {\n\tsenderEI: BytesView;\n}\n\n@extensionType(S2ExtensionType.SPAN)\nexport class SPANExtension extends Security2Extension {\n\tpublic constructor(\n\t\toptions: SPANExtensionOptions & Security2ExtensionBaseOptions,\n\t) {\n\t\tif (options.senderEI.length !== 16) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The sender's entropy must be a 16-byte buffer!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tsuper({ critical: true, ...options });\n\t\tthis.senderEI = options.senderEI;\n\t}\n\n\tpublic static from(raw: Security2ExtensionRaw): Security2Extension {\n\t\tvalidatePayload(raw.payload.length === 16);\n\t\tconst senderEI = raw.payload;\n\n\t\treturn new SPANExtension({\n\t\t\tcritical: raw.critical,\n\t\t\tmoreToFollow: raw.moreToFollow,\n\t\t\tsenderEI,\n\t\t});\n\t}\n\n\tpublic senderEI: BytesView;\n\tpublic static readonly expectedLength = 18;\n\n\tpublic serialize(moreToFollow: boolean): Bytes {\n\t\tthis.payload = this.senderEI;\n\t\treturn super.serialize(moreToFollow);\n\t}\n\n\tprotected toLogEntryDict(): MessageRecord {\n\t\treturn {\n\t\t\t\"sender EI\": buffer2hex(this.senderEI),\n\t\t};\n\t}\n}\n\ninterface MPANExtensionOptions {\n\tgroupId: number;\n\tinnerMPANState: BytesView;\n}\n\n@extensionType(S2ExtensionType.MPAN)\nexport class MPANExtension extends Security2Extension {\n\tpublic constructor(\n\t\toptions: MPANExtensionOptions & Security2ExtensionBaseOptions,\n\t) {\n\t\tif (options.innerMPANState.length !== 16) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The inner MPAN state must be a 16-byte buffer!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tsuper({ critical: true, ...options });\n\t\tthis.groupId = options.groupId;\n\t\tthis.innerMPANState = options.innerMPANState;\n\t}\n\n\tpublic static from(raw: Security2ExtensionRaw): Security2Extension {\n\t\tvalidatePayload(raw.payload.length === 17);\n\t\tconst groupId = raw.payload[0];\n\t\tconst innerMPANState = raw.payload.subarray(1);\n\n\t\treturn new MPANExtension({\n\t\t\tcritical: raw.critical,\n\t\t\tmoreToFollow: raw.moreToFollow,\n\t\t\tgroupId,\n\t\t\tinnerMPANState,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\tpublic innerMPANState: BytesView;\n\n\tpublic isEncrypted(): boolean {\n\t\treturn true;\n\t}\n\n\tpublic static readonly expectedLength = 19;\n\n\tpublic serialize(moreToFollow: boolean): Bytes {\n\t\tthis.payload = Bytes.concat([\n\t\t\t[this.groupId],\n\t\t\tthis.innerMPANState,\n\t\t]);\n\t\treturn super.serialize(moreToFollow);\n\t}\n\n\tprotected toLogEntryDict(): MessageRecord {\n\t\tconst mpanState = getenv(\"NODE_ENV\") === \"test\"\n\t\t\t\t|| getenv(\"NODE_ENV\") === \"development\"\n\t\t\t? buffer2hex(this.innerMPANState)\n\t\t\t: \"(hidden)\";\n\t\treturn {\n\t\t\t\"group ID\": this.groupId,\n\t\t\t\"MPAN state\": mpanState,\n\t\t};\n\t}\n}\n\ninterface MGRPExtensionOptions {\n\tgroupId: number;\n}\n\n@extensionType(S2ExtensionType.MGRP)\nexport class MGRPExtension extends Security2Extension {\n\tpublic constructor(\n\t\toptions: MGRPExtensionOptions & Security2ExtensionBaseOptions,\n\t) {\n\t\tsuper({ critical: true, ...options });\n\t\tthis.groupId = options.groupId;\n\t}\n\n\tpublic static from(raw: Security2ExtensionRaw): Security2Extension {\n\t\tvalidatePayload(raw.payload.length === 1);\n\t\tconst groupId = raw.payload[0];\n\n\t\treturn new MGRPExtension({\n\t\t\tcritical: raw.critical,\n\t\t\tmoreToFollow: raw.moreToFollow,\n\t\t\tgroupId,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\n\tpublic static readonly expectedLength = 3;\n\n\tpublic serialize(moreToFollow: boolean): Bytes {\n\t\tthis.payload = Bytes.from([this.groupId]);\n\t\treturn super.serialize(moreToFollow);\n\t}\n\n\tprotected toLogEntryDict(): MessageRecord {\n\t\treturn {\n\t\t\t\"group ID\": this.groupId,\n\t\t};\n\t}\n}\n\n@extensionType(S2ExtensionType.MOS)\nexport class MOSExtension extends Security2Extension {\n\tpublic constructor(options: Security2ExtensionBaseOptions = {}) {\n\t\tsuper({ critical: false, ...options });\n\t}\n\n\tpublic static readonly expectedLength = 2;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBASO;AACP,wBAAgD;AAChD,oBAMO;AAEP,IAAK;CAAL,SAA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qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;;IACC,YACC,SAA6D;AAE7D,YAAM,EAAE,UAAU,MAAM,GAAG,QAAO,CAAE;AACpC,WAAK,UAAU,QAAQ;IACxB;IAEO,OAAO,KAAK,KAA0B;AAC5C,uCAAgB,IAAI,QAAQ,WAAW,CAAC;AACxC,YAAM,UAAU,IAAI,QAAQ,CAAC;AAE7B,aAAO,IAAIC,eAAc;QACxB,UAAU,IAAI;QACd,cAAc,IAAI;QAClB;OACA;IACF;IAEO;IAEA,OAAgB,iBAAiB;IAEjC,UAAU,cAAqB;AACrC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,OAAO,CAAC;AACxC,aAAO,MAAM,UAAU,YAAY;IACpC;IAEU,iBAAc;AACvB,aAAO;QACN,YAAY,KAAK;;IAEnB;;AAhCY,0CAAA,YAAA,uBAAA;;;;;IAoCA,gBAAY,MAAA;0BADxB,cAAc,gBAAgB,GAAG,CAAC;;;;oBACD;oCAAA,YAAkB;WAAA;;;;;;;;AAApD,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;;IACC,YAAmB,UAAyC,CAAA,GAAE;AAC7D,YAAM,EAAE,UAAU,OAAO,GAAG,QAAO,CAAE;IACtC;IAEO,OAAgB,iBAAiB;;AAL5B,0CAAA,YAAA,uBAAA;;;;;",
4
+ "sourcesContent": ["import {\n\ttype LogPayloadText,\n\ttype MessageRecord,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tlogBuffer,\n\tlogDict,\n\tlogText,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport { createSimpleReflectionDecorator } from \"@zwave-js/core/reflection\";\nimport {\n\tBytes,\n\ttype BytesView,\n\tbuffer2hex,\n\tgetEnumMemberName,\n\tgetenv,\n} from \"@zwave-js/shared\";\n\nenum S2ExtensionType {\n\tSPAN = 0x01,\n\tMPAN = 0x02,\n\tMGRP = 0x03,\n\tMOS = 0x04,\n}\n\nconst extensionTypeDecorator = createSimpleReflectionDecorator<\n\ttypeof Security2Extension,\n\t[type: S2ExtensionType],\n\tSecurity2ExtensionConstructor<Security2Extension>\n>({\n\tname: \"extensionType\",\n});\n\n/** Defines which S2 extension type a subclass of S2Extension has */\nexport const extensionType = extensionTypeDecorator.decorator;\n\n/** Returns which S2 extension type a subclass of S2Extension has */\nexport const getExtensionType = extensionTypeDecorator.lookupValue;\n\n/**\n * Looks up the S2 extension constructor for a given S2 extension type\n */\nexport const getS2ExtensionConstructor =\n\textensionTypeDecorator.lookupConstructor;\n\nexport type Security2ExtensionConstructor<T extends Security2Extension> =\n\ttypeof Security2Extension & {\n\t\tnew (options: Security2ExtensionOptions): T;\n\t};\n\nexport enum ValidateS2ExtensionResult {\n\tOK,\n\tDiscardExtension,\n\tDiscardCommand,\n}\n\n/** Tests if the extension may be accepted */\nexport function validateS2Extension(\n\text: Security2Extension,\n\twasEncrypted: boolean,\n): ValidateS2ExtensionResult {\n\tif (ext instanceof InvalidExtension) {\n\t\t// The extension could not be parsed, ignore it\n\t\treturn ValidateS2ExtensionResult.DiscardExtension;\n\t}\n\n\tif (ext.critical && !(ext.type in S2ExtensionType)) {\n\t\t// A receiving node MUST discard the entire command if the Critical flag\n\t\t// is set to \u20181\u2019 and the Type field advertises a value that the\n\t\t// receiving node does not support.\n\t\treturn ValidateS2ExtensionResult.DiscardCommand;\n\t}\n\n\t// Check if the extension is correctly encrypted or not encrypted\n\tswitch (ext.type) {\n\t\tcase S2ExtensionType.MPAN:\n\t\t\tif (!wasEncrypted) {\n\t\t\t\treturn ValidateS2ExtensionResult.DiscardExtension;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase S2ExtensionType.SPAN:\n\t\tcase S2ExtensionType.MGRP:\n\t\tcase S2ExtensionType.MOS:\n\t\t\tif (wasEncrypted) {\n\t\t\t\treturn ValidateS2ExtensionResult.DiscardExtension;\n\t\t\t}\n\t\t\tbreak;\n\t}\n\n\treturn ValidateS2ExtensionResult.OK;\n}\n\nexport class Security2ExtensionRaw {\n\tpublic constructor(\n\t\tpublic type: S2ExtensionType,\n\t\tpublic critical: boolean,\n\t\tpublic readonly moreToFollow: boolean,\n\t\tpublic payload: BytesView,\n\t) {}\n\n\tpublic static parse(data: BytesView): Security2ExtensionRaw {\n\t\tvalidatePayload(data.length >= 2);\n\t\tconst totalLength = data[0];\n\t\tconst moreToFollow = !!(data[1] & 0b1000_0000);\n\t\tconst critical = !!(data[1] & 0b0100_0000);\n\t\tconst type = data[1] & 0b11_1111;\n\t\tconst payload = data.subarray(2, totalLength);\n\n\t\treturn new Security2ExtensionRaw(type, critical, moreToFollow, payload);\n\t}\n\n\tpublic withPayload(payload: Bytes): Security2ExtensionRaw {\n\t\treturn new Security2ExtensionRaw(\n\t\t\tthis.type,\n\t\t\tthis.critical,\n\t\t\tthis.moreToFollow,\n\t\t\tpayload,\n\t\t);\n\t}\n}\n\ninterface Security2ExtensionBaseOptions {\n\tcritical?: boolean;\n\tmoreToFollow?: boolean;\n}\n\ninterface Security2ExtensionOptions extends Security2ExtensionBaseOptions {\n\ttype?: S2ExtensionType;\n\tpayload?: BytesView;\n}\n\nexport class Security2Extension {\n\tpublic constructor(options: Security2ExtensionOptions) {\n\t\tconst {\n\t\t\t// Try to determine the extension type if none is given\n\t\t\ttype = getExtensionType(this),\n\t\t\tcritical = false,\n\t\t\tmoreToFollow = false,\n\t\t\tpayload = new Uint8Array(),\n\t\t} = options;\n\n\t\tif (type == undefined) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"A Security2Extension must have a given or predefined extension type\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\n\t\tthis.type = type;\n\t\tthis.critical = critical;\n\t\tthis.moreToFollow = moreToFollow;\n\t\tthis.payload = payload;\n\t}\n\n\tpublic static parse(data: BytesView): Security2Extension {\n\t\tconst raw = Security2ExtensionRaw.parse(data);\n\t\tconst Constructor =\n\t\t\tgetS2ExtensionConstructor(raw.type) ?? Security2Extension;\n\t\treturn Constructor.from(raw);\n\t}\n\n\t/** Creates an instance of the message that is serialized in the given buffer */\n\tpublic static from(raw: Security2ExtensionRaw): Security2Extension {\n\t\treturn new this({\n\t\t\ttype: raw.type,\n\t\t\tcritical: raw.critical,\n\t\t\tmoreToFollow: raw.moreToFollow,\n\t\t\tpayload: raw.payload,\n\t\t});\n\t}\n\n\tpublic type: S2ExtensionType;\n\tpublic critical: boolean;\n\tpublic readonly moreToFollow?: boolean;\n\tpublic payload: BytesView;\n\n\tpublic isEncrypted(): boolean {\n\t\treturn false;\n\t}\n\n\tpublic serialize(moreToFollow: boolean): Bytes {\n\t\treturn Bytes.concat([\n\t\t\t[\n\t\t\t\t2 + this.payload.length,\n\t\t\t\t(moreToFollow ? 0b1000_0000 : 0)\n\t\t\t\t\t| (this.critical ? 0b0100_0000 : 0)\n\t\t\t\t\t| (this.type & 0b11_1111),\n\t\t\t],\n\t\t\tthis.payload,\n\t\t]);\n\t}\n\n\t/** Returns the number of bytes the first extension in the buffer occupies */\n\tpublic static getExtensionLength(data: BytesView): {\n\t\texpected?: number;\n\t\tactual: number;\n\t} {\n\t\tconst actual = data[0];\n\t\tlet expected: number | undefined;\n\n\t\t// For known extensions, return the expected length\n\t\tconst type = data[1] & 0b11_1111;\n\t\tswitch (type) {\n\t\t\tcase S2ExtensionType.SPAN:\n\t\t\t\texpected = SPANExtension.expectedLength;\n\t\t\t\tbreak;\n\t\t\tcase S2ExtensionType.MPAN:\n\t\t\t\texpected = MPANExtension.expectedLength;\n\t\t\t\tbreak;\n\t\t\tcase S2ExtensionType.MGRP:\n\t\t\t\texpected = MGRPExtension.expectedLength;\n\t\t\t\tbreak;\n\t\t\tcase S2ExtensionType.MOS:\n\t\t\t\texpected = MOSExtension.expectedLength;\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn { expected, actual };\n\t}\n\n\t/** Returns the number of bytes the serialized extension will occupy */\n\tpublic computeLength(): number {\n\t\treturn 2 + this.payload.length;\n\t}\n\n\tpublic toLogEntry(): LogPayloadText {\n\t\treturn logText([], {\n\t\t\ttags: [getEnumMemberName(S2ExtensionType, this.type)],\n\t\t\tnested: logDict(this.toLogEntryDict()),\n\t\t});\n\t}\n\n\tprotected toLogEntryDict(): MessageRecord {\n\t\treturn {\n\t\t\tpayload: logBuffer(this.payload),\n\t\t};\n\t}\n}\n\nexport class InvalidExtension extends Security2Extension {}\n\ninterface SPANExtensionOptions {\n\tsenderEI: BytesView;\n}\n\n@extensionType(S2ExtensionType.SPAN)\nexport class SPANExtension extends Security2Extension {\n\tpublic constructor(\n\t\toptions: SPANExtensionOptions & Security2ExtensionBaseOptions,\n\t) {\n\t\tif (options.senderEI.length !== 16) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The sender's entropy must be a 16-byte buffer!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tsuper({ critical: true, ...options });\n\t\tthis.senderEI = options.senderEI;\n\t}\n\n\tpublic static from(raw: Security2ExtensionRaw): Security2Extension {\n\t\tvalidatePayload(raw.payload.length === 16);\n\t\tconst senderEI = raw.payload;\n\n\t\treturn new SPANExtension({\n\t\t\tcritical: raw.critical,\n\t\t\tmoreToFollow: raw.moreToFollow,\n\t\t\tsenderEI,\n\t\t});\n\t}\n\n\tpublic senderEI: BytesView;\n\tpublic static readonly expectedLength = 18;\n\n\tpublic serialize(moreToFollow: boolean): Bytes {\n\t\tthis.payload = this.senderEI;\n\t\treturn super.serialize(moreToFollow);\n\t}\n\n\tprotected toLogEntryDict(): MessageRecord {\n\t\treturn {\n\t\t\t\"sender EI\": buffer2hex(this.senderEI),\n\t\t};\n\t}\n}\n\ninterface MPANExtensionOptions {\n\tgroupId: number;\n\tinnerMPANState: BytesView;\n}\n\n@extensionType(S2ExtensionType.MPAN)\nexport class MPANExtension extends Security2Extension {\n\tpublic constructor(\n\t\toptions: MPANExtensionOptions & Security2ExtensionBaseOptions,\n\t) {\n\t\tif (options.innerMPANState.length !== 16) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The inner MPAN state must be a 16-byte buffer!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tsuper({ critical: true, ...options });\n\t\tthis.groupId = options.groupId;\n\t\tthis.innerMPANState = options.innerMPANState;\n\t}\n\n\tpublic static from(raw: Security2ExtensionRaw): Security2Extension {\n\t\tvalidatePayload(raw.payload.length === 17);\n\t\tconst groupId = raw.payload[0];\n\t\tconst innerMPANState = raw.payload.subarray(1);\n\n\t\treturn new MPANExtension({\n\t\t\tcritical: raw.critical,\n\t\t\tmoreToFollow: raw.moreToFollow,\n\t\t\tgroupId,\n\t\t\tinnerMPANState,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\tpublic innerMPANState: BytesView;\n\n\tpublic isEncrypted(): boolean {\n\t\treturn true;\n\t}\n\n\tpublic static readonly expectedLength = 19;\n\n\tpublic serialize(moreToFollow: boolean): Bytes {\n\t\tthis.payload = Bytes.concat([[this.groupId], this.innerMPANState]);\n\t\treturn super.serialize(moreToFollow);\n\t}\n\n\tprotected toLogEntryDict(): MessageRecord {\n\t\tconst mpanState =\n\t\t\tgetenv(\"NODE_ENV\") === \"test\"\n\t\t\t|| getenv(\"NODE_ENV\") === \"development\"\n\t\t\t\t? buffer2hex(this.innerMPANState)\n\t\t\t\t: \"(hidden)\";\n\t\treturn {\n\t\t\t\"group ID\": this.groupId,\n\t\t\t\"MPAN state\": mpanState,\n\t\t};\n\t}\n}\n\ninterface MGRPExtensionOptions {\n\tgroupId: number;\n}\n\n@extensionType(S2ExtensionType.MGRP)\nexport class MGRPExtension extends Security2Extension {\n\tpublic constructor(\n\t\toptions: MGRPExtensionOptions & Security2ExtensionBaseOptions,\n\t) {\n\t\tsuper({ critical: true, ...options });\n\t\tthis.groupId = options.groupId;\n\t}\n\n\tpublic static from(raw: Security2ExtensionRaw): Security2Extension {\n\t\tvalidatePayload(raw.payload.length === 1);\n\t\tconst groupId = raw.payload[0];\n\n\t\treturn new MGRPExtension({\n\t\t\tcritical: raw.critical,\n\t\t\tmoreToFollow: raw.moreToFollow,\n\t\t\tgroupId,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\n\tpublic static readonly expectedLength = 3;\n\n\tpublic serialize(moreToFollow: boolean): Bytes {\n\t\tthis.payload = Bytes.from([this.groupId]);\n\t\treturn super.serialize(moreToFollow);\n\t}\n\n\tprotected toLogEntryDict(): MessageRecord {\n\t\treturn {\n\t\t\t\"group ID\": this.groupId,\n\t\t};\n\t}\n}\n\n@extensionType(S2ExtensionType.MOS)\nexport class MOSExtension extends Security2Extension {\n\tpublic constructor(options: Security2ExtensionBaseOptions = {}) {\n\t\tsuper({ critical: false, ...options });\n\t}\n\n\tpublic static readonly expectedLength = 2;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBASO;AACP,wBAAgD;AAChD,oBAMO;AAEP,IAAK;CAAL,SAAKA,kBAAe;AACnB,EAAAA,iBAAAA,iBAAA,MAAA,IAAA,CAAA,IAAA;AACA,EAAAA,iBAAAA,iBAAA,MAAA,IAAA,CAAA,IAAA;AACA,EAAAA,iBAAAA,iBAAA,MAAA,IAAA,CAAA,IAAA;AACA,EAAAA,iBAAAA,iBAAA,KAAA,IAAA,CAAA,IAAA;AACD,GALK,oBAAA,kBAAe,CAAA,EAAA;AAOpB,MAAM,6BAAyB,mDAI7B;EACD,MAAM;CACN;AAGM,MAAM,gBAAgB,uBAAuB;AAG7C,MAAM,mBAAmB,uBAAuB;AAKhD,MAAM,4BACZ,uBAAuB;AAOxB,IAAY;CAAZ,SAAYC,4BAAyB;AACpC,EAAAA,2BAAAA,2BAAA,IAAA,IAAA,CAAA,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UAAU,oBAAM,KAAK,CAAC,KAAK,OAAO,CAAC;AACxC,aAAO,MAAM,UAAU,YAAY;IACpC;IAEU,iBAAc;AACvB,aAAO;QACN,YAAY,KAAK;;IAEnB;;AAhCY,0CAAA,YAAA,uBAAA;;;;;IAoCA,gBAAY,MAAA;0BADxB,cAAc,gBAAgB,GAAG,CAAC;;;;oBACD;oCAAA,YAAkB;WAAA;;;;;;;;AAApD,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;;IACC,YAAmB,UAAyC,CAAA,GAAE;AAC7D,YAAM,EAAE,UAAU,OAAO,GAAG,QAAO,CAAE;IACtC;IAEO,OAAgB,iBAAiB;;AAL5B,0CAAA,YAAA,uBAAA;;;;;",
6
6
  "names": ["S2ExtensionType", "ValidateS2ExtensionResult", "SPANExtension", "MPANExtension", "MGRPExtension"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src_gen/lib/Security2/shared.ts"],
4
- "sourcesContent": ["/** @publicAPI */\nexport enum KEXSchemes {\n\tKEXScheme1 = 1,\n}\n\n/** @publicAPI */\nexport enum ECDHProfiles {\n\tCurve25519 = 0,\n}\n\n/** @publicAPI */\nexport enum KEXFailType {\n\tNoKeyMatch = 0x01, // KEX_KEY\n\tNoSupportedScheme = 0x02, // KEX_SCHEME\n\tNoSupportedCurve = 0x03, // KEX_CURVES\n\tDecrypt = 0x05,\n\tBootstrappingCanceled = 0x06, // CANCEL\n\tWrongSecurityLevel = 0x07, // AUTH\n\tKeyNotGranted = 0x08, // GET\n\tNoVerify = 0x09, // VERIFY\n\tDifferentKey = 0x0a, // REPORT\n}\n\n/** @publicAPI */\nexport const inclusionTimeouts = Object.freeze(\n\t{\n\t\tTA1: 10000,\n\t\tTA2: 10000,\n\t\tTA3: 10000,\n\t\tTA4: 10000,\n\t\tTA5: 10000,\n\t\tTAI1: 240000,\n\t\tTAI2: 240000,\n\t\tTB1: 30000,\n\t\tTB2: 240000,\n\t\tTB3: 10000,\n\t\tTB4: 10000,\n\t\tTB5: 10000,\n\t\tTBI1: 240000,\n\t} as const,\n);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;AACA,IAAY;CAAZ,SAAYA,aAAU;AACrB,EAAAA,YAAAA,YAAA,YAAA,IAAA,CAAA,IAAA;AACD,GAFY,eAAA,aAAU,CAAA,EAAA;AAKtB,IAAY;CAAZ,SAAYC,eAAY;AACvB,EAAAA,cAAAA,cAAA,YAAA,IAAA,CAAA,IAAA;AACD,GAFY,iBAAA,eAAY,CAAA,EAAA;AAKxB,IAAY;CAAZ,SAAYC,cAAW;AACtB,EAAAA,aAAAA,aAAA,YAAA,IAAA,CAAA,IAAA;AACA,EAAAA,aAAAA,aAAA,mBAAA,IAAA,CAAA,IAAA;AACA,EAAAA,aAAAA,aAAA,kBAAA,IAAA,CAAA,IAAA;AACA,EAAAA,aAAAA,aAAA,SAAA,IAAA,CAAA,IAAA;AACA,EAAAA,aAAAA,aAAA,uBAAA,IAAA,CAAA,IAAA;AACA,EAAAA,aAAAA,aAAA,oBAAA,IAAA,CAAA,IAAA;AACA,EAAAA,aAAAA,aAAA,eAAA,IAAA,CAAA,IAAA;AACA,EAAAA,aAAAA,aAAA,UAAA,IAAA,CAAA,IAAA;AACA,EAAAA,aAAAA,aAAA,cAAA,IAAA,EAAA,IAAA;AACD,GAVY,gBAAA,cAAW,CAAA,EAAA;AAahB,MAAM,oBAAoB,OAAO,OACvC;EACC,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,MAAM;EACN,MAAM;EACN,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,MAAM;CACG;",
4
+ "sourcesContent": ["/** @publicAPI */\nexport enum KEXSchemes {\n\tKEXScheme1 = 1,\n}\n\n/** @publicAPI */\nexport enum ECDHProfiles {\n\tCurve25519 = 0,\n}\n\n/** @publicAPI */\nexport enum KEXFailType {\n\tNoKeyMatch = 0x01, // KEX_KEY\n\tNoSupportedScheme = 0x02, // KEX_SCHEME\n\tNoSupportedCurve = 0x03, // KEX_CURVES\n\tDecrypt = 0x05,\n\tBootstrappingCanceled = 0x06, // CANCEL\n\tWrongSecurityLevel = 0x07, // AUTH\n\tKeyNotGranted = 0x08, // GET\n\tNoVerify = 0x09, // VERIFY\n\tDifferentKey = 0x0a, // REPORT\n}\n\n/** @publicAPI */\nexport const inclusionTimeouts = Object.freeze({\n\tTA1: 10000,\n\tTA2: 10000,\n\tTA3: 10000,\n\tTA4: 10000,\n\tTA5: 10000,\n\tTAI1: 240000,\n\tTAI2: 240000,\n\tTB1: 30000,\n\tTB2: 240000,\n\tTB3: 10000,\n\tTB4: 10000,\n\tTB5: 10000,\n\tTBI1: 240000,\n} as const);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;AACA,IAAY;CAAZ,SAAYA,aAAU;AACrB,EAAAA,YAAAA,YAAA,YAAA,IAAA,CAAA,IAAA;AACD,GAFY,eAAA,aAAU,CAAA,EAAA;AAKtB,IAAY;CAAZ,SAAYC,eAAY;AACvB,EAAAA,cAAAA,cAAA,YAAA,IAAA,CAAA,IAAA;AACD,GAFY,iBAAA,eAAY,CAAA,EAAA;AAKxB,IAAY;CAAZ,SAAYC,cAAW;AACtB,EAAAA,aAAAA,aAAA,YAAA,IAAA,CAAA,IAAA;AACA,EAAAA,aAAAA,aAAA,mBAAA,IAAA,CAAA,IAAA;AACA,EAAAA,aAAAA,aAAA,kBAAA,IAAA,CAAA,IAAA;AACA,EAAAA,aAAAA,aAAA,SAAA,IAAA,CAAA,IAAA;AACA,EAAAA,aAAAA,aAAA,uBAAA,IAAA,CAAA,IAAA;AACA,EAAAA,aAAAA,aAAA,oBAAA,IAAA,CAAA,IAAA;AACA,EAAAA,aAAAA,aAAA,eAAA,IAAA,CAAA,IAAA;AACA,EAAAA,aAAAA,aAAA,UAAA,IAAA,CAAA,IAAA;AACA,EAAAA,aAAAA,aAAA,cAAA,IAAA,EAAA,IAAA;AACD,GAVY,gBAAA,cAAW,CAAA,EAAA;AAahB,MAAM,oBAAoB,OAAO,OAAO;EAC9C,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,MAAM;EACN,MAAM;EACN,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,MAAM;CACG;",
6
6
  "names": ["KEXSchemes", "ECDHProfiles", "KEXFailType"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/lib/SetValueResult.ts"],
4
- "sourcesContent": ["import type { Duration, SupervisionResult } from \"@zwave-js/core\";\n\n/**\n * Indicates the status of a `setValue` call. This enum is an extension of `SupervisionStatus`\n * with additional status codes to indicate errors that are not related to supervision.\n */\nexport enum SetValueStatus {\n\t/** The device reports no support for this command */\n\tNoDeviceSupport = 0x00,\n\t/** The device has accepted the command and is working on it */\n\tWorking = 0x01,\n\t/** The device has rejected the command */\n\tFail = 0x02,\n\t/** The endpoint specified in the value ID does not exist */\n\tEndpointNotFound = 0x03,\n\t/** The given CC or its API is not implemented (yet) or it has no `setValue` implementation */\n\tNotImplemented = 0x04,\n\t/** The value to set (or a related value) is invalid */\n\tInvalidValue = 0x05,\n\t/** The command was sent successfully, but it is unknown whether it was executed */\n\tSuccessUnsupervised = 0xfe,\n\t/** The device has executed the command successfully */\n\tSuccess = 0xff,\n}\n\n/** Indicates the result of a `setValue` call. */\nexport type SetValueResult =\n\t// Derived from SupervisionResult\n\t| {\n\t\tstatus:\n\t\t\t| SetValueStatus.NoDeviceSupport\n\t\t\t| SetValueStatus.Fail\n\t\t\t| SetValueStatus.Success;\n\t\tremainingDuration?: undefined;\n\t\tmessage?: undefined;\n\t}\n\t| {\n\t\tstatus: SetValueStatus.Working;\n\t\tremainingDuration: Duration;\n\t\tmessage?: undefined;\n\t}\n\t// Added by setValue\n\t| {\n\t\tstatus: SetValueStatus.SuccessUnsupervised;\n\t\tremainingDuration?: undefined;\n\t\tmessage?: undefined;\n\t}\n\t| {\n\t\tstatus:\n\t\t\t| SetValueStatus.EndpointNotFound\n\t\t\t| SetValueStatus.NotImplemented\n\t\t\t| SetValueStatus.InvalidValue;\n\t\tremainingDuration?: undefined;\n\t\tmessage: string;\n\t};\n\nexport function supervisionResultToSetValueResult(\n\tresult: SupervisionResult | undefined,\n): SetValueResult {\n\tif (result == undefined) {\n\t\treturn {\n\t\t\tstatus: SetValueStatus.SuccessUnsupervised,\n\t\t};\n\t} else {\n\t\t// @ts-expect-error We only care about the compatible subset of status codes\n\t\treturn result;\n\t}\n}\n\n/** Tests whether a `SetValueResult` indicates that the device accepted the command. */\nexport function setValueSucceeded(\n\tresult: SetValueResult,\n): result is SetValueResult & {\n\tstatus: SetValueStatus.Success | SetValueStatus.Working;\n} {\n\treturn (\n\t\tresult.status === SetValueStatus.Success\n\t\t|| result.status === SetValueStatus.Working\n\t);\n}\n\n/** Tests whether a `SetValueResult` indicates that the command could not be sent or the device did not accept the command. */\nexport function setValueFailed(\n\tresult: SetValueResult,\n): result is SetValueResult & {\n\tstatus:\n\t\t| SetValueStatus.NoDeviceSupport\n\t\t| SetValueStatus.Fail\n\t\t| SetValueStatus.EndpointNotFound\n\t\t| SetValueStatus.NotImplemented\n\t\t| SetValueStatus.InvalidValue;\n} {\n\treturn (\n\t\tresult.status === SetValueStatus.NoDeviceSupport\n\t\t|| result.status === SetValueStatus.Fail\n\t\t|| result.status === SetValueStatus.EndpointNotFound\n\t\t|| result.status === SetValueStatus.NotImplemented\n\t\t|| result.status === SetValueStatus.InvalidValue\n\t);\n}\n\n/** Tests whether a `SetValueResult` indicates that the command was sent and that the device maybe accepted the command. */\nexport function setValueWasUnsupervisedOrSucceeded(\n\tresult: SetValueResult,\n): result is SetValueResult & {\n\tstatus:\n\t\t| SetValueStatus.SuccessUnsupervised\n\t\t| SetValueStatus.Success\n\t\t| SetValueStatus.Working;\n} {\n\treturn (\n\t\tresult.status === SetValueStatus.SuccessUnsupervised\n\t\t|| setValueSucceeded(result)\n\t);\n}\n"],
4
+ "sourcesContent": ["import type { Duration, SupervisionResult } from \"@zwave-js/core\";\n\n/**\n * Indicates the status of a `setValue` call. This enum is an extension of `SupervisionStatus`\n * with additional status codes to indicate errors that are not related to supervision.\n */\nexport enum SetValueStatus {\n\t/** The device reports no support for this command */\n\tNoDeviceSupport = 0x00,\n\t/** The device has accepted the command and is working on it */\n\tWorking = 0x01,\n\t/** The device has rejected the command */\n\tFail = 0x02,\n\t/** The endpoint specified in the value ID does not exist */\n\tEndpointNotFound = 0x03,\n\t/** The given CC or its API is not implemented (yet) or it has no `setValue` implementation */\n\tNotImplemented = 0x04,\n\t/** The value to set (or a related value) is invalid */\n\tInvalidValue = 0x05,\n\t/** The command was sent successfully, but it is unknown whether it was executed */\n\tSuccessUnsupervised = 0xfe,\n\t/** The device has executed the command successfully */\n\tSuccess = 0xff,\n}\n\n/** Indicates the result of a `setValue` call. */\nexport type SetValueResult =\n\t// Derived from SupervisionResult\n\t| {\n\t\t\tstatus:\n\t\t\t\t| SetValueStatus.NoDeviceSupport\n\t\t\t\t| SetValueStatus.Fail\n\t\t\t\t| SetValueStatus.Success;\n\t\t\tremainingDuration?: undefined;\n\t\t\tmessage?: undefined;\n\t }\n\t| {\n\t\t\tstatus: SetValueStatus.Working;\n\t\t\tremainingDuration: Duration;\n\t\t\tmessage?: undefined;\n\t }\n\t// Added by setValue\n\t| {\n\t\t\tstatus: SetValueStatus.SuccessUnsupervised;\n\t\t\tremainingDuration?: undefined;\n\t\t\tmessage?: undefined;\n\t }\n\t| {\n\t\t\tstatus:\n\t\t\t\t| SetValueStatus.EndpointNotFound\n\t\t\t\t| SetValueStatus.NotImplemented\n\t\t\t\t| SetValueStatus.InvalidValue;\n\t\t\tremainingDuration?: undefined;\n\t\t\tmessage: string;\n\t };\n\nexport function supervisionResultToSetValueResult(\n\tresult: SupervisionResult | undefined,\n): SetValueResult {\n\tif (result == undefined) {\n\t\treturn {\n\t\t\tstatus: SetValueStatus.SuccessUnsupervised,\n\t\t};\n\t} else {\n\t\t// @ts-expect-error We only care about the compatible subset of status codes\n\t\treturn result;\n\t}\n}\n\n/** Tests whether a `SetValueResult` indicates that the device accepted the command. */\nexport function setValueSucceeded(\n\tresult: SetValueResult,\n): result is SetValueResult & {\n\tstatus: SetValueStatus.Success | SetValueStatus.Working;\n} {\n\treturn (\n\t\tresult.status === SetValueStatus.Success\n\t\t|| result.status === SetValueStatus.Working\n\t);\n}\n\n/** Tests whether a `SetValueResult` indicates that the command could not be sent or the device did not accept the command. */\nexport function setValueFailed(\n\tresult: SetValueResult,\n): result is SetValueResult & {\n\tstatus:\n\t\t| SetValueStatus.NoDeviceSupport\n\t\t| SetValueStatus.Fail\n\t\t| SetValueStatus.EndpointNotFound\n\t\t| SetValueStatus.NotImplemented\n\t\t| SetValueStatus.InvalidValue;\n} {\n\treturn (\n\t\tresult.status === SetValueStatus.NoDeviceSupport\n\t\t|| result.status === SetValueStatus.Fail\n\t\t|| result.status === SetValueStatus.EndpointNotFound\n\t\t|| result.status === SetValueStatus.NotImplemented\n\t\t|| result.status === SetValueStatus.InvalidValue\n\t);\n}\n\n/** Tests whether a `SetValueResult` indicates that the command was sent and that the device maybe accepted the command. */\nexport function setValueWasUnsupervisedOrSucceeded(\n\tresult: SetValueResult,\n): result is SetValueResult & {\n\tstatus:\n\t\t| SetValueStatus.SuccessUnsupervised\n\t\t| SetValueStatus.Success\n\t\t| SetValueStatus.Working;\n} {\n\treturn (\n\t\tresult.status === SetValueStatus.SuccessUnsupervised\n\t\t|| setValueSucceeded(result)\n\t);\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;;AAIA,IAAY;CAAZ,SAAYA,iBAAc;AAEzB,EAAAA,gBAAAA,gBAAA,iBAAA,IAAA,CAAA,IAAA;AAEA,EAAAA,gBAAAA,gBAAA,SAAA,IAAA,CAAA,IAAA;AAEA,EAAAA,gBAAAA,gBAAA,MAAA,IAAA,CAAA,IAAA;AAEA,EAAAA,gBAAAA,gBAAA,kBAAA,IAAA,CAAA,IAAA;AAEA,EAAAA,gBAAAA,gBAAA,gBAAA,IAAA,CAAA,IAAA;AAEA,EAAAA,gBAAAA,gBAAA,cAAA,IAAA,CAAA,IAAA;AAEA,EAAAA,gBAAAA,gBAAA,qBAAA,IAAA,GAAA,IAAA;AAEA,EAAAA,gBAAAA,gBAAA,SAAA,IAAA,GAAA,IAAA;AACD,GAjBY,mBAAA,iBAAc,CAAA,EAAA;AAkDpB,SAAU,kCACf,QAAqC;AAErC,MAAI,UAAU,QAAW;AACxB,WAAO;MACN,QAAQ,eAAe;;EAEzB,OAAO;AAEN,WAAO;EACR;AACD;AAXgB;AAcV,SAAU,kBACf,QAAsB;AAItB,SACC,OAAO,WAAW,eAAe,WAC9B,OAAO,WAAW,eAAe;AAEtC;AATgB;AAYV,SAAU,eACf,QAAsB;AAStB,SACC,OAAO,WAAW,eAAe,mBAC9B,OAAO,WAAW,eAAe,QACjC,OAAO,WAAW,eAAe,oBACjC,OAAO,WAAW,eAAe,kBACjC,OAAO,WAAW,eAAe;AAEtC;AAjBgB;AAoBV,SAAU,mCACf,QAAsB;AAOtB,SACC,OAAO,WAAW,eAAe,uBAC9B,kBAAkB,MAAM;AAE7B;AAZgB;",
6
6
  "names": ["SetValueStatus"]
7
7
  }
@@ -2,7 +2,7 @@ import type { GetDeviceConfig } from "@zwave-js/config";
2
2
  import type { CommandClasses, EndpointId, GetValueDB, ValueID, ValueMetadata } from "@zwave-js/core";
3
3
  import { type FnOrStatic, type ReturnTypeOrStatic } from "@zwave-js/shared";
4
4
  import type { ValueIDProperties } from "./API.js";
5
- declare function defineCCValues<T extends CommandClasses>(commandClass: T, _: Record<string, CCValueBlueprint | DynamicCCValueBlueprint<any[]>>): typeof import("../cc/_CCValues.generated.js").CCValues[T];
5
+ declare function defineCCValues<T extends CommandClasses>(commandClass: T, _: Record<string, CCValueBlueprint | DynamicCCValueBlueprint<any[]>>): (typeof import("../cc/_CCValues.generated.js").CCValues)[T];
6
6
  export interface CCValueOptions {
7
7
  /**
8
8
  * Whether the CC value is internal. Internal values are not exposed to the user.