@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.
- package/build/cjs/cc/AlarmSensorCC.js +381 -266
- package/build/cjs/cc/AlarmSensorCC.js.map +3 -3
- package/build/cjs/cc/AssociationCC.js +669 -503
- package/build/cjs/cc/AssociationCC.js.map +3 -3
- package/build/cjs/cc/AssociationGroupInfoCC.js +633 -492
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +3 -3
- package/build/cjs/cc/BarrierOperatorCC.js +595 -429
- package/build/cjs/cc/BarrierOperatorCC.js.map +3 -3
- package/build/cjs/cc/BasicCC.js +354 -260
- package/build/cjs/cc/BasicCC.js.map +3 -3
- package/build/cjs/cc/BatteryCC.js +427 -345
- package/build/cjs/cc/BatteryCC.js.map +3 -3
- package/build/cjs/cc/BinarySensorCC.js +391 -276
- package/build/cjs/cc/BinarySensorCC.js.map +3 -3
- package/build/cjs/cc/BinarySwitchCC.js +347 -253
- package/build/cjs/cc/BinarySwitchCC.js.map +3 -3
- package/build/cjs/cc/CRC16CC.js +160 -85
- package/build/cjs/cc/CRC16CC.js.map +3 -3
- package/build/cjs/cc/CentralSceneCC.js +459 -324
- package/build/cjs/cc/CentralSceneCC.js.map +3 -3
- package/build/cjs/cc/ClimateControlScheduleCC.js +459 -293
- package/build/cjs/cc/ClimateControlScheduleCC.js.map +3 -3
- package/build/cjs/cc/ClockCC.js +254 -150
- package/build/cjs/cc/ClockCC.js.map +3 -3
- package/build/cjs/cc/ColorSwitchCC.js +758 -610
- package/build/cjs/cc/ColorSwitchCC.js.map +3 -3
- package/build/cjs/cc/ConfigurationCC.js +1700 -1453
- package/build/cjs/cc/ConfigurationCC.js.map +3 -3
- package/build/cjs/cc/DeviceResetLocallyCC.js +125 -49
- package/build/cjs/cc/DeviceResetLocallyCC.js.map +3 -3
- package/build/cjs/cc/DoorLockCC.js +904 -777
- package/build/cjs/cc/DoorLockCC.js.map +3 -3
- package/build/cjs/cc/DoorLockLoggingCC.js +321 -206
- package/build/cjs/cc/DoorLockLoggingCC.js.map +3 -3
- package/build/cjs/cc/EnergyProductionCC.js +249 -160
- package/build/cjs/cc/EnergyProductionCC.js.map +3 -3
- package/build/cjs/cc/EntryControlCC.js +619 -458
- package/build/cjs/cc/EntryControlCC.js.map +3 -3
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +898 -698
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +3 -3
- package/build/cjs/cc/HailCC.js +57 -11
- package/build/cjs/cc/HailCC.js.map +2 -2
- package/build/cjs/cc/HumidityControlModeCC.js +359 -233
- package/build/cjs/cc/HumidityControlModeCC.js.map +3 -3
- package/build/cjs/cc/HumidityControlOperatingStateCC.js +189 -103
- package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +3 -3
- package/build/cjs/cc/HumidityControlSetpointCC.js +682 -495
- package/build/cjs/cc/HumidityControlSetpointCC.js.map +3 -3
- package/build/cjs/cc/InclusionControllerCC.js +205 -114
- package/build/cjs/cc/InclusionControllerCC.js.map +3 -3
- package/build/cjs/cc/IndicatorCC.js +897 -736
- package/build/cjs/cc/IndicatorCC.js.map +3 -3
- package/build/cjs/cc/IrrigationCC.js +1651 -1405
- package/build/cjs/cc/IrrigationCC.js.map +3 -3
- package/build/cjs/cc/LanguageCC.js +268 -171
- package/build/cjs/cc/LanguageCC.js.map +3 -3
- package/build/cjs/cc/LockCC.js +254 -154
- package/build/cjs/cc/LockCC.js.map +3 -3
- package/build/cjs/cc/ManufacturerProprietaryCC.js +189 -129
- package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerSpecificCC.js +319 -213
- package/build/cjs/cc/ManufacturerSpecificCC.js.map +3 -3
- package/build/cjs/cc/MeterCC.js +827 -707
- package/build/cjs/cc/MeterCC.js.map +3 -3
- package/build/cjs/cc/MultiChannelAssociationCC.js +612 -478
- package/build/cjs/cc/MultiChannelAssociationCC.js.map +3 -3
- package/build/cjs/cc/MultiChannelCC.js +1037 -819
- package/build/cjs/cc/MultiChannelCC.js.map +3 -3
- package/build/cjs/cc/MultiCommandCC.js +172 -97
- package/build/cjs/cc/MultiCommandCC.js.map +3 -3
- package/build/cjs/cc/MultilevelSensorCC.js +589 -449
- package/build/cjs/cc/MultilevelSensorCC.js.map +3 -3
- package/build/cjs/cc/MultilevelSwitchCC.js +587 -439
- package/build/cjs/cc/MultilevelSwitchCC.js.map +3 -3
- package/build/cjs/cc/NoOperationCC.js +89 -27
- package/build/cjs/cc/NoOperationCC.js.map +2 -2
- package/build/cjs/cc/NodeNamingCC.js +417 -277
- package/build/cjs/cc/NodeNamingCC.js.map +3 -3
- package/build/cjs/cc/NotificationCC.js +972 -818
- package/build/cjs/cc/NotificationCC.js.map +3 -3
- package/build/cjs/cc/PowerlevelCC.js +450 -303
- package/build/cjs/cc/PowerlevelCC.js.map +3 -3
- package/build/cjs/cc/ProtectionCC.js +686 -494
- package/build/cjs/cc/ProtectionCC.js.map +3 -3
- package/build/cjs/cc/SceneActivationCC.js +165 -97
- package/build/cjs/cc/SceneActivationCC.js.map +3 -3
- package/build/cjs/cc/SceneActuatorConfigurationCC.js +346 -243
- package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +3 -3
- package/build/cjs/cc/SceneControllerConfigurationCC.js +401 -298
- package/build/cjs/cc/SceneControllerConfigurationCC.js.map +3 -3
- package/build/cjs/cc/ScheduleEntryLockCC.js +1552 -1272
- package/build/cjs/cc/ScheduleEntryLockCC.js.map +3 -3
- package/build/cjs/cc/Security2CC.js +1483 -1219
- package/build/cjs/cc/Security2CC.js.map +3 -3
- package/build/cjs/cc/SecurityCC.js +839 -619
- package/build/cjs/cc/SecurityCC.js.map +3 -3
- package/build/cjs/cc/SoundSwitchCC.js +707 -515
- package/build/cjs/cc/SoundSwitchCC.js.map +3 -3
- package/build/cjs/cc/SupervisionCC.js +327 -237
- package/build/cjs/cc/SupervisionCC.js.map +3 -3
- package/build/cjs/cc/ThermostatFanModeCC.js +386 -263
- package/build/cjs/cc/ThermostatFanModeCC.js.map +3 -3
- package/build/cjs/cc/ThermostatFanStateCC.js +192 -106
- package/build/cjs/cc/ThermostatFanStateCC.js.map +3 -3
- package/build/cjs/cc/ThermostatModeCC.js +425 -302
- package/build/cjs/cc/ThermostatModeCC.js.map +3 -3
- package/build/cjs/cc/ThermostatOperatingStateCC.js +188 -102
- package/build/cjs/cc/ThermostatOperatingStateCC.js.map +3 -3
- package/build/cjs/cc/ThermostatSetbackCC.js +277 -173
- package/build/cjs/cc/ThermostatSetbackCC.js.map +3 -3
- package/build/cjs/cc/ThermostatSetpointCC.js +645 -491
- package/build/cjs/cc/ThermostatSetpointCC.js.map +3 -3
- package/build/cjs/cc/TimeCC.js +515 -353
- package/build/cjs/cc/TimeCC.js.map +3 -3
- package/build/cjs/cc/TimeParametersCC.js +302 -202
- package/build/cjs/cc/TimeParametersCC.js.map +3 -3
- package/build/cjs/cc/TransportServiceCC.js +433 -315
- package/build/cjs/cc/TransportServiceCC.js.map +3 -3
- package/build/cjs/cc/UserCodeCC.js +1385 -1102
- package/build/cjs/cc/UserCodeCC.js.map +3 -3
- package/build/cjs/cc/VersionCC.js +696 -562
- package/build/cjs/cc/VersionCC.js.map +3 -3
- package/build/cjs/cc/WakeUpCC.js +499 -346
- package/build/cjs/cc/WakeUpCC.js.map +3 -3
- package/build/cjs/cc/WindowCoveringCC.js +626 -478
- package/build/cjs/cc/WindowCoveringCC.js.map +3 -3
- package/build/cjs/cc/ZWaveLongRangeCC.js +57 -10
- package/build/cjs/cc/ZWaveLongRangeCC.js.map +2 -2
- package/build/cjs/cc/ZWavePlusCC.js +233 -159
- package/build/cjs/cc/ZWavePlusCC.js.map +3 -3
- package/build/cjs/cc/ZWaveProtocolCC.js +1515 -948
- package/build/cjs/cc/ZWaveProtocolCC.js.map +3 -3
- package/build/cjs/cc/manufacturerProprietary/Decorators.d.ts +4 -4
- package/build/cjs/cc/manufacturerProprietary/Decorators.js.map +1 -1
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +395 -274
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +3 -3
- package/build/cjs/lib/CommandClassDecorators.d.ts +11 -15
- package/build/cjs/lib/CommandClassDecorators.js +19 -20
- package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
- package/build/cjs/lib/Security2/Extension.d.ts +1 -1
- package/build/cjs/lib/Security2/Extension.js +217 -126
- package/build/cjs/lib/Security2/Extension.js.map +3 -3
- package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
- package/build/esm/cc/AlarmSensorCC.js +389 -291
- package/build/esm/cc/AlarmSensorCC.js.map +1 -1
- package/build/esm/cc/AssociationCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationCC.js +678 -537
- package/build/esm/cc/AssociationCC.js.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.js +659 -539
- package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.js +634 -493
- package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
- package/build/esm/cc/BasicCC.d.ts.map +1 -1
- package/build/esm/cc/BasicCC.js +380 -302
- package/build/esm/cc/BasicCC.js.map +1 -1
- package/build/esm/cc/BatteryCC.d.ts.map +1 -1
- package/build/esm/cc/BatteryCC.js +449 -384
- package/build/esm/cc/BatteryCC.js.map +1 -1
- package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySensorCC.js +395 -297
- package/build/esm/cc/BinarySensorCC.js.map +1 -1
- package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySwitchCC.js +353 -274
- package/build/esm/cc/BinarySwitchCC.js.map +1 -1
- package/build/esm/cc/CRC16CC.js +162 -98
- package/build/esm/cc/CRC16CC.js.map +1 -1
- package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
- package/build/esm/cc/CentralSceneCC.js +465 -351
- package/build/esm/cc/CentralSceneCC.js.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.js +454 -313
- package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
- package/build/esm/cc/ClockCC.js +248 -159
- package/build/esm/cc/ClockCC.js.map +1 -1
- package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/ColorSwitchCC.js +802 -677
- package/build/esm/cc/ColorSwitchCC.js.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +1899 -1687
- package/build/esm/cc/ConfigurationCC.js.map +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.js +124 -59
- package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
- package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockCC.js +951 -849
- package/build/esm/cc/DoorLockCC.js.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.js +316 -218
- package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
- package/build/esm/cc/EnergyProductionCC.js +240 -164
- package/build/esm/cc/EnergyProductionCC.js.map +1 -1
- package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
- package/build/esm/cc/EntryControlCC.js +629 -493
- package/build/esm/cc/EntryControlCC.js.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js +938 -769
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
- package/build/esm/cc/HailCC.js +51 -12
- package/build/esm/cc/HailCC.js.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.js +357 -250
- package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.js +182 -109
- package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.js +706 -546
- package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
- package/build/esm/cc/InclusionControllerCC.js +197 -119
- package/build/esm/cc/InclusionControllerCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.js +973 -835
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
- package/build/esm/cc/IrrigationCC.js +1697 -1496
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/LanguageCC.d.ts.map +1 -1
- package/build/esm/cc/LanguageCC.js +266 -184
- package/build/esm/cc/LanguageCC.js.map +1 -1
- package/build/esm/cc/LockCC.d.ts.map +1 -1
- package/build/esm/cc/LockCC.js +247 -162
- package/build/esm/cc/LockCC.js.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.js +192 -141
- package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js +312 -223
- package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/esm/cc/MeterCC.d.ts.map +1 -1
- package/build/esm/cc/MeterCC.js +896 -795
- package/build/esm/cc/MeterCC.js.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.js +631 -518
- package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +1106 -921
- package/build/esm/cc/MultiChannelCC.js.map +1 -1
- package/build/esm/cc/MultiCommandCC.js +166 -102
- package/build/esm/cc/MultiCommandCC.js.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.js +616 -497
- package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.js +621 -496
- package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/esm/cc/NoOperationCC.js +82 -29
- package/build/esm/cc/NoOperationCC.js.map +1 -1
- package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
- package/build/esm/cc/NodeNamingCC.js +413 -294
- package/build/esm/cc/NodeNamingCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.d.ts.map +1 -1
- package/build/esm/cc/NotificationCC.js +1097 -966
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/PowerlevelCC.js +437 -311
- package/build/esm/cc/PowerlevelCC.js.map +1 -1
- package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
- package/build/esm/cc/ProtectionCC.js +704 -543
- package/build/esm/cc/ProtectionCC.js.map +1 -1
- package/build/esm/cc/SceneActivationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActivationCC.js +157 -100
- package/build/esm/cc/SceneActivationCC.js.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.js +357 -269
- package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js +434 -346
- package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.js +1596 -1357
- package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/esm/cc/Security2CC.js +1633 -1406
- package/build/esm/cc/Security2CC.js.map +1 -1
- package/build/esm/cc/SecurityCC.js +876 -687
- package/build/esm/cc/SecurityCC.js.map +1 -1
- package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/SoundSwitchCC.js +689 -526
- package/build/esm/cc/SoundSwitchCC.js.map +1 -1
- package/build/esm/cc/SupervisionCC.js +349 -272
- package/build/esm/cc/SupervisionCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.js +388 -284
- package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.js +184 -111
- package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatModeCC.js +435 -331
- package/build/esm/cc/ThermostatModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.js +180 -107
- package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.js +274 -185
- package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.js +674 -543
- package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/esm/cc/TimeCC.js +499 -360
- package/build/esm/cc/TimeCC.js.map +1 -1
- package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
- package/build/esm/cc/TimeParametersCC.js +296 -211
- package/build/esm/cc/TimeParametersCC.js.map +1 -1
- package/build/esm/cc/TransportServiceCC.js +464 -363
- package/build/esm/cc/TransportServiceCC.js.map +1 -1
- package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
- package/build/esm/cc/UserCodeCC.js +1443 -1205
- package/build/esm/cc/UserCodeCC.js.map +1 -1
- package/build/esm/cc/VersionCC.d.ts.map +1 -1
- package/build/esm/cc/VersionCC.js +744 -635
- package/build/esm/cc/VersionCC.js.map +1 -1
- package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
- package/build/esm/cc/WakeUpCC.js +494 -364
- package/build/esm/cc/WakeUpCC.js.map +1 -1
- package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/esm/cc/WindowCoveringCC.js +655 -530
- package/build/esm/cc/WindowCoveringCC.js.map +1 -1
- package/build/esm/cc/ZWaveLongRangeCC.js +51 -11
- package/build/esm/cc/ZWaveLongRangeCC.js.map +1 -1
- package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
- package/build/esm/cc/ZWavePlusCC.js +223 -162
- package/build/esm/cc/ZWavePlusCC.js.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.js +1443 -953
- package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
- package/build/esm/cc/manufacturerProprietary/Decorators.d.ts +4 -4
- package/build/esm/cc/manufacturerProprietary/Decorators.d.ts.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js +390 -286
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/esm/lib/CommandClassDecorators.d.ts +11 -15
- package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
- package/build/esm/lib/CommandClassDecorators.js +24 -24
- package/build/esm/lib/CommandClassDecorators.js.map +1 -1
- package/build/esm/lib/Security2/Extension.d.ts +1 -1
- package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
- package/build/esm/lib/Security2/Extension.js +207 -123
- package/build/esm/lib/Security2/Extension.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,10 +1,37 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 UserCodeCC_1, UserCodeCCSet_1, UserCodeCCReport_1, UserCodeCCGet_1, UserCodeCCUsersNumberReport_1, UserCodeCCCapabilitiesReport_1, UserCodeCCKeypadModeSet_1, UserCodeCCKeypadModeReport_1, UserCodeCCAdminCodeSet_1, UserCodeCCAdminCodeReport_1, UserCodeCCUserCodeChecksumReport_1, UserCodeCCExtendedUserCodeReport_1;
|
|
8
35
|
function __assertType(argName, typeName, boundHasError) {
|
|
9
36
|
const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
|
|
10
37
|
if (boundHasError()) {
|
|
@@ -248,7 +275,7 @@ import { Bytes, isUint8Array, uint8ArrayToString } from "@zwave-js/shared/safe";
|
|
|
248
275
|
import { getEnumMemberName, isPrintableASCII, isPrintableASCIIWithWhitespace, num2hex, pick, } from "@zwave-js/shared/safe";
|
|
249
276
|
import { CCAPI, POLL_VALUE, PhysicalCCAPI, SET_VALUE, throwMissingPropertyKey, throwUnsupportedProperty, throwUnsupportedPropertyKey, throwWrongValueType, } from "../lib/API.js";
|
|
250
277
|
import { CommandClass, getEffectiveCCVersion, } from "../lib/CommandClass.js";
|
|
251
|
-
import { API, CCCommand,
|
|
278
|
+
import { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from "../lib/CommandClassDecorators.js";
|
|
252
279
|
import { V } from "../lib/Values.js";
|
|
253
280
|
import { KeypadMode, UserCodeCommand, UserIDStatus } from "../lib/_Types.js";
|
|
254
281
|
export const UserCodeCCValues = Object.freeze({
|
|
@@ -391,1305 +418,1516 @@ export function userCodeToLogString(userCode) {
|
|
|
391
418
|
return "(empty)";
|
|
392
419
|
return "*".repeat(userCode.length);
|
|
393
420
|
}
|
|
394
|
-
let UserCodeCCAPI =
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
case UserCodeCommand.AdminCodeGet: {
|
|
409
|
-
if (this.version < 2)
|
|
410
|
-
return false;
|
|
411
|
-
return this.tryGetValueDB()?.getValue(UserCodeCCValues.supportsAdminCode.endpoint(this.endpoint.index));
|
|
412
|
-
}
|
|
413
|
-
case UserCodeCommand.UserCodeChecksumGet: {
|
|
414
|
-
if (this.version < 2)
|
|
415
|
-
return false;
|
|
416
|
-
return this.tryGetValueDB()?.getValue(UserCodeCCValues.supportsUserCodeChecksum.endpoint(this.endpoint.index));
|
|
417
|
-
}
|
|
421
|
+
let UserCodeCCAPI = (() => {
|
|
422
|
+
let _classDecorators = [API(CommandClasses["User Code"])];
|
|
423
|
+
let _classDescriptor;
|
|
424
|
+
let _classExtraInitializers = [];
|
|
425
|
+
let _classThis;
|
|
426
|
+
let _classSuper = PhysicalCCAPI;
|
|
427
|
+
var UserCodeCCAPI = class extends _classSuper {
|
|
428
|
+
static { _classThis = this; }
|
|
429
|
+
static {
|
|
430
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
431
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
432
|
+
UserCodeCCAPI = _classThis = _classDescriptor.value;
|
|
433
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
434
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
418
435
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
436
|
+
supportsCommand(cmd) {
|
|
437
|
+
switch (cmd) {
|
|
438
|
+
case UserCodeCommand.Get:
|
|
439
|
+
case UserCodeCommand.Set:
|
|
440
|
+
case UserCodeCommand.UsersNumberGet:
|
|
441
|
+
return true; // This is mandatory
|
|
442
|
+
case UserCodeCommand.CapabilitiesGet:
|
|
443
|
+
case UserCodeCommand.KeypadModeSet:
|
|
444
|
+
case UserCodeCommand.KeypadModeGet:
|
|
445
|
+
case UserCodeCommand.ExtendedUserCodeSet:
|
|
446
|
+
case UserCodeCommand.ExtendedUserCodeGet:
|
|
447
|
+
return this.version >= 2;
|
|
448
|
+
case UserCodeCommand.AdminCodeSet:
|
|
449
|
+
case UserCodeCommand.AdminCodeGet: {
|
|
450
|
+
if (this.version < 2)
|
|
451
|
+
return false;
|
|
452
|
+
return this.tryGetValueDB()?.getValue(UserCodeCCValues.supportsAdminCode.endpoint(this.endpoint.index));
|
|
427
453
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|| property === "masterCode") {
|
|
433
|
-
if (typeof value !== "string") {
|
|
434
|
-
throwWrongValueType(this.ccId, property, "string", typeof value);
|
|
454
|
+
case UserCodeCommand.UserCodeChecksumGet: {
|
|
455
|
+
if (this.version < 2)
|
|
456
|
+
return false;
|
|
457
|
+
return this.tryGetValueDB()?.getValue(UserCodeCCValues.supportsUserCodeChecksum.endpoint(this.endpoint.index));
|
|
435
458
|
}
|
|
436
|
-
result = await this.setAdminCode(value);
|
|
437
459
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
460
|
+
return super.supportsCommand(cmd);
|
|
461
|
+
}
|
|
462
|
+
get [SET_VALUE]() {
|
|
463
|
+
return async function ({ property, propertyKey }, value) {
|
|
464
|
+
let result;
|
|
465
|
+
if (property === "keypadMode") {
|
|
466
|
+
if (typeof value !== "number") {
|
|
467
|
+
throwWrongValueType(this.ccId, property, "number", typeof value);
|
|
468
|
+
}
|
|
469
|
+
result = await this.setKeypadMode(value);
|
|
441
470
|
}
|
|
442
|
-
else if (
|
|
443
|
-
|
|
471
|
+
else if (property === "adminCode"
|
|
472
|
+
// Support devices that were interviewed before the rename to adminCode
|
|
473
|
+
|| property === "masterCode") {
|
|
474
|
+
if (typeof value !== "string") {
|
|
475
|
+
throwWrongValueType(this.ccId, property, "string", typeof value);
|
|
476
|
+
}
|
|
477
|
+
result = await this.setAdminCode(value);
|
|
444
478
|
}
|
|
445
|
-
if (
|
|
446
|
-
|
|
479
|
+
else if (property === "userIdStatus") {
|
|
480
|
+
if (propertyKey == undefined) {
|
|
481
|
+
throwMissingPropertyKey(this.ccId, property);
|
|
482
|
+
}
|
|
483
|
+
else if (typeof propertyKey !== "number") {
|
|
484
|
+
throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
|
|
485
|
+
}
|
|
486
|
+
if (typeof value !== "number") {
|
|
487
|
+
throwWrongValueType(this.ccId, property, "number", typeof value);
|
|
488
|
+
}
|
|
489
|
+
if (value === UserIDStatus.Available) {
|
|
490
|
+
// Clear Code
|
|
491
|
+
result = await this.clear(propertyKey);
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
// We need to set the user code along with the status
|
|
495
|
+
const userCode = this.getValueDB().getValue(UserCodeCCValues.userCode(propertyKey).endpoint(this.endpoint.index));
|
|
496
|
+
result = await this.set(propertyKey, value, userCode);
|
|
497
|
+
}
|
|
447
498
|
}
|
|
448
|
-
if (
|
|
449
|
-
|
|
450
|
-
|
|
499
|
+
else if (property === "userCode") {
|
|
500
|
+
if (propertyKey == undefined) {
|
|
501
|
+
throwMissingPropertyKey(this.ccId, property);
|
|
502
|
+
}
|
|
503
|
+
else if (typeof propertyKey !== "number") {
|
|
504
|
+
throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
|
|
505
|
+
}
|
|
506
|
+
if (typeof value !== "string" && !isUint8Array(value)) {
|
|
507
|
+
throwWrongValueType(this.ccId, property, "string or Buffer", typeof value);
|
|
508
|
+
}
|
|
509
|
+
// We need to set the user id status along with the code
|
|
510
|
+
let userIdStatus = this.getValueDB().getValue(UserCodeCCValues.userIdStatus(propertyKey).endpoint(this.endpoint.index));
|
|
511
|
+
if (userIdStatus === UserIDStatus.Available
|
|
512
|
+
|| userIdStatus == undefined) {
|
|
513
|
+
userIdStatus = UserIDStatus.Enabled;
|
|
514
|
+
}
|
|
515
|
+
result = await this.set(propertyKey, userIdStatus, value);
|
|
451
516
|
}
|
|
452
517
|
else {
|
|
453
|
-
|
|
454
|
-
const userCode = this.getValueDB().getValue(UserCodeCCValues.userCode(propertyKey).endpoint(this.endpoint.index));
|
|
455
|
-
result = await this.set(propertyKey, value, userCode);
|
|
518
|
+
throwUnsupportedProperty(this.ccId, property);
|
|
456
519
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
520
|
+
// Verify the change after a short delay, unless the command was supervised and successful
|
|
521
|
+
if (this.isSinglecast() && !supervisedCommandSucceeded(result)) {
|
|
522
|
+
this.schedulePoll({ property, propertyKey }, value, {
|
|
523
|
+
transition: "fast",
|
|
524
|
+
});
|
|
461
525
|
}
|
|
462
|
-
|
|
463
|
-
|
|
526
|
+
return result;
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
get [POLL_VALUE]() {
|
|
530
|
+
return async function ({ property, propertyKey }) {
|
|
531
|
+
switch (property) {
|
|
532
|
+
case "keypadMode":
|
|
533
|
+
return this.getKeypadMode();
|
|
534
|
+
case "adminCode":
|
|
535
|
+
return this.getAdminCode();
|
|
536
|
+
case "userIdStatus":
|
|
537
|
+
case "userCode": {
|
|
538
|
+
if (propertyKey == undefined) {
|
|
539
|
+
throwMissingPropertyKey(this.ccId, property);
|
|
540
|
+
}
|
|
541
|
+
else if (typeof propertyKey !== "number") {
|
|
542
|
+
throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
|
|
543
|
+
}
|
|
544
|
+
return (await this.get(propertyKey))?.[property];
|
|
545
|
+
}
|
|
546
|
+
default:
|
|
547
|
+
throwUnsupportedProperty(this.ccId, property);
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
async getUsersCount() {
|
|
552
|
+
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.UsersNumberGet);
|
|
553
|
+
const cc = new UserCodeCCUsersNumberGet({
|
|
554
|
+
nodeId: this.endpoint.nodeId,
|
|
555
|
+
endpointIndex: this.endpoint.index,
|
|
556
|
+
});
|
|
557
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
558
|
+
return response?.supportedUsers;
|
|
559
|
+
}
|
|
560
|
+
async get(userId, multiple = false) {
|
|
561
|
+
__assertType("userId", "number", __assertType__number.bind(void 0, userId));
|
|
562
|
+
__assertType("multiple", "(optional) boolean", __assertType__optional_boolean.bind(void 0, multiple));
|
|
563
|
+
if (userId > 255 || multiple) {
|
|
564
|
+
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.ExtendedUserCodeGet);
|
|
565
|
+
const cc = new UserCodeCCExtendedUserCodeGet({
|
|
566
|
+
nodeId: this.endpoint.nodeId,
|
|
567
|
+
endpointIndex: this.endpoint.index,
|
|
568
|
+
userId,
|
|
569
|
+
reportMore: multiple,
|
|
570
|
+
});
|
|
571
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
572
|
+
if (!response) {
|
|
573
|
+
return;
|
|
464
574
|
}
|
|
465
|
-
if (
|
|
466
|
-
|
|
575
|
+
else if (multiple) {
|
|
576
|
+
return pick(response, ["userCodes", "nextUserId"]);
|
|
467
577
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
578
|
+
else {
|
|
579
|
+
return pick(response.userCodes[0], [
|
|
580
|
+
"userIdStatus",
|
|
581
|
+
"userCode",
|
|
582
|
+
]);
|
|
473
583
|
}
|
|
474
|
-
result = await this.set(propertyKey, userIdStatus, value);
|
|
475
584
|
}
|
|
476
585
|
else {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
transition: "fast",
|
|
586
|
+
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.Get);
|
|
587
|
+
const cc = new UserCodeCCGet({
|
|
588
|
+
nodeId: this.endpoint.nodeId,
|
|
589
|
+
endpointIndex: this.endpoint.index,
|
|
590
|
+
userId,
|
|
483
591
|
});
|
|
592
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
593
|
+
if (response)
|
|
594
|
+
return pick(response, ["userIdStatus", "userCode"]);
|
|
484
595
|
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
case "adminCode":
|
|
494
|
-
return this.getAdminCode();
|
|
495
|
-
case "userIdStatus":
|
|
496
|
-
case "userCode": {
|
|
497
|
-
if (propertyKey == undefined) {
|
|
498
|
-
throwMissingPropertyKey(this.ccId, property);
|
|
499
|
-
}
|
|
500
|
-
else if (typeof propertyKey !== "number") {
|
|
501
|
-
throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
|
|
502
|
-
}
|
|
503
|
-
return (await this.get(propertyKey))?.[property];
|
|
504
|
-
}
|
|
505
|
-
default:
|
|
506
|
-
throwUnsupportedProperty(this.ccId, property);
|
|
596
|
+
}
|
|
597
|
+
/** Configures a single user code */
|
|
598
|
+
async set(userId, userIdStatus, userCode) {
|
|
599
|
+
__assertType("userId", "number", __assertType__number.bind(void 0, userId));
|
|
600
|
+
__assertType("userIdStatus", undefined, __assertType__su__1__2__3__4_eu.bind(void 0, userIdStatus));
|
|
601
|
+
__assertType("userCode", undefined, __assertType__su__string__uint8array_eu.bind(void 0, userCode));
|
|
602
|
+
if (userId > 255) {
|
|
603
|
+
return this.setMany([{ userId, userIdStatus, userCode }]);
|
|
507
604
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
endpointIndex: this.endpoint.index,
|
|
515
|
-
});
|
|
516
|
-
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
517
|
-
return response?.supportedUsers;
|
|
518
|
-
}
|
|
519
|
-
async get(userId, multiple = false) {
|
|
520
|
-
__assertType("userId", "number", __assertType__number.bind(void 0, userId));
|
|
521
|
-
__assertType("multiple", "(optional) boolean", __assertType__optional_boolean.bind(void 0, multiple));
|
|
522
|
-
if (userId > 255 || multiple) {
|
|
523
|
-
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.ExtendedUserCodeGet);
|
|
524
|
-
const cc = new UserCodeCCExtendedUserCodeGet({
|
|
605
|
+
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.Set);
|
|
606
|
+
const numUsers = UserCodeCC.getSupportedUsersCached(this.host, this.endpoint);
|
|
607
|
+
if (numUsers != undefined && userId > numUsers) {
|
|
608
|
+
throw new ZWaveError(`The user ID must be between 0 and the number of supported users ${numUsers}.`, ZWaveErrorCodes.Argument_Invalid);
|
|
609
|
+
}
|
|
610
|
+
const cc = new UserCodeCCSet({
|
|
525
611
|
nodeId: this.endpoint.nodeId,
|
|
526
612
|
endpointIndex: this.endpoint.index,
|
|
527
613
|
userId,
|
|
528
|
-
|
|
614
|
+
userIdStatus,
|
|
615
|
+
userCode,
|
|
529
616
|
});
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
617
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
618
|
+
}
|
|
619
|
+
/** Configures multiple user codes */
|
|
620
|
+
async setMany(codes) {
|
|
621
|
+
__assertType("codes", undefined, __assertType__sa_su__3__4__5_eu_ea_2.bind(void 0, codes));
|
|
622
|
+
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.ExtendedUserCodeSet);
|
|
623
|
+
const numUsers = UserCodeCC.getSupportedUsersCached(this.host, this.endpoint);
|
|
624
|
+
const supportedStatuses = UserCodeCC.getSupportedUserIDStatusesCached(this.host, this.endpoint);
|
|
625
|
+
const supportedASCIIChars = UserCodeCC.getSupportedASCIICharsCached(this.host, this.endpoint);
|
|
626
|
+
const supportsMultipleUserCodeSet = UserCodeCC.supportsMultipleUserCodeSetCached(this.host, this.endpoint) ?? false;
|
|
627
|
+
// Validate options
|
|
628
|
+
if (numUsers != undefined) {
|
|
629
|
+
if (codes.some((code) => code.userId < 0 || code.userId > numUsers)) {
|
|
630
|
+
throw new ZWaveError(`All User IDs must be between 0 and the number of supported users ${numUsers}.`, ZWaveErrorCodes.Argument_Invalid);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
else {
|
|
634
|
+
if (codes.some((code) => code.userId < 0)) {
|
|
635
|
+
throw new ZWaveError(`All User IDs must be greater than 0.`, ZWaveErrorCodes.Argument_Invalid);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
if (codes.some((code) => code.userId === 0) && codes.length > 1) {
|
|
639
|
+
throw new ZWaveError(`If user ID 0 is used, only one code may be set`, ZWaveErrorCodes.Argument_Invalid);
|
|
533
640
|
}
|
|
534
|
-
else if (
|
|
535
|
-
|
|
641
|
+
else if (codes.some((code) => code.userId === 0
|
|
642
|
+
&& code.userIdStatus !== UserIDStatus.Available)) {
|
|
643
|
+
throw new ZWaveError(`User ID 0 may only be used to clear all user codes`, ZWaveErrorCodes.Argument_Invalid);
|
|
644
|
+
}
|
|
645
|
+
else if (codes.length > 1 && !supportsMultipleUserCodeSet) {
|
|
646
|
+
throw new ZWaveError(`The node does not support setting multiple user codes at once`, ZWaveErrorCodes.Argument_Invalid);
|
|
647
|
+
}
|
|
648
|
+
for (const code of codes) {
|
|
649
|
+
if (supportedStatuses != undefined
|
|
650
|
+
&& !supportedStatuses.includes(code.userIdStatus)) {
|
|
651
|
+
throw new ZWaveError(`The user ID status ${getEnumMemberName(UserIDStatus, code.userIdStatus)} is not supported by the node`, ZWaveErrorCodes.Argument_Invalid);
|
|
652
|
+
}
|
|
653
|
+
else if (code.userIdStatus === UserIDStatus.Available) {
|
|
654
|
+
code.userCode = undefined;
|
|
655
|
+
}
|
|
656
|
+
else if (supportedASCIIChars) {
|
|
657
|
+
const userCodeString = typeof code.userCode === "string"
|
|
658
|
+
? code.userCode
|
|
659
|
+
: uint8ArrayToString(code.userCode);
|
|
660
|
+
if (!validateCode(userCodeString, supportedASCIIChars)) {
|
|
661
|
+
throw new ZWaveError(`The user code must consist of 4 to 10 of the following characters: ${supportedASCIIChars}`, ZWaveErrorCodes.Argument_Invalid);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
const cc = new UserCodeCCExtendedUserCodeSet({
|
|
666
|
+
nodeId: this.endpoint.nodeId,
|
|
667
|
+
endpointIndex: this.endpoint.index,
|
|
668
|
+
userCodes: codes,
|
|
669
|
+
});
|
|
670
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Clears one or all user code
|
|
674
|
+
* @param userId The user code to clear. If none or 0 is given, all codes are cleared
|
|
675
|
+
*/
|
|
676
|
+
async clear(userId = 0) {
|
|
677
|
+
__assertType("userId", "(optional) number", __assertType__optional_number.bind(void 0, userId));
|
|
678
|
+
if (this.version > 1 || userId > 255) {
|
|
679
|
+
return this.setMany([
|
|
680
|
+
{ userId, userIdStatus: UserIDStatus.Available },
|
|
681
|
+
]);
|
|
536
682
|
}
|
|
537
683
|
else {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
684
|
+
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.Set);
|
|
685
|
+
const numUsers = UserCodeCC.getSupportedUsersCached(this.host, this.endpoint);
|
|
686
|
+
if (numUsers != undefined && userId > numUsers) {
|
|
687
|
+
throw new ZWaveError(`The user ID must be between 0 and the number of supported users ${numUsers}.`, ZWaveErrorCodes.Argument_Invalid);
|
|
688
|
+
}
|
|
689
|
+
const cc = new UserCodeCCSet({
|
|
690
|
+
nodeId: this.endpoint.nodeId,
|
|
691
|
+
endpointIndex: this.endpoint.index,
|
|
692
|
+
userId,
|
|
693
|
+
userIdStatus: UserIDStatus.Available,
|
|
694
|
+
});
|
|
695
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
699
|
+
async getCapabilities() {
|
|
700
|
+
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.CapabilitiesGet);
|
|
701
|
+
const cc = new UserCodeCCCapabilitiesGet({
|
|
702
|
+
nodeId: this.endpoint.nodeId,
|
|
703
|
+
endpointIndex: this.endpoint.index,
|
|
704
|
+
});
|
|
705
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
706
|
+
if (response) {
|
|
707
|
+
return pick(response, [
|
|
708
|
+
"supportsAdminCode",
|
|
709
|
+
"supportsAdminCodeDeactivation",
|
|
710
|
+
"supportsUserCodeChecksum",
|
|
711
|
+
"supportsMultipleUserCodeReport",
|
|
712
|
+
"supportsMultipleUserCodeSet",
|
|
713
|
+
"supportedUserIDStatuses",
|
|
714
|
+
"supportedKeypadModes",
|
|
715
|
+
"supportedASCIIChars",
|
|
541
716
|
]);
|
|
542
717
|
}
|
|
543
718
|
}
|
|
544
|
-
|
|
545
|
-
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.
|
|
546
|
-
const cc = new
|
|
719
|
+
async getKeypadMode() {
|
|
720
|
+
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.KeypadModeGet);
|
|
721
|
+
const cc = new UserCodeCCKeypadModeGet({
|
|
547
722
|
nodeId: this.endpoint.nodeId,
|
|
548
723
|
endpointIndex: this.endpoint.index,
|
|
549
|
-
userId,
|
|
550
724
|
});
|
|
551
725
|
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
552
|
-
|
|
553
|
-
return pick(response, ["userIdStatus", "userCode"]);
|
|
726
|
+
return response?.keypadMode;
|
|
554
727
|
}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
if (userId > 255) {
|
|
562
|
-
return this.setMany([{ userId, userIdStatus, userCode }]);
|
|
563
|
-
}
|
|
564
|
-
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.Set);
|
|
565
|
-
const numUsers = UserCodeCC.getSupportedUsersCached(this.host, this.endpoint);
|
|
566
|
-
if (numUsers != undefined && userId > numUsers) {
|
|
567
|
-
throw new ZWaveError(`The user ID must be between 0 and the number of supported users ${numUsers}.`, ZWaveErrorCodes.Argument_Invalid);
|
|
568
|
-
}
|
|
569
|
-
const cc = new UserCodeCCSet({
|
|
570
|
-
nodeId: this.endpoint.nodeId,
|
|
571
|
-
endpointIndex: this.endpoint.index,
|
|
572
|
-
userId,
|
|
573
|
-
userIdStatus,
|
|
574
|
-
userCode,
|
|
575
|
-
});
|
|
576
|
-
return this.host.sendCommand(cc, this.commandOptions);
|
|
577
|
-
}
|
|
578
|
-
/** Configures multiple user codes */
|
|
579
|
-
async setMany(codes) {
|
|
580
|
-
__assertType("codes", undefined, __assertType__sa_su__3__4__5_eu_ea_2.bind(void 0, codes));
|
|
581
|
-
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.ExtendedUserCodeSet);
|
|
582
|
-
const numUsers = UserCodeCC.getSupportedUsersCached(this.host, this.endpoint);
|
|
583
|
-
const supportedStatuses = UserCodeCC.getSupportedUserIDStatusesCached(this.host, this.endpoint);
|
|
584
|
-
const supportedASCIIChars = UserCodeCC.getSupportedASCIICharsCached(this.host, this.endpoint);
|
|
585
|
-
const supportsMultipleUserCodeSet = UserCodeCC.supportsMultipleUserCodeSetCached(this.host, this.endpoint) ?? false;
|
|
586
|
-
// Validate options
|
|
587
|
-
if (numUsers != undefined) {
|
|
588
|
-
if (codes.some((code) => code.userId < 0 || code.userId > numUsers)) {
|
|
589
|
-
throw new ZWaveError(`All User IDs must be between 0 and the number of supported users ${numUsers}.`, ZWaveErrorCodes.Argument_Invalid);
|
|
728
|
+
async setKeypadMode(keypadMode) {
|
|
729
|
+
__assertType("keypadMode", "KeypadMode", __assertType__KeypadMode.bind(void 0, keypadMode));
|
|
730
|
+
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.KeypadModeSet);
|
|
731
|
+
const supportedModes = UserCodeCC.getSupportedKeypadModesCached(this.host, this.endpoint);
|
|
732
|
+
if (!supportedModes) {
|
|
733
|
+
throw new ZWaveError(`The keypad mode can only be set after the interview is complete!`, ZWaveErrorCodes.Argument_Invalid);
|
|
590
734
|
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
if (codes.some((code) => code.userId < 0)) {
|
|
594
|
-
throw new ZWaveError(`All User IDs must be greater than 0.`, ZWaveErrorCodes.Argument_Invalid);
|
|
735
|
+
else if (!supportedModes.includes(keypadMode)) {
|
|
736
|
+
throw new ZWaveError(`The keypad mode ${getEnumMemberName(KeypadMode, keypadMode)} is not supported by the node!`, ZWaveErrorCodes.Argument_Invalid);
|
|
595
737
|
}
|
|
738
|
+
const cc = new UserCodeCCKeypadModeSet({
|
|
739
|
+
nodeId: this.endpoint.nodeId,
|
|
740
|
+
endpointIndex: this.endpoint.index,
|
|
741
|
+
keypadMode,
|
|
742
|
+
});
|
|
743
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
596
744
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
throw new ZWaveError(`The node does not support setting multiple user codes at once`, ZWaveErrorCodes.Argument_Invalid);
|
|
745
|
+
async getAdminCode() {
|
|
746
|
+
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.AdminCodeGet);
|
|
747
|
+
const cc = new UserCodeCCAdminCodeGet({
|
|
748
|
+
nodeId: this.endpoint.nodeId,
|
|
749
|
+
endpointIndex: this.endpoint.index,
|
|
750
|
+
});
|
|
751
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
752
|
+
return response?.adminCode;
|
|
606
753
|
}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
754
|
+
async setAdminCode(adminCode) {
|
|
755
|
+
__assertType("adminCode", "string", __assertType__string.bind(void 0, adminCode));
|
|
756
|
+
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.AdminCodeSet);
|
|
757
|
+
const supportedASCIIChars = UserCodeCC.getSupportedASCIICharsCached(this.host, this.endpoint);
|
|
758
|
+
if (!supportedASCIIChars) {
|
|
759
|
+
throw new ZWaveError(`The admin code can only be set after the interview is complete!`, ZWaveErrorCodes.Argument_Invalid);
|
|
611
760
|
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
: uint8ArrayToString(code.userCode);
|
|
619
|
-
if (!validateCode(userCodeString, supportedASCIIChars)) {
|
|
620
|
-
throw new ZWaveError(`The user code must consist of 4 to 10 of the following characters: ${supportedASCIIChars}`, ZWaveErrorCodes.Argument_Invalid);
|
|
761
|
+
// Validate the code
|
|
762
|
+
if (!adminCode) {
|
|
763
|
+
const supportsDeactivation = UserCodeCC
|
|
764
|
+
.supportsAdminCodeDeactivationCached(this.host, this.endpoint);
|
|
765
|
+
if (!supportsDeactivation) {
|
|
766
|
+
throw new ZWaveError(`The node does not support deactivating the admin code!`, ZWaveErrorCodes.Argument_Invalid);
|
|
621
767
|
}
|
|
622
768
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
nodeId: this.endpoint.nodeId,
|
|
626
|
-
endpointIndex: this.endpoint.index,
|
|
627
|
-
userCodes: codes,
|
|
628
|
-
});
|
|
629
|
-
return this.host.sendCommand(cc, this.commandOptions);
|
|
630
|
-
}
|
|
631
|
-
/**
|
|
632
|
-
* Clears one or all user code
|
|
633
|
-
* @param userId The user code to clear. If none or 0 is given, all codes are cleared
|
|
634
|
-
*/
|
|
635
|
-
async clear(userId = 0) {
|
|
636
|
-
__assertType("userId", "(optional) number", __assertType__optional_number.bind(void 0, userId));
|
|
637
|
-
if (this.version > 1 || userId > 255) {
|
|
638
|
-
return this.setMany([
|
|
639
|
-
{ userId, userIdStatus: UserIDStatus.Available },
|
|
640
|
-
]);
|
|
641
|
-
}
|
|
642
|
-
else {
|
|
643
|
-
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.Set);
|
|
644
|
-
const numUsers = UserCodeCC.getSupportedUsersCached(this.host, this.endpoint);
|
|
645
|
-
if (numUsers != undefined && userId > numUsers) {
|
|
646
|
-
throw new ZWaveError(`The user ID must be between 0 and the number of supported users ${numUsers}.`, ZWaveErrorCodes.Argument_Invalid);
|
|
769
|
+
else if (!validateCode(adminCode, supportedASCIIChars)) {
|
|
770
|
+
throw new ZWaveError(`The admin code must consist of 4 to 10 of the following characters: ${supportedASCIIChars}`, ZWaveErrorCodes.Argument_Invalid);
|
|
647
771
|
}
|
|
648
|
-
const cc = new
|
|
772
|
+
const cc = new UserCodeCCAdminCodeSet({
|
|
649
773
|
nodeId: this.endpoint.nodeId,
|
|
650
774
|
endpointIndex: this.endpoint.index,
|
|
651
|
-
|
|
652
|
-
userIdStatus: UserIDStatus.Available,
|
|
775
|
+
adminCode,
|
|
653
776
|
});
|
|
654
777
|
return this.host.sendCommand(cc, this.commandOptions);
|
|
655
778
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
665
|
-
if (response) {
|
|
666
|
-
return pick(response, [
|
|
667
|
-
"supportsAdminCode",
|
|
668
|
-
"supportsAdminCodeDeactivation",
|
|
669
|
-
"supportsUserCodeChecksum",
|
|
670
|
-
"supportsMultipleUserCodeReport",
|
|
671
|
-
"supportsMultipleUserCodeSet",
|
|
672
|
-
"supportedUserIDStatuses",
|
|
673
|
-
"supportedKeypadModes",
|
|
674
|
-
"supportedASCIIChars",
|
|
675
|
-
]);
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
async getKeypadMode() {
|
|
679
|
-
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.KeypadModeGet);
|
|
680
|
-
const cc = new UserCodeCCKeypadModeGet({
|
|
681
|
-
nodeId: this.endpoint.nodeId,
|
|
682
|
-
endpointIndex: this.endpoint.index,
|
|
683
|
-
});
|
|
684
|
-
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
685
|
-
return response?.keypadMode;
|
|
686
|
-
}
|
|
687
|
-
async setKeypadMode(keypadMode) {
|
|
688
|
-
__assertType("keypadMode", "KeypadMode", __assertType__KeypadMode.bind(void 0, keypadMode));
|
|
689
|
-
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.KeypadModeSet);
|
|
690
|
-
const supportedModes = UserCodeCC.getSupportedKeypadModesCached(this.host, this.endpoint);
|
|
691
|
-
if (!supportedModes) {
|
|
692
|
-
throw new ZWaveError(`The keypad mode can only be set after the interview is complete!`, ZWaveErrorCodes.Argument_Invalid);
|
|
693
|
-
}
|
|
694
|
-
else if (!supportedModes.includes(keypadMode)) {
|
|
695
|
-
throw new ZWaveError(`The keypad mode ${getEnumMemberName(KeypadMode, keypadMode)} is not supported by the node!`, ZWaveErrorCodes.Argument_Invalid);
|
|
696
|
-
}
|
|
697
|
-
const cc = new UserCodeCCKeypadModeSet({
|
|
698
|
-
nodeId: this.endpoint.nodeId,
|
|
699
|
-
endpointIndex: this.endpoint.index,
|
|
700
|
-
keypadMode,
|
|
701
|
-
});
|
|
702
|
-
return this.host.sendCommand(cc, this.commandOptions);
|
|
703
|
-
}
|
|
704
|
-
async getAdminCode() {
|
|
705
|
-
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.AdminCodeGet);
|
|
706
|
-
const cc = new UserCodeCCAdminCodeGet({
|
|
707
|
-
nodeId: this.endpoint.nodeId,
|
|
708
|
-
endpointIndex: this.endpoint.index,
|
|
709
|
-
});
|
|
710
|
-
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
711
|
-
return response?.adminCode;
|
|
712
|
-
}
|
|
713
|
-
async setAdminCode(adminCode) {
|
|
714
|
-
__assertType("adminCode", "string", __assertType__string.bind(void 0, adminCode));
|
|
715
|
-
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.AdminCodeSet);
|
|
716
|
-
const supportedASCIIChars = UserCodeCC.getSupportedASCIICharsCached(this.host, this.endpoint);
|
|
717
|
-
if (!supportedASCIIChars) {
|
|
718
|
-
throw new ZWaveError(`The admin code can only be set after the interview is complete!`, ZWaveErrorCodes.Argument_Invalid);
|
|
719
|
-
}
|
|
720
|
-
// Validate the code
|
|
721
|
-
if (!adminCode) {
|
|
722
|
-
const supportsDeactivation = UserCodeCC
|
|
723
|
-
.supportsAdminCodeDeactivationCached(this.host, this.endpoint);
|
|
724
|
-
if (!supportsDeactivation) {
|
|
725
|
-
throw new ZWaveError(`The node does not support deactivating the admin code!`, ZWaveErrorCodes.Argument_Invalid);
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
else if (!validateCode(adminCode, supportedASCIIChars)) {
|
|
729
|
-
throw new ZWaveError(`The admin code must consist of 4 to 10 of the following characters: ${supportedASCIIChars}`, ZWaveErrorCodes.Argument_Invalid);
|
|
779
|
+
async getUserCodeChecksum() {
|
|
780
|
+
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.UserCodeChecksumGet);
|
|
781
|
+
const cc = new UserCodeCCUserCodeChecksumGet({
|
|
782
|
+
nodeId: this.endpoint.nodeId,
|
|
783
|
+
endpointIndex: this.endpoint.index,
|
|
784
|
+
});
|
|
785
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
786
|
+
return response?.userCodeChecksum;
|
|
730
787
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
adminCode,
|
|
735
|
-
});
|
|
736
|
-
return this.host.sendCommand(cc, this.commandOptions);
|
|
737
|
-
}
|
|
738
|
-
async getUserCodeChecksum() {
|
|
739
|
-
this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.UserCodeChecksumGet);
|
|
740
|
-
const cc = new UserCodeCCUserCodeChecksumGet({
|
|
741
|
-
nodeId: this.endpoint.nodeId,
|
|
742
|
-
endpointIndex: this.endpoint.index,
|
|
743
|
-
});
|
|
744
|
-
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
745
|
-
return response?.userCodeChecksum;
|
|
746
|
-
}
|
|
747
|
-
};
|
|
748
|
-
UserCodeCCAPI = __decorate([
|
|
749
|
-
API(CommandClasses["User Code"])
|
|
750
|
-
], UserCodeCCAPI);
|
|
788
|
+
};
|
|
789
|
+
return UserCodeCCAPI = _classThis;
|
|
790
|
+
})();
|
|
751
791
|
export { UserCodeCCAPI };
|
|
752
|
-
let UserCodeCC =
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
ctx.logNode(node.id, {
|
|
767
|
-
message: "querying capabilities...",
|
|
768
|
-
direction: "outbound",
|
|
769
|
-
});
|
|
770
|
-
const caps = await api.getCapabilities();
|
|
771
|
-
if (!caps) {
|
|
772
|
-
ctx.logNode(node.id, {
|
|
773
|
-
endpoint: this.endpointIndex,
|
|
774
|
-
message: "User Code capabilities query timed out, skipping interview...",
|
|
775
|
-
level: "warn",
|
|
776
|
-
});
|
|
777
|
-
return;
|
|
778
|
-
}
|
|
792
|
+
let UserCodeCC = (() => {
|
|
793
|
+
let _classDecorators = [commandClass(CommandClasses["User Code"]), implementedVersion(2), ccValues(UserCodeCCValues)];
|
|
794
|
+
let _classDescriptor;
|
|
795
|
+
let _classExtraInitializers = [];
|
|
796
|
+
let _classThis;
|
|
797
|
+
let _classSuper = CommandClass;
|
|
798
|
+
var UserCodeCC = class extends _classSuper {
|
|
799
|
+
static { _classThis = this; }
|
|
800
|
+
static {
|
|
801
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
802
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
803
|
+
UserCodeCC = _classThis = _classDescriptor.value;
|
|
804
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
805
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
779
806
|
}
|
|
780
|
-
ctx
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
807
|
+
async interview(ctx) {
|
|
808
|
+
const node = this.getNode(ctx);
|
|
809
|
+
const endpoint = this.getEndpoint(ctx);
|
|
810
|
+
const api = CCAPI.create(CommandClasses["User Code"], ctx, endpoint).withOptions({
|
|
811
|
+
priority: MessagePriority.NodeQuery,
|
|
812
|
+
});
|
|
786
813
|
ctx.logNode(node.id, {
|
|
787
814
|
endpoint: this.endpointIndex,
|
|
788
|
-
message:
|
|
789
|
-
|
|
815
|
+
message: `Interviewing ${this.ccName}...`,
|
|
816
|
+
direction: "none",
|
|
790
817
|
});
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
for (let userId = 1; userId <= supportedUsers; userId++) {
|
|
794
|
-
setUserCodeMetadata.call(this, ctx, userId);
|
|
795
|
-
}
|
|
796
|
-
// Synchronize user codes and settings
|
|
797
|
-
if (ctx.getInterviewOptions()?.queryAllUserCodes) {
|
|
798
|
-
await this.refreshValues(ctx);
|
|
799
|
-
}
|
|
800
|
-
// Remember that the interview is complete
|
|
801
|
-
this.setInterviewComplete(ctx, true);
|
|
802
|
-
}
|
|
803
|
-
async refreshValues(ctx) {
|
|
804
|
-
const node = this.getNode(ctx);
|
|
805
|
-
const endpoint = this.getEndpoint(ctx);
|
|
806
|
-
const api = CCAPI.create(CommandClasses["User Code"], ctx, endpoint).withOptions({
|
|
807
|
-
priority: MessagePriority.NodeQuery,
|
|
808
|
-
});
|
|
809
|
-
const supportsAdminCode = UserCodeCC_1.supportsAdminCodeCached(ctx, endpoint);
|
|
810
|
-
const supportsUserCodeChecksum = this.getValue(ctx, UserCodeCCValues.supportsUserCodeChecksum) ?? false;
|
|
811
|
-
const supportedKeypadModes = this.getValue(ctx, UserCodeCCValues.supportedKeypadModes)
|
|
812
|
-
?? [];
|
|
813
|
-
const supportedUsers = this.getValue(ctx, UserCodeCCValues.supportedUsers) ?? 0;
|
|
814
|
-
const supportsMultipleUserCodeReport = !!this.getValue(ctx, UserCodeCCValues.supportsMultipleUserCodeReport);
|
|
815
|
-
// Check for changed values and codes
|
|
816
|
-
if (api.version >= 2) {
|
|
817
|
-
if (supportsAdminCode) {
|
|
818
|
+
// Query capabilities first to determine what needs to be done when refreshing
|
|
819
|
+
if (api.version >= 2) {
|
|
818
820
|
ctx.logNode(node.id, {
|
|
819
|
-
message: "querying
|
|
821
|
+
message: "querying capabilities...",
|
|
820
822
|
direction: "outbound",
|
|
821
823
|
});
|
|
822
|
-
await api.
|
|
824
|
+
const caps = await api.getCapabilities();
|
|
825
|
+
if (!caps) {
|
|
826
|
+
ctx.logNode(node.id, {
|
|
827
|
+
endpoint: this.endpointIndex,
|
|
828
|
+
message: "User Code capabilities query timed out, skipping interview...",
|
|
829
|
+
level: "warn",
|
|
830
|
+
});
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
823
833
|
}
|
|
824
|
-
|
|
834
|
+
ctx.logNode(node.id, {
|
|
835
|
+
message: "querying number of user codes...",
|
|
836
|
+
direction: "outbound",
|
|
837
|
+
});
|
|
838
|
+
const supportedUsers = await api.getUsersCount();
|
|
839
|
+
if (supportedUsers == undefined) {
|
|
825
840
|
ctx.logNode(node.id, {
|
|
826
|
-
|
|
827
|
-
|
|
841
|
+
endpoint: this.endpointIndex,
|
|
842
|
+
message: "Querying number of user codes timed out, skipping interview...",
|
|
843
|
+
level: "warn",
|
|
828
844
|
});
|
|
829
|
-
|
|
845
|
+
return;
|
|
830
846
|
}
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
if (supportsUserCodeChecksum) {
|
|
834
|
-
ctx.logNode(node.id, {
|
|
835
|
-
message: "retrieving current user code checksum...",
|
|
836
|
-
direction: "outbound",
|
|
837
|
-
});
|
|
838
|
-
currentUserCodeChecksum = await api.getUserCodeChecksum();
|
|
847
|
+
for (let userId = 1; userId <= supportedUsers; userId++) {
|
|
848
|
+
setUserCodeMetadata.call(this, ctx, userId);
|
|
839
849
|
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
850
|
+
// Synchronize user codes and settings
|
|
851
|
+
if (ctx.getInterviewOptions()?.queryAllUserCodes) {
|
|
852
|
+
await this.refreshValues(ctx);
|
|
853
|
+
}
|
|
854
|
+
// Remember that the interview is complete
|
|
855
|
+
this.setInterviewComplete(ctx, true);
|
|
856
|
+
}
|
|
857
|
+
async refreshValues(ctx) {
|
|
858
|
+
const node = this.getNode(ctx);
|
|
859
|
+
const endpoint = this.getEndpoint(ctx);
|
|
860
|
+
const api = CCAPI.create(CommandClasses["User Code"], ctx, endpoint).withOptions({
|
|
861
|
+
priority: MessagePriority.NodeQuery,
|
|
862
|
+
});
|
|
863
|
+
const supportsAdminCode = UserCodeCC.supportsAdminCodeCached(ctx, endpoint);
|
|
864
|
+
const supportsUserCodeChecksum = this.getValue(ctx, UserCodeCCValues.supportsUserCodeChecksum) ?? false;
|
|
865
|
+
const supportedKeypadModes = this.getValue(ctx, UserCodeCCValues.supportedKeypadModes)
|
|
866
|
+
?? [];
|
|
867
|
+
const supportedUsers = this.getValue(ctx, UserCodeCCValues.supportedUsers) ?? 0;
|
|
868
|
+
const supportsMultipleUserCodeReport = !!this.getValue(ctx, UserCodeCCValues.supportsMultipleUserCodeReport);
|
|
869
|
+
// Check for changed values and codes
|
|
870
|
+
if (api.version >= 2) {
|
|
871
|
+
if (supportsAdminCode) {
|
|
872
|
+
ctx.logNode(node.id, {
|
|
873
|
+
message: "querying admin code...",
|
|
874
|
+
direction: "outbound",
|
|
875
|
+
});
|
|
876
|
+
await api.getAdminCode();
|
|
877
|
+
}
|
|
878
|
+
if (supportedKeypadModes.length > 1) {
|
|
879
|
+
ctx.logNode(node.id, {
|
|
880
|
+
message: "querying active keypad mode...",
|
|
881
|
+
direction: "outbound",
|
|
882
|
+
});
|
|
883
|
+
await api.getKeypadMode();
|
|
884
|
+
}
|
|
885
|
+
const storedUserCodeChecksum = this.getValue(ctx, UserCodeCCValues.userCodeChecksum) ?? 0;
|
|
886
|
+
let currentUserCodeChecksum = 0;
|
|
887
|
+
if (supportsUserCodeChecksum) {
|
|
888
|
+
ctx.logNode(node.id, {
|
|
889
|
+
message: "retrieving current user code checksum...",
|
|
890
|
+
direction: "outbound",
|
|
891
|
+
});
|
|
892
|
+
currentUserCodeChecksum = await api.getUserCodeChecksum();
|
|
893
|
+
}
|
|
894
|
+
if (!supportsUserCodeChecksum
|
|
895
|
+
|| currentUserCodeChecksum !== storedUserCodeChecksum) {
|
|
896
|
+
ctx.logNode(node.id, {
|
|
897
|
+
message: "checksum changed or is not supported, querying all user codes...",
|
|
898
|
+
direction: "outbound",
|
|
899
|
+
});
|
|
900
|
+
if (supportsMultipleUserCodeReport) {
|
|
901
|
+
// Query the user codes in bulk
|
|
902
|
+
let nextUserId = 1;
|
|
903
|
+
while (nextUserId > 0 && nextUserId <= supportedUsers) {
|
|
904
|
+
const response = await api.get(nextUserId, true);
|
|
905
|
+
if (response) {
|
|
906
|
+
nextUserId = response.nextUserId;
|
|
907
|
+
}
|
|
908
|
+
else {
|
|
909
|
+
ctx.logNode(node.id, {
|
|
910
|
+
endpoint: this.endpointIndex,
|
|
911
|
+
message: `Querying user code #${nextUserId} timed out, skipping the remaining interview...`,
|
|
912
|
+
level: "warn",
|
|
913
|
+
});
|
|
914
|
+
break;
|
|
915
|
+
}
|
|
853
916
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
});
|
|
860
|
-
break;
|
|
917
|
+
}
|
|
918
|
+
else {
|
|
919
|
+
// Query one user code at a time
|
|
920
|
+
for (let userId = 1; userId <= supportedUsers; userId++) {
|
|
921
|
+
await api.get(userId);
|
|
861
922
|
}
|
|
862
923
|
}
|
|
863
924
|
}
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
925
|
+
}
|
|
926
|
+
else {
|
|
927
|
+
// V1
|
|
928
|
+
ctx.logNode(node.id, {
|
|
929
|
+
message: "querying all user codes...",
|
|
930
|
+
direction: "outbound",
|
|
931
|
+
});
|
|
932
|
+
for (let userId = 1; userId <= supportedUsers; userId++) {
|
|
933
|
+
await api.get(userId);
|
|
869
934
|
}
|
|
870
935
|
}
|
|
871
936
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
}
|
|
937
|
+
/**
|
|
938
|
+
* Returns the number of supported users.
|
|
939
|
+
* This only works AFTER the interview process
|
|
940
|
+
*/
|
|
941
|
+
static getSupportedUsersCached(ctx, endpoint) {
|
|
942
|
+
return ctx
|
|
943
|
+
.getValueDB(endpoint.nodeId)
|
|
944
|
+
.getValue(UserCodeCCValues.supportedUsers.endpoint(endpoint.index));
|
|
881
945
|
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
.
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
.
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
* This only works AFTER the user IDs have been queried.
|
|
959
|
-
*/
|
|
960
|
-
static getUserCodeCached(ctx, endpoint, userId) {
|
|
961
|
-
return ctx
|
|
962
|
-
.getValueDB(endpoint.nodeId)
|
|
963
|
-
.getValue(UserCodeCCValues.userCode(userId).endpoint(endpoint.index));
|
|
964
|
-
}
|
|
965
|
-
};
|
|
966
|
-
UserCodeCC = UserCodeCC_1 = __decorate([
|
|
967
|
-
commandClass(CommandClasses["User Code"]),
|
|
968
|
-
implementedVersion(2),
|
|
969
|
-
ccValues(UserCodeCCValues)
|
|
970
|
-
], UserCodeCC);
|
|
946
|
+
/**
|
|
947
|
+
* Returns the supported keypad modes.
|
|
948
|
+
* This only works AFTER the interview process
|
|
949
|
+
*/
|
|
950
|
+
static getSupportedKeypadModesCached(ctx, endpoint) {
|
|
951
|
+
return ctx
|
|
952
|
+
.getValueDB(endpoint.nodeId)
|
|
953
|
+
.getValue(UserCodeCCValues.supportedKeypadModes.endpoint(endpoint.index));
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Returns the supported user ID statuses.
|
|
957
|
+
* This only works AFTER the interview process
|
|
958
|
+
*/
|
|
959
|
+
static getSupportedUserIDStatusesCached(ctx, endpoint) {
|
|
960
|
+
return ctx
|
|
961
|
+
.getValueDB(endpoint.nodeId)
|
|
962
|
+
.getValue(UserCodeCCValues.supportedUserIDStatuses.endpoint(endpoint.index));
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Returns the supported ASCII characters.
|
|
966
|
+
* This only works AFTER the interview process
|
|
967
|
+
*/
|
|
968
|
+
static getSupportedASCIICharsCached(ctx, endpoint) {
|
|
969
|
+
return ctx
|
|
970
|
+
.getValueDB(endpoint.nodeId)
|
|
971
|
+
.getValue(UserCodeCCValues.supportedASCIIChars.endpoint(endpoint.index));
|
|
972
|
+
}
|
|
973
|
+
/**
|
|
974
|
+
* Returns whether the admin code functionality is supported.
|
|
975
|
+
* This only works AFTER the interview process
|
|
976
|
+
*/
|
|
977
|
+
static supportsAdminCodeCached(ctx, endpoint) {
|
|
978
|
+
const valueDB = ctx
|
|
979
|
+
.getValueDB(endpoint.nodeId);
|
|
980
|
+
return valueDB.getValue(UserCodeCCValues.supportsAdminCode.endpoint(endpoint.index)) ?? valueDB.getValue(UserCodeCCValues._deprecated_supportsMasterCode.endpoint(endpoint.index)) ?? false;
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* Returns whether deactivating the admin code is supported.
|
|
984
|
+
* This only works AFTER the interview process
|
|
985
|
+
*/
|
|
986
|
+
static supportsAdminCodeDeactivationCached(ctx, endpoint) {
|
|
987
|
+
const valueDB = ctx
|
|
988
|
+
.getValueDB(endpoint.nodeId);
|
|
989
|
+
return valueDB.getValue(UserCodeCCValues.supportsAdminCodeDeactivation.endpoint(endpoint.index)) ?? valueDB.getValue(UserCodeCCValues._deprecated_supportsMasterCodeDeactivation
|
|
990
|
+
.endpoint(endpoint.index)) ?? false;
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* Returns whether setting multiple user codes at once is supported.
|
|
994
|
+
* This only works AFTER the interview process
|
|
995
|
+
*/
|
|
996
|
+
static supportsMultipleUserCodeSetCached(ctx, endpoint) {
|
|
997
|
+
return !!ctx
|
|
998
|
+
.getValueDB(endpoint.nodeId)
|
|
999
|
+
.getValue(UserCodeCCValues.supportsMultipleUserCodeSet.endpoint(endpoint.index));
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Returns the current status of a user ID.
|
|
1003
|
+
* This only works AFTER the user IDs have been queried.
|
|
1004
|
+
*/
|
|
1005
|
+
static getUserIdStatusCached(ctx, endpoint, userId) {
|
|
1006
|
+
return ctx
|
|
1007
|
+
.getValueDB(endpoint.nodeId)
|
|
1008
|
+
.getValue(UserCodeCCValues.userIdStatus(userId).endpoint(endpoint.index));
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Returns the current code belonging to a user ID.
|
|
1012
|
+
* This only works AFTER the user IDs have been queried.
|
|
1013
|
+
*/
|
|
1014
|
+
static getUserCodeCached(ctx, endpoint, userId) {
|
|
1015
|
+
return ctx
|
|
1016
|
+
.getValueDB(endpoint.nodeId)
|
|
1017
|
+
.getValue(UserCodeCCValues.userCode(userId).endpoint(endpoint.index));
|
|
1018
|
+
}
|
|
1019
|
+
};
|
|
1020
|
+
return UserCodeCC = _classThis;
|
|
1021
|
+
})();
|
|
971
1022
|
export { UserCodeCC };
|
|
972
|
-
let UserCodeCCSet =
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
this.
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1023
|
+
let UserCodeCCSet = (() => {
|
|
1024
|
+
let _classDecorators = [CCCommand(UserCodeCommand.Set), useSupervision()];
|
|
1025
|
+
let _classDescriptor;
|
|
1026
|
+
let _classExtraInitializers = [];
|
|
1027
|
+
let _classThis;
|
|
1028
|
+
let _classSuper = UserCodeCC;
|
|
1029
|
+
var UserCodeCCSet = class extends _classSuper {
|
|
1030
|
+
static { _classThis = this; }
|
|
1031
|
+
static {
|
|
1032
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1033
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1034
|
+
UserCodeCCSet = _classThis = _classDescriptor.value;
|
|
1035
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1036
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1037
|
+
}
|
|
1038
|
+
constructor(options) {
|
|
1039
|
+
super(options);
|
|
1040
|
+
this.userId = options.userId;
|
|
1041
|
+
this.userIdStatus = options.userIdStatus;
|
|
1042
|
+
// Validate options
|
|
1043
|
+
if (this.userId < 0) {
|
|
1044
|
+
throw new ZWaveError(`${this.constructor.name}: The user ID must be between greater than 0.`, ZWaveErrorCodes.Argument_Invalid);
|
|
1045
|
+
}
|
|
1046
|
+
else if (this.userId === 0
|
|
1047
|
+
&& this.userIdStatus !== UserIDStatus.Available) {
|
|
1048
|
+
throw new ZWaveError(`${this.constructor.name}: User ID 0 may only be used to clear all user codes`, ZWaveErrorCodes.Argument_Invalid);
|
|
1049
|
+
}
|
|
1050
|
+
else if (this.userIdStatus === UserIDStatus.Available) {
|
|
1051
|
+
this.userCode = "\0".repeat(4);
|
|
1052
|
+
}
|
|
1053
|
+
else {
|
|
1054
|
+
this.userCode = options.userCode;
|
|
1055
|
+
// Specs say ASCII 0-9, manufacturers don't care :)
|
|
1056
|
+
if (this.userCode.length < 4 || this.userCode.length > 10) {
|
|
1057
|
+
throw new ZWaveError(`${this.constructor.name}: The user code must have a length of 4 to 10 ${typeof this.userCode === "string"
|
|
1058
|
+
? "characters"
|
|
1059
|
+
: "bytes"}`, ZWaveErrorCodes.Argument_Invalid);
|
|
1060
|
+
}
|
|
995
1061
|
}
|
|
996
1062
|
}
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1063
|
+
static from(raw, ctx) {
|
|
1064
|
+
validatePayload(raw.payload.length >= 2);
|
|
1065
|
+
const userId = raw.payload[0];
|
|
1066
|
+
const userIdStatus = raw.payload[1];
|
|
1067
|
+
if (userIdStatus === UserIDStatus.StatusNotAvailable) {
|
|
1068
|
+
validatePayload.fail("Invalid user ID status");
|
|
1069
|
+
}
|
|
1070
|
+
if (userIdStatus === UserIDStatus.Available) {
|
|
1071
|
+
return new this({
|
|
1072
|
+
nodeId: ctx.sourceNodeId,
|
|
1073
|
+
userId,
|
|
1074
|
+
userIdStatus,
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
const userCode = raw.payload.subarray(2);
|
|
1078
|
+
return new this({
|
|
1007
1079
|
nodeId: ctx.sourceNodeId,
|
|
1008
1080
|
userId,
|
|
1009
1081
|
userIdStatus,
|
|
1082
|
+
userCode,
|
|
1010
1083
|
});
|
|
1011
1084
|
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
"id status": getEnumMemberName(UserIDStatus, this.userIdStatus),
|
|
1038
|
-
"user code": userCodeToLogString(this.userCode),
|
|
1039
|
-
},
|
|
1040
|
-
};
|
|
1041
|
-
}
|
|
1042
|
-
};
|
|
1043
|
-
UserCodeCCSet = UserCodeCCSet_1 = __decorate([
|
|
1044
|
-
CCCommand(UserCodeCommand.Set),
|
|
1045
|
-
useSupervision()
|
|
1046
|
-
], UserCodeCCSet);
|
|
1085
|
+
userId;
|
|
1086
|
+
userIdStatus;
|
|
1087
|
+
userCode;
|
|
1088
|
+
serialize(ctx) {
|
|
1089
|
+
this.payload = Bytes.concat([
|
|
1090
|
+
Bytes.from([this.userId, this.userIdStatus]),
|
|
1091
|
+
typeof this.userCode === "string"
|
|
1092
|
+
? Bytes.from(this.userCode, "ascii")
|
|
1093
|
+
: this.userCode,
|
|
1094
|
+
]);
|
|
1095
|
+
return super.serialize(ctx);
|
|
1096
|
+
}
|
|
1097
|
+
toLogEntry(ctx) {
|
|
1098
|
+
return {
|
|
1099
|
+
...super.toLogEntry(ctx),
|
|
1100
|
+
message: {
|
|
1101
|
+
"user id": this.userId,
|
|
1102
|
+
"id status": getEnumMemberName(UserIDStatus, this.userIdStatus),
|
|
1103
|
+
"user code": userCodeToLogString(this.userCode),
|
|
1104
|
+
},
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
return UserCodeCCSet = _classThis;
|
|
1109
|
+
})();
|
|
1047
1110
|
export { UserCodeCCSet };
|
|
1048
|
-
let UserCodeCCReport =
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1111
|
+
let UserCodeCCReport = (() => {
|
|
1112
|
+
let _classDecorators = [CCCommand(UserCodeCommand.Report)];
|
|
1113
|
+
let _classDescriptor;
|
|
1114
|
+
let _classExtraInitializers = [];
|
|
1115
|
+
let _classThis;
|
|
1116
|
+
let _classSuper = UserCodeCC;
|
|
1117
|
+
var UserCodeCCReport = class extends _classSuper {
|
|
1118
|
+
static { _classThis = this; }
|
|
1119
|
+
static {
|
|
1120
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1121
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1122
|
+
UserCodeCCReport = _classThis = _classDescriptor.value;
|
|
1123
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1124
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1125
|
+
}
|
|
1126
|
+
constructor(options) {
|
|
1127
|
+
super(options);
|
|
1128
|
+
this.userId = options.userId;
|
|
1129
|
+
this.userIdStatus = options.userIdStatus;
|
|
1130
|
+
this.userCode = options.userCode ?? "";
|
|
1131
|
+
}
|
|
1132
|
+
static from(raw, ctx) {
|
|
1133
|
+
validatePayload(raw.payload.length >= 2);
|
|
1134
|
+
const userId = raw.payload[0];
|
|
1135
|
+
const userIdStatus = raw.payload[1];
|
|
1136
|
+
let userCode;
|
|
1137
|
+
if (raw.payload.length === 2
|
|
1138
|
+
&& (userIdStatus === UserIDStatus.Available
|
|
1139
|
+
|| userIdStatus === UserIDStatus.StatusNotAvailable)) {
|
|
1140
|
+
// The user code is not set or not available and this report contains no user code
|
|
1141
|
+
userCode = "";
|
|
1073
1142
|
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1143
|
+
else {
|
|
1144
|
+
// The specs require the user code to be at least 4 digits
|
|
1145
|
+
validatePayload(raw.payload.length >= 6);
|
|
1146
|
+
let userCodeBuffer = raw.payload.subarray(2);
|
|
1147
|
+
// Specs say infer user code from payload length, manufacturers send zero-padded strings
|
|
1148
|
+
while (userCodeBuffer.at(-1) === 0) {
|
|
1149
|
+
userCodeBuffer = userCodeBuffer.subarray(0, -1);
|
|
1150
|
+
}
|
|
1151
|
+
// Specs say ASCII 0-9, manufacturers don't care :)
|
|
1152
|
+
// Thus we check if the code is printable using ASCII, if not keep it as a Buffer
|
|
1153
|
+
const userCodeString = userCodeBuffer.toString("utf8");
|
|
1154
|
+
if (isPrintableASCII(userCodeString)) {
|
|
1155
|
+
userCode = userCodeString;
|
|
1156
|
+
}
|
|
1157
|
+
else if (isPrintableASCIIWithWhitespace(userCodeString)) {
|
|
1158
|
+
// Ignore leading and trailing whitespace in V1 reports if the rest is ASCII
|
|
1159
|
+
userCode = userCodeString.trim();
|
|
1160
|
+
}
|
|
1161
|
+
else {
|
|
1162
|
+
userCode = userCodeBuffer;
|
|
1163
|
+
}
|
|
1079
1164
|
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1165
|
+
return new this({
|
|
1166
|
+
nodeId: ctx.sourceNodeId,
|
|
1167
|
+
userId,
|
|
1168
|
+
userIdStatus,
|
|
1169
|
+
userCode,
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
userId;
|
|
1173
|
+
userIdStatus;
|
|
1174
|
+
userCode;
|
|
1175
|
+
persistValues(ctx) {
|
|
1176
|
+
if (!super.persistValues(ctx))
|
|
1177
|
+
return false;
|
|
1178
|
+
persistUserCode.call(this, ctx, this.userId, this.userIdStatus, this.userCode);
|
|
1179
|
+
return true;
|
|
1180
|
+
}
|
|
1181
|
+
serialize(ctx) {
|
|
1182
|
+
let userCodeBuffer;
|
|
1183
|
+
if (typeof this.userCode === "string") {
|
|
1184
|
+
userCodeBuffer = Bytes.from(this.userCode, "ascii");
|
|
1083
1185
|
}
|
|
1084
1186
|
else {
|
|
1085
|
-
|
|
1187
|
+
userCodeBuffer = this.userCode;
|
|
1086
1188
|
}
|
|
1189
|
+
this.payload = Bytes.concat([
|
|
1190
|
+
Bytes.from([this.userId, this.userIdStatus]),
|
|
1191
|
+
userCodeBuffer,
|
|
1192
|
+
]);
|
|
1193
|
+
return super.serialize(ctx);
|
|
1087
1194
|
}
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
return
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
let userCodeBuffer;
|
|
1106
|
-
if (typeof this.userCode === "string") {
|
|
1107
|
-
userCodeBuffer = Bytes.from(this.userCode, "ascii");
|
|
1108
|
-
}
|
|
1109
|
-
else {
|
|
1110
|
-
userCodeBuffer = this.userCode;
|
|
1111
|
-
}
|
|
1112
|
-
this.payload = Bytes.concat([
|
|
1113
|
-
Bytes.from([this.userId, this.userIdStatus]),
|
|
1114
|
-
userCodeBuffer,
|
|
1115
|
-
]);
|
|
1116
|
-
return super.serialize(ctx);
|
|
1117
|
-
}
|
|
1118
|
-
toLogEntry(ctx) {
|
|
1119
|
-
return {
|
|
1120
|
-
...super.toLogEntry(ctx),
|
|
1121
|
-
message: {
|
|
1122
|
-
"user id": this.userId,
|
|
1123
|
-
"id status": getEnumMemberName(UserIDStatus, this.userIdStatus),
|
|
1124
|
-
"user code": userCodeToLogString(this.userCode),
|
|
1125
|
-
},
|
|
1126
|
-
};
|
|
1127
|
-
}
|
|
1128
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
1129
|
-
toNotificationEventParameters() {
|
|
1130
|
-
return { userId: this.userId };
|
|
1131
|
-
}
|
|
1132
|
-
};
|
|
1133
|
-
UserCodeCCReport = UserCodeCCReport_1 = __decorate([
|
|
1134
|
-
CCCommand(UserCodeCommand.Report)
|
|
1135
|
-
], UserCodeCCReport);
|
|
1195
|
+
toLogEntry(ctx) {
|
|
1196
|
+
return {
|
|
1197
|
+
...super.toLogEntry(ctx),
|
|
1198
|
+
message: {
|
|
1199
|
+
"user id": this.userId,
|
|
1200
|
+
"id status": getEnumMemberName(UserIDStatus, this.userIdStatus),
|
|
1201
|
+
"user code": userCodeToLogString(this.userCode),
|
|
1202
|
+
},
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
1206
|
+
toNotificationEventParameters() {
|
|
1207
|
+
return { userId: this.userId };
|
|
1208
|
+
}
|
|
1209
|
+
};
|
|
1210
|
+
return UserCodeCCReport = _classThis;
|
|
1211
|
+
})();
|
|
1136
1212
|
export { UserCodeCCReport };
|
|
1137
|
-
let UserCodeCCGet =
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1213
|
+
let UserCodeCCGet = (() => {
|
|
1214
|
+
let _classDecorators = [CCCommand(UserCodeCommand.Get), expectedCCResponse(UserCodeCCReport)];
|
|
1215
|
+
let _classDescriptor;
|
|
1216
|
+
let _classExtraInitializers = [];
|
|
1217
|
+
let _classThis;
|
|
1218
|
+
let _classSuper = UserCodeCC;
|
|
1219
|
+
var UserCodeCCGet = class extends _classSuper {
|
|
1220
|
+
static { _classThis = this; }
|
|
1221
|
+
static {
|
|
1222
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1223
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1224
|
+
UserCodeCCGet = _classThis = _classDescriptor.value;
|
|
1225
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1226
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1227
|
+
}
|
|
1228
|
+
constructor(options) {
|
|
1229
|
+
super(options);
|
|
1230
|
+
this.userId = options.userId;
|
|
1231
|
+
}
|
|
1232
|
+
static from(raw, ctx) {
|
|
1233
|
+
validatePayload(raw.payload.length >= 1);
|
|
1234
|
+
const userId = raw.payload[0];
|
|
1235
|
+
return new this({
|
|
1236
|
+
nodeId: ctx.sourceNodeId,
|
|
1237
|
+
userId,
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
userId;
|
|
1241
|
+
serialize(ctx) {
|
|
1242
|
+
this.payload = Bytes.from([this.userId]);
|
|
1243
|
+
return super.serialize(ctx);
|
|
1244
|
+
}
|
|
1245
|
+
toLogEntry(ctx) {
|
|
1246
|
+
return {
|
|
1247
|
+
...super.toLogEntry(ctx),
|
|
1248
|
+
message: { "user id": this.userId },
|
|
1249
|
+
};
|
|
1250
|
+
}
|
|
1251
|
+
};
|
|
1252
|
+
return UserCodeCCGet = _classThis;
|
|
1253
|
+
})();
|
|
1166
1254
|
export { UserCodeCCGet };
|
|
1167
|
-
let UserCodeCCUsersNumberReport =
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1255
|
+
let UserCodeCCUsersNumberReport = (() => {
|
|
1256
|
+
let _classDecorators = [CCCommand(UserCodeCommand.UsersNumberReport), ccValueProperty("supportedUsers", UserCodeCCValues.supportedUsers)];
|
|
1257
|
+
let _classDescriptor;
|
|
1258
|
+
let _classExtraInitializers = [];
|
|
1259
|
+
let _classThis;
|
|
1260
|
+
let _classSuper = UserCodeCC;
|
|
1261
|
+
var UserCodeCCUsersNumberReport = class extends _classSuper {
|
|
1262
|
+
static { _classThis = this; }
|
|
1263
|
+
static {
|
|
1264
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1265
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1266
|
+
UserCodeCCUsersNumberReport = _classThis = _classDescriptor.value;
|
|
1267
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1268
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1269
|
+
}
|
|
1270
|
+
constructor(options) {
|
|
1271
|
+
super(options);
|
|
1272
|
+
this.supportedUsers = options.supportedUsers;
|
|
1273
|
+
}
|
|
1274
|
+
static from(raw, ctx) {
|
|
1275
|
+
validatePayload(raw.payload.length >= 1);
|
|
1276
|
+
let supportedUsers;
|
|
1277
|
+
if (raw.payload.length >= 3) {
|
|
1278
|
+
// V2+
|
|
1279
|
+
supportedUsers = raw.payload.readUInt16BE(1);
|
|
1280
|
+
}
|
|
1281
|
+
else {
|
|
1282
|
+
// V1
|
|
1283
|
+
supportedUsers = raw.payload[0];
|
|
1284
|
+
}
|
|
1285
|
+
return new this({
|
|
1286
|
+
nodeId: ctx.sourceNodeId,
|
|
1287
|
+
supportedUsers,
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
1290
|
+
supportedUsers;
|
|
1291
|
+
serialize(ctx) {
|
|
1292
|
+
this.payload = new Bytes(3);
|
|
1293
|
+
// If the node implements more than 255 users, this field MUST be set to 255
|
|
1294
|
+
this.payload[0] = Math.min(255, this.supportedUsers);
|
|
1295
|
+
this.payload.writeUInt16BE(this.supportedUsers, 1);
|
|
1296
|
+
return super.serialize(ctx);
|
|
1297
|
+
}
|
|
1298
|
+
toLogEntry(ctx) {
|
|
1299
|
+
return {
|
|
1300
|
+
...super.toLogEntry(ctx),
|
|
1301
|
+
message: { "supported users": this.supportedUsers },
|
|
1302
|
+
};
|
|
1303
|
+
}
|
|
1304
|
+
};
|
|
1305
|
+
return UserCodeCCUsersNumberReport = _classThis;
|
|
1306
|
+
})();
|
|
1209
1307
|
export { UserCodeCCUsersNumberReport };
|
|
1210
|
-
let UserCodeCCUsersNumberGet =
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1308
|
+
let UserCodeCCUsersNumberGet = (() => {
|
|
1309
|
+
let _classDecorators = [CCCommand(UserCodeCommand.UsersNumberGet), expectedCCResponse(UserCodeCCUsersNumberReport)];
|
|
1310
|
+
let _classDescriptor;
|
|
1311
|
+
let _classExtraInitializers = [];
|
|
1312
|
+
let _classThis;
|
|
1313
|
+
let _classSuper = UserCodeCC;
|
|
1314
|
+
var UserCodeCCUsersNumberGet = class extends _classSuper {
|
|
1315
|
+
static { _classThis = this; }
|
|
1316
|
+
static {
|
|
1317
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1318
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1319
|
+
UserCodeCCUsersNumberGet = _classThis = _classDescriptor.value;
|
|
1320
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1321
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1324
|
+
return UserCodeCCUsersNumberGet = _classThis;
|
|
1325
|
+
})();
|
|
1216
1326
|
export { UserCodeCCUsersNumberGet };
|
|
1217
|
-
let UserCodeCCCapabilitiesReport =
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
this
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
supportedKeypadModes,
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
supportedStatusesBitmask,
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
ccValue(UserCodeCCValues.supportedUserIDStatuses)
|
|
1333
|
-
], UserCodeCCCapabilitiesReport.prototype, "supportedUserIDStatuses", void 0);
|
|
1334
|
-
__decorate([
|
|
1335
|
-
ccValue(UserCodeCCValues.supportedKeypadModes)
|
|
1336
|
-
], UserCodeCCCapabilitiesReport.prototype, "supportedKeypadModes", void 0);
|
|
1337
|
-
__decorate([
|
|
1338
|
-
ccValue(UserCodeCCValues.supportedASCIIChars)
|
|
1339
|
-
], UserCodeCCCapabilitiesReport.prototype, "supportedASCIIChars", void 0);
|
|
1340
|
-
UserCodeCCCapabilitiesReport = UserCodeCCCapabilitiesReport_1 = __decorate([
|
|
1341
|
-
CCCommand(UserCodeCommand.CapabilitiesReport)
|
|
1342
|
-
], UserCodeCCCapabilitiesReport);
|
|
1327
|
+
let UserCodeCCCapabilitiesReport = (() => {
|
|
1328
|
+
let _classDecorators = [CCCommand(UserCodeCommand.CapabilitiesReport), ccValueProperty("supportsAdminCode", UserCodeCCValues.supportsAdminCode), ccValueProperty("supportsAdminCodeDeactivation", UserCodeCCValues.supportsAdminCodeDeactivation), ccValueProperty("supportsUserCodeChecksum", UserCodeCCValues.supportsUserCodeChecksum), ccValueProperty("supportsMultipleUserCodeReport", UserCodeCCValues.supportsMultipleUserCodeReport), ccValueProperty("supportsMultipleUserCodeSet", UserCodeCCValues.supportsMultipleUserCodeSet), ccValueProperty("supportedUserIDStatuses", UserCodeCCValues.supportedUserIDStatuses), ccValueProperty("supportedKeypadModes", UserCodeCCValues.supportedKeypadModes), ccValueProperty("supportedASCIIChars", UserCodeCCValues.supportedASCIIChars)];
|
|
1329
|
+
let _classDescriptor;
|
|
1330
|
+
let _classExtraInitializers = [];
|
|
1331
|
+
let _classThis;
|
|
1332
|
+
let _classSuper = UserCodeCC;
|
|
1333
|
+
var UserCodeCCCapabilitiesReport = class extends _classSuper {
|
|
1334
|
+
static { _classThis = this; }
|
|
1335
|
+
static {
|
|
1336
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1337
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1338
|
+
UserCodeCCCapabilitiesReport = _classThis = _classDescriptor.value;
|
|
1339
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1340
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1341
|
+
}
|
|
1342
|
+
constructor(options) {
|
|
1343
|
+
super(options);
|
|
1344
|
+
this.supportsAdminCode = options.supportsAdminCode;
|
|
1345
|
+
this.supportsAdminCodeDeactivation =
|
|
1346
|
+
options.supportsAdminCodeDeactivation;
|
|
1347
|
+
this.supportsUserCodeChecksum = options.supportsUserCodeChecksum;
|
|
1348
|
+
this.supportsMultipleUserCodeReport =
|
|
1349
|
+
options.supportsMultipleUserCodeReport;
|
|
1350
|
+
this.supportsMultipleUserCodeSet = options.supportsMultipleUserCodeSet;
|
|
1351
|
+
this.supportedUserIDStatuses = options.supportedUserIDStatuses;
|
|
1352
|
+
this.supportedKeypadModes = options.supportedKeypadModes;
|
|
1353
|
+
this.supportedASCIIChars = options.supportedASCIIChars;
|
|
1354
|
+
}
|
|
1355
|
+
static from(raw, ctx) {
|
|
1356
|
+
let offset = 0;
|
|
1357
|
+
validatePayload(raw.payload.length >= offset + 1);
|
|
1358
|
+
const supportsAdminCode = !!(raw.payload[offset] & 0b100_00000);
|
|
1359
|
+
const supportsAdminCodeDeactivation = !!(raw.payload[offset] & 0b010_00000);
|
|
1360
|
+
const statusBitMaskLength = raw.payload[offset] & 0b000_11111;
|
|
1361
|
+
offset += 1;
|
|
1362
|
+
validatePayload(raw.payload.length >= offset + statusBitMaskLength + 1);
|
|
1363
|
+
const supportedUserIDStatuses = parseBitMask(raw.payload.subarray(offset, offset + statusBitMaskLength), UserIDStatus.Available);
|
|
1364
|
+
offset += statusBitMaskLength;
|
|
1365
|
+
const supportsUserCodeChecksum = !!(raw.payload[offset] & 0b100_00000);
|
|
1366
|
+
const supportsMultipleUserCodeReport = !!(raw.payload[offset] & 0b010_00000);
|
|
1367
|
+
const supportsMultipleUserCodeSet = !!(raw.payload[offset] & 0b001_00000);
|
|
1368
|
+
const keypadModesBitMaskLength = raw.payload[offset] & 0b000_11111;
|
|
1369
|
+
offset += 1;
|
|
1370
|
+
validatePayload(raw.payload.length >= offset + keypadModesBitMaskLength + 1);
|
|
1371
|
+
const supportedKeypadModes = parseBitMask(raw.payload.subarray(offset, offset + keypadModesBitMaskLength), KeypadMode.Normal);
|
|
1372
|
+
offset += keypadModesBitMaskLength;
|
|
1373
|
+
const keysBitMaskLength = raw.payload[offset] & 0b000_11111;
|
|
1374
|
+
offset += 1;
|
|
1375
|
+
validatePayload(raw.payload.length >= offset + keysBitMaskLength);
|
|
1376
|
+
const supportedASCIIChars = Bytes.from(parseBitMask(raw.payload.subarray(offset, offset + keysBitMaskLength), 0)).toString("ascii");
|
|
1377
|
+
return new this({
|
|
1378
|
+
nodeId: ctx.sourceNodeId,
|
|
1379
|
+
supportsAdminCode,
|
|
1380
|
+
supportsAdminCodeDeactivation,
|
|
1381
|
+
supportedUserIDStatuses,
|
|
1382
|
+
supportsUserCodeChecksum,
|
|
1383
|
+
supportsMultipleUserCodeReport,
|
|
1384
|
+
supportsMultipleUserCodeSet,
|
|
1385
|
+
supportedKeypadModes,
|
|
1386
|
+
supportedASCIIChars,
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
supportsAdminCode;
|
|
1390
|
+
supportsAdminCodeDeactivation;
|
|
1391
|
+
supportsUserCodeChecksum;
|
|
1392
|
+
supportsMultipleUserCodeReport;
|
|
1393
|
+
supportsMultipleUserCodeSet;
|
|
1394
|
+
supportedUserIDStatuses;
|
|
1395
|
+
supportedKeypadModes;
|
|
1396
|
+
supportedASCIIChars;
|
|
1397
|
+
serialize(ctx) {
|
|
1398
|
+
const supportedStatusesBitmask = encodeBitMask(this.supportedUserIDStatuses, undefined, UserIDStatus.Available);
|
|
1399
|
+
const controlByte1 = (this.supportsAdminCode ? 0b100_00000 : 0)
|
|
1400
|
+
| (this.supportsAdminCodeDeactivation ? 0b010_00000 : 0)
|
|
1401
|
+
| (supportedStatusesBitmask.length & 0b000_11111);
|
|
1402
|
+
const supportedKeypadModesBitmask = encodeBitMask(this.supportedKeypadModes, undefined, KeypadMode.Normal);
|
|
1403
|
+
const controlByte2 = (this.supportsUserCodeChecksum ? 0b100_00000 : 0)
|
|
1404
|
+
| (this.supportsMultipleUserCodeReport ? 0b010_00000 : 0)
|
|
1405
|
+
| (this.supportsMultipleUserCodeSet ? 0b001_00000 : 0)
|
|
1406
|
+
| (supportedKeypadModesBitmask.length & 0b000_11111);
|
|
1407
|
+
const keysAsNumbers = [...this.supportedASCIIChars].map((char) => char.charCodeAt(0));
|
|
1408
|
+
const supportedKeysBitmask = encodeBitMask(keysAsNumbers, undefined, 0);
|
|
1409
|
+
const controlByte3 = supportedKeysBitmask.length & 0b000_11111;
|
|
1410
|
+
this.payload = Bytes.concat([
|
|
1411
|
+
Bytes.from([controlByte1]),
|
|
1412
|
+
supportedStatusesBitmask,
|
|
1413
|
+
Bytes.from([controlByte2]),
|
|
1414
|
+
supportedKeypadModesBitmask,
|
|
1415
|
+
Bytes.from([controlByte3]),
|
|
1416
|
+
supportedKeysBitmask,
|
|
1417
|
+
]);
|
|
1418
|
+
return super.serialize(ctx);
|
|
1419
|
+
}
|
|
1420
|
+
toLogEntry(ctx) {
|
|
1421
|
+
return {
|
|
1422
|
+
...super.toLogEntry(ctx),
|
|
1423
|
+
message: {
|
|
1424
|
+
"supports admin code": this.supportsAdminCode,
|
|
1425
|
+
"supports admin code deactivation": this.supportsAdminCodeDeactivation,
|
|
1426
|
+
"supports user code checksum": this.supportsUserCodeChecksum,
|
|
1427
|
+
"supports multiple codes in report": this.supportsMultipleUserCodeReport,
|
|
1428
|
+
"supports multiple codes in set": this.supportsMultipleUserCodeSet,
|
|
1429
|
+
"supported user id statuses": this.supportedUserIDStatuses
|
|
1430
|
+
.map((status) => `\n· ${getEnumMemberName(UserIDStatus, status)}`)
|
|
1431
|
+
.join(""),
|
|
1432
|
+
"supported keypad modes": this.supportedKeypadModes
|
|
1433
|
+
.map((mode) => `\n· ${getEnumMemberName(KeypadMode, mode)}`)
|
|
1434
|
+
.join(""),
|
|
1435
|
+
"supported ASCII chars": this.supportedASCIIChars,
|
|
1436
|
+
},
|
|
1437
|
+
};
|
|
1438
|
+
}
|
|
1439
|
+
};
|
|
1440
|
+
return UserCodeCCCapabilitiesReport = _classThis;
|
|
1441
|
+
})();
|
|
1343
1442
|
export { UserCodeCCCapabilitiesReport };
|
|
1344
|
-
let UserCodeCCCapabilitiesGet =
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1443
|
+
let UserCodeCCCapabilitiesGet = (() => {
|
|
1444
|
+
let _classDecorators = [CCCommand(UserCodeCommand.CapabilitiesGet), expectedCCResponse(UserCodeCCCapabilitiesReport)];
|
|
1445
|
+
let _classDescriptor;
|
|
1446
|
+
let _classExtraInitializers = [];
|
|
1447
|
+
let _classThis;
|
|
1448
|
+
let _classSuper = UserCodeCC;
|
|
1449
|
+
var UserCodeCCCapabilitiesGet = class extends _classSuper {
|
|
1450
|
+
static { _classThis = this; }
|
|
1451
|
+
static {
|
|
1452
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1453
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1454
|
+
UserCodeCCCapabilitiesGet = _classThis = _classDescriptor.value;
|
|
1455
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1456
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1457
|
+
}
|
|
1458
|
+
};
|
|
1459
|
+
return UserCodeCCCapabilitiesGet = _classThis;
|
|
1460
|
+
})();
|
|
1350
1461
|
export { UserCodeCCCapabilitiesGet };
|
|
1351
|
-
let UserCodeCCKeypadModeSet =
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1462
|
+
let UserCodeCCKeypadModeSet = (() => {
|
|
1463
|
+
let _classDecorators = [CCCommand(UserCodeCommand.KeypadModeSet), useSupervision()];
|
|
1464
|
+
let _classDescriptor;
|
|
1465
|
+
let _classExtraInitializers = [];
|
|
1466
|
+
let _classThis;
|
|
1467
|
+
let _classSuper = UserCodeCC;
|
|
1468
|
+
var UserCodeCCKeypadModeSet = class extends _classSuper {
|
|
1469
|
+
static { _classThis = this; }
|
|
1470
|
+
static {
|
|
1471
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1472
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1473
|
+
UserCodeCCKeypadModeSet = _classThis = _classDescriptor.value;
|
|
1474
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1475
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1476
|
+
}
|
|
1477
|
+
constructor(options) {
|
|
1478
|
+
super(options);
|
|
1479
|
+
this.keypadMode = options.keypadMode;
|
|
1480
|
+
}
|
|
1481
|
+
static from(raw, ctx) {
|
|
1482
|
+
validatePayload(raw.payload.length >= 1);
|
|
1483
|
+
const keypadMode = raw.payload[0];
|
|
1484
|
+
return new this({
|
|
1485
|
+
nodeId: ctx.sourceNodeId,
|
|
1486
|
+
keypadMode,
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
keypadMode;
|
|
1490
|
+
serialize(ctx) {
|
|
1491
|
+
this.payload = Bytes.from([this.keypadMode]);
|
|
1492
|
+
return super.serialize(ctx);
|
|
1493
|
+
}
|
|
1494
|
+
toLogEntry(ctx) {
|
|
1495
|
+
return {
|
|
1496
|
+
...super.toLogEntry(ctx),
|
|
1497
|
+
message: { mode: getEnumMemberName(KeypadMode, this.keypadMode) },
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1500
|
+
};
|
|
1501
|
+
return UserCodeCCKeypadModeSet = _classThis;
|
|
1502
|
+
})();
|
|
1380
1503
|
export { UserCodeCCKeypadModeSet };
|
|
1381
|
-
let UserCodeCCKeypadModeReport =
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1504
|
+
let UserCodeCCKeypadModeReport = (() => {
|
|
1505
|
+
let _classDecorators = [CCCommand(UserCodeCommand.KeypadModeReport), ccValueProperty("keypadMode", UserCodeCCValues.keypadMode)];
|
|
1506
|
+
let _classDescriptor;
|
|
1507
|
+
let _classExtraInitializers = [];
|
|
1508
|
+
let _classThis;
|
|
1509
|
+
let _classSuper = UserCodeCC;
|
|
1510
|
+
var UserCodeCCKeypadModeReport = class extends _classSuper {
|
|
1511
|
+
static { _classThis = this; }
|
|
1512
|
+
static {
|
|
1513
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1514
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1515
|
+
UserCodeCCKeypadModeReport = _classThis = _classDescriptor.value;
|
|
1516
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1517
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1518
|
+
}
|
|
1519
|
+
constructor(options) {
|
|
1520
|
+
super(options);
|
|
1521
|
+
this.keypadMode = options.keypadMode;
|
|
1522
|
+
}
|
|
1523
|
+
static from(raw, ctx) {
|
|
1524
|
+
validatePayload(raw.payload.length >= 1);
|
|
1525
|
+
const keypadMode = raw.payload[0];
|
|
1526
|
+
return new this({
|
|
1527
|
+
nodeId: ctx.sourceNodeId,
|
|
1528
|
+
keypadMode,
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
persistValues(ctx) {
|
|
1532
|
+
if (!super.persistValues(ctx))
|
|
1533
|
+
return false;
|
|
1534
|
+
// Update the keypad modes metadata
|
|
1535
|
+
const supportedKeypadModes = this.getValue(ctx, UserCodeCCValues.supportedKeypadModes) ?? [this.keypadMode];
|
|
1536
|
+
const keypadModeValue = UserCodeCCValues.keypadMode;
|
|
1537
|
+
this.setMetadata(ctx, keypadModeValue, {
|
|
1538
|
+
...keypadModeValue.meta,
|
|
1539
|
+
states: enumValuesToMetadataStates(KeypadMode, supportedKeypadModes),
|
|
1540
|
+
});
|
|
1541
|
+
return true;
|
|
1542
|
+
}
|
|
1543
|
+
keypadMode;
|
|
1544
|
+
serialize(ctx) {
|
|
1545
|
+
this.payload = Bytes.from([this.keypadMode]);
|
|
1546
|
+
return super.serialize(ctx);
|
|
1547
|
+
}
|
|
1548
|
+
toLogEntry(ctx) {
|
|
1549
|
+
return {
|
|
1550
|
+
...super.toLogEntry(ctx),
|
|
1551
|
+
message: {
|
|
1552
|
+
keypadMode: getEnumMemberName(KeypadMode, this.keypadMode),
|
|
1553
|
+
},
|
|
1554
|
+
};
|
|
1555
|
+
}
|
|
1556
|
+
};
|
|
1557
|
+
return UserCodeCCKeypadModeReport = _classThis;
|
|
1558
|
+
})();
|
|
1426
1559
|
export { UserCodeCCKeypadModeReport };
|
|
1427
|
-
let UserCodeCCKeypadModeGet =
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1560
|
+
let UserCodeCCKeypadModeGet = (() => {
|
|
1561
|
+
let _classDecorators = [CCCommand(UserCodeCommand.KeypadModeGet), expectedCCResponse(UserCodeCCKeypadModeReport)];
|
|
1562
|
+
let _classDescriptor;
|
|
1563
|
+
let _classExtraInitializers = [];
|
|
1564
|
+
let _classThis;
|
|
1565
|
+
let _classSuper = UserCodeCC;
|
|
1566
|
+
var UserCodeCCKeypadModeGet = class extends _classSuper {
|
|
1567
|
+
static { _classThis = this; }
|
|
1568
|
+
static {
|
|
1569
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1570
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1571
|
+
UserCodeCCKeypadModeGet = _classThis = _classDescriptor.value;
|
|
1572
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1573
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1574
|
+
}
|
|
1575
|
+
};
|
|
1576
|
+
return UserCodeCCKeypadModeGet = _classThis;
|
|
1577
|
+
})();
|
|
1433
1578
|
export { UserCodeCCKeypadModeGet };
|
|
1434
|
-
let UserCodeCCAdminCodeSet =
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
.
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1579
|
+
let UserCodeCCAdminCodeSet = (() => {
|
|
1580
|
+
let _classDecorators = [CCCommand(UserCodeCommand.AdminCodeSet), useSupervision()];
|
|
1581
|
+
let _classDescriptor;
|
|
1582
|
+
let _classExtraInitializers = [];
|
|
1583
|
+
let _classThis;
|
|
1584
|
+
let _classSuper = UserCodeCC;
|
|
1585
|
+
var UserCodeCCAdminCodeSet = class extends _classSuper {
|
|
1586
|
+
static { _classThis = this; }
|
|
1587
|
+
static {
|
|
1588
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1589
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1590
|
+
UserCodeCCAdminCodeSet = _classThis = _classDescriptor.value;
|
|
1591
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1592
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1593
|
+
}
|
|
1594
|
+
constructor(options) {
|
|
1595
|
+
super(options);
|
|
1596
|
+
this.adminCode = options.adminCode;
|
|
1597
|
+
}
|
|
1598
|
+
static from(raw, ctx) {
|
|
1599
|
+
validatePayload(raw.payload.length >= 1);
|
|
1600
|
+
const codeLength = raw.payload[0] & 0b1111;
|
|
1601
|
+
validatePayload(raw.payload.length >= 1 + codeLength);
|
|
1602
|
+
const adminCode = raw.payload
|
|
1603
|
+
.subarray(1, 1 + codeLength)
|
|
1604
|
+
.toString("ascii");
|
|
1605
|
+
return new this({
|
|
1606
|
+
nodeId: ctx.sourceNodeId,
|
|
1607
|
+
adminCode,
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
adminCode;
|
|
1611
|
+
serialize(ctx) {
|
|
1612
|
+
this.payload = Bytes.concat([
|
|
1613
|
+
Bytes.from([this.adminCode.length & 0b1111]),
|
|
1614
|
+
Bytes.from(this.adminCode, "ascii"),
|
|
1615
|
+
]);
|
|
1616
|
+
return super.serialize(ctx);
|
|
1617
|
+
}
|
|
1618
|
+
toLogEntry(ctx) {
|
|
1619
|
+
return {
|
|
1620
|
+
...super.toLogEntry(ctx),
|
|
1621
|
+
message: { "admin code": userCodeToLogString(this.adminCode) },
|
|
1622
|
+
};
|
|
1623
|
+
}
|
|
1624
|
+
};
|
|
1625
|
+
return UserCodeCCAdminCodeSet = _classThis;
|
|
1626
|
+
})();
|
|
1470
1627
|
export { UserCodeCCAdminCodeSet };
|
|
1471
|
-
let UserCodeCCAdminCodeReport =
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
.
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1628
|
+
let UserCodeCCAdminCodeReport = (() => {
|
|
1629
|
+
let _classDecorators = [CCCommand(UserCodeCommand.AdminCodeReport), ccValueProperty("adminCode", UserCodeCCValues.adminCode)];
|
|
1630
|
+
let _classDescriptor;
|
|
1631
|
+
let _classExtraInitializers = [];
|
|
1632
|
+
let _classThis;
|
|
1633
|
+
let _classSuper = UserCodeCC;
|
|
1634
|
+
var UserCodeCCAdminCodeReport = class extends _classSuper {
|
|
1635
|
+
static { _classThis = this; }
|
|
1636
|
+
static {
|
|
1637
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1638
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1639
|
+
UserCodeCCAdminCodeReport = _classThis = _classDescriptor.value;
|
|
1640
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1641
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1642
|
+
}
|
|
1643
|
+
constructor(options) {
|
|
1644
|
+
super(options);
|
|
1645
|
+
this.adminCode = options.adminCode;
|
|
1646
|
+
}
|
|
1647
|
+
static from(raw, ctx) {
|
|
1648
|
+
validatePayload(raw.payload.length >= 1);
|
|
1649
|
+
const codeLength = raw.payload[0] & 0b1111;
|
|
1650
|
+
validatePayload(raw.payload.length >= 1 + codeLength);
|
|
1651
|
+
const adminCode = raw.payload
|
|
1652
|
+
.subarray(1, 1 + codeLength)
|
|
1653
|
+
.toString("ascii");
|
|
1654
|
+
return new this({
|
|
1655
|
+
nodeId: ctx.sourceNodeId,
|
|
1656
|
+
adminCode,
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
adminCode;
|
|
1660
|
+
serialize(ctx) {
|
|
1661
|
+
this.payload = Bytes.concat([
|
|
1662
|
+
Bytes.from([this.adminCode.length & 0b1111]),
|
|
1663
|
+
Bytes.from(this.adminCode, "ascii"),
|
|
1664
|
+
]);
|
|
1665
|
+
return super.serialize(ctx);
|
|
1666
|
+
}
|
|
1667
|
+
toLogEntry(ctx) {
|
|
1668
|
+
return {
|
|
1669
|
+
...super.toLogEntry(ctx),
|
|
1670
|
+
message: { "admin code": userCodeToLogString(this.adminCode) },
|
|
1671
|
+
};
|
|
1672
|
+
}
|
|
1673
|
+
};
|
|
1674
|
+
return UserCodeCCAdminCodeReport = _classThis;
|
|
1675
|
+
})();
|
|
1509
1676
|
export { UserCodeCCAdminCodeReport };
|
|
1510
|
-
let UserCodeCCAdminCodeGet =
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1677
|
+
let UserCodeCCAdminCodeGet = (() => {
|
|
1678
|
+
let _classDecorators = [CCCommand(UserCodeCommand.AdminCodeGet), expectedCCResponse(UserCodeCCAdminCodeReport)];
|
|
1679
|
+
let _classDescriptor;
|
|
1680
|
+
let _classExtraInitializers = [];
|
|
1681
|
+
let _classThis;
|
|
1682
|
+
let _classSuper = UserCodeCC;
|
|
1683
|
+
var UserCodeCCAdminCodeGet = class extends _classSuper {
|
|
1684
|
+
static { _classThis = this; }
|
|
1685
|
+
static {
|
|
1686
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1687
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1688
|
+
UserCodeCCAdminCodeGet = _classThis = _classDescriptor.value;
|
|
1689
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1690
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1691
|
+
}
|
|
1692
|
+
};
|
|
1693
|
+
return UserCodeCCAdminCodeGet = _classThis;
|
|
1694
|
+
})();
|
|
1516
1695
|
export { UserCodeCCAdminCodeGet };
|
|
1517
|
-
let UserCodeCCUserCodeChecksumReport =
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
};
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1696
|
+
let UserCodeCCUserCodeChecksumReport = (() => {
|
|
1697
|
+
let _classDecorators = [CCCommand(UserCodeCommand.UserCodeChecksumReport), ccValueProperty("userCodeChecksum", UserCodeCCValues.userCodeChecksum)];
|
|
1698
|
+
let _classDescriptor;
|
|
1699
|
+
let _classExtraInitializers = [];
|
|
1700
|
+
let _classThis;
|
|
1701
|
+
let _classSuper = UserCodeCC;
|
|
1702
|
+
var UserCodeCCUserCodeChecksumReport = class extends _classSuper {
|
|
1703
|
+
static { _classThis = this; }
|
|
1704
|
+
static {
|
|
1705
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1706
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1707
|
+
UserCodeCCUserCodeChecksumReport = _classThis = _classDescriptor.value;
|
|
1708
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1709
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1710
|
+
}
|
|
1711
|
+
constructor(options) {
|
|
1712
|
+
super(options);
|
|
1713
|
+
this.userCodeChecksum = options.userCodeChecksum;
|
|
1714
|
+
}
|
|
1715
|
+
static from(raw, ctx) {
|
|
1716
|
+
validatePayload(raw.payload.length >= 2);
|
|
1717
|
+
const userCodeChecksum = raw.payload.readUInt16BE(0);
|
|
1718
|
+
return new this({
|
|
1719
|
+
nodeId: ctx.sourceNodeId,
|
|
1720
|
+
userCodeChecksum,
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1723
|
+
userCodeChecksum;
|
|
1724
|
+
serialize(ctx) {
|
|
1725
|
+
this.payload = new Bytes(2);
|
|
1726
|
+
this.payload.writeUInt16BE(this.userCodeChecksum, 0);
|
|
1727
|
+
return super.serialize(ctx);
|
|
1728
|
+
}
|
|
1729
|
+
toLogEntry(ctx) {
|
|
1730
|
+
return {
|
|
1731
|
+
...super.toLogEntry(ctx),
|
|
1732
|
+
message: { "user code checksum": num2hex(this.userCodeChecksum) },
|
|
1733
|
+
};
|
|
1734
|
+
}
|
|
1735
|
+
};
|
|
1736
|
+
return UserCodeCCUserCodeChecksumReport = _classThis;
|
|
1737
|
+
})();
|
|
1549
1738
|
export { UserCodeCCUserCodeChecksumReport };
|
|
1550
|
-
let UserCodeCCUserCodeChecksumGet =
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1739
|
+
let UserCodeCCUserCodeChecksumGet = (() => {
|
|
1740
|
+
let _classDecorators = [CCCommand(UserCodeCommand.UserCodeChecksumGet), expectedCCResponse(UserCodeCCUserCodeChecksumReport)];
|
|
1741
|
+
let _classDescriptor;
|
|
1742
|
+
let _classExtraInitializers = [];
|
|
1743
|
+
let _classThis;
|
|
1744
|
+
let _classSuper = UserCodeCC;
|
|
1745
|
+
var UserCodeCCUserCodeChecksumGet = class extends _classSuper {
|
|
1746
|
+
static { _classThis = this; }
|
|
1747
|
+
static {
|
|
1748
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1749
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1750
|
+
UserCodeCCUserCodeChecksumGet = _classThis = _classDescriptor.value;
|
|
1751
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1752
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1753
|
+
}
|
|
1754
|
+
};
|
|
1755
|
+
return UserCodeCCUserCodeChecksumGet = _classThis;
|
|
1756
|
+
})();
|
|
1556
1757
|
export { UserCodeCCUserCodeChecksumGet };
|
|
1557
|
-
let UserCodeCCExtendedUserCodeSet =
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1758
|
+
let UserCodeCCExtendedUserCodeSet = (() => {
|
|
1759
|
+
let _classDecorators = [CCCommand(UserCodeCommand.ExtendedUserCodeSet), useSupervision()];
|
|
1760
|
+
let _classDescriptor;
|
|
1761
|
+
let _classExtraInitializers = [];
|
|
1762
|
+
let _classThis;
|
|
1763
|
+
let _classSuper = UserCodeCC;
|
|
1764
|
+
var UserCodeCCExtendedUserCodeSet = class extends _classSuper {
|
|
1765
|
+
static { _classThis = this; }
|
|
1766
|
+
static {
|
|
1767
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1768
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1769
|
+
UserCodeCCExtendedUserCodeSet = _classThis = _classDescriptor.value;
|
|
1770
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1771
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1772
|
+
}
|
|
1773
|
+
constructor(options) {
|
|
1774
|
+
super(options);
|
|
1775
|
+
this.userCodes = options.userCodes;
|
|
1776
|
+
}
|
|
1777
|
+
static from(_raw, _ctx) {
|
|
1778
|
+
// TODO: Deserialize payload
|
|
1779
|
+
throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
1780
|
+
// return new UserCodeCCExtendedUserCodeSet({
|
|
1781
|
+
// nodeId: ctx.sourceNodeId,
|
|
1782
|
+
// });
|
|
1783
|
+
}
|
|
1784
|
+
userCodes;
|
|
1785
|
+
serialize(ctx) {
|
|
1786
|
+
const userCodeBuffers = this.userCodes.map((code) => {
|
|
1787
|
+
const ret = Bytes.concat([
|
|
1788
|
+
Bytes.from([
|
|
1789
|
+
0,
|
|
1790
|
+
0,
|
|
1791
|
+
code.userIdStatus,
|
|
1792
|
+
code.userCode?.length ?? 0,
|
|
1793
|
+
]),
|
|
1794
|
+
isUint8Array(code.userCode)
|
|
1795
|
+
? code.userCode
|
|
1796
|
+
: Bytes.from(code.userCode ?? "", "ascii"),
|
|
1797
|
+
]);
|
|
1798
|
+
ret.writeUInt16BE(code.userId, 0);
|
|
1799
|
+
return ret;
|
|
1800
|
+
});
|
|
1801
|
+
this.payload = Bytes.concat([
|
|
1802
|
+
Bytes.from([this.userCodes.length]),
|
|
1803
|
+
...userCodeBuffers,
|
|
1582
1804
|
]);
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
...super.toLogEntry(ctx),
|
|
1599
|
-
message,
|
|
1600
|
-
};
|
|
1601
|
-
}
|
|
1602
|
-
};
|
|
1603
|
-
UserCodeCCExtendedUserCodeSet = __decorate([
|
|
1604
|
-
CCCommand(UserCodeCommand.ExtendedUserCodeSet),
|
|
1605
|
-
useSupervision()
|
|
1606
|
-
], UserCodeCCExtendedUserCodeSet);
|
|
1805
|
+
return super.serialize(ctx);
|
|
1806
|
+
}
|
|
1807
|
+
toLogEntry(ctx) {
|
|
1808
|
+
const message = {};
|
|
1809
|
+
for (const { userId, userIdStatus, userCode } of this.userCodes) {
|
|
1810
|
+
message[`code #${userId}`] = `${userCodeToLogString(userCode ?? "")} (status: ${getEnumMemberName(UserIDStatus, userIdStatus)})`;
|
|
1811
|
+
}
|
|
1812
|
+
return {
|
|
1813
|
+
...super.toLogEntry(ctx),
|
|
1814
|
+
message,
|
|
1815
|
+
};
|
|
1816
|
+
}
|
|
1817
|
+
};
|
|
1818
|
+
return UserCodeCCExtendedUserCodeSet = _classThis;
|
|
1819
|
+
})();
|
|
1607
1820
|
export { UserCodeCCExtendedUserCodeSet };
|
|
1608
|
-
let UserCodeCCExtendedUserCodeReport =
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
const { code, bytesRead } = parseExtendedUserCode(raw.payload.subarray(offset));
|
|
1623
|
-
userCodes.push(code);
|
|
1624
|
-
offset += bytesRead;
|
|
1625
|
-
}
|
|
1626
|
-
validatePayload(raw.payload.length >= offset + 2);
|
|
1627
|
-
const nextUserId = raw.payload.readUInt16BE(offset);
|
|
1628
|
-
return new UserCodeCCExtendedUserCodeReport_1({
|
|
1629
|
-
nodeId: ctx.sourceNodeId,
|
|
1630
|
-
userCodes,
|
|
1631
|
-
nextUserId,
|
|
1632
|
-
});
|
|
1633
|
-
}
|
|
1634
|
-
persistValues(ctx) {
|
|
1635
|
-
if (!super.persistValues(ctx))
|
|
1636
|
-
return false;
|
|
1637
|
-
for (const { userId, userIdStatus, userCode } of this.userCodes) {
|
|
1638
|
-
persistUserCode.call(this, ctx, userId, userIdStatus, userCode);
|
|
1821
|
+
let UserCodeCCExtendedUserCodeReport = (() => {
|
|
1822
|
+
let _classDecorators = [CCCommand(UserCodeCommand.ExtendedUserCodeReport)];
|
|
1823
|
+
let _classDescriptor;
|
|
1824
|
+
let _classExtraInitializers = [];
|
|
1825
|
+
let _classThis;
|
|
1826
|
+
let _classSuper = UserCodeCC;
|
|
1827
|
+
var UserCodeCCExtendedUserCodeReport = class extends _classSuper {
|
|
1828
|
+
static { _classThis = this; }
|
|
1829
|
+
static {
|
|
1830
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1831
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1832
|
+
UserCodeCCExtendedUserCodeReport = _classThis = _classDescriptor.value;
|
|
1833
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1834
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1639
1835
|
}
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1836
|
+
constructor(options) {
|
|
1837
|
+
super(options);
|
|
1838
|
+
// TODO: Check implementation:
|
|
1839
|
+
this.userCodes = options.userCodes;
|
|
1840
|
+
this.nextUserId = options.nextUserId;
|
|
1841
|
+
}
|
|
1842
|
+
static from(raw, ctx) {
|
|
1843
|
+
validatePayload(raw.payload.length >= 1);
|
|
1844
|
+
const numCodes = raw.payload[0];
|
|
1845
|
+
let offset = 1;
|
|
1846
|
+
const userCodes = [];
|
|
1847
|
+
// parse each user code
|
|
1848
|
+
for (let i = 0; i < numCodes; i++) {
|
|
1849
|
+
const { code, bytesRead } = parseExtendedUserCode(raw.payload.subarray(offset));
|
|
1850
|
+
userCodes.push(code);
|
|
1851
|
+
offset += bytesRead;
|
|
1852
|
+
}
|
|
1853
|
+
validatePayload(raw.payload.length >= offset + 2);
|
|
1854
|
+
const nextUserId = raw.payload.readUInt16BE(offset);
|
|
1855
|
+
return new this({
|
|
1856
|
+
nodeId: ctx.sourceNodeId,
|
|
1857
|
+
userCodes,
|
|
1858
|
+
nextUserId,
|
|
1859
|
+
});
|
|
1860
|
+
}
|
|
1861
|
+
persistValues(ctx) {
|
|
1862
|
+
if (!super.persistValues(ctx))
|
|
1863
|
+
return false;
|
|
1864
|
+
for (const { userId, userIdStatus, userCode } of this.userCodes) {
|
|
1865
|
+
persistUserCode.call(this, ctx, userId, userIdStatus, userCode);
|
|
1866
|
+
}
|
|
1867
|
+
return true;
|
|
1868
|
+
}
|
|
1869
|
+
userCodes;
|
|
1870
|
+
nextUserId;
|
|
1871
|
+
toLogEntry(ctx) {
|
|
1872
|
+
const message = {};
|
|
1873
|
+
for (const { userId, userIdStatus, userCode } of this.userCodes) {
|
|
1874
|
+
message[`code #${userId}`] = `${userCodeToLogString(userCode)} (status: ${getEnumMemberName(UserIDStatus, userIdStatus)})`;
|
|
1875
|
+
}
|
|
1876
|
+
message["next user id"] = this.nextUserId;
|
|
1877
|
+
return {
|
|
1878
|
+
...super.toLogEntry(ctx),
|
|
1879
|
+
message,
|
|
1880
|
+
};
|
|
1881
|
+
}
|
|
1882
|
+
};
|
|
1883
|
+
return UserCodeCCExtendedUserCodeReport = _classThis;
|
|
1884
|
+
})();
|
|
1659
1885
|
export { UserCodeCCExtendedUserCodeReport };
|
|
1660
|
-
let UserCodeCCExtendedUserCodeGet =
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1886
|
+
let UserCodeCCExtendedUserCodeGet = (() => {
|
|
1887
|
+
let _classDecorators = [CCCommand(UserCodeCommand.ExtendedUserCodeGet), expectedCCResponse(UserCodeCCExtendedUserCodeReport)];
|
|
1888
|
+
let _classDescriptor;
|
|
1889
|
+
let _classExtraInitializers = [];
|
|
1890
|
+
let _classThis;
|
|
1891
|
+
let _classSuper = UserCodeCC;
|
|
1892
|
+
var UserCodeCCExtendedUserCodeGet = class extends _classSuper {
|
|
1893
|
+
static { _classThis = this; }
|
|
1894
|
+
static {
|
|
1895
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1896
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1897
|
+
UserCodeCCExtendedUserCodeGet = _classThis = _classDescriptor.value;
|
|
1898
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1899
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1900
|
+
}
|
|
1901
|
+
constructor(options) {
|
|
1902
|
+
super(options);
|
|
1903
|
+
this.userId = options.userId;
|
|
1904
|
+
this.reportMore = !!options.reportMore;
|
|
1905
|
+
}
|
|
1906
|
+
static from(_raw, _ctx) {
|
|
1907
|
+
// TODO: Deserialize payload
|
|
1908
|
+
throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
1909
|
+
// return new UserCodeCCExtendedUserCodeGet({
|
|
1910
|
+
// nodeId: ctx.sourceNodeId,
|
|
1911
|
+
// });
|
|
1912
|
+
}
|
|
1913
|
+
userId;
|
|
1914
|
+
reportMore;
|
|
1915
|
+
serialize(ctx) {
|
|
1916
|
+
this.payload = Bytes.from([0, 0, this.reportMore ? 1 : 0]);
|
|
1917
|
+
this.payload.writeUInt16BE(this.userId, 0);
|
|
1918
|
+
return super.serialize(ctx);
|
|
1919
|
+
}
|
|
1920
|
+
toLogEntry(ctx) {
|
|
1921
|
+
return {
|
|
1922
|
+
...super.toLogEntry(ctx),
|
|
1923
|
+
message: {
|
|
1924
|
+
"user id": this.userId,
|
|
1925
|
+
"report more": this.reportMore,
|
|
1926
|
+
},
|
|
1927
|
+
};
|
|
1928
|
+
}
|
|
1929
|
+
};
|
|
1930
|
+
return UserCodeCCExtendedUserCodeGet = _classThis;
|
|
1931
|
+
})();
|
|
1694
1932
|
export { UserCodeCCExtendedUserCodeGet };
|
|
1695
1933
|
//# sourceMappingURL=UserCodeCC.js.map
|