@zwave-js/cc 14.0.0-beta.4 → 14.0.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 (331) hide show
  1. package/build/cjs/cc/AlarmSensorCC.js +381 -266
  2. package/build/cjs/cc/AlarmSensorCC.js.map +3 -3
  3. package/build/cjs/cc/AssociationCC.js +669 -503
  4. package/build/cjs/cc/AssociationCC.js.map +3 -3
  5. package/build/cjs/cc/AssociationGroupInfoCC.js +633 -492
  6. package/build/cjs/cc/AssociationGroupInfoCC.js.map +3 -3
  7. package/build/cjs/cc/BarrierOperatorCC.js +595 -429
  8. package/build/cjs/cc/BarrierOperatorCC.js.map +3 -3
  9. package/build/cjs/cc/BasicCC.js +354 -260
  10. package/build/cjs/cc/BasicCC.js.map +3 -3
  11. package/build/cjs/cc/BatteryCC.js +427 -345
  12. package/build/cjs/cc/BatteryCC.js.map +3 -3
  13. package/build/cjs/cc/BinarySensorCC.js +391 -276
  14. package/build/cjs/cc/BinarySensorCC.js.map +3 -3
  15. package/build/cjs/cc/BinarySwitchCC.js +347 -253
  16. package/build/cjs/cc/BinarySwitchCC.js.map +3 -3
  17. package/build/cjs/cc/CRC16CC.js +160 -85
  18. package/build/cjs/cc/CRC16CC.js.map +3 -3
  19. package/build/cjs/cc/CentralSceneCC.js +459 -324
  20. package/build/cjs/cc/CentralSceneCC.js.map +3 -3
  21. package/build/cjs/cc/ClimateControlScheduleCC.js +459 -293
  22. package/build/cjs/cc/ClimateControlScheduleCC.js.map +3 -3
  23. package/build/cjs/cc/ClockCC.js +254 -150
  24. package/build/cjs/cc/ClockCC.js.map +3 -3
  25. package/build/cjs/cc/ColorSwitchCC.js +758 -610
  26. package/build/cjs/cc/ColorSwitchCC.js.map +3 -3
  27. package/build/cjs/cc/ConfigurationCC.js +1700 -1453
  28. package/build/cjs/cc/ConfigurationCC.js.map +3 -3
  29. package/build/cjs/cc/DeviceResetLocallyCC.js +125 -49
  30. package/build/cjs/cc/DeviceResetLocallyCC.js.map +3 -3
  31. package/build/cjs/cc/DoorLockCC.js +904 -777
  32. package/build/cjs/cc/DoorLockCC.js.map +3 -3
  33. package/build/cjs/cc/DoorLockLoggingCC.js +321 -206
  34. package/build/cjs/cc/DoorLockLoggingCC.js.map +3 -3
  35. package/build/cjs/cc/EnergyProductionCC.js +249 -160
  36. package/build/cjs/cc/EnergyProductionCC.js.map +3 -3
  37. package/build/cjs/cc/EntryControlCC.js +619 -458
  38. package/build/cjs/cc/EntryControlCC.js.map +3 -3
  39. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +898 -698
  40. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +3 -3
  41. package/build/cjs/cc/HailCC.js +57 -11
  42. package/build/cjs/cc/HailCC.js.map +2 -2
  43. package/build/cjs/cc/HumidityControlModeCC.js +359 -233
  44. package/build/cjs/cc/HumidityControlModeCC.js.map +3 -3
  45. package/build/cjs/cc/HumidityControlOperatingStateCC.js +189 -103
  46. package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +3 -3
  47. package/build/cjs/cc/HumidityControlSetpointCC.js +682 -495
  48. package/build/cjs/cc/HumidityControlSetpointCC.js.map +3 -3
  49. package/build/cjs/cc/InclusionControllerCC.js +205 -114
  50. package/build/cjs/cc/InclusionControllerCC.js.map +3 -3
  51. package/build/cjs/cc/IndicatorCC.js +897 -736
  52. package/build/cjs/cc/IndicatorCC.js.map +3 -3
  53. package/build/cjs/cc/IrrigationCC.js +1651 -1405
  54. package/build/cjs/cc/IrrigationCC.js.map +3 -3
  55. package/build/cjs/cc/LanguageCC.js +268 -171
  56. package/build/cjs/cc/LanguageCC.js.map +3 -3
  57. package/build/cjs/cc/LockCC.js +254 -154
  58. package/build/cjs/cc/LockCC.js.map +3 -3
  59. package/build/cjs/cc/ManufacturerProprietaryCC.js +189 -129
  60. package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
  61. package/build/cjs/cc/ManufacturerSpecificCC.js +319 -213
  62. package/build/cjs/cc/ManufacturerSpecificCC.js.map +3 -3
  63. package/build/cjs/cc/MeterCC.js +827 -707
  64. package/build/cjs/cc/MeterCC.js.map +3 -3
  65. package/build/cjs/cc/MultiChannelAssociationCC.js +612 -478
  66. package/build/cjs/cc/MultiChannelAssociationCC.js.map +3 -3
  67. package/build/cjs/cc/MultiChannelCC.js +1037 -819
  68. package/build/cjs/cc/MultiChannelCC.js.map +3 -3
  69. package/build/cjs/cc/MultiCommandCC.js +172 -97
  70. package/build/cjs/cc/MultiCommandCC.js.map +3 -3
  71. package/build/cjs/cc/MultilevelSensorCC.js +589 -449
  72. package/build/cjs/cc/MultilevelSensorCC.js.map +3 -3
  73. package/build/cjs/cc/MultilevelSwitchCC.js +587 -439
  74. package/build/cjs/cc/MultilevelSwitchCC.js.map +3 -3
  75. package/build/cjs/cc/NoOperationCC.js +89 -27
  76. package/build/cjs/cc/NoOperationCC.js.map +2 -2
  77. package/build/cjs/cc/NodeNamingCC.js +417 -277
  78. package/build/cjs/cc/NodeNamingCC.js.map +3 -3
  79. package/build/cjs/cc/NotificationCC.js +972 -818
  80. package/build/cjs/cc/NotificationCC.js.map +3 -3
  81. package/build/cjs/cc/PowerlevelCC.js +450 -303
  82. package/build/cjs/cc/PowerlevelCC.js.map +3 -3
  83. package/build/cjs/cc/ProtectionCC.js +686 -494
  84. package/build/cjs/cc/ProtectionCC.js.map +3 -3
  85. package/build/cjs/cc/SceneActivationCC.js +165 -97
  86. package/build/cjs/cc/SceneActivationCC.js.map +3 -3
  87. package/build/cjs/cc/SceneActuatorConfigurationCC.js +346 -243
  88. package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +3 -3
  89. package/build/cjs/cc/SceneControllerConfigurationCC.js +401 -298
  90. package/build/cjs/cc/SceneControllerConfigurationCC.js.map +3 -3
  91. package/build/cjs/cc/ScheduleEntryLockCC.js +1552 -1272
  92. package/build/cjs/cc/ScheduleEntryLockCC.js.map +3 -3
  93. package/build/cjs/cc/Security2CC.js +1483 -1219
  94. package/build/cjs/cc/Security2CC.js.map +3 -3
  95. package/build/cjs/cc/SecurityCC.js +839 -619
  96. package/build/cjs/cc/SecurityCC.js.map +3 -3
  97. package/build/cjs/cc/SoundSwitchCC.js +707 -515
  98. package/build/cjs/cc/SoundSwitchCC.js.map +3 -3
  99. package/build/cjs/cc/SupervisionCC.js +327 -237
  100. package/build/cjs/cc/SupervisionCC.js.map +3 -3
  101. package/build/cjs/cc/ThermostatFanModeCC.js +386 -263
  102. package/build/cjs/cc/ThermostatFanModeCC.js.map +3 -3
  103. package/build/cjs/cc/ThermostatFanStateCC.js +192 -106
  104. package/build/cjs/cc/ThermostatFanStateCC.js.map +3 -3
  105. package/build/cjs/cc/ThermostatModeCC.js +425 -302
  106. package/build/cjs/cc/ThermostatModeCC.js.map +3 -3
  107. package/build/cjs/cc/ThermostatOperatingStateCC.js +188 -102
  108. package/build/cjs/cc/ThermostatOperatingStateCC.js.map +3 -3
  109. package/build/cjs/cc/ThermostatSetbackCC.js +277 -173
  110. package/build/cjs/cc/ThermostatSetbackCC.js.map +3 -3
  111. package/build/cjs/cc/ThermostatSetpointCC.js +645 -491
  112. package/build/cjs/cc/ThermostatSetpointCC.js.map +3 -3
  113. package/build/cjs/cc/TimeCC.js +515 -353
  114. package/build/cjs/cc/TimeCC.js.map +3 -3
  115. package/build/cjs/cc/TimeParametersCC.js +302 -202
  116. package/build/cjs/cc/TimeParametersCC.js.map +3 -3
  117. package/build/cjs/cc/TransportServiceCC.js +433 -315
  118. package/build/cjs/cc/TransportServiceCC.js.map +3 -3
  119. package/build/cjs/cc/UserCodeCC.js +1385 -1102
  120. package/build/cjs/cc/UserCodeCC.js.map +3 -3
  121. package/build/cjs/cc/VersionCC.js +696 -562
  122. package/build/cjs/cc/VersionCC.js.map +3 -3
  123. package/build/cjs/cc/WakeUpCC.js +499 -346
  124. package/build/cjs/cc/WakeUpCC.js.map +3 -3
  125. package/build/cjs/cc/WindowCoveringCC.js +626 -478
  126. package/build/cjs/cc/WindowCoveringCC.js.map +3 -3
  127. package/build/cjs/cc/ZWaveLongRangeCC.js +57 -10
  128. package/build/cjs/cc/ZWaveLongRangeCC.js.map +2 -2
  129. package/build/cjs/cc/ZWavePlusCC.js +233 -159
  130. package/build/cjs/cc/ZWavePlusCC.js.map +3 -3
  131. package/build/cjs/cc/ZWaveProtocolCC.js +1515 -948
  132. package/build/cjs/cc/ZWaveProtocolCC.js.map +3 -3
  133. package/build/cjs/cc/manufacturerProprietary/Decorators.d.ts +4 -4
  134. package/build/cjs/cc/manufacturerProprietary/Decorators.js.map +1 -1
  135. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +395 -274
  136. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +3 -3
  137. package/build/cjs/lib/CommandClassDecorators.d.ts +11 -15
  138. package/build/cjs/lib/CommandClassDecorators.js +19 -20
  139. package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
  140. package/build/cjs/lib/Security2/Extension.d.ts +1 -1
  141. package/build/cjs/lib/Security2/Extension.js +217 -126
  142. package/build/cjs/lib/Security2/Extension.js.map +3 -3
  143. package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
  144. package/build/esm/cc/AlarmSensorCC.js +389 -291
  145. package/build/esm/cc/AlarmSensorCC.js.map +1 -1
  146. package/build/esm/cc/AssociationCC.d.ts.map +1 -1
  147. package/build/esm/cc/AssociationCC.js +678 -537
  148. package/build/esm/cc/AssociationCC.js.map +1 -1
  149. package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  150. package/build/esm/cc/AssociationGroupInfoCC.js +659 -539
  151. package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
  152. package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
  153. package/build/esm/cc/BarrierOperatorCC.js +634 -493
  154. package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
  155. package/build/esm/cc/BasicCC.d.ts.map +1 -1
  156. package/build/esm/cc/BasicCC.js +380 -302
  157. package/build/esm/cc/BasicCC.js.map +1 -1
  158. package/build/esm/cc/BatteryCC.d.ts.map +1 -1
  159. package/build/esm/cc/BatteryCC.js +449 -384
  160. package/build/esm/cc/BatteryCC.js.map +1 -1
  161. package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
  162. package/build/esm/cc/BinarySensorCC.js +395 -297
  163. package/build/esm/cc/BinarySensorCC.js.map +1 -1
  164. package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
  165. package/build/esm/cc/BinarySwitchCC.js +353 -274
  166. package/build/esm/cc/BinarySwitchCC.js.map +1 -1
  167. package/build/esm/cc/CRC16CC.js +162 -98
  168. package/build/esm/cc/CRC16CC.js.map +1 -1
  169. package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
  170. package/build/esm/cc/CentralSceneCC.js +465 -351
  171. package/build/esm/cc/CentralSceneCC.js.map +1 -1
  172. package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
  173. package/build/esm/cc/ClimateControlScheduleCC.js +454 -313
  174. package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
  175. package/build/esm/cc/ClockCC.js +248 -159
  176. package/build/esm/cc/ClockCC.js.map +1 -1
  177. package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
  178. package/build/esm/cc/ColorSwitchCC.js +802 -677
  179. package/build/esm/cc/ColorSwitchCC.js.map +1 -1
  180. package/build/esm/cc/ConfigurationCC.js +1899 -1687
  181. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  182. package/build/esm/cc/DeviceResetLocallyCC.js +124 -59
  183. package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
  184. package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
  185. package/build/esm/cc/DoorLockCC.js +951 -849
  186. package/build/esm/cc/DoorLockCC.js.map +1 -1
  187. package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
  188. package/build/esm/cc/DoorLockLoggingCC.js +316 -218
  189. package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
  190. package/build/esm/cc/EnergyProductionCC.js +240 -164
  191. package/build/esm/cc/EnergyProductionCC.js.map +1 -1
  192. package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
  193. package/build/esm/cc/EntryControlCC.js +629 -493
  194. package/build/esm/cc/EntryControlCC.js.map +1 -1
  195. package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
  196. package/build/esm/cc/FirmwareUpdateMetaDataCC.js +938 -769
  197. package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
  198. package/build/esm/cc/HailCC.js +51 -12
  199. package/build/esm/cc/HailCC.js.map +1 -1
  200. package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
  201. package/build/esm/cc/HumidityControlModeCC.js +357 -250
  202. package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
  203. package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
  204. package/build/esm/cc/HumidityControlOperatingStateCC.js +182 -109
  205. package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
  206. package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
  207. package/build/esm/cc/HumidityControlSetpointCC.js +706 -546
  208. package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
  209. package/build/esm/cc/InclusionControllerCC.js +197 -119
  210. package/build/esm/cc/InclusionControllerCC.js.map +1 -1
  211. package/build/esm/cc/IndicatorCC.js +973 -835
  212. package/build/esm/cc/IndicatorCC.js.map +1 -1
  213. package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
  214. package/build/esm/cc/IrrigationCC.js +1697 -1496
  215. package/build/esm/cc/IrrigationCC.js.map +1 -1
  216. package/build/esm/cc/LanguageCC.d.ts.map +1 -1
  217. package/build/esm/cc/LanguageCC.js +266 -184
  218. package/build/esm/cc/LanguageCC.js.map +1 -1
  219. package/build/esm/cc/LockCC.d.ts.map +1 -1
  220. package/build/esm/cc/LockCC.js +247 -162
  221. package/build/esm/cc/LockCC.js.map +1 -1
  222. package/build/esm/cc/ManufacturerProprietaryCC.js +192 -141
  223. package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
  224. package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
  225. package/build/esm/cc/ManufacturerSpecificCC.js +312 -223
  226. package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
  227. package/build/esm/cc/MeterCC.d.ts.map +1 -1
  228. package/build/esm/cc/MeterCC.js +896 -795
  229. package/build/esm/cc/MeterCC.js.map +1 -1
  230. package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
  231. package/build/esm/cc/MultiChannelAssociationCC.js +631 -518
  232. package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
  233. package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
  234. package/build/esm/cc/MultiChannelCC.js +1106 -921
  235. package/build/esm/cc/MultiChannelCC.js.map +1 -1
  236. package/build/esm/cc/MultiCommandCC.js +166 -102
  237. package/build/esm/cc/MultiCommandCC.js.map +1 -1
  238. package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
  239. package/build/esm/cc/MultilevelSensorCC.js +616 -497
  240. package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
  241. package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
  242. package/build/esm/cc/MultilevelSwitchCC.js +621 -496
  243. package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
  244. package/build/esm/cc/NoOperationCC.js +82 -29
  245. package/build/esm/cc/NoOperationCC.js.map +1 -1
  246. package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
  247. package/build/esm/cc/NodeNamingCC.js +413 -294
  248. package/build/esm/cc/NodeNamingCC.js.map +1 -1
  249. package/build/esm/cc/NotificationCC.d.ts.map +1 -1
  250. package/build/esm/cc/NotificationCC.js +1097 -966
  251. package/build/esm/cc/NotificationCC.js.map +1 -1
  252. package/build/esm/cc/PowerlevelCC.js +437 -311
  253. package/build/esm/cc/PowerlevelCC.js.map +1 -1
  254. package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
  255. package/build/esm/cc/ProtectionCC.js +704 -543
  256. package/build/esm/cc/ProtectionCC.js.map +1 -1
  257. package/build/esm/cc/SceneActivationCC.d.ts.map +1 -1
  258. package/build/esm/cc/SceneActivationCC.js +157 -100
  259. package/build/esm/cc/SceneActivationCC.js.map +1 -1
  260. package/build/esm/cc/SceneActuatorConfigurationCC.js +357 -269
  261. package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
  262. package/build/esm/cc/SceneControllerConfigurationCC.js +434 -346
  263. package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
  264. package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
  265. package/build/esm/cc/ScheduleEntryLockCC.js +1596 -1357
  266. package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
  267. package/build/esm/cc/Security2CC.js +1633 -1406
  268. package/build/esm/cc/Security2CC.js.map +1 -1
  269. package/build/esm/cc/SecurityCC.js +876 -687
  270. package/build/esm/cc/SecurityCC.js.map +1 -1
  271. package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
  272. package/build/esm/cc/SoundSwitchCC.js +689 -526
  273. package/build/esm/cc/SoundSwitchCC.js.map +1 -1
  274. package/build/esm/cc/SupervisionCC.js +349 -272
  275. package/build/esm/cc/SupervisionCC.js.map +1 -1
  276. package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
  277. package/build/esm/cc/ThermostatFanModeCC.js +388 -284
  278. package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
  279. package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
  280. package/build/esm/cc/ThermostatFanStateCC.js +184 -111
  281. package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
  282. package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
  283. package/build/esm/cc/ThermostatModeCC.js +435 -331
  284. package/build/esm/cc/ThermostatModeCC.js.map +1 -1
  285. package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
  286. package/build/esm/cc/ThermostatOperatingStateCC.js +180 -107
  287. package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
  288. package/build/esm/cc/ThermostatSetbackCC.js +274 -185
  289. package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
  290. package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
  291. package/build/esm/cc/ThermostatSetpointCC.js +674 -543
  292. package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
  293. package/build/esm/cc/TimeCC.js +499 -360
  294. package/build/esm/cc/TimeCC.js.map +1 -1
  295. package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
  296. package/build/esm/cc/TimeParametersCC.js +296 -211
  297. package/build/esm/cc/TimeParametersCC.js.map +1 -1
  298. package/build/esm/cc/TransportServiceCC.js +464 -363
  299. package/build/esm/cc/TransportServiceCC.js.map +1 -1
  300. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  301. package/build/esm/cc/UserCodeCC.js +1443 -1205
  302. package/build/esm/cc/UserCodeCC.js.map +1 -1
  303. package/build/esm/cc/VersionCC.d.ts.map +1 -1
  304. package/build/esm/cc/VersionCC.js +744 -635
  305. package/build/esm/cc/VersionCC.js.map +1 -1
  306. package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
  307. package/build/esm/cc/WakeUpCC.js +494 -364
  308. package/build/esm/cc/WakeUpCC.js.map +1 -1
  309. package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
  310. package/build/esm/cc/WindowCoveringCC.js +655 -530
  311. package/build/esm/cc/WindowCoveringCC.js.map +1 -1
  312. package/build/esm/cc/ZWaveLongRangeCC.js +51 -11
  313. package/build/esm/cc/ZWaveLongRangeCC.js.map +1 -1
  314. package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
  315. package/build/esm/cc/ZWavePlusCC.js +223 -162
  316. package/build/esm/cc/ZWavePlusCC.js.map +1 -1
  317. package/build/esm/cc/ZWaveProtocolCC.js +1443 -953
  318. package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
  319. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts +4 -4
  320. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts.map +1 -1
  321. package/build/esm/cc/manufacturerProprietary/FibaroCC.js +390 -286
  322. package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
  323. package/build/esm/lib/CommandClassDecorators.d.ts +11 -15
  324. package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
  325. package/build/esm/lib/CommandClassDecorators.js +24 -24
  326. package/build/esm/lib/CommandClassDecorators.js.map +1 -1
  327. package/build/esm/lib/Security2/Extension.d.ts +1 -1
  328. package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
  329. package/build/esm/lib/Security2/Extension.js +207 -123
  330. package/build/esm/lib/Security2/Extension.js.map +1 -1
  331. package/package.json +6 -6
@@ -1,10 +1,37 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
6
34
  };
7
- var TransportServiceCCFirstSegment_1, TransportServiceCCSubsequentSegment_1, TransportServiceCCSegmentRequest_1, TransportServiceCCSegmentComplete_1, TransportServiceCCSegmentWait_1;
8
35
  import { CRC16_CCITT, CommandClasses, ZWaveError, ZWaveErrorCodes, validatePayload, } from "@zwave-js/core/safe";
9
36
  import { Bytes } from "@zwave-js/shared/safe";
10
37
  import { buffer2hex } from "@zwave-js/shared/safe";
@@ -29,12 +56,24 @@ export const TransportServiceTimeouts = {
29
56
  /** Waiting time between segments when sending more than {@link RELAXED_TIMING_THRESHOLD} segments at data rate R3 */
30
57
  relaxedTimingDelayR3: 15,
31
58
  };
32
- let TransportServiceCC = class TransportServiceCC extends CommandClass {
33
- };
34
- TransportServiceCC = __decorate([
35
- commandClass(CommandClasses["Transport Service"]),
36
- implementedVersion(2)
37
- ], TransportServiceCC);
59
+ let TransportServiceCC = (() => {
60
+ let _classDecorators = [commandClass(CommandClasses["Transport Service"]), implementedVersion(2)];
61
+ let _classDescriptor;
62
+ let _classExtraInitializers = [];
63
+ let _classThis;
64
+ let _classSuper = CommandClass;
65
+ var TransportServiceCC = class extends _classSuper {
66
+ static { _classThis = this; }
67
+ static {
68
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
69
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
70
+ TransportServiceCC = _classThis = _classDescriptor.value;
71
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
72
+ __runInitializers(_classThis, _classExtraInitializers);
73
+ }
74
+ };
75
+ return TransportServiceCC = _classThis;
76
+ })();
38
77
  export { TransportServiceCC };
39
78
  /** @publicAPI */
40
79
  export function isTransportServiceEncapsulation(command) {
@@ -42,273 +81,297 @@ export function isTransportServiceEncapsulation(command) {
42
81
  && (command.ccCommand === TransportServiceCommand.FirstSegment
43
82
  || command.ccCommand === TransportServiceCommand.SubsequentSegment));
44
83
  }
45
- let TransportServiceCCFirstSegment = TransportServiceCCFirstSegment_1 = class TransportServiceCCFirstSegment extends TransportServiceCC {
46
- constructor(options) {
47
- super(options);
48
- this.datagramSize = options.datagramSize;
49
- this.sessionId = options.sessionId;
50
- this.headerExtension = options.headerExtension;
51
- this.partialDatagram = options.partialDatagram;
52
- }
53
- static from(raw, ctx) {
54
- // Deserialization has already split the datagram size from the ccCommand.
55
- // Therefore we have one more payload byte
56
- validatePayload(raw.payload.length >= 6); // 2 bytes dgram size, 1 byte sessid/ext, 1+ bytes payload, 2 bytes checksum
57
- // Verify the CRC
58
- const headerBuffer = Bytes.from([
59
- CommandClasses["Transport Service"],
60
- TransportServiceCommand.FirstSegment | raw.payload[0],
61
- ]);
62
- const ccBuffer = raw.payload.subarray(1, -2);
63
- let expectedCRC = CRC16_CCITT(headerBuffer);
64
- expectedCRC = CRC16_CCITT(ccBuffer, expectedCRC);
65
- const actualCRC = raw.payload.readUInt16BE(raw.payload.length - 2);
66
- validatePayload(expectedCRC === actualCRC);
67
- const datagramSize = raw.payload.readUInt16BE(0);
68
- const sessionId = raw.payload[2] >>> 4;
69
- let payloadOffset = 3;
70
- // If there is a header extension, read it
71
- const hasHeaderExtension = !!(raw.payload[2] & 0b1000);
72
- let headerExtension;
73
- if (hasHeaderExtension) {
74
- const extLength = raw.payload[3];
75
- headerExtension = raw.payload.subarray(4, 4 + extLength);
76
- payloadOffset += 1 + extLength;
77
- }
78
- const partialDatagram = raw.payload.subarray(payloadOffset, -2);
79
- // A node supporting the Transport Service Command Class, version 2
80
- // MUST NOT send Transport Service segments with the Payload field longer than 39 bytes.
81
- validatePayload(partialDatagram.length <= MAX_SEGMENT_SIZE);
82
- return new TransportServiceCCFirstSegment_1({
83
- nodeId: ctx.sourceNodeId,
84
- datagramSize,
85
- sessionId,
86
- headerExtension,
87
- partialDatagram,
88
- });
89
- }
90
- datagramSize;
91
- sessionId;
92
- headerExtension;
93
- partialDatagram;
94
- encapsulated;
95
- serialize(ctx) {
96
- // Transport Service re-uses the lower 3 bits of the ccCommand as payload
97
- this.ccCommand = (this.ccCommand & 0b11111_000)
98
- | ((this.datagramSize >>> 8) & 0b111);
99
- const ext = !!this.headerExtension && this.headerExtension.length >= 1;
100
- this.payload = Bytes.from([
101
- this.datagramSize & 0xff,
102
- ((this.sessionId & 0b1111) << 4) | (ext ? 0b1000 : 0),
103
- ]);
104
- if (ext) {
84
+ let TransportServiceCCFirstSegment = (() => {
85
+ let _classDecorators = [CCCommand(TransportServiceCommand.FirstSegment)];
86
+ let _classDescriptor;
87
+ let _classExtraInitializers = [];
88
+ let _classThis;
89
+ let _classSuper = TransportServiceCC;
90
+ var TransportServiceCCFirstSegment = class extends _classSuper {
91
+ static { _classThis = this; }
92
+ static {
93
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
94
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
95
+ TransportServiceCCFirstSegment = _classThis = _classDescriptor.value;
96
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
97
+ __runInitializers(_classThis, _classExtraInitializers);
98
+ }
99
+ constructor(options) {
100
+ super(options);
101
+ this.datagramSize = options.datagramSize;
102
+ this.sessionId = options.sessionId;
103
+ this.headerExtension = options.headerExtension;
104
+ this.partialDatagram = options.partialDatagram;
105
+ }
106
+ static from(raw, ctx) {
107
+ // Deserialization has already split the datagram size from the ccCommand.
108
+ // Therefore we have one more payload byte
109
+ validatePayload(raw.payload.length >= 6); // 2 bytes dgram size, 1 byte sessid/ext, 1+ bytes payload, 2 bytes checksum
110
+ // Verify the CRC
111
+ const headerBuffer = Bytes.from([
112
+ CommandClasses["Transport Service"],
113
+ TransportServiceCommand.FirstSegment | raw.payload[0],
114
+ ]);
115
+ const ccBuffer = raw.payload.subarray(1, -2);
116
+ let expectedCRC = CRC16_CCITT(headerBuffer);
117
+ expectedCRC = CRC16_CCITT(ccBuffer, expectedCRC);
118
+ const actualCRC = raw.payload.readUInt16BE(raw.payload.length - 2);
119
+ validatePayload(expectedCRC === actualCRC);
120
+ const datagramSize = raw.payload.readUInt16BE(0);
121
+ const sessionId = raw.payload[2] >>> 4;
122
+ let payloadOffset = 3;
123
+ // If there is a header extension, read it
124
+ const hasHeaderExtension = !!(raw.payload[2] & 0b1000);
125
+ let headerExtension;
126
+ if (hasHeaderExtension) {
127
+ const extLength = raw.payload[3];
128
+ headerExtension = raw.payload.subarray(4, 4 + extLength);
129
+ payloadOffset += 1 + extLength;
130
+ }
131
+ const partialDatagram = raw.payload.subarray(payloadOffset, -2);
132
+ // A node supporting the Transport Service Command Class, version 2
133
+ // MUST NOT send Transport Service segments with the Payload field longer than 39 bytes.
134
+ validatePayload(partialDatagram.length <= MAX_SEGMENT_SIZE);
135
+ return new this({
136
+ nodeId: ctx.sourceNodeId,
137
+ datagramSize,
138
+ sessionId,
139
+ headerExtension,
140
+ partialDatagram,
141
+ });
142
+ }
143
+ datagramSize;
144
+ sessionId;
145
+ headerExtension;
146
+ partialDatagram;
147
+ encapsulated;
148
+ serialize(ctx) {
149
+ // Transport Service re-uses the lower 3 bits of the ccCommand as payload
150
+ this.ccCommand = (this.ccCommand & 0b11111_000)
151
+ | ((this.datagramSize >>> 8) & 0b111);
152
+ const ext = !!this.headerExtension && this.headerExtension.length >= 1;
153
+ this.payload = Bytes.from([
154
+ this.datagramSize & 0xff,
155
+ ((this.sessionId & 0b1111) << 4) | (ext ? 0b1000 : 0),
156
+ ]);
157
+ if (ext) {
158
+ this.payload = Bytes.concat([
159
+ this.payload,
160
+ Bytes.from([this.headerExtension.length]),
161
+ this.headerExtension,
162
+ ]);
163
+ }
105
164
  this.payload = Bytes.concat([
106
165
  this.payload,
107
- Bytes.from([this.headerExtension.length]),
108
- this.headerExtension,
166
+ this.partialDatagram,
167
+ Bytes.alloc(2, 0), // checksum
109
168
  ]);
169
+ // Compute and save the CRC16 in the payload
170
+ // The CC header is included in the CRC computation
171
+ const headerBuffer = Bytes.from([this.ccId, this.ccCommand]);
172
+ let crc = CRC16_CCITT(headerBuffer);
173
+ crc = CRC16_CCITT(this.payload.subarray(0, -2), crc);
174
+ // Write the checksum into the last two bytes of the payload
175
+ this.payload.writeUInt16BE(crc, this.payload.length - 2);
176
+ return super.serialize(ctx);
110
177
  }
111
- this.payload = Bytes.concat([
112
- this.payload,
113
- this.partialDatagram,
114
- Bytes.alloc(2, 0), // checksum
115
- ]);
116
- // Compute and save the CRC16 in the payload
117
- // The CC header is included in the CRC computation
118
- const headerBuffer = Bytes.from([this.ccId, this.ccCommand]);
119
- let crc = CRC16_CCITT(headerBuffer);
120
- crc = CRC16_CCITT(this.payload.subarray(0, -2), crc);
121
- // Write the checksum into the last two bytes of the payload
122
- this.payload.writeUInt16BE(crc, this.payload.length - 2);
123
- return super.serialize(ctx);
124
- }
125
- expectMoreMessages() {
126
- return true; // The FirstSegment message always expects more messages
127
- }
128
- getPartialCCSessionId() {
129
- // Only use the session ID to identify the session, not the CC command
130
- return { ccCommand: undefined, sessionId: this.sessionId };
131
- }
132
- computeEncapsulationOverhead() {
133
- // Transport Service CC (first segment) adds 1 byte datagram size, 1 byte Session ID/..., 2 bytes checksum and (0 OR n+1) bytes header extension
134
- return (super.computeEncapsulationOverhead()
135
- + 4
136
- + (this.headerExtension?.length
137
- ? 1 + this.headerExtension.length
138
- : 0));
139
- }
140
- toLogEntry(ctx) {
141
- return {
142
- ...super.toLogEntry(ctx),
143
- message: {
144
- "session ID": this.sessionId,
145
- "datagram size": this.datagramSize,
146
- "byte range": `0...${this.partialDatagram.length - 1}`,
147
- payload: buffer2hex(this.partialDatagram),
148
- },
149
- };
150
- }
151
- };
152
- TransportServiceCCFirstSegment = TransportServiceCCFirstSegment_1 = __decorate([
153
- CCCommand(TransportServiceCommand.FirstSegment)
154
- // @expectedCCResponse(TransportServiceCCReport)
155
- ], TransportServiceCCFirstSegment);
178
+ expectMoreMessages() {
179
+ return true; // The FirstSegment message always expects more messages
180
+ }
181
+ getPartialCCSessionId() {
182
+ // Only use the session ID to identify the session, not the CC command
183
+ return { ccCommand: undefined, sessionId: this.sessionId };
184
+ }
185
+ computeEncapsulationOverhead() {
186
+ // Transport Service CC (first segment) adds 1 byte datagram size, 1 byte Session ID/..., 2 bytes checksum and (0 OR n+1) bytes header extension
187
+ return (super.computeEncapsulationOverhead()
188
+ + 4
189
+ + (this.headerExtension?.length
190
+ ? 1 + this.headerExtension.length
191
+ : 0));
192
+ }
193
+ toLogEntry(ctx) {
194
+ return {
195
+ ...super.toLogEntry(ctx),
196
+ message: {
197
+ "session ID": this.sessionId,
198
+ "datagram size": this.datagramSize,
199
+ "byte range": `0...${this.partialDatagram.length - 1}`,
200
+ payload: buffer2hex(this.partialDatagram),
201
+ },
202
+ };
203
+ }
204
+ };
205
+ return TransportServiceCCFirstSegment = _classThis;
206
+ })();
156
207
  export { TransportServiceCCFirstSegment };
157
- let TransportServiceCCSubsequentSegment = TransportServiceCCSubsequentSegment_1 = class TransportServiceCCSubsequentSegment extends TransportServiceCC {
158
- constructor(options) {
159
- super(options);
160
- this.datagramSize = options.datagramSize;
161
- this.datagramOffset = options.datagramOffset;
162
- this.sessionId = options.sessionId;
163
- this.headerExtension = options.headerExtension;
164
- this.partialDatagram = options.partialDatagram;
165
- }
166
- static from(raw, ctx) {
167
- // Deserialization has already split the datagram size from the ccCommand.
168
- // Therefore we have one more payload byte
169
- validatePayload(raw.payload.length >= 7); // 2 bytes dgram size, 1 byte sessid/ext/offset, 1 byte offset, 1+ bytes payload, 2 bytes checksum
170
- // Verify the CRC
171
- const headerBuffer = Bytes.from([
172
- CommandClasses["Transport Service"],
173
- TransportServiceCommand.SubsequentSegment | raw.payload[0],
174
- ]);
175
- const ccBuffer = raw.payload.subarray(1, -2);
176
- let expectedCRC = CRC16_CCITT(headerBuffer);
177
- expectedCRC = CRC16_CCITT(ccBuffer, expectedCRC);
178
- const actualCRC = raw.payload.readUInt16BE(raw.payload.length - 2);
179
- validatePayload(expectedCRC === actualCRC);
180
- const datagramSize = raw.payload.readUInt16BE(0);
181
- const sessionId = raw.payload[2] >>> 4;
182
- const datagramOffset = ((raw.payload[2] & 0b111) << 8)
183
- + raw.payload[3];
184
- let payloadOffset = 4;
185
- // If there is a header extension, read it
186
- const hasHeaderExtension = !!(raw.payload[2] & 0b1000);
187
- let headerExtension;
188
- if (hasHeaderExtension) {
189
- const extLength = raw.payload[4];
190
- headerExtension = raw.payload.subarray(5, 5 + extLength);
191
- payloadOffset += 1 + extLength;
192
- }
193
- const partialDatagram = raw.payload.subarray(payloadOffset, -2);
194
- // A node supporting the Transport Service Command Class, version 2
195
- // MUST NOT send Transport Service segments with the Payload field longer than 39 bytes.
196
- validatePayload(partialDatagram.length <= MAX_SEGMENT_SIZE);
197
- return new TransportServiceCCSubsequentSegment_1({
198
- nodeId: ctx.sourceNodeId,
199
- datagramSize,
200
- sessionId,
201
- datagramOffset,
202
- headerExtension,
203
- partialDatagram,
204
- });
205
- }
206
- datagramSize;
207
- datagramOffset;
208
- sessionId;
209
- headerExtension;
210
- partialDatagram;
211
- // This can only be received
212
- _encapsulated;
213
- get encapsulated() {
214
- return this._encapsulated;
215
- }
216
- expectMoreMessages(session) {
217
- if (!(session[0] instanceof TransportServiceCCFirstSegment)) {
218
- // First segment is missing
219
- return true;
220
- }
221
- const datagramSize = session[0].datagramSize;
222
- const receivedBytes = new Array(datagramSize).fill(false);
223
- for (const segment of [...session, this]) {
224
- const offset = segment instanceof TransportServiceCCFirstSegment
225
- ? 0
226
- : segment.datagramOffset;
227
- for (let i = offset; i <= offset + segment.partialDatagram.length; i++) {
228
- receivedBytes[i] = true;
208
+ let TransportServiceCCSubsequentSegment = (() => {
209
+ let _classDecorators = [CCCommand(TransportServiceCommand.SubsequentSegment)];
210
+ let _classDescriptor;
211
+ let _classExtraInitializers = [];
212
+ let _classThis;
213
+ let _classSuper = TransportServiceCC;
214
+ var TransportServiceCCSubsequentSegment = class extends _classSuper {
215
+ static { _classThis = this; }
216
+ static {
217
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
218
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
219
+ TransportServiceCCSubsequentSegment = _classThis = _classDescriptor.value;
220
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
221
+ __runInitializers(_classThis, _classExtraInitializers);
222
+ }
223
+ constructor(options) {
224
+ super(options);
225
+ this.datagramSize = options.datagramSize;
226
+ this.datagramOffset = options.datagramOffset;
227
+ this.sessionId = options.sessionId;
228
+ this.headerExtension = options.headerExtension;
229
+ this.partialDatagram = options.partialDatagram;
230
+ }
231
+ static from(raw, ctx) {
232
+ // Deserialization has already split the datagram size from the ccCommand.
233
+ // Therefore we have one more payload byte
234
+ validatePayload(raw.payload.length >= 7); // 2 bytes dgram size, 1 byte sessid/ext/offset, 1 byte offset, 1+ bytes payload, 2 bytes checksum
235
+ // Verify the CRC
236
+ const headerBuffer = Bytes.from([
237
+ CommandClasses["Transport Service"],
238
+ TransportServiceCommand.SubsequentSegment | raw.payload[0],
239
+ ]);
240
+ const ccBuffer = raw.payload.subarray(1, -2);
241
+ let expectedCRC = CRC16_CCITT(headerBuffer);
242
+ expectedCRC = CRC16_CCITT(ccBuffer, expectedCRC);
243
+ const actualCRC = raw.payload.readUInt16BE(raw.payload.length - 2);
244
+ validatePayload(expectedCRC === actualCRC);
245
+ const datagramSize = raw.payload.readUInt16BE(0);
246
+ const sessionId = raw.payload[2] >>> 4;
247
+ const datagramOffset = ((raw.payload[2] & 0b111) << 8)
248
+ + raw.payload[3];
249
+ let payloadOffset = 4;
250
+ // If there is a header extension, read it
251
+ const hasHeaderExtension = !!(raw.payload[2] & 0b1000);
252
+ let headerExtension;
253
+ if (hasHeaderExtension) {
254
+ const extLength = raw.payload[4];
255
+ headerExtension = raw.payload.subarray(5, 5 + extLength);
256
+ payloadOffset += 1 + extLength;
229
257
  }
258
+ const partialDatagram = raw.payload.subarray(payloadOffset, -2);
259
+ // A node supporting the Transport Service Command Class, version 2
260
+ // MUST NOT send Transport Service segments with the Payload field longer than 39 bytes.
261
+ validatePayload(partialDatagram.length <= MAX_SEGMENT_SIZE);
262
+ return new this({
263
+ nodeId: ctx.sourceNodeId,
264
+ datagramSize,
265
+ sessionId,
266
+ datagramOffset,
267
+ headerExtension,
268
+ partialDatagram,
269
+ });
230
270
  }
231
- // Expect more messages as long as we haven't received everything
232
- return receivedBytes.includes(false);
233
- }
234
- getPartialCCSessionId() {
235
- // Only use the session ID to identify the session, not the CC command
236
- return { ccCommand: undefined, sessionId: this.sessionId };
237
- }
238
- mergePartialCCs(partials, ctx) {
239
- // Concat the CC buffers
240
- const datagram = new Bytes(this.datagramSize);
241
- for (const partial of [...partials, this]) {
242
- // Ensure that we don't try to write out-of-bounds
243
- const offset = partial instanceof TransportServiceCCFirstSegment
244
- ? 0
245
- : partial.datagramOffset;
246
- if (offset + partial.partialDatagram.length > datagram.length) {
247
- throw new ZWaveError(`The partial datagram offset and length in a segment are not compatible to the communicated datagram length`, ZWaveErrorCodes.PacketFormat_InvalidPayload);
271
+ datagramSize;
272
+ datagramOffset;
273
+ sessionId;
274
+ headerExtension;
275
+ partialDatagram;
276
+ // This can only be received
277
+ _encapsulated;
278
+ get encapsulated() {
279
+ return this._encapsulated;
280
+ }
281
+ expectMoreMessages(session) {
282
+ if (!(session[0] instanceof TransportServiceCCFirstSegment)) {
283
+ // First segment is missing
284
+ return true;
248
285
  }
249
- datagram.set(partial.partialDatagram, offset);
286
+ const datagramSize = session[0].datagramSize;
287
+ const receivedBytes = new Array(datagramSize).fill(false);
288
+ for (const segment of [...session, this]) {
289
+ const offset = segment instanceof TransportServiceCCFirstSegment
290
+ ? 0
291
+ : segment.datagramOffset;
292
+ for (let i = offset; i <= offset + segment.partialDatagram.length; i++) {
293
+ receivedBytes[i] = true;
294
+ }
295
+ }
296
+ // Expect more messages as long as we haven't received everything
297
+ return receivedBytes.includes(false);
250
298
  }
251
- // and deserialize the CC
252
- this._encapsulated = CommandClass.parse(datagram, ctx);
253
- this._encapsulated.encapsulatingCC = this;
254
- }
255
- serialize(ctx) {
256
- // Transport Service re-uses the lower 3 bits of the ccCommand as payload
257
- this.ccCommand = (this.ccCommand & 0b11111_000)
258
- | ((this.datagramSize >>> 8) & 0b111);
259
- const ext = !!this.headerExtension && this.headerExtension.length >= 1;
260
- this.payload = Bytes.from([
261
- this.datagramSize & 0xff,
262
- ((this.sessionId & 0b1111) << 4)
263
- | (ext ? 0b1000 : 0)
264
- | ((this.datagramOffset >>> 8) & 0b111),
265
- this.datagramOffset & 0xff,
266
- ]);
267
- if (ext) {
299
+ getPartialCCSessionId() {
300
+ // Only use the session ID to identify the session, not the CC command
301
+ return { ccCommand: undefined, sessionId: this.sessionId };
302
+ }
303
+ mergePartialCCs(partials, ctx) {
304
+ // Concat the CC buffers
305
+ const datagram = new Bytes(this.datagramSize);
306
+ for (const partial of [...partials, this]) {
307
+ // Ensure that we don't try to write out-of-bounds
308
+ const offset = partial instanceof TransportServiceCCFirstSegment
309
+ ? 0
310
+ : partial.datagramOffset;
311
+ if (offset + partial.partialDatagram.length > datagram.length) {
312
+ throw new ZWaveError(`The partial datagram offset and length in a segment are not compatible to the communicated datagram length`, ZWaveErrorCodes.PacketFormat_InvalidPayload);
313
+ }
314
+ datagram.set(partial.partialDatagram, offset);
315
+ }
316
+ // and deserialize the CC
317
+ this._encapsulated = CommandClass.parse(datagram, ctx);
318
+ this._encapsulated.encapsulatingCC = this;
319
+ }
320
+ serialize(ctx) {
321
+ // Transport Service re-uses the lower 3 bits of the ccCommand as payload
322
+ this.ccCommand = (this.ccCommand & 0b11111_000)
323
+ | ((this.datagramSize >>> 8) & 0b111);
324
+ const ext = !!this.headerExtension && this.headerExtension.length >= 1;
325
+ this.payload = Bytes.from([
326
+ this.datagramSize & 0xff,
327
+ ((this.sessionId & 0b1111) << 4)
328
+ | (ext ? 0b1000 : 0)
329
+ | ((this.datagramOffset >>> 8) & 0b111),
330
+ this.datagramOffset & 0xff,
331
+ ]);
332
+ if (ext) {
333
+ this.payload = Bytes.concat([
334
+ this.payload,
335
+ Bytes.from([this.headerExtension.length]),
336
+ this.headerExtension,
337
+ ]);
338
+ }
268
339
  this.payload = Bytes.concat([
269
340
  this.payload,
270
- Bytes.from([this.headerExtension.length]),
271
- this.headerExtension,
341
+ this.partialDatagram,
342
+ Bytes.alloc(2, 0), // checksum
272
343
  ]);
344
+ // Compute and save the CRC16 in the payload
345
+ // The CC header is included in the CRC computation
346
+ const headerBuffer = Bytes.from([this.ccId, this.ccCommand]);
347
+ let crc = CRC16_CCITT(headerBuffer);
348
+ crc = CRC16_CCITT(this.payload.subarray(0, -2), crc);
349
+ // Write the checksum into the last two bytes of the payload
350
+ this.payload.writeUInt16BE(crc, this.payload.length - 2);
351
+ return super.serialize(ctx);
273
352
  }
274
- this.payload = Bytes.concat([
275
- this.payload,
276
- this.partialDatagram,
277
- Bytes.alloc(2, 0), // checksum
278
- ]);
279
- // Compute and save the CRC16 in the payload
280
- // The CC header is included in the CRC computation
281
- const headerBuffer = Bytes.from([this.ccId, this.ccCommand]);
282
- let crc = CRC16_CCITT(headerBuffer);
283
- crc = CRC16_CCITT(this.payload.subarray(0, -2), crc);
284
- // Write the checksum into the last two bytes of the payload
285
- this.payload.writeUInt16BE(crc, this.payload.length - 2);
286
- return super.serialize(ctx);
287
- }
288
- computeEncapsulationOverhead() {
289
- // Transport Service CC (first segment) adds 1 byte datagram size, 1 byte Session ID/..., 1 byte offset, 2 bytes checksum and (0 OR n+1) bytes header extension
290
- return (super.computeEncapsulationOverhead()
291
- + 5
292
- + (this.headerExtension?.length
293
- ? 1 + this.headerExtension.length
294
- : 0));
295
- }
296
- toLogEntry(ctx) {
297
- return {
298
- ...super.toLogEntry(ctx),
299
- message: {
300
- "session ID": this.sessionId,
301
- "datagram size": this.datagramSize,
302
- "byte range": `${this.datagramOffset}...${this.datagramOffset + this.partialDatagram.length - 1}`,
303
- payload: buffer2hex(this.partialDatagram),
304
- },
305
- };
306
- }
307
- };
308
- TransportServiceCCSubsequentSegment = TransportServiceCCSubsequentSegment_1 = __decorate([
309
- CCCommand(TransportServiceCommand.SubsequentSegment)
310
- // @expectedCCResponse(TransportServiceCCReport)
311
- ], TransportServiceCCSubsequentSegment);
353
+ computeEncapsulationOverhead() {
354
+ // Transport Service CC (first segment) adds 1 byte datagram size, 1 byte Session ID/..., 1 byte offset, 2 bytes checksum and (0 OR n+1) bytes header extension
355
+ return (super.computeEncapsulationOverhead()
356
+ + 5
357
+ + (this.headerExtension?.length
358
+ ? 1 + this.headerExtension.length
359
+ : 0));
360
+ }
361
+ toLogEntry(ctx) {
362
+ return {
363
+ ...super.toLogEntry(ctx),
364
+ message: {
365
+ "session ID": this.sessionId,
366
+ "datagram size": this.datagramSize,
367
+ "byte range": `${this.datagramOffset}...${this.datagramOffset + this.partialDatagram.length - 1}`,
368
+ payload: buffer2hex(this.partialDatagram),
369
+ },
370
+ };
371
+ }
372
+ };
373
+ return TransportServiceCCSubsequentSegment = _classThis;
374
+ })();
312
375
  export { TransportServiceCCSubsequentSegment };
313
376
  function testResponseForSegmentRequest(sent, received) {
314
377
  return ((sent.datagramOffset === 0
@@ -319,104 +382,142 @@ function testResponseForSegmentRequest(sent, received) {
319
382
  && sent.datagramOffset === received.datagramOffset
320
383
  && received.sessionId === sent.sessionId));
321
384
  }
322
- let TransportServiceCCSegmentRequest = TransportServiceCCSegmentRequest_1 = class TransportServiceCCSegmentRequest extends TransportServiceCC {
323
- constructor(options) {
324
- super(options);
325
- this.sessionId = options.sessionId;
326
- this.datagramOffset = options.datagramOffset;
327
- }
328
- static from(raw, ctx) {
329
- validatePayload(raw.payload.length >= 3);
330
- const sessionId = raw.payload[1] >>> 4;
331
- const datagramOffset = ((raw.payload[1] & 0b111) << 8)
332
- + raw.payload[2];
333
- return new TransportServiceCCSegmentRequest_1({
334
- nodeId: ctx.sourceNodeId,
335
- sessionId,
336
- datagramOffset,
337
- });
338
- }
339
- sessionId;
340
- datagramOffset;
341
- serialize(ctx) {
342
- this.payload = Bytes.from([
343
- ((this.sessionId & 0b1111) << 4)
344
- | ((this.datagramOffset >>> 8) & 0b111),
345
- this.datagramOffset & 0xff,
346
- ]);
347
- return super.serialize(ctx);
348
- }
349
- toLogEntry(ctx) {
350
- return {
351
- ...super.toLogEntry(ctx),
352
- message: {
353
- "session ID": this.sessionId,
354
- offset: this.datagramOffset,
355
- },
356
- };
357
- }
358
- };
359
- TransportServiceCCSegmentRequest = TransportServiceCCSegmentRequest_1 = __decorate([
360
- CCCommand(TransportServiceCommand.SegmentRequest),
361
- expectedCCResponse(TransportServiceCC, testResponseForSegmentRequest)
362
- ], TransportServiceCCSegmentRequest);
385
+ let TransportServiceCCSegmentRequest = (() => {
386
+ let _classDecorators = [CCCommand(TransportServiceCommand.SegmentRequest), expectedCCResponse(TransportServiceCC, testResponseForSegmentRequest)];
387
+ let _classDescriptor;
388
+ let _classExtraInitializers = [];
389
+ let _classThis;
390
+ let _classSuper = TransportServiceCC;
391
+ var TransportServiceCCSegmentRequest = class extends _classSuper {
392
+ static { _classThis = this; }
393
+ static {
394
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
395
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
396
+ TransportServiceCCSegmentRequest = _classThis = _classDescriptor.value;
397
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
398
+ __runInitializers(_classThis, _classExtraInitializers);
399
+ }
400
+ constructor(options) {
401
+ super(options);
402
+ this.sessionId = options.sessionId;
403
+ this.datagramOffset = options.datagramOffset;
404
+ }
405
+ static from(raw, ctx) {
406
+ validatePayload(raw.payload.length >= 3);
407
+ const sessionId = raw.payload[1] >>> 4;
408
+ const datagramOffset = ((raw.payload[1] & 0b111) << 8)
409
+ + raw.payload[2];
410
+ return new this({
411
+ nodeId: ctx.sourceNodeId,
412
+ sessionId,
413
+ datagramOffset,
414
+ });
415
+ }
416
+ sessionId;
417
+ datagramOffset;
418
+ serialize(ctx) {
419
+ this.payload = Bytes.from([
420
+ ((this.sessionId & 0b1111) << 4)
421
+ | ((this.datagramOffset >>> 8) & 0b111),
422
+ this.datagramOffset & 0xff,
423
+ ]);
424
+ return super.serialize(ctx);
425
+ }
426
+ toLogEntry(ctx) {
427
+ return {
428
+ ...super.toLogEntry(ctx),
429
+ message: {
430
+ "session ID": this.sessionId,
431
+ offset: this.datagramOffset,
432
+ },
433
+ };
434
+ }
435
+ };
436
+ return TransportServiceCCSegmentRequest = _classThis;
437
+ })();
363
438
  export { TransportServiceCCSegmentRequest };
364
- let TransportServiceCCSegmentComplete = TransportServiceCCSegmentComplete_1 = class TransportServiceCCSegmentComplete extends TransportServiceCC {
365
- constructor(options) {
366
- super(options);
367
- this.sessionId = options.sessionId;
368
- }
369
- static from(raw, ctx) {
370
- validatePayload(raw.payload.length >= 2);
371
- const sessionId = raw.payload[1] >>> 4;
372
- return new TransportServiceCCSegmentComplete_1({
373
- nodeId: ctx.sourceNodeId,
374
- sessionId,
375
- });
376
- }
377
- sessionId;
378
- serialize(ctx) {
379
- this.payload = Bytes.from([(this.sessionId & 0b1111) << 4]);
380
- return super.serialize(ctx);
381
- }
382
- toLogEntry(ctx) {
383
- return {
384
- ...super.toLogEntry(ctx),
385
- message: { "session ID": this.sessionId },
386
- };
387
- }
388
- };
389
- TransportServiceCCSegmentComplete = TransportServiceCCSegmentComplete_1 = __decorate([
390
- CCCommand(TransportServiceCommand.SegmentComplete)
391
- ], TransportServiceCCSegmentComplete);
439
+ let TransportServiceCCSegmentComplete = (() => {
440
+ let _classDecorators = [CCCommand(TransportServiceCommand.SegmentComplete)];
441
+ let _classDescriptor;
442
+ let _classExtraInitializers = [];
443
+ let _classThis;
444
+ let _classSuper = TransportServiceCC;
445
+ var TransportServiceCCSegmentComplete = class extends _classSuper {
446
+ static { _classThis = this; }
447
+ static {
448
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
449
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
450
+ TransportServiceCCSegmentComplete = _classThis = _classDescriptor.value;
451
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
452
+ __runInitializers(_classThis, _classExtraInitializers);
453
+ }
454
+ constructor(options) {
455
+ super(options);
456
+ this.sessionId = options.sessionId;
457
+ }
458
+ static from(raw, ctx) {
459
+ validatePayload(raw.payload.length >= 2);
460
+ const sessionId = raw.payload[1] >>> 4;
461
+ return new this({
462
+ nodeId: ctx.sourceNodeId,
463
+ sessionId,
464
+ });
465
+ }
466
+ sessionId;
467
+ serialize(ctx) {
468
+ this.payload = Bytes.from([(this.sessionId & 0b1111) << 4]);
469
+ return super.serialize(ctx);
470
+ }
471
+ toLogEntry(ctx) {
472
+ return {
473
+ ...super.toLogEntry(ctx),
474
+ message: { "session ID": this.sessionId },
475
+ };
476
+ }
477
+ };
478
+ return TransportServiceCCSegmentComplete = _classThis;
479
+ })();
392
480
  export { TransportServiceCCSegmentComplete };
393
- let TransportServiceCCSegmentWait = TransportServiceCCSegmentWait_1 = class TransportServiceCCSegmentWait extends TransportServiceCC {
394
- constructor(options) {
395
- super(options);
396
- this.pendingSegments = options.pendingSegments;
397
- }
398
- static from(raw, ctx) {
399
- validatePayload(raw.payload.length >= 2);
400
- const pendingSegments = raw.payload[1];
401
- return new TransportServiceCCSegmentWait_1({
402
- nodeId: ctx.sourceNodeId,
403
- pendingSegments,
404
- });
405
- }
406
- pendingSegments;
407
- serialize(ctx) {
408
- this.payload = Bytes.from([this.pendingSegments]);
409
- return super.serialize(ctx);
410
- }
411
- toLogEntry(ctx) {
412
- return {
413
- ...super.toLogEntry(ctx),
414
- message: { "pending segments": this.pendingSegments },
415
- };
416
- }
417
- };
418
- TransportServiceCCSegmentWait = TransportServiceCCSegmentWait_1 = __decorate([
419
- CCCommand(TransportServiceCommand.SegmentWait)
420
- ], TransportServiceCCSegmentWait);
481
+ let TransportServiceCCSegmentWait = (() => {
482
+ let _classDecorators = [CCCommand(TransportServiceCommand.SegmentWait)];
483
+ let _classDescriptor;
484
+ let _classExtraInitializers = [];
485
+ let _classThis;
486
+ let _classSuper = TransportServiceCC;
487
+ var TransportServiceCCSegmentWait = class extends _classSuper {
488
+ static { _classThis = this; }
489
+ static {
490
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
491
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
492
+ TransportServiceCCSegmentWait = _classThis = _classDescriptor.value;
493
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
494
+ __runInitializers(_classThis, _classExtraInitializers);
495
+ }
496
+ constructor(options) {
497
+ super(options);
498
+ this.pendingSegments = options.pendingSegments;
499
+ }
500
+ static from(raw, ctx) {
501
+ validatePayload(raw.payload.length >= 2);
502
+ const pendingSegments = raw.payload[1];
503
+ return new this({
504
+ nodeId: ctx.sourceNodeId,
505
+ pendingSegments,
506
+ });
507
+ }
508
+ pendingSegments;
509
+ serialize(ctx) {
510
+ this.payload = Bytes.from([this.pendingSegments]);
511
+ return super.serialize(ctx);
512
+ }
513
+ toLogEntry(ctx) {
514
+ return {
515
+ ...super.toLogEntry(ctx),
516
+ message: { "pending segments": this.pendingSegments },
517
+ };
518
+ }
519
+ };
520
+ return TransportServiceCCSegmentWait = _classThis;
521
+ })();
421
522
  export { TransportServiceCCSegmentWait };
422
523
  //# sourceMappingURL=TransportServiceCC.js.map