@zwave-js/cc 14.0.0-beta.4 → 14.0.0-beta.5
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 ConfigurationCCReport_1, ConfigurationCCGet_1, ConfigurationCCSet_1, ConfigurationCCBulkReport_1, ConfigurationCCNameReport_1, ConfigurationCCNameGet_1, ConfigurationCCInfoReport_1, ConfigurationCCInfoGet_1, ConfigurationCCPropertiesReport_1, ConfigurationCCPropertiesGet_1;
|
|
8
35
|
function __assertType(argName, typeName, boundHasError) {
|
|
9
36
|
const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
|
|
10
37
|
if (boundHasError()) {
|
|
@@ -538,597 +565,624 @@ function getParamInformationFromConfigFile(ctx, nodeId, endpointIndex) {
|
|
|
538
565
|
return deviceConfig?.endpoints?.get(endpointIndex)?.paramInformation;
|
|
539
566
|
}
|
|
540
567
|
}
|
|
541
|
-
let ConfigurationCCAPI =
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
const nodes = this.endpoint.node.physicalNodes;
|
|
579
|
-
if (!nodes.every((node) => node
|
|
580
|
-
.getEndpoint(this.endpoint.index)
|
|
581
|
-
?.supportsCC(CommandClasses.Configuration))) {
|
|
582
|
-
throw new ZWaveError(`The multicast setValue API for Configuration CC requires all virtual target endpoints to support Configuration CC!`, ZWaveErrorCodes.CC_Invalid);
|
|
568
|
+
let ConfigurationCCAPI = (() => {
|
|
569
|
+
let _classDecorators = [API(CommandClasses.Configuration)];
|
|
570
|
+
let _classDescriptor;
|
|
571
|
+
let _classExtraInitializers = [];
|
|
572
|
+
let _classThis;
|
|
573
|
+
let _classSuper = CCAPI;
|
|
574
|
+
var ConfigurationCCAPI = class extends _classSuper {
|
|
575
|
+
static { _classThis = this; }
|
|
576
|
+
static {
|
|
577
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
578
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
579
|
+
ConfigurationCCAPI = _classThis = _classDescriptor.value;
|
|
580
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
581
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
582
|
+
}
|
|
583
|
+
supportsCommand(cmd) {
|
|
584
|
+
switch (cmd) {
|
|
585
|
+
case ConfigurationCommand.Get:
|
|
586
|
+
case ConfigurationCommand.Set:
|
|
587
|
+
return true; // This is mandatory
|
|
588
|
+
case ConfigurationCommand.BulkGet:
|
|
589
|
+
case ConfigurationCommand.BulkSet:
|
|
590
|
+
return this.version >= 2;
|
|
591
|
+
case ConfigurationCommand.NameGet:
|
|
592
|
+
case ConfigurationCommand.InfoGet:
|
|
593
|
+
case ConfigurationCommand.PropertiesGet:
|
|
594
|
+
return this.version >= 3;
|
|
595
|
+
case ConfigurationCommand.DefaultReset:
|
|
596
|
+
return this.version >= 4;
|
|
597
|
+
}
|
|
598
|
+
return super.supportsCommand(cmd);
|
|
599
|
+
}
|
|
600
|
+
get [SET_VALUE]() {
|
|
601
|
+
return async function ({ property, propertyKey }, value) {
|
|
602
|
+
// Config parameters are addressed with numeric properties/keys
|
|
603
|
+
if (typeof property !== "number") {
|
|
604
|
+
throwUnsupportedProperty(this.ccId, property);
|
|
583
605
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
606
|
+
if (propertyKey != undefined && typeof propertyKey !== "number") {
|
|
607
|
+
throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
|
|
608
|
+
}
|
|
609
|
+
if (typeof value !== "number") {
|
|
610
|
+
throwWrongValueType(this.ccId, property, "number", typeof value);
|
|
611
|
+
}
|
|
612
|
+
let ccInstance;
|
|
613
|
+
const applHost = this.host;
|
|
614
|
+
if (this.isSinglecast()) {
|
|
615
|
+
ccInstance = createConfigurationCCInstance(this.endpoint);
|
|
616
|
+
}
|
|
617
|
+
else if (this.isMulticast()) {
|
|
618
|
+
// Multicast is only possible if the parameter definition is the same on all target nodes
|
|
619
|
+
const nodes = this.endpoint.node.physicalNodes;
|
|
620
|
+
if (!nodes.every((node) => node
|
|
621
|
+
.getEndpoint(this.endpoint.index)
|
|
622
|
+
?.supportsCC(CommandClasses.Configuration))) {
|
|
623
|
+
throw new ZWaveError(`The multicast setValue API for Configuration CC requires all virtual target endpoints to support Configuration CC!`, ZWaveErrorCodes.CC_Invalid);
|
|
624
|
+
}
|
|
625
|
+
// Figure out if all the relevant info is the same
|
|
626
|
+
const paramInfos = this.endpoint.node.physicalNodes.map((node) => createConfigurationCCInstance(node.getEndpoint(this.endpoint.index)).getParamInformation(this.host, property, propertyKey));
|
|
627
|
+
if (!paramInfos.length
|
|
628
|
+
|| !paramInfos.every((info, index) => {
|
|
629
|
+
if (index === 0)
|
|
630
|
+
return true;
|
|
631
|
+
return (info.valueSize === paramInfos[0].valueSize
|
|
632
|
+
&& info.format === paramInfos[0].format);
|
|
633
|
+
})) {
|
|
634
|
+
throw new ZWaveError(`The multicast setValue API for Configuration CC requires all virtual target nodes to have the same parameter definition!`, ZWaveErrorCodes.CC_Invalid);
|
|
635
|
+
}
|
|
636
|
+
// If it is, just use the first node to create the CC instance
|
|
637
|
+
ccInstance = createConfigurationCCInstance(this.endpoint);
|
|
638
|
+
}
|
|
639
|
+
else {
|
|
640
|
+
throw new ZWaveError(`The setValue API for Configuration CC is not supported via broadcast!`, ZWaveErrorCodes.CC_NotSupported);
|
|
641
|
+
}
|
|
642
|
+
let { valueSize, format: valueFormat = ConfigValueFormat.SignedInteger, } = ccInstance.getParamInformation(applHost, property);
|
|
643
|
+
let targetValue;
|
|
644
|
+
if (propertyKey) {
|
|
645
|
+
// This is a partial value, we need to update some bits only
|
|
646
|
+
// Find out the correct value size
|
|
647
|
+
if (!valueSize) {
|
|
648
|
+
valueSize = ccInstance.getParamInformation(applHost, property, propertyKey).valueSize;
|
|
649
|
+
}
|
|
650
|
+
// Add the target value to the remaining partial values
|
|
651
|
+
targetValue = ccInstance.composePartialParamValue(applHost, property, propertyKey, value);
|
|
652
|
+
// Partial parameters are internally converted to unsigned values - update the valueFormat accordingly
|
|
653
|
+
valueFormat = ConfigValueFormat.UnsignedInteger;
|
|
654
|
+
}
|
|
655
|
+
else {
|
|
656
|
+
targetValue = value;
|
|
594
657
|
}
|
|
595
|
-
// If it is, just use the first node to create the CC instance
|
|
596
|
-
ccInstance = createConfigurationCCInstance(this.endpoint);
|
|
597
|
-
}
|
|
598
|
-
else {
|
|
599
|
-
throw new ZWaveError(`The setValue API for Configuration CC is not supported via broadcast!`, ZWaveErrorCodes.CC_NotSupported);
|
|
600
|
-
}
|
|
601
|
-
let { valueSize, format: valueFormat = ConfigValueFormat.SignedInteger, } = ccInstance.getParamInformation(applHost, property);
|
|
602
|
-
let targetValue;
|
|
603
|
-
if (propertyKey) {
|
|
604
|
-
// This is a partial value, we need to update some bits only
|
|
605
|
-
// Find out the correct value size
|
|
606
658
|
if (!valueSize) {
|
|
607
|
-
|
|
659
|
+
// If there's no value size configured, figure out a matching value size
|
|
660
|
+
valueSize = getMinIntegerSize(targetValue, valueFormat === ConfigValueFormat.SignedInteger);
|
|
661
|
+
// Throw if the value is too large or too small
|
|
662
|
+
if (!valueSize) {
|
|
663
|
+
throw new ZWaveError(`The value ${targetValue} is not valid for configuration parameters!`, ZWaveErrorCodes.Argument_Invalid);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
// Make sure that the given value fits into the value size
|
|
667
|
+
if (!isSafeValue(targetValue, valueSize, valueFormat)) {
|
|
668
|
+
// If there is a value size configured, check that the given value is compatible
|
|
669
|
+
throwInvalidValueError(targetValue, property, valueSize, valueFormat);
|
|
670
|
+
}
|
|
671
|
+
const result = await this.set({
|
|
672
|
+
parameter: property,
|
|
673
|
+
value: targetValue,
|
|
674
|
+
valueSize: valueSize,
|
|
675
|
+
valueFormat,
|
|
676
|
+
});
|
|
677
|
+
if (!supervisedCommandSucceeded(result)
|
|
678
|
+
&& this.isSinglecast()) {
|
|
679
|
+
// Verify the current value after a delay, unless the command was supervised and successful
|
|
680
|
+
this.schedulePoll({ property, propertyKey }, targetValue,
|
|
681
|
+
// Configuration changes are instant
|
|
682
|
+
{ transition: "fast" });
|
|
683
|
+
}
|
|
684
|
+
return result;
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
get [POLL_VALUE]() {
|
|
688
|
+
return async function ({ property, propertyKey }) {
|
|
689
|
+
// Config parameters are addressed with numeric properties/keys
|
|
690
|
+
if (typeof property !== "number") {
|
|
691
|
+
throwUnsupportedProperty(this.ccId, property);
|
|
692
|
+
}
|
|
693
|
+
if (propertyKey != undefined && typeof propertyKey !== "number") {
|
|
694
|
+
throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
|
|
608
695
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
696
|
+
return this.get(property, { valueBitMask: propertyKey });
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Requests the current value of a given config parameter from the device.
|
|
701
|
+
* This may timeout and return `undefined` if the node does not respond.
|
|
702
|
+
* If the node replied with a different parameter number, a `ConfigurationCCError`
|
|
703
|
+
* is thrown with the `argument` property set to the reported parameter number.
|
|
704
|
+
*/
|
|
705
|
+
async get(parameter, options) {
|
|
706
|
+
__assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
|
|
707
|
+
__assertType("options", undefined, __assertType__optional__0.bind(void 0, options));
|
|
708
|
+
// Get-type commands are only possible in singlecast
|
|
709
|
+
this.assertPhysicalEndpoint(this.endpoint);
|
|
710
|
+
// Two-byte parameter numbers can only be read using the BulkGet command
|
|
711
|
+
if (parameter > 255) {
|
|
712
|
+
const result = await this.getBulk([
|
|
713
|
+
{
|
|
714
|
+
parameter,
|
|
715
|
+
bitMask: options?.valueBitMask,
|
|
716
|
+
},
|
|
717
|
+
]);
|
|
718
|
+
return result.find((r) => r.parameter === parameter)?.value;
|
|
613
719
|
}
|
|
614
|
-
|
|
615
|
-
|
|
720
|
+
this.assertSupportsCommand(ConfigurationCommand, ConfigurationCommand.Get);
|
|
721
|
+
const { valueBitMask, allowUnexpectedResponse } = options ?? {};
|
|
722
|
+
const cc = new ConfigurationCCGet({
|
|
723
|
+
nodeId: this.endpoint.nodeId,
|
|
724
|
+
endpointIndex: this.endpoint.index,
|
|
725
|
+
parameter,
|
|
726
|
+
allowUnexpectedResponse,
|
|
727
|
+
});
|
|
728
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
729
|
+
if (!response)
|
|
730
|
+
return;
|
|
731
|
+
// Nodes may respond with a different parameter, e.g. if we
|
|
732
|
+
// requested a non-existing one
|
|
733
|
+
if (response.parameter === parameter) {
|
|
734
|
+
if (!valueBitMask)
|
|
735
|
+
return response.value;
|
|
736
|
+
// If a partial parameter was requested, extract that value
|
|
737
|
+
const paramInfo = cc.getParamInformation(this.host, response.parameter, valueBitMask);
|
|
738
|
+
return parsePartial(response.value, valueBitMask, isSignedPartial(valueBitMask, paramInfo.format));
|
|
616
739
|
}
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
740
|
+
this.host.logNode(this.endpoint.nodeId, {
|
|
741
|
+
endpoint: this.endpoint.index,
|
|
742
|
+
message: `Received unexpected ConfigurationReport (param = ${response.parameter}, value = ${response.value.toString()})`,
|
|
743
|
+
direction: "inbound",
|
|
744
|
+
level: "error",
|
|
745
|
+
});
|
|
746
|
+
throw new ConfigurationCCError(`The first existing parameter on this node is ${response.parameter}`, ZWaveErrorCodes.ConfigurationCC_FirstParameterNumber, response.parameter);
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Requests the current value of the config parameters from the device.
|
|
750
|
+
* When the node does not respond due to a timeout, the `value` in the returned array will be `undefined`.
|
|
751
|
+
*/
|
|
752
|
+
async getBulk(options) {
|
|
753
|
+
__assertType("options", undefined, __assertType__sa__2_ea_2.bind(void 0, options));
|
|
754
|
+
// Get-type commands are only possible in singlecast
|
|
755
|
+
this.assertPhysicalEndpoint(this.endpoint);
|
|
756
|
+
let values;
|
|
757
|
+
// If the parameters are consecutive, we may use BulkGet
|
|
758
|
+
const distinctParameters = distinct(options.map((o) => o.parameter));
|
|
759
|
+
if (this.supportsCommand(ConfigurationCommand.BulkGet)
|
|
760
|
+
&& isConsecutiveArray(distinctParameters)) {
|
|
761
|
+
const cc = new ConfigurationCCBulkGet({
|
|
762
|
+
nodeId: this.endpoint.nodeId,
|
|
763
|
+
endpointIndex: this.endpoint.index,
|
|
764
|
+
parameters: distinctParameters,
|
|
765
|
+
});
|
|
766
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
767
|
+
if (response)
|
|
768
|
+
values = response.values;
|
|
624
769
|
}
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
770
|
+
else {
|
|
771
|
+
this.assertSupportsCommand(ConfigurationCommand, ConfigurationCommand.Get);
|
|
772
|
+
const _values = new Map();
|
|
773
|
+
for (const parameter of distinctParameters) {
|
|
774
|
+
const cc = new ConfigurationCCGet({
|
|
775
|
+
nodeId: this.endpoint.nodeId,
|
|
776
|
+
endpointIndex: this.endpoint.index,
|
|
777
|
+
parameter,
|
|
778
|
+
});
|
|
779
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
780
|
+
if (response) {
|
|
781
|
+
_values.set(response.parameter, response.value);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
values = _values;
|
|
629
785
|
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
786
|
+
// Combine the returned values with the requested ones
|
|
787
|
+
const cc = createConfigurationCCInstance(this.endpoint);
|
|
788
|
+
return options.map((o) => {
|
|
789
|
+
let value = values?.get(o.parameter);
|
|
790
|
+
if (typeof value === "number" && o.bitMask) {
|
|
791
|
+
const paramInfo = cc.getParamInformation(this.host, o.parameter, o.bitMask);
|
|
792
|
+
value = parsePartial(value, o.bitMask, isSignedPartial(o.bitMask, paramInfo.format));
|
|
793
|
+
}
|
|
794
|
+
return { ...o, value };
|
|
635
795
|
});
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
}
|
|
646
|
-
get [POLL_VALUE]() {
|
|
647
|
-
return async function ({ property, propertyKey }) {
|
|
648
|
-
// Config parameters are addressed with numeric properties/keys
|
|
649
|
-
if (typeof property !== "number") {
|
|
650
|
-
throwUnsupportedProperty(this.ccId, property);
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Sets a new value for a given config parameter of the device.
|
|
799
|
+
*/
|
|
800
|
+
async set(options) {
|
|
801
|
+
__assertType("options", "ConfigurationCCAPISetOptions", __assertType__ConfigurationCCAPISetOptions.bind(void 0, options));
|
|
802
|
+
// Two-byte parameter numbers can only be set using the BulkSet command
|
|
803
|
+
if (options.parameter > 255) {
|
|
804
|
+
return this.setBulk([options]);
|
|
651
805
|
}
|
|
652
|
-
|
|
653
|
-
|
|
806
|
+
this.assertSupportsCommand(ConfigurationCommand, ConfigurationCommand.Set);
|
|
807
|
+
const normalized = normalizeConfigurationCCAPISetOptions(this.host, this.endpoint, options);
|
|
808
|
+
let value = normalized.value;
|
|
809
|
+
if (normalized.bitMask) {
|
|
810
|
+
const ccc = createConfigurationCCInstance(this.endpoint);
|
|
811
|
+
value = ccc.composePartialParamValue(this.host, normalized.parameter, normalized.bitMask, normalized.value);
|
|
654
812
|
}
|
|
655
|
-
|
|
656
|
-
};
|
|
657
|
-
}
|
|
658
|
-
/**
|
|
659
|
-
* Requests the current value of a given config parameter from the device.
|
|
660
|
-
* This may timeout and return `undefined` if the node does not respond.
|
|
661
|
-
* If the node replied with a different parameter number, a `ConfigurationCCError`
|
|
662
|
-
* is thrown with the `argument` property set to the reported parameter number.
|
|
663
|
-
*/
|
|
664
|
-
async get(parameter, options) {
|
|
665
|
-
__assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
|
|
666
|
-
__assertType("options", undefined, __assertType__optional__0.bind(void 0, options));
|
|
667
|
-
// Get-type commands are only possible in singlecast
|
|
668
|
-
this.assertPhysicalEndpoint(this.endpoint);
|
|
669
|
-
// Two-byte parameter numbers can only be read using the BulkGet command
|
|
670
|
-
if (parameter > 255) {
|
|
671
|
-
const result = await this.getBulk([
|
|
672
|
-
{
|
|
673
|
-
parameter,
|
|
674
|
-
bitMask: options?.valueBitMask,
|
|
675
|
-
},
|
|
676
|
-
]);
|
|
677
|
-
return result.find((r) => r.parameter === parameter)?.value;
|
|
678
|
-
}
|
|
679
|
-
this.assertSupportsCommand(ConfigurationCommand, ConfigurationCommand.Get);
|
|
680
|
-
const { valueBitMask, allowUnexpectedResponse } = options ?? {};
|
|
681
|
-
const cc = new ConfigurationCCGet({
|
|
682
|
-
nodeId: this.endpoint.nodeId,
|
|
683
|
-
endpointIndex: this.endpoint.index,
|
|
684
|
-
parameter,
|
|
685
|
-
allowUnexpectedResponse,
|
|
686
|
-
});
|
|
687
|
-
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
688
|
-
if (!response)
|
|
689
|
-
return;
|
|
690
|
-
// Nodes may respond with a different parameter, e.g. if we
|
|
691
|
-
// requested a non-existing one
|
|
692
|
-
if (response.parameter === parameter) {
|
|
693
|
-
if (!valueBitMask)
|
|
694
|
-
return response.value;
|
|
695
|
-
// If a partial parameter was requested, extract that value
|
|
696
|
-
const paramInfo = cc.getParamInformation(this.host, response.parameter, valueBitMask);
|
|
697
|
-
return parsePartial(response.value, valueBitMask, isSignedPartial(valueBitMask, paramInfo.format));
|
|
698
|
-
}
|
|
699
|
-
this.host.logNode(this.endpoint.nodeId, {
|
|
700
|
-
endpoint: this.endpoint.index,
|
|
701
|
-
message: `Received unexpected ConfigurationReport (param = ${response.parameter}, value = ${response.value.toString()})`,
|
|
702
|
-
direction: "inbound",
|
|
703
|
-
level: "error",
|
|
704
|
-
});
|
|
705
|
-
throw new ConfigurationCCError(`The first existing parameter on this node is ${response.parameter}`, ZWaveErrorCodes.ConfigurationCC_FirstParameterNumber, response.parameter);
|
|
706
|
-
}
|
|
707
|
-
/**
|
|
708
|
-
* Requests the current value of the config parameters from the device.
|
|
709
|
-
* When the node does not respond due to a timeout, the `value` in the returned array will be `undefined`.
|
|
710
|
-
*/
|
|
711
|
-
async getBulk(options) {
|
|
712
|
-
__assertType("options", undefined, __assertType__sa__2_ea_2.bind(void 0, options));
|
|
713
|
-
// Get-type commands are only possible in singlecast
|
|
714
|
-
this.assertPhysicalEndpoint(this.endpoint);
|
|
715
|
-
let values;
|
|
716
|
-
// If the parameters are consecutive, we may use BulkGet
|
|
717
|
-
const distinctParameters = distinct(options.map((o) => o.parameter));
|
|
718
|
-
if (this.supportsCommand(ConfigurationCommand.BulkGet)
|
|
719
|
-
&& isConsecutiveArray(distinctParameters)) {
|
|
720
|
-
const cc = new ConfigurationCCBulkGet({
|
|
813
|
+
const cc = new ConfigurationCCSet({
|
|
721
814
|
nodeId: this.endpoint.nodeId,
|
|
722
815
|
endpointIndex: this.endpoint.index,
|
|
723
|
-
|
|
816
|
+
resetToDefault: false,
|
|
817
|
+
parameter: normalized.parameter,
|
|
818
|
+
value,
|
|
819
|
+
valueSize: normalized.valueSize,
|
|
820
|
+
valueFormat: normalized.valueFormat,
|
|
724
821
|
});
|
|
725
|
-
|
|
726
|
-
if (response)
|
|
727
|
-
values = response.values;
|
|
822
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
728
823
|
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
824
|
+
/**
|
|
825
|
+
* Sets new values for multiple config parameters of the device. Uses the `BulkSet` command if supported, otherwise falls back to individual `Set` commands.
|
|
826
|
+
*/
|
|
827
|
+
async setBulk(values) {
|
|
828
|
+
__assertType("values", undefined, __assertType__sa_su_si__4__5_ei_si__4__7_ei_si__4__9_ei_eu_ea_2.bind(void 0, values));
|
|
829
|
+
// Normalize the values so we can better work with them
|
|
830
|
+
const normalized = values.map((v) => normalizeConfigurationCCAPISetOptions(this.host, this.endpoint, v));
|
|
831
|
+
// And merge multiple partials that belong the same "full" value
|
|
832
|
+
const allParams = bulkMergePartialParamValues(this.host, this.endpoint, normalized);
|
|
833
|
+
const canUseBulkSet = this.supportsCommand(ConfigurationCommand.BulkSet)
|
|
834
|
+
// For Bulk Set we need consecutive parameters
|
|
835
|
+
&& isConsecutiveArray(allParams.map((v) => v.parameter))
|
|
836
|
+
// and identical format
|
|
837
|
+
&& new Set(allParams.map((v) => v.valueFormat)).size === 1
|
|
838
|
+
// and identical size
|
|
839
|
+
&& new Set(allParams.map((v) => v.valueSize)).size === 1;
|
|
840
|
+
if (canUseBulkSet) {
|
|
841
|
+
const cc = new ConfigurationCCBulkSet({
|
|
734
842
|
nodeId: this.endpoint.nodeId,
|
|
735
843
|
endpointIndex: this.endpoint.index,
|
|
736
|
-
parameter,
|
|
844
|
+
parameters: allParams.map((v) => v.parameter),
|
|
845
|
+
valueSize: allParams[0].valueSize,
|
|
846
|
+
valueFormat: allParams[0].valueFormat,
|
|
847
|
+
values: allParams.map((v) => v.value),
|
|
848
|
+
handshake: true,
|
|
737
849
|
});
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
850
|
+
// The handshake flag is set, so we expect a BulkReport in response
|
|
851
|
+
const result = await this.host.sendCommand(cc, this.commandOptions);
|
|
852
|
+
// If we did receive a response, we also received the updated parameters,
|
|
853
|
+
// so if any one was not accepted, we know by looking at the values.
|
|
854
|
+
// Translate the result into a SupervisionResult by comparing the values
|
|
855
|
+
if (result) {
|
|
856
|
+
const sentValues = cc.values;
|
|
857
|
+
const receivedValues = [...result.values.values()];
|
|
858
|
+
const success = sentValues.length === receivedValues.length
|
|
859
|
+
&& sentValues.every((v, i) => v === receivedValues[i]);
|
|
860
|
+
return {
|
|
861
|
+
status: success
|
|
862
|
+
? SupervisionStatus.Success
|
|
863
|
+
: SupervisionStatus.Fail,
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
else {
|
|
867
|
+
return undefined;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
else {
|
|
871
|
+
this.assertSupportsCommand(ConfigurationCommand, ConfigurationCommand.Set);
|
|
872
|
+
const supervisionResults = [];
|
|
873
|
+
for (const { parameter, value, valueSize, valueFormat, } of allParams) {
|
|
874
|
+
const cc = new ConfigurationCCSet({
|
|
875
|
+
nodeId: this.endpoint.nodeId,
|
|
876
|
+
endpointIndex: this.endpoint.index,
|
|
877
|
+
parameter,
|
|
878
|
+
value,
|
|
879
|
+
valueSize,
|
|
880
|
+
valueFormat,
|
|
881
|
+
});
|
|
882
|
+
supervisionResults.push(await this.host.sendCommand(cc, this.commandOptions));
|
|
741
883
|
}
|
|
884
|
+
return mergeSupervisionResults(supervisionResults);
|
|
742
885
|
}
|
|
743
|
-
values = _values;
|
|
744
886
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
887
|
+
/**
|
|
888
|
+
* Resets a configuration parameter to its default value.
|
|
889
|
+
*
|
|
890
|
+
* WARNING: This will throw on legacy devices (ConfigurationCC v3 and below)
|
|
891
|
+
*/
|
|
892
|
+
async reset(parameter) {
|
|
893
|
+
__assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
|
|
894
|
+
// Two-byte parameter numbers can only be reset using the BulkSet command
|
|
895
|
+
if (parameter > 255) {
|
|
896
|
+
return this.resetBulk([parameter]);
|
|
752
897
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
if (options.parameter > 255) {
|
|
763
|
-
return this.setBulk([options]);
|
|
764
|
-
}
|
|
765
|
-
this.assertSupportsCommand(ConfigurationCommand, ConfigurationCommand.Set);
|
|
766
|
-
const normalized = normalizeConfigurationCCAPISetOptions(this.host, this.endpoint, options);
|
|
767
|
-
let value = normalized.value;
|
|
768
|
-
if (normalized.bitMask) {
|
|
769
|
-
const ccc = createConfigurationCCInstance(this.endpoint);
|
|
770
|
-
value = ccc.composePartialParamValue(this.host, normalized.parameter, normalized.bitMask, normalized.value);
|
|
771
|
-
}
|
|
772
|
-
const cc = new ConfigurationCCSet({
|
|
773
|
-
nodeId: this.endpoint.nodeId,
|
|
774
|
-
endpointIndex: this.endpoint.index,
|
|
775
|
-
resetToDefault: false,
|
|
776
|
-
parameter: normalized.parameter,
|
|
777
|
-
value,
|
|
778
|
-
valueSize: normalized.valueSize,
|
|
779
|
-
valueFormat: normalized.valueFormat,
|
|
780
|
-
});
|
|
781
|
-
return this.host.sendCommand(cc, this.commandOptions);
|
|
782
|
-
}
|
|
783
|
-
/**
|
|
784
|
-
* Sets new values for multiple config parameters of the device. Uses the `BulkSet` command if supported, otherwise falls back to individual `Set` commands.
|
|
785
|
-
*/
|
|
786
|
-
async setBulk(values) {
|
|
787
|
-
__assertType("values", undefined, __assertType__sa_su_si__4__5_ei_si__4__7_ei_si__4__9_ei_eu_ea_2.bind(void 0, values));
|
|
788
|
-
// Normalize the values so we can better work with them
|
|
789
|
-
const normalized = values.map((v) => normalizeConfigurationCCAPISetOptions(this.host, this.endpoint, v));
|
|
790
|
-
// And merge multiple partials that belong the same "full" value
|
|
791
|
-
const allParams = bulkMergePartialParamValues(this.host, this.endpoint, normalized);
|
|
792
|
-
const canUseBulkSet = this.supportsCommand(ConfigurationCommand.BulkSet)
|
|
793
|
-
// For Bulk Set we need consecutive parameters
|
|
794
|
-
&& isConsecutiveArray(allParams.map((v) => v.parameter))
|
|
795
|
-
// and identical format
|
|
796
|
-
&& new Set(allParams.map((v) => v.valueFormat)).size === 1
|
|
797
|
-
// and identical size
|
|
798
|
-
&& new Set(allParams.map((v) => v.valueSize)).size === 1;
|
|
799
|
-
if (canUseBulkSet) {
|
|
800
|
-
const cc = new ConfigurationCCBulkSet({
|
|
898
|
+
// According to SDS14223 this flag SHOULD NOT be set
|
|
899
|
+
// Because we don't want to test the behavior, we enforce that it MUST not be set
|
|
900
|
+
// on legacy nodes
|
|
901
|
+
if (this.version <= 3) {
|
|
902
|
+
throw new ZWaveError(`Resetting configuration parameters to default MUST not be done on nodes implementing ConfigurationCC V3 or below!`, ZWaveErrorCodes
|
|
903
|
+
.ConfigurationCC_NoResetToDefaultOnLegacyDevices);
|
|
904
|
+
}
|
|
905
|
+
this.assertSupportsCommand(ConfigurationCommand, ConfigurationCommand.Set);
|
|
906
|
+
const cc = new ConfigurationCCSet({
|
|
801
907
|
nodeId: this.endpoint.nodeId,
|
|
802
908
|
endpointIndex: this.endpoint.index,
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
valueFormat: allParams[0].valueFormat,
|
|
806
|
-
values: allParams.map((v) => v.value),
|
|
807
|
-
handshake: true,
|
|
909
|
+
parameter,
|
|
910
|
+
resetToDefault: true,
|
|
808
911
|
});
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
912
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* Resets multiple configuration parameters to their default value. Uses BulkSet if supported, otherwise falls back to individual Set commands.
|
|
916
|
+
*
|
|
917
|
+
* WARNING: This will throw on legacy devices (ConfigurationCC v3 and below)
|
|
918
|
+
*/
|
|
919
|
+
async resetBulk(parameters) {
|
|
920
|
+
__assertType("parameters", undefined, __assertType__sa__number_ea_2.bind(void 0, parameters));
|
|
921
|
+
if (isConsecutiveArray(parameters)
|
|
922
|
+
&& this.supportsCommand(ConfigurationCommand.BulkSet)) {
|
|
923
|
+
const cc = new ConfigurationCCBulkSet({
|
|
924
|
+
nodeId: this.endpoint.nodeId,
|
|
925
|
+
endpointIndex: this.endpoint.index,
|
|
926
|
+
parameters,
|
|
927
|
+
resetToDefault: true,
|
|
928
|
+
});
|
|
929
|
+
return this.host.sendCommand(cc, this.commandOptions);
|
|
824
930
|
}
|
|
825
931
|
else {
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
}
|
|
829
|
-
else {
|
|
830
|
-
this.assertSupportsCommand(ConfigurationCommand, ConfigurationCommand.Set);
|
|
831
|
-
const supervisionResults = [];
|
|
832
|
-
for (const { parameter, value, valueSize, valueFormat, } of allParams) {
|
|
833
|
-
const cc = new ConfigurationCCSet({
|
|
932
|
+
this.assertSupportsCommand(ConfigurationCommand, ConfigurationCommand.Set);
|
|
933
|
+
const CCs = distinct(parameters).map((parameter) => new ConfigurationCCSet({
|
|
834
934
|
nodeId: this.endpoint.nodeId,
|
|
835
935
|
endpointIndex: this.endpoint.index,
|
|
836
936
|
parameter,
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
937
|
+
resetToDefault: true,
|
|
938
|
+
}));
|
|
939
|
+
for (const cc of CCs) {
|
|
940
|
+
await this.host.sendCommand(cc, this.commandOptions);
|
|
941
|
+
}
|
|
842
942
|
}
|
|
843
|
-
return mergeSupervisionResults(supervisionResults);
|
|
844
943
|
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
async reset(parameter) {
|
|
852
|
-
__assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
|
|
853
|
-
// Two-byte parameter numbers can only be reset using the BulkSet command
|
|
854
|
-
if (parameter > 255) {
|
|
855
|
-
return this.resetBulk([parameter]);
|
|
856
|
-
}
|
|
857
|
-
// According to SDS14223 this flag SHOULD NOT be set
|
|
858
|
-
// Because we don't want to test the behavior, we enforce that it MUST not be set
|
|
859
|
-
// on legacy nodes
|
|
860
|
-
if (this.version <= 3) {
|
|
861
|
-
throw new ZWaveError(`Resetting configuration parameters to default MUST not be done on nodes implementing ConfigurationCC V3 or below!`, ZWaveErrorCodes
|
|
862
|
-
.ConfigurationCC_NoResetToDefaultOnLegacyDevices);
|
|
863
|
-
}
|
|
864
|
-
this.assertSupportsCommand(ConfigurationCommand, ConfigurationCommand.Set);
|
|
865
|
-
const cc = new ConfigurationCCSet({
|
|
866
|
-
nodeId: this.endpoint.nodeId,
|
|
867
|
-
endpointIndex: this.endpoint.index,
|
|
868
|
-
parameter,
|
|
869
|
-
resetToDefault: true,
|
|
870
|
-
});
|
|
871
|
-
return this.host.sendCommand(cc, this.commandOptions);
|
|
872
|
-
}
|
|
873
|
-
/**
|
|
874
|
-
* Resets multiple configuration parameters to their default value. Uses BulkSet if supported, otherwise falls back to individual Set commands.
|
|
875
|
-
*
|
|
876
|
-
* WARNING: This will throw on legacy devices (ConfigurationCC v3 and below)
|
|
877
|
-
*/
|
|
878
|
-
async resetBulk(parameters) {
|
|
879
|
-
__assertType("parameters", undefined, __assertType__sa__number_ea_2.bind(void 0, parameters));
|
|
880
|
-
if (isConsecutiveArray(parameters)
|
|
881
|
-
&& this.supportsCommand(ConfigurationCommand.BulkSet)) {
|
|
882
|
-
const cc = new ConfigurationCCBulkSet({
|
|
944
|
+
/** Resets all configuration parameters to their default value */
|
|
945
|
+
async resetAll() {
|
|
946
|
+
// This is dangerous - don't allow resetting all parameters via multicast
|
|
947
|
+
this.assertPhysicalEndpoint(this.endpoint);
|
|
948
|
+
this.assertSupportsCommand(ConfigurationCommand, ConfigurationCommand.DefaultReset);
|
|
949
|
+
const cc = new ConfigurationCCDefaultReset({
|
|
883
950
|
nodeId: this.endpoint.nodeId,
|
|
884
951
|
endpointIndex: this.endpoint.index,
|
|
885
|
-
parameters,
|
|
886
|
-
resetToDefault: true,
|
|
887
952
|
});
|
|
888
|
-
|
|
953
|
+
await this.host.sendCommand(cc, this.commandOptions);
|
|
889
954
|
}
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
955
|
+
async getProperties(parameter) {
|
|
956
|
+
__assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
|
|
957
|
+
// Get-type commands are only possible in singlecast
|
|
958
|
+
this.assertPhysicalEndpoint(this.endpoint);
|
|
959
|
+
const cc = new ConfigurationCCPropertiesGet({
|
|
893
960
|
nodeId: this.endpoint.nodeId,
|
|
894
961
|
endpointIndex: this.endpoint.index,
|
|
895
962
|
parameter,
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
963
|
+
});
|
|
964
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
965
|
+
if (response) {
|
|
966
|
+
return pick(response, [
|
|
967
|
+
"valueSize",
|
|
968
|
+
"valueFormat",
|
|
969
|
+
"minValue",
|
|
970
|
+
"maxValue",
|
|
971
|
+
"defaultValue",
|
|
972
|
+
"nextParameter",
|
|
973
|
+
"altersCapabilities",
|
|
974
|
+
"isReadonly",
|
|
975
|
+
"isAdvanced",
|
|
976
|
+
"noBulkSupport",
|
|
977
|
+
]);
|
|
900
978
|
}
|
|
901
979
|
}
|
|
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
|
-
endpointIndex: this.endpoint.index,
|
|
947
|
-
parameter,
|
|
948
|
-
});
|
|
949
|
-
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
950
|
-
return response?.name;
|
|
951
|
-
}
|
|
952
|
-
/** Requests usage info for a configuration parameter from the node */
|
|
953
|
-
async getInfo(parameter) {
|
|
954
|
-
__assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
|
|
955
|
-
// Get-type commands are only possible in singlecast
|
|
956
|
-
this.assertPhysicalEndpoint(this.endpoint);
|
|
957
|
-
const cc = new ConfigurationCCInfoGet({
|
|
958
|
-
nodeId: this.endpoint.nodeId,
|
|
959
|
-
endpointIndex: this.endpoint.index,
|
|
960
|
-
parameter,
|
|
961
|
-
});
|
|
962
|
-
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
963
|
-
return response?.info;
|
|
964
|
-
}
|
|
965
|
-
/**
|
|
966
|
-
* This scans the node for the existing parameters. Found parameters will be reported
|
|
967
|
-
* through the `value added` and `value updated` events.
|
|
968
|
-
*
|
|
969
|
-
* WARNING: This method throws for newer devices.
|
|
970
|
-
*
|
|
971
|
-
* WARNING: On nodes implementing V1 and V2, this process may take
|
|
972
|
-
* **up to an hour**, depending on the configured timeout.
|
|
973
|
-
*
|
|
974
|
-
* WARNING: On nodes implementing V2, all parameters after 255 will be ignored.
|
|
975
|
-
*/
|
|
976
|
-
async scanParametersLegacy() {
|
|
977
|
-
if (this.version >= 3) {
|
|
978
|
-
throw new ZWaveError("Use ConfigurationCC.interview instead of scanning parameters for versions 3 and above.", ZWaveErrorCodes.ConfigurationCC_NoLegacyScanOnNewDevices);
|
|
979
|
-
}
|
|
980
|
-
// Get-type commands are only possible in singlecast
|
|
981
|
-
this.assertPhysicalEndpoint(this.endpoint);
|
|
982
|
-
// TODO: Reduce the priority of the messages
|
|
983
|
-
this.host.logNode(this.endpoint.nodeId, {
|
|
984
|
-
endpoint: this.endpoint.index,
|
|
985
|
-
message: `Scanning available parameters...`,
|
|
986
|
-
});
|
|
987
|
-
const ccInstance = createConfigurationCCInstance(this.endpoint);
|
|
988
|
-
for (let param = 1; param <= 255; param++) {
|
|
989
|
-
// Check if the parameter is readable
|
|
990
|
-
let originalValue;
|
|
980
|
+
/** Requests the name of a configuration parameter from the node */
|
|
981
|
+
async getName(parameter) {
|
|
982
|
+
__assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
|
|
983
|
+
// Get-type commands are only possible in singlecast
|
|
984
|
+
this.assertPhysicalEndpoint(this.endpoint);
|
|
985
|
+
const cc = new ConfigurationCCNameGet({
|
|
986
|
+
nodeId: this.endpoint.nodeId,
|
|
987
|
+
endpointIndex: this.endpoint.index,
|
|
988
|
+
parameter,
|
|
989
|
+
});
|
|
990
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
991
|
+
return response?.name;
|
|
992
|
+
}
|
|
993
|
+
/** Requests usage info for a configuration parameter from the node */
|
|
994
|
+
async getInfo(parameter) {
|
|
995
|
+
__assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
|
|
996
|
+
// Get-type commands are only possible in singlecast
|
|
997
|
+
this.assertPhysicalEndpoint(this.endpoint);
|
|
998
|
+
const cc = new ConfigurationCCInfoGet({
|
|
999
|
+
nodeId: this.endpoint.nodeId,
|
|
1000
|
+
endpointIndex: this.endpoint.index,
|
|
1001
|
+
parameter,
|
|
1002
|
+
});
|
|
1003
|
+
const response = await this.host.sendCommand(cc, this.commandOptions);
|
|
1004
|
+
return response?.info;
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* This scans the node for the existing parameters. Found parameters will be reported
|
|
1008
|
+
* through the `value added` and `value updated` events.
|
|
1009
|
+
*
|
|
1010
|
+
* WARNING: This method throws for newer devices.
|
|
1011
|
+
*
|
|
1012
|
+
* WARNING: On nodes implementing V1 and V2, this process may take
|
|
1013
|
+
* **up to an hour**, depending on the configured timeout.
|
|
1014
|
+
*
|
|
1015
|
+
* WARNING: On nodes implementing V2, all parameters after 255 will be ignored.
|
|
1016
|
+
*/
|
|
1017
|
+
async scanParametersLegacy() {
|
|
1018
|
+
if (this.version >= 3) {
|
|
1019
|
+
throw new ZWaveError("Use ConfigurationCC.interview instead of scanning parameters for versions 3 and above.", ZWaveErrorCodes.ConfigurationCC_NoLegacyScanOnNewDevices);
|
|
1020
|
+
}
|
|
1021
|
+
// Get-type commands are only possible in singlecast
|
|
1022
|
+
this.assertPhysicalEndpoint(this.endpoint);
|
|
1023
|
+
// TODO: Reduce the priority of the messages
|
|
991
1024
|
this.host.logNode(this.endpoint.nodeId, {
|
|
992
1025
|
endpoint: this.endpoint.index,
|
|
993
|
-
message: `
|
|
994
|
-
direction: "outbound",
|
|
1026
|
+
message: `Scanning available parameters...`,
|
|
995
1027
|
});
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1028
|
+
const ccInstance = createConfigurationCCInstance(this.endpoint);
|
|
1029
|
+
for (let param = 1; param <= 255; param++) {
|
|
1030
|
+
// Check if the parameter is readable
|
|
1031
|
+
let originalValue;
|
|
1032
|
+
this.host.logNode(this.endpoint.nodeId, {
|
|
1033
|
+
endpoint: this.endpoint.index,
|
|
1034
|
+
message: ` trying param ${param}...`,
|
|
1035
|
+
direction: "outbound",
|
|
1002
1036
|
});
|
|
1003
|
-
|
|
1004
|
-
|
|
1037
|
+
try {
|
|
1038
|
+
originalValue = await this.get(param, {
|
|
1039
|
+
// When requesting a non-existing parameter, a node SHOULD respond with the
|
|
1040
|
+
// first available parameter. We use this for the first param only,
|
|
1041
|
+
// because delayed responses might otherwise confuse the interview process
|
|
1042
|
+
allowUnexpectedResponse: param === 1,
|
|
1043
|
+
});
|
|
1044
|
+
if (originalValue != undefined) {
|
|
1045
|
+
const logMessage = ` Param ${param}:
|
|
1005
1046
|
readable = true
|
|
1006
1047
|
valueSize = ${ccInstance.getParamInformation(this.host, param)
|
|
1007
|
-
|
|
1048
|
+
.valueSize}
|
|
1008
1049
|
value = ${originalValue.toString()}`;
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1050
|
+
this.host.logNode(this.endpoint.nodeId, {
|
|
1051
|
+
endpoint: this.endpoint.index,
|
|
1052
|
+
message: logMessage,
|
|
1053
|
+
direction: "inbound",
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1014
1056
|
}
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1057
|
+
catch (e) {
|
|
1058
|
+
if (e instanceof ConfigurationCCError
|
|
1059
|
+
&& e.code
|
|
1060
|
+
=== ZWaveErrorCodes.ConfigurationCC_FirstParameterNumber) {
|
|
1061
|
+
// Continue iterating with the next param
|
|
1062
|
+
if (e.argument - 1 > param)
|
|
1063
|
+
param = e.argument - 1;
|
|
1064
|
+
continue;
|
|
1065
|
+
}
|
|
1066
|
+
throw e;
|
|
1024
1067
|
}
|
|
1025
|
-
throw e;
|
|
1026
1068
|
}
|
|
1027
1069
|
}
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
API(CommandClasses.Configuration)
|
|
1032
|
-
], ConfigurationCCAPI);
|
|
1070
|
+
};
|
|
1071
|
+
return ConfigurationCCAPI = _classThis;
|
|
1072
|
+
})();
|
|
1033
1073
|
export { ConfigurationCCAPI };
|
|
1034
|
-
let ConfigurationCC =
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1074
|
+
let ConfigurationCC = (() => {
|
|
1075
|
+
let _classDecorators = [commandClass(CommandClasses.Configuration), implementedVersion(4), ccValues(ConfigurationCCValues)];
|
|
1076
|
+
let _classDescriptor;
|
|
1077
|
+
let _classExtraInitializers = [];
|
|
1078
|
+
let _classThis;
|
|
1079
|
+
let _classSuper = CommandClass;
|
|
1080
|
+
var ConfigurationCC = class extends _classSuper {
|
|
1081
|
+
static { _classThis = this; }
|
|
1082
|
+
static {
|
|
1083
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1084
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1085
|
+
ConfigurationCC = _classThis = _classDescriptor.value;
|
|
1086
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1087
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1088
|
+
}
|
|
1089
|
+
async interview(ctx) {
|
|
1090
|
+
const node = this.getNode(ctx);
|
|
1091
|
+
const endpoint = this.getEndpoint(ctx);
|
|
1092
|
+
const api = CCAPI.create(CommandClasses.Configuration, ctx, endpoint).withOptions({
|
|
1093
|
+
priority: MessagePriority.NodeQuery,
|
|
1053
1094
|
});
|
|
1054
|
-
this.deserializeParamInformationFromConfig(ctx, paramInfo);
|
|
1055
|
-
}
|
|
1056
|
-
const documentedParamNumbers = new Set(Array.from(paramInfo?.keys() ?? []).map((k) => k.parameter));
|
|
1057
|
-
if (api.version >= 3) {
|
|
1058
1095
|
ctx.logNode(node.id, {
|
|
1059
1096
|
endpoint: this.endpointIndex,
|
|
1060
|
-
message:
|
|
1061
|
-
direction: "
|
|
1097
|
+
message: `Interviewing ${this.ccName}...`,
|
|
1098
|
+
direction: "none",
|
|
1062
1099
|
});
|
|
1063
|
-
const
|
|
1064
|
-
|
|
1065
|
-
if (
|
|
1066
|
-
param = param0props.nextParameter;
|
|
1067
|
-
if (param === 0) {
|
|
1068
|
-
ctx.logNode(node.id, {
|
|
1069
|
-
endpoint: this.endpointIndex,
|
|
1070
|
-
message: `didn't report any config params, trying #1 just to be sure...`,
|
|
1071
|
-
direction: "inbound",
|
|
1072
|
-
});
|
|
1073
|
-
param = 1;
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
else {
|
|
1100
|
+
const deviceConfig = ctx.getDeviceConfig?.(node.id);
|
|
1101
|
+
const paramInfo = getParamInformationFromConfigFile(ctx, node.id, this.endpointIndex);
|
|
1102
|
+
if (paramInfo) {
|
|
1077
1103
|
ctx.logNode(node.id, {
|
|
1078
1104
|
endpoint: this.endpointIndex,
|
|
1079
|
-
message:
|
|
1080
|
-
|
|
1105
|
+
message: `${this.constructor.name}: Loading configuration parameters from device config`,
|
|
1106
|
+
direction: "none",
|
|
1081
1107
|
});
|
|
1082
|
-
|
|
1108
|
+
this.deserializeParamInformationFromConfig(ctx, paramInfo);
|
|
1083
1109
|
}
|
|
1084
|
-
|
|
1110
|
+
const documentedParamNumbers = new Set(Array.from(paramInfo?.keys() ?? []).map((k) => k.parameter));
|
|
1111
|
+
if (api.version >= 3) {
|
|
1085
1112
|
ctx.logNode(node.id, {
|
|
1086
1113
|
endpoint: this.endpointIndex,
|
|
1087
|
-
message:
|
|
1114
|
+
message: "finding first configuration parameter...",
|
|
1088
1115
|
direction: "outbound",
|
|
1089
1116
|
});
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1117
|
+
const param0props = await api.getProperties(0);
|
|
1118
|
+
let param;
|
|
1119
|
+
if (param0props) {
|
|
1120
|
+
param = param0props.nextParameter;
|
|
1121
|
+
if (param === 0) {
|
|
1122
|
+
ctx.logNode(node.id, {
|
|
1123
|
+
endpoint: this.endpointIndex,
|
|
1124
|
+
message: `didn't report any config params, trying #1 just to be sure...`,
|
|
1125
|
+
direction: "inbound",
|
|
1126
|
+
});
|
|
1127
|
+
param = 1;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
else {
|
|
1095
1131
|
ctx.logNode(node.id, {
|
|
1096
1132
|
endpoint: this.endpointIndex,
|
|
1097
|
-
message:
|
|
1133
|
+
message: "Finding first configuration parameter timed out, skipping interview...",
|
|
1098
1134
|
level: "warn",
|
|
1099
1135
|
});
|
|
1100
|
-
|
|
1136
|
+
return;
|
|
1101
1137
|
}
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
//
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1138
|
+
while (param > 0) {
|
|
1139
|
+
ctx.logNode(node.id, {
|
|
1140
|
+
endpoint: this.endpointIndex,
|
|
1141
|
+
message: `querying parameter #${param} information...`,
|
|
1142
|
+
direction: "outbound",
|
|
1143
|
+
});
|
|
1144
|
+
// Query properties and the next param
|
|
1145
|
+
const props = await api.getProperties(param).catch(
|
|
1146
|
+
// If querying the properties fails, don't abort the entire interview
|
|
1147
|
+
() => undefined);
|
|
1148
|
+
if (!props) {
|
|
1149
|
+
ctx.logNode(node.id, {
|
|
1150
|
+
endpoint: this.endpointIndex,
|
|
1151
|
+
message: `Querying parameter #${param} information timed out, skipping scan...`,
|
|
1152
|
+
level: "warn",
|
|
1153
|
+
});
|
|
1154
|
+
break;
|
|
1155
|
+
}
|
|
1156
|
+
const { nextParameter, ...properties } = props;
|
|
1157
|
+
let logMessage;
|
|
1158
|
+
if (properties.valueSize === 0) {
|
|
1159
|
+
logMessage =
|
|
1160
|
+
`Parameter #${param} is unsupported. Next parameter: ${nextParameter}`;
|
|
1161
|
+
}
|
|
1162
|
+
else {
|
|
1163
|
+
let name;
|
|
1164
|
+
// Query the name and info for parameters that are NOT defined in a config file
|
|
1165
|
+
if (!documentedParamNumbers.has(param)) {
|
|
1166
|
+
// Skip the name query for bugged devices
|
|
1167
|
+
if (!deviceConfig?.compat?.skipConfigurationNameQuery) {
|
|
1168
|
+
name = await api.getName(param).catch(
|
|
1169
|
+
// If querying the name fails, don't abort the entire interview
|
|
1170
|
+
() => undefined);
|
|
1171
|
+
}
|
|
1172
|
+
// Skip the info query for bugged devices
|
|
1173
|
+
if (!deviceConfig?.compat?.skipConfigurationInfoQuery) {
|
|
1174
|
+
await api.getInfo(param).catch(
|
|
1175
|
+
// If querying the info fails, don't abort the entire interview
|
|
1176
|
+
() => undefined);
|
|
1177
|
+
}
|
|
1117
1178
|
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1179
|
+
logMessage =
|
|
1180
|
+
`received information for parameter #${param}:`;
|
|
1181
|
+
if (name) {
|
|
1182
|
+
logMessage += `
|
|
1183
|
+
parameter name: ${name}`;
|
|
1123
1184
|
}
|
|
1124
|
-
}
|
|
1125
|
-
logMessage =
|
|
1126
|
-
`received information for parameter #${param}:`;
|
|
1127
|
-
if (name) {
|
|
1128
1185
|
logMessage += `
|
|
1129
|
-
parameter name: ${name}`;
|
|
1130
|
-
}
|
|
1131
|
-
logMessage += `
|
|
1132
1186
|
value format: ${getEnumMemberName(ConfigValueFormat, properties.valueFormat)}
|
|
1133
1187
|
value size: ${properties.valueSize} bytes
|
|
1134
1188
|
min value: ${properties.minValue?.toString() ?? "undefined"}
|
|
@@ -1138,1264 +1192,1422 @@ is read-only: ${!!properties.isReadonly}
|
|
|
1138
1192
|
is advanced (UI): ${!!properties.isAdvanced}
|
|
1139
1193
|
has bulk support: ${!properties.noBulkSupport}
|
|
1140
1194
|
alters capabilities: ${!!properties.altersCapabilities}`;
|
|
1195
|
+
}
|
|
1196
|
+
ctx.logNode(node.id, {
|
|
1197
|
+
endpoint: this.endpointIndex,
|
|
1198
|
+
message: logMessage,
|
|
1199
|
+
direction: "inbound",
|
|
1200
|
+
});
|
|
1201
|
+
// Some devices report their parameter 1 instead of 0 as the next one
|
|
1202
|
+
// when reaching the end. To avoid infinite loops, stop scanning
|
|
1203
|
+
// once the next parameter is lower than the current one
|
|
1204
|
+
if (nextParameter > param) {
|
|
1205
|
+
param = nextParameter;
|
|
1206
|
+
}
|
|
1207
|
+
else {
|
|
1208
|
+
break;
|
|
1209
|
+
}
|
|
1141
1210
|
}
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1211
|
+
}
|
|
1212
|
+
await this.refreshValues(ctx);
|
|
1213
|
+
// Remember that the interview is complete
|
|
1214
|
+
this.setInterviewComplete(ctx, true);
|
|
1215
|
+
}
|
|
1216
|
+
async refreshValues(ctx) {
|
|
1217
|
+
const node = this.getNode(ctx);
|
|
1218
|
+
const endpoint = this.getEndpoint(ctx);
|
|
1219
|
+
const api = CCAPI.create(CommandClasses.Configuration, ctx, endpoint).withOptions({
|
|
1220
|
+
priority: MessagePriority.NodeQuery,
|
|
1221
|
+
});
|
|
1222
|
+
if (api.version < 3) {
|
|
1223
|
+
// V1/V2: Query all values defined in the config file
|
|
1224
|
+
const paramInfo = getParamInformationFromConfigFile(ctx, node.id, this.endpointIndex);
|
|
1225
|
+
if (paramInfo?.size) {
|
|
1226
|
+
// Because partial params share the same parameter number,
|
|
1227
|
+
// we need to remember which ones we have already queried.
|
|
1228
|
+
const alreadyQueried = new Set();
|
|
1229
|
+
for (const param of paramInfo.keys()) {
|
|
1230
|
+
// No need to query writeonly params
|
|
1231
|
+
if (paramInfo.get(param)?.writeOnly)
|
|
1232
|
+
continue;
|
|
1233
|
+
// Don't double-query params
|
|
1234
|
+
if (alreadyQueried.has(param.parameter))
|
|
1235
|
+
continue;
|
|
1236
|
+
alreadyQueried.add(param.parameter);
|
|
1237
|
+
// Query the current value
|
|
1238
|
+
ctx.logNode(node.id, {
|
|
1239
|
+
endpoint: this.endpointIndex,
|
|
1240
|
+
message: `querying parameter #${param.parameter} value...`,
|
|
1241
|
+
direction: "outbound",
|
|
1242
|
+
});
|
|
1243
|
+
// ... at least try to
|
|
1244
|
+
const paramValue = await api.get(param.parameter);
|
|
1245
|
+
if (typeof paramValue === "number") {
|
|
1246
|
+
ctx.logNode(node.id, {
|
|
1247
|
+
endpoint: this.endpointIndex,
|
|
1248
|
+
message: `parameter #${param.parameter} has value: ${paramValue}`,
|
|
1249
|
+
direction: "inbound",
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
else if (!paramValue) {
|
|
1253
|
+
ctx.logNode(node.id, {
|
|
1254
|
+
endpoint: this.endpointIndex,
|
|
1255
|
+
message: `received no value for parameter #${param.parameter}`,
|
|
1256
|
+
direction: "inbound",
|
|
1257
|
+
level: "warn",
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1152
1261
|
}
|
|
1153
1262
|
else {
|
|
1154
|
-
break;
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
await this.refreshValues(ctx);
|
|
1159
|
-
// Remember that the interview is complete
|
|
1160
|
-
this.setInterviewComplete(ctx, true);
|
|
1161
|
-
}
|
|
1162
|
-
async refreshValues(ctx) {
|
|
1163
|
-
const node = this.getNode(ctx);
|
|
1164
|
-
const endpoint = this.getEndpoint(ctx);
|
|
1165
|
-
const api = CCAPI.create(CommandClasses.Configuration, ctx, endpoint).withOptions({
|
|
1166
|
-
priority: MessagePriority.NodeQuery,
|
|
1167
|
-
});
|
|
1168
|
-
if (api.version < 3) {
|
|
1169
|
-
// V1/V2: Query all values defined in the config file
|
|
1170
|
-
const paramInfo = getParamInformationFromConfigFile(ctx, node.id, this.endpointIndex);
|
|
1171
|
-
if (paramInfo?.size) {
|
|
1172
|
-
// Because partial params share the same parameter number,
|
|
1173
|
-
// we need to remember which ones we have already queried.
|
|
1174
|
-
const alreadyQueried = new Set();
|
|
1175
|
-
for (const param of paramInfo.keys()) {
|
|
1176
|
-
// No need to query writeonly params
|
|
1177
|
-
if (paramInfo.get(param)?.writeOnly)
|
|
1178
|
-
continue;
|
|
1179
|
-
// Don't double-query params
|
|
1180
|
-
if (alreadyQueried.has(param.parameter))
|
|
1181
|
-
continue;
|
|
1182
|
-
alreadyQueried.add(param.parameter);
|
|
1183
|
-
// Query the current value
|
|
1184
1263
|
ctx.logNode(node.id, {
|
|
1185
1264
|
endpoint: this.endpointIndex,
|
|
1186
|
-
message:
|
|
1187
|
-
direction: "
|
|
1265
|
+
message: `${this.constructor.name}: skipping interview because CC version is < 3 and there is no config file`,
|
|
1266
|
+
direction: "none",
|
|
1188
1267
|
});
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
else {
|
|
1271
|
+
// V3+: Query the values of discovered parameters
|
|
1272
|
+
const parameters = distinct(this.getDefinedValueIDs(ctx)
|
|
1273
|
+
.map((v) => v.property)
|
|
1274
|
+
.filter((p) => typeof p === "number"));
|
|
1275
|
+
for (const param of parameters) {
|
|
1276
|
+
if (this.getParamInformation(ctx, param).readable !== false) {
|
|
1192
1277
|
ctx.logNode(node.id, {
|
|
1193
1278
|
endpoint: this.endpointIndex,
|
|
1194
|
-
message: `parameter #${param
|
|
1195
|
-
direction: "
|
|
1279
|
+
message: `querying parameter #${param} value...`,
|
|
1280
|
+
direction: "outbound",
|
|
1196
1281
|
});
|
|
1282
|
+
await api.get(param);
|
|
1197
1283
|
}
|
|
1198
|
-
else
|
|
1284
|
+
else {
|
|
1199
1285
|
ctx.logNode(node.id, {
|
|
1200
1286
|
endpoint: this.endpointIndex,
|
|
1201
|
-
message: `
|
|
1202
|
-
direction: "
|
|
1203
|
-
level: "warn",
|
|
1287
|
+
message: `not querying parameter #${param} value, because it is writeonly`,
|
|
1288
|
+
direction: "none",
|
|
1204
1289
|
});
|
|
1205
1290
|
}
|
|
1206
1291
|
}
|
|
1207
1292
|
}
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* Whether this node's param information was loaded from a config file.
|
|
1296
|
+
* If this is true, we don't trust what the node reports
|
|
1297
|
+
*/
|
|
1298
|
+
paramExistsInConfigFile(ctx, parameter, valueBitMask) {
|
|
1299
|
+
if (this.getValue(ctx, ConfigurationCCValues.isParamInformationFromConfig) !== true) {
|
|
1300
|
+
return false;
|
|
1214
1301
|
}
|
|
1302
|
+
const paramInformation = getParamInformationFromConfigFile(ctx, this.nodeId, this.endpointIndex);
|
|
1303
|
+
if (!paramInformation)
|
|
1304
|
+
return false;
|
|
1305
|
+
// Check if the param is defined in the config file, either as a normal param or a partial
|
|
1306
|
+
if (paramInformation.has({ parameter, valueBitMask })) {
|
|
1307
|
+
return true;
|
|
1308
|
+
}
|
|
1309
|
+
else if (valueBitMask == undefined) {
|
|
1310
|
+
// Also consider partials when looking for plain params
|
|
1311
|
+
for (const key of paramInformation.keys()) {
|
|
1312
|
+
if (key.parameter === parameter)
|
|
1313
|
+
return true;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
return false;
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* @internal
|
|
1320
|
+
* Stores config parameter metadata for this CC's node
|
|
1321
|
+
*/
|
|
1322
|
+
extendParamInformation(ctx, parameter, valueBitMask, info) {
|
|
1323
|
+
// Don't trust param information that a node reports if we have already loaded it from a config file
|
|
1324
|
+
if (valueBitMask === undefined
|
|
1325
|
+
&& this.paramExistsInConfigFile(ctx, parameter)) {
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
// Retrieve the base metadata
|
|
1329
|
+
const metadata = this.getParamInformation(ctx, parameter, valueBitMask);
|
|
1330
|
+
// Override it with new data
|
|
1331
|
+
Object.assign(metadata, info);
|
|
1332
|
+
// And store it back
|
|
1333
|
+
this.setMetadata(ctx, ConfigurationCCValues.paramInformation(parameter, valueBitMask), metadata);
|
|
1334
|
+
}
|
|
1335
|
+
/**
|
|
1336
|
+
* @internal
|
|
1337
|
+
* Returns stored config parameter metadata for this CC's node
|
|
1338
|
+
*/
|
|
1339
|
+
getParamInformation(ctx, parameter, valueBitMask) {
|
|
1340
|
+
return (this.getMetadata(ctx, ConfigurationCCValues.paramInformation(parameter, valueBitMask)) ?? {
|
|
1341
|
+
...ValueMetadata.Any,
|
|
1342
|
+
});
|
|
1215
1343
|
}
|
|
1216
|
-
|
|
1217
|
-
|
|
1344
|
+
/**
|
|
1345
|
+
* **INTERNAL:** Returns the param info that was queried for this node. This returns the information that was returned by the node
|
|
1346
|
+
* and does not include partial parameters.
|
|
1347
|
+
*/
|
|
1348
|
+
getQueriedParamInfos(ctx) {
|
|
1218
1349
|
const parameters = distinct(this.getDefinedValueIDs(ctx)
|
|
1219
1350
|
.map((v) => v.property)
|
|
1220
1351
|
.filter((p) => typeof p === "number"));
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1352
|
+
return composeObject(parameters.map((p) => [
|
|
1353
|
+
p,
|
|
1354
|
+
this.getParamInformation(ctx, p),
|
|
1355
|
+
]));
|
|
1356
|
+
}
|
|
1357
|
+
/**
|
|
1358
|
+
* Returns stored config parameter metadata for all partial config params addressed with the given parameter number
|
|
1359
|
+
*/
|
|
1360
|
+
getPartialParamInfos(ctx, parameter) {
|
|
1361
|
+
const valueDB = this.getValueDB(ctx);
|
|
1362
|
+
return valueDB.findMetadata((id) => id.commandClass === this.ccId
|
|
1363
|
+
&& (id.endpoint ?? 0) === this.endpointIndex
|
|
1364
|
+
&& id.property === parameter
|
|
1365
|
+
&& id.propertyKey != undefined);
|
|
1366
|
+
}
|
|
1367
|
+
/**
|
|
1368
|
+
* Computes the full value of a parameter after applying a partial param value
|
|
1369
|
+
*/
|
|
1370
|
+
composePartialParamValue(ctx, parameter, bitMask, partialValue) {
|
|
1371
|
+
return this.composePartialParamValues(ctx, parameter, [
|
|
1372
|
+
{ bitMask, partialValue },
|
|
1373
|
+
]);
|
|
1374
|
+
}
|
|
1375
|
+
/**
|
|
1376
|
+
* Computes the full value of a parameter after applying multiple partial param values
|
|
1377
|
+
*/
|
|
1378
|
+
composePartialParamValues(ctx, parameter, partials) {
|
|
1379
|
+
const valueDB = this.getValueDB(ctx);
|
|
1380
|
+
// Add the other values together
|
|
1381
|
+
const otherValues = valueDB.findValues((id) => id.commandClass === this.ccId
|
|
1382
|
+
&& (id.endpoint ?? 0) === this.endpointIndex
|
|
1383
|
+
&& id.property === parameter
|
|
1384
|
+
&& id.propertyKey != undefined
|
|
1385
|
+
&& !partials.some((p) => id.propertyKey === p.bitMask));
|
|
1386
|
+
let ret = 0;
|
|
1387
|
+
for (const { propertyKey: bitMask, value: partialValue, } of otherValues) {
|
|
1388
|
+
ret = encodePartial(ret, partialValue, bitMask);
|
|
1389
|
+
}
|
|
1390
|
+
for (const { bitMask, partialValue } of partials) {
|
|
1391
|
+
ret = encodePartial(ret, partialValue, bitMask);
|
|
1392
|
+
}
|
|
1393
|
+
return ret;
|
|
1394
|
+
}
|
|
1395
|
+
/** Deserializes the config parameter info from a config file */
|
|
1396
|
+
deserializeParamInformationFromConfig(ctx, config) {
|
|
1397
|
+
const valueDB = this.getValueDB(ctx);
|
|
1398
|
+
// Clear old param information
|
|
1399
|
+
for (const meta of valueDB.getAllMetadata(this.ccId)) {
|
|
1400
|
+
if (typeof meta.property === "number"
|
|
1401
|
+
&& (meta.endpoint ?? 0) === this.endpointIndex) {
|
|
1402
|
+
// this is a param information, delete it
|
|
1403
|
+
valueDB.setMetadata(meta, undefined,
|
|
1404
|
+
// Don't emit the added/updated events, as this will spam applications with untranslated events
|
|
1405
|
+
{ noEvent: true });
|
|
1229
1406
|
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1407
|
+
}
|
|
1408
|
+
// Allow overwriting the param info (mark it as unloaded)
|
|
1409
|
+
this.setValue(ctx, ConfigurationCCValues.isParamInformationFromConfig, false);
|
|
1410
|
+
for (const [param, info] of config.entries()) {
|
|
1411
|
+
// We need to make the config information compatible with the
|
|
1412
|
+
// format that ConfigurationCC reports
|
|
1413
|
+
const paramInfo = stripUndefined({
|
|
1414
|
+
// TODO: Make this smarter! (0...1 ==> boolean)
|
|
1415
|
+
type: "number",
|
|
1416
|
+
valueSize: info.valueSize,
|
|
1417
|
+
min: info.minValue,
|
|
1418
|
+
max: info.maxValue,
|
|
1419
|
+
default: info.defaultValue,
|
|
1420
|
+
unit: info.unit,
|
|
1421
|
+
format: info.unsigned
|
|
1422
|
+
? ConfigValueFormat.UnsignedInteger
|
|
1423
|
+
: ConfigValueFormat.SignedInteger,
|
|
1424
|
+
readable: !info.writeOnly,
|
|
1425
|
+
writeable: !info.readOnly,
|
|
1426
|
+
allowManualEntry: info.allowManualEntry,
|
|
1427
|
+
states: info.options.length > 0
|
|
1428
|
+
? composeObject(info.options.map(({ label, value }) => [
|
|
1429
|
+
value.toString(),
|
|
1430
|
+
label,
|
|
1431
|
+
]))
|
|
1432
|
+
: undefined,
|
|
1433
|
+
label: info.label,
|
|
1434
|
+
description: info.description,
|
|
1435
|
+
isFromConfig: true,
|
|
1436
|
+
});
|
|
1437
|
+
this.extendParamInformation(ctx, param.parameter, param.valueBitMask, paramInfo);
|
|
1438
|
+
}
|
|
1439
|
+
// Remember that we loaded the param information from a config file
|
|
1440
|
+
this.setValue(ctx, ConfigurationCCValues.isParamInformationFromConfig, true);
|
|
1441
|
+
}
|
|
1442
|
+
translatePropertyKey(ctx, property, propertyKey) {
|
|
1443
|
+
if (typeof property === "number"
|
|
1444
|
+
&& (propertyKey == undefined || typeof propertyKey === "number")) {
|
|
1445
|
+
// This CC names all configuration parameters differently,
|
|
1446
|
+
// so no name for the property key is required
|
|
1447
|
+
return undefined;
|
|
1448
|
+
}
|
|
1449
|
+
return super.translateProperty(ctx, property, propertyKey);
|
|
1450
|
+
}
|
|
1451
|
+
translateProperty(ctx, property, propertyKey) {
|
|
1452
|
+
// Try to retrieve the configured param label
|
|
1453
|
+
if (typeof property === "number"
|
|
1454
|
+
&& (propertyKey == undefined || typeof propertyKey === "number")) {
|
|
1455
|
+
const paramInfo = this.getParamInformation(ctx, property, propertyKey);
|
|
1456
|
+
if (paramInfo.label)
|
|
1457
|
+
return paramInfo.label;
|
|
1458
|
+
// fall back to paramXYZ[_key] if none is defined
|
|
1459
|
+
let ret = `param${padStart(property.toString(), 3, "0")}`;
|
|
1460
|
+
if (propertyKey != undefined) {
|
|
1461
|
+
ret += "_" + propertyKey.toString();
|
|
1236
1462
|
}
|
|
1463
|
+
return ret;
|
|
1237
1464
|
}
|
|
1465
|
+
return super.translateProperty(ctx, property, propertyKey);
|
|
1238
1466
|
}
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1467
|
+
};
|
|
1468
|
+
return ConfigurationCC = _classThis;
|
|
1469
|
+
})();
|
|
1470
|
+
export { ConfigurationCC };
|
|
1471
|
+
let ConfigurationCCReport = (() => {
|
|
1472
|
+
let _classDecorators = [CCCommand(ConfigurationCommand.Report)];
|
|
1473
|
+
let _classDescriptor;
|
|
1474
|
+
let _classExtraInitializers = [];
|
|
1475
|
+
let _classThis;
|
|
1476
|
+
let _classSuper = ConfigurationCC;
|
|
1477
|
+
var ConfigurationCCReport = class extends _classSuper {
|
|
1478
|
+
static { _classThis = this; }
|
|
1479
|
+
static {
|
|
1480
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1481
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1482
|
+
ConfigurationCCReport = _classThis = _classDescriptor.value;
|
|
1483
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1484
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1485
|
+
}
|
|
1486
|
+
constructor(options) {
|
|
1487
|
+
super(options);
|
|
1488
|
+
this.parameter = options.parameter;
|
|
1489
|
+
this.value = options.value;
|
|
1490
|
+
this.valueSize = options.valueSize;
|
|
1491
|
+
this.valueFormat = options.valueFormat;
|
|
1492
|
+
}
|
|
1493
|
+
static from(raw, ctx) {
|
|
1494
|
+
// All fields must be present
|
|
1495
|
+
validatePayload(raw.payload.length > 2);
|
|
1496
|
+
const parameter = raw.payload[0];
|
|
1497
|
+
const valueSize = raw.payload[1] & 0b111;
|
|
1498
|
+
// Ensure we received a valid report
|
|
1499
|
+
validatePayload(valueSize >= 1, valueSize <= 4, raw.payload.length >= 2 + valueSize);
|
|
1500
|
+
// Default to parsing the value as SignedInteger, like the specs say.
|
|
1501
|
+
// We try to re-interpret the value in persistValues()
|
|
1502
|
+
const value = parseValue(raw.payload.subarray(2), valueSize, ConfigValueFormat.SignedInteger);
|
|
1503
|
+
return new this({
|
|
1504
|
+
nodeId: ctx.sourceNodeId,
|
|
1505
|
+
parameter,
|
|
1506
|
+
valueSize,
|
|
1507
|
+
value,
|
|
1508
|
+
});
|
|
1247
1509
|
}
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
//
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
//
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1510
|
+
parameter;
|
|
1511
|
+
value;
|
|
1512
|
+
valueSize;
|
|
1513
|
+
valueFormat; // only used for serialization
|
|
1514
|
+
persistValues(ctx) {
|
|
1515
|
+
if (!super.persistValues(ctx))
|
|
1516
|
+
return false;
|
|
1517
|
+
const ccVersion = getEffectiveCCVersion(ctx, this);
|
|
1518
|
+
// This parameter may be a partial param in the following cases:
|
|
1519
|
+
// * a config file defines it as such
|
|
1520
|
+
// * it was reported by the device as a bit field
|
|
1521
|
+
const partialParams = this.getPartialParamInfos(ctx, this.parameter);
|
|
1522
|
+
let cachedValueFormat;
|
|
1523
|
+
if (partialParams.length > 0) {
|
|
1524
|
+
// This is a partial param. All definitions should have the same format, so we just take the first one
|
|
1525
|
+
cachedValueFormat = partialParams[0].metadata.format;
|
|
1260
1526
|
}
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
this.setMetadata(ctx, ConfigurationCCValues.paramInformation(parameter, valueBitMask), metadata);
|
|
1280
|
-
}
|
|
1281
|
-
/**
|
|
1282
|
-
* @internal
|
|
1283
|
-
* Returns stored config parameter metadata for this CC's node
|
|
1284
|
-
*/
|
|
1285
|
-
getParamInformation(ctx, parameter, valueBitMask) {
|
|
1286
|
-
return (this.getMetadata(ctx, ConfigurationCCValues.paramInformation(parameter, valueBitMask)) ?? {
|
|
1287
|
-
...ValueMetadata.Any,
|
|
1288
|
-
});
|
|
1289
|
-
}
|
|
1290
|
-
/**
|
|
1291
|
-
* **INTERNAL:** Returns the param info that was queried for this node. This returns the information that was returned by the node
|
|
1292
|
-
* and does not include partial parameters.
|
|
1293
|
-
*/
|
|
1294
|
-
getQueriedParamInfos(ctx) {
|
|
1295
|
-
const parameters = distinct(this.getDefinedValueIDs(ctx)
|
|
1296
|
-
.map((v) => v.property)
|
|
1297
|
-
.filter((p) => typeof p === "number"));
|
|
1298
|
-
return composeObject(parameters.map((p) => [
|
|
1299
|
-
p,
|
|
1300
|
-
this.getParamInformation(ctx, p),
|
|
1301
|
-
]));
|
|
1302
|
-
}
|
|
1303
|
-
/**
|
|
1304
|
-
* Returns stored config parameter metadata for all partial config params addressed with the given parameter number
|
|
1305
|
-
*/
|
|
1306
|
-
getPartialParamInfos(ctx, parameter) {
|
|
1307
|
-
const valueDB = this.getValueDB(ctx);
|
|
1308
|
-
return valueDB.findMetadata((id) => id.commandClass === this.ccId
|
|
1309
|
-
&& (id.endpoint ?? 0) === this.endpointIndex
|
|
1310
|
-
&& id.property === parameter
|
|
1311
|
-
&& id.propertyKey != undefined);
|
|
1312
|
-
}
|
|
1313
|
-
/**
|
|
1314
|
-
* Computes the full value of a parameter after applying a partial param value
|
|
1315
|
-
*/
|
|
1316
|
-
composePartialParamValue(ctx, parameter, bitMask, partialValue) {
|
|
1317
|
-
return this.composePartialParamValues(ctx, parameter, [
|
|
1318
|
-
{ bitMask, partialValue },
|
|
1319
|
-
]);
|
|
1320
|
-
}
|
|
1321
|
-
/**
|
|
1322
|
-
* Computes the full value of a parameter after applying multiple partial param values
|
|
1323
|
-
*/
|
|
1324
|
-
composePartialParamValues(ctx, parameter, partials) {
|
|
1325
|
-
const valueDB = this.getValueDB(ctx);
|
|
1326
|
-
// Add the other values together
|
|
1327
|
-
const otherValues = valueDB.findValues((id) => id.commandClass === this.ccId
|
|
1328
|
-
&& (id.endpoint ?? 0) === this.endpointIndex
|
|
1329
|
-
&& id.property === parameter
|
|
1330
|
-
&& id.propertyKey != undefined
|
|
1331
|
-
&& !partials.some((p) => id.propertyKey === p.bitMask));
|
|
1332
|
-
let ret = 0;
|
|
1333
|
-
for (const { propertyKey: bitMask, value: partialValue, } of otherValues) {
|
|
1334
|
-
ret = encodePartial(ret, partialValue, bitMask);
|
|
1335
|
-
}
|
|
1336
|
-
for (const { bitMask, partialValue } of partials) {
|
|
1337
|
-
ret = encodePartial(ret, partialValue, bitMask);
|
|
1338
|
-
}
|
|
1339
|
-
return ret;
|
|
1340
|
-
}
|
|
1341
|
-
/** Deserializes the config parameter info from a config file */
|
|
1342
|
-
deserializeParamInformationFromConfig(ctx, config) {
|
|
1343
|
-
const valueDB = this.getValueDB(ctx);
|
|
1344
|
-
// Clear old param information
|
|
1345
|
-
for (const meta of valueDB.getAllMetadata(this.ccId)) {
|
|
1346
|
-
if (typeof meta.property === "number"
|
|
1347
|
-
&& (meta.endpoint ?? 0) === this.endpointIndex) {
|
|
1348
|
-
// this is a param information, delete it
|
|
1349
|
-
valueDB.setMetadata(meta, undefined,
|
|
1350
|
-
// Don't emit the added/updated events, as this will spam applications with untranslated events
|
|
1351
|
-
{ noEvent: true });
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
// Allow overwriting the param info (mark it as unloaded)
|
|
1355
|
-
this.setValue(ctx, ConfigurationCCValues.isParamInformationFromConfig, false);
|
|
1356
|
-
for (const [param, info] of config.entries()) {
|
|
1357
|
-
// We need to make the config information compatible with the
|
|
1358
|
-
// format that ConfigurationCC reports
|
|
1359
|
-
const paramInfo = stripUndefined({
|
|
1360
|
-
// TODO: Make this smarter! (0...1 ==> boolean)
|
|
1361
|
-
type: "number",
|
|
1362
|
-
valueSize: info.valueSize,
|
|
1363
|
-
min: info.minValue,
|
|
1364
|
-
max: info.maxValue,
|
|
1365
|
-
default: info.defaultValue,
|
|
1366
|
-
unit: info.unit,
|
|
1367
|
-
format: info.unsigned
|
|
1368
|
-
? ConfigValueFormat.UnsignedInteger
|
|
1369
|
-
: ConfigValueFormat.SignedInteger,
|
|
1370
|
-
readable: !info.writeOnly,
|
|
1371
|
-
writeable: !info.readOnly,
|
|
1372
|
-
allowManualEntry: info.allowManualEntry,
|
|
1373
|
-
states: info.options.length > 0
|
|
1374
|
-
? composeObject(info.options.map(({ label, value }) => [
|
|
1375
|
-
value.toString(),
|
|
1376
|
-
label,
|
|
1377
|
-
]))
|
|
1378
|
-
: undefined,
|
|
1379
|
-
label: info.label,
|
|
1380
|
-
description: info.description,
|
|
1381
|
-
isFromConfig: true,
|
|
1382
|
-
});
|
|
1383
|
-
this.extendParamInformation(ctx, param.parameter, param.valueBitMask, paramInfo);
|
|
1384
|
-
}
|
|
1385
|
-
// Remember that we loaded the param information from a config file
|
|
1386
|
-
this.setValue(ctx, ConfigurationCCValues.isParamInformationFromConfig, true);
|
|
1387
|
-
}
|
|
1388
|
-
translatePropertyKey(ctx, property, propertyKey) {
|
|
1389
|
-
if (typeof property === "number"
|
|
1390
|
-
&& (propertyKey == undefined || typeof propertyKey === "number")) {
|
|
1391
|
-
// This CC names all configuration parameters differently,
|
|
1392
|
-
// so no name for the property key is required
|
|
1393
|
-
return undefined;
|
|
1394
|
-
}
|
|
1395
|
-
return super.translateProperty(ctx, property, propertyKey);
|
|
1396
|
-
}
|
|
1397
|
-
translateProperty(ctx, property, propertyKey) {
|
|
1398
|
-
// Try to retrieve the configured param label
|
|
1399
|
-
if (typeof property === "number"
|
|
1400
|
-
&& (propertyKey == undefined || typeof propertyKey === "number")) {
|
|
1401
|
-
const paramInfo = this.getParamInformation(ctx, property, propertyKey);
|
|
1402
|
-
if (paramInfo.label)
|
|
1403
|
-
return paramInfo.label;
|
|
1404
|
-
// fall back to paramXYZ[_key] if none is defined
|
|
1405
|
-
let ret = `param${padStart(property.toString(), 3, "0")}`;
|
|
1406
|
-
if (propertyKey != undefined) {
|
|
1407
|
-
ret += "_" + propertyKey.toString();
|
|
1527
|
+
else {
|
|
1528
|
+
// Check if the initial assumption of SignedInteger holds true
|
|
1529
|
+
const oldParamInformation = this.getParamInformation(ctx, this.parameter);
|
|
1530
|
+
cachedValueFormat = oldParamInformation.format;
|
|
1531
|
+
// On older CC versions, these reports may be the only way we can retrieve the value size
|
|
1532
|
+
// Therefore we store it here
|
|
1533
|
+
this.extendParamInformation(ctx, this.parameter, undefined, {
|
|
1534
|
+
valueSize: this.valueSize,
|
|
1535
|
+
});
|
|
1536
|
+
if (ccVersion < 3
|
|
1537
|
+
&& !this.paramExistsInConfigFile(ctx, this.parameter)
|
|
1538
|
+
&& oldParamInformation.min == undefined
|
|
1539
|
+
&& oldParamInformation.max == undefined) {
|
|
1540
|
+
const isSigned = oldParamInformation.format == undefined
|
|
1541
|
+
|| oldParamInformation.format
|
|
1542
|
+
=== ConfigValueFormat.SignedInteger;
|
|
1543
|
+
this.extendParamInformation(ctx, this.parameter, undefined, getIntegerLimits(this.valueSize, isSigned));
|
|
1544
|
+
}
|
|
1408
1545
|
}
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
super(options);
|
|
1423
|
-
this.parameter = options.parameter;
|
|
1424
|
-
this.value = options.value;
|
|
1425
|
-
this.valueSize = options.valueSize;
|
|
1426
|
-
this.valueFormat = options.valueFormat;
|
|
1427
|
-
}
|
|
1428
|
-
static from(raw, ctx) {
|
|
1429
|
-
// All fields must be present
|
|
1430
|
-
validatePayload(raw.payload.length > 2);
|
|
1431
|
-
const parameter = raw.payload[0];
|
|
1432
|
-
const valueSize = raw.payload[1] & 0b111;
|
|
1433
|
-
// Ensure we received a valid report
|
|
1434
|
-
validatePayload(valueSize >= 1, valueSize <= 4, raw.payload.length >= 2 + valueSize);
|
|
1435
|
-
// Default to parsing the value as SignedInteger, like the specs say.
|
|
1436
|
-
// We try to re-interpret the value in persistValues()
|
|
1437
|
-
const value = parseValue(raw.payload.subarray(2), valueSize, ConfigValueFormat.SignedInteger);
|
|
1438
|
-
return new ConfigurationCCReport_1({
|
|
1439
|
-
nodeId: ctx.sourceNodeId,
|
|
1440
|
-
parameter,
|
|
1441
|
-
valueSize,
|
|
1442
|
-
value,
|
|
1443
|
-
});
|
|
1444
|
-
}
|
|
1445
|
-
parameter;
|
|
1446
|
-
value;
|
|
1447
|
-
valueSize;
|
|
1448
|
-
valueFormat; // only used for serialization
|
|
1449
|
-
persistValues(ctx) {
|
|
1450
|
-
if (!super.persistValues(ctx))
|
|
1451
|
-
return false;
|
|
1452
|
-
const ccVersion = getEffectiveCCVersion(ctx, this);
|
|
1453
|
-
// This parameter may be a partial param in the following cases:
|
|
1454
|
-
// * a config file defines it as such
|
|
1455
|
-
// * it was reported by the device as a bit field
|
|
1456
|
-
const partialParams = this.getPartialParamInfos(ctx, this.parameter);
|
|
1457
|
-
let cachedValueFormat;
|
|
1458
|
-
if (partialParams.length > 0) {
|
|
1459
|
-
// This is a partial param. All definitions should have the same format, so we just take the first one
|
|
1460
|
-
cachedValueFormat = partialParams[0].metadata.format;
|
|
1461
|
-
}
|
|
1462
|
-
else {
|
|
1463
|
-
// Check if the initial assumption of SignedInteger holds true
|
|
1464
|
-
const oldParamInformation = this.getParamInformation(ctx, this.parameter);
|
|
1465
|
-
cachedValueFormat = oldParamInformation.format;
|
|
1466
|
-
// On older CC versions, these reports may be the only way we can retrieve the value size
|
|
1467
|
-
// Therefore we store it here
|
|
1468
|
-
this.extendParamInformation(ctx, this.parameter, undefined, {
|
|
1469
|
-
valueSize: this.valueSize,
|
|
1470
|
-
});
|
|
1471
|
-
if (ccVersion < 3
|
|
1472
|
-
&& !this.paramExistsInConfigFile(ctx, this.parameter)
|
|
1473
|
-
&& oldParamInformation.min == undefined
|
|
1474
|
-
&& oldParamInformation.max == undefined) {
|
|
1475
|
-
const isSigned = oldParamInformation.format == undefined
|
|
1476
|
-
|| oldParamInformation.format
|
|
1477
|
-
=== ConfigValueFormat.SignedInteger;
|
|
1478
|
-
this.extendParamInformation(ctx, this.parameter, undefined, getIntegerLimits(this.valueSize, isSigned));
|
|
1479
|
-
}
|
|
1480
|
-
}
|
|
1481
|
-
// We may have to re-interpret the value as unsigned, depending on the cached value format
|
|
1482
|
-
if (cachedValueFormat != undefined
|
|
1483
|
-
&& cachedValueFormat !== ConfigValueFormat.SignedInteger) {
|
|
1484
|
-
// Re-interpret the value with the new format
|
|
1485
|
-
this.value = reInterpretSignedValue(this.value, this.valueSize, cachedValueFormat);
|
|
1486
|
-
}
|
|
1487
|
-
// And store the value itself
|
|
1488
|
-
// If we have partial config params defined, we need to split the value
|
|
1489
|
-
if (partialParams.length > 0) {
|
|
1490
|
-
for (const param of partialParams) {
|
|
1491
|
-
if (typeof param.propertyKey === "number") {
|
|
1492
|
-
this.setValue(ctx, ConfigurationCCValues.paramInformation(this.parameter, param.propertyKey), parsePartial(this.value, param.propertyKey, isSignedPartial(param.propertyKey, param.metadata.format)));
|
|
1546
|
+
// We may have to re-interpret the value as unsigned, depending on the cached value format
|
|
1547
|
+
if (cachedValueFormat != undefined
|
|
1548
|
+
&& cachedValueFormat !== ConfigValueFormat.SignedInteger) {
|
|
1549
|
+
// Re-interpret the value with the new format
|
|
1550
|
+
this.value = reInterpretSignedValue(this.value, this.valueSize, cachedValueFormat);
|
|
1551
|
+
}
|
|
1552
|
+
// And store the value itself
|
|
1553
|
+
// If we have partial config params defined, we need to split the value
|
|
1554
|
+
if (partialParams.length > 0) {
|
|
1555
|
+
for (const param of partialParams) {
|
|
1556
|
+
if (typeof param.propertyKey === "number") {
|
|
1557
|
+
this.setValue(ctx, ConfigurationCCValues.paramInformation(this.parameter, param.propertyKey), parsePartial(this.value, param.propertyKey, isSignedPartial(param.propertyKey, param.metadata.format)));
|
|
1558
|
+
}
|
|
1493
1559
|
}
|
|
1494
1560
|
}
|
|
1561
|
+
else {
|
|
1562
|
+
// This is a single param
|
|
1563
|
+
this.setValue(ctx, ConfigurationCCValues.paramInformation(this.parameter), this.value);
|
|
1564
|
+
}
|
|
1565
|
+
return true;
|
|
1495
1566
|
}
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1567
|
+
serialize(ctx) {
|
|
1568
|
+
this.payload = Bytes.concat([
|
|
1569
|
+
Bytes.from([this.parameter, this.valueSize & 0b111]),
|
|
1570
|
+
new Bytes(this.valueSize),
|
|
1571
|
+
]);
|
|
1572
|
+
serializeValue(this.payload, 2, this.valueSize, this.valueFormat ?? ConfigValueFormat.SignedInteger, this.value);
|
|
1573
|
+
return super.serialize(ctx);
|
|
1574
|
+
}
|
|
1575
|
+
toLogEntry(ctx) {
|
|
1576
|
+
return {
|
|
1577
|
+
...super.toLogEntry(ctx),
|
|
1578
|
+
message: {
|
|
1579
|
+
"parameter #": this.parameter,
|
|
1580
|
+
"value size": this.valueSize,
|
|
1581
|
+
value: configValueToString(this.value),
|
|
1582
|
+
},
|
|
1583
|
+
};
|
|
1499
1584
|
}
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
this.payload = Bytes.concat([
|
|
1504
|
-
Bytes.from([this.parameter, this.valueSize & 0b111]),
|
|
1505
|
-
new Bytes(this.valueSize),
|
|
1506
|
-
]);
|
|
1507
|
-
serializeValue(this.payload, 2, this.valueSize, this.valueFormat ?? ConfigValueFormat.SignedInteger, this.value);
|
|
1508
|
-
return super.serialize(ctx);
|
|
1509
|
-
}
|
|
1510
|
-
toLogEntry(ctx) {
|
|
1511
|
-
return {
|
|
1512
|
-
...super.toLogEntry(ctx),
|
|
1513
|
-
message: {
|
|
1514
|
-
"parameter #": this.parameter,
|
|
1515
|
-
"value size": this.valueSize,
|
|
1516
|
-
value: configValueToString(this.value),
|
|
1517
|
-
},
|
|
1518
|
-
};
|
|
1519
|
-
}
|
|
1520
|
-
};
|
|
1521
|
-
ConfigurationCCReport = ConfigurationCCReport_1 = __decorate([
|
|
1522
|
-
CCCommand(ConfigurationCommand.Report)
|
|
1523
|
-
], ConfigurationCCReport);
|
|
1585
|
+
};
|
|
1586
|
+
return ConfigurationCCReport = _classThis;
|
|
1587
|
+
})();
|
|
1524
1588
|
export { ConfigurationCCReport };
|
|
1525
1589
|
function testResponseForConfigurationGet(sent, received) {
|
|
1526
1590
|
// We expect a Configuration Report that matches the requested parameter
|
|
1527
1591
|
return (sent.parameter === received.parameter || sent.allowUnexpectedResponse);
|
|
1528
1592
|
}
|
|
1529
|
-
let ConfigurationCCGet =
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
};
|
|
1557
|
-
ConfigurationCCGet = ConfigurationCCGet_1 = __decorate([
|
|
1558
|
-
CCCommand(ConfigurationCommand.Get),
|
|
1559
|
-
expectedCCResponse(ConfigurationCCReport, testResponseForConfigurationGet)
|
|
1560
|
-
], ConfigurationCCGet);
|
|
1561
|
-
export { ConfigurationCCGet };
|
|
1562
|
-
let ConfigurationCCSet = ConfigurationCCSet_1 = class ConfigurationCCSet extends ConfigurationCC {
|
|
1563
|
-
constructor(options) {
|
|
1564
|
-
super(options);
|
|
1565
|
-
this.parameter = options.parameter;
|
|
1566
|
-
this.resetToDefault = !!options.resetToDefault;
|
|
1567
|
-
if (!options.resetToDefault) {
|
|
1568
|
-
// TODO: Default to the stored value size
|
|
1569
|
-
this.valueSize = options.valueSize;
|
|
1570
|
-
this.valueFormat = options.valueFormat
|
|
1571
|
-
?? ConfigValueFormat.SignedInteger;
|
|
1572
|
-
this.value = options.value;
|
|
1593
|
+
let ConfigurationCCGet = (() => {
|
|
1594
|
+
let _classDecorators = [CCCommand(ConfigurationCommand.Get), expectedCCResponse(ConfigurationCCReport, testResponseForConfigurationGet)];
|
|
1595
|
+
let _classDescriptor;
|
|
1596
|
+
let _classExtraInitializers = [];
|
|
1597
|
+
let _classThis;
|
|
1598
|
+
let _classSuper = ConfigurationCC;
|
|
1599
|
+
var ConfigurationCCGet = class extends _classSuper {
|
|
1600
|
+
static { _classThis = this; }
|
|
1601
|
+
static {
|
|
1602
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1603
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1604
|
+
ConfigurationCCGet = _classThis = _classDescriptor.value;
|
|
1605
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1606
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1607
|
+
}
|
|
1608
|
+
constructor(options) {
|
|
1609
|
+
super(options);
|
|
1610
|
+
this.parameter = options.parameter;
|
|
1611
|
+
this.allowUnexpectedResponse = options.allowUnexpectedResponse
|
|
1612
|
+
?? false;
|
|
1613
|
+
}
|
|
1614
|
+
static from(raw, ctx) {
|
|
1615
|
+
validatePayload(raw.payload.length >= 1);
|
|
1616
|
+
const parameter = raw.payload[0];
|
|
1617
|
+
return new this({
|
|
1618
|
+
nodeId: ctx.sourceNodeId,
|
|
1619
|
+
parameter,
|
|
1620
|
+
});
|
|
1573
1621
|
}
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
const valueSize = raw.payload[1] & 0b111;
|
|
1580
|
-
// Ensure we received a valid report
|
|
1581
|
-
validatePayload(valueSize >= 1, valueSize <= 4, raw.payload.length >= 2 + valueSize);
|
|
1582
|
-
// Parse the value as signed integer. We don't know the format here.
|
|
1583
|
-
const value = parseValue(raw.payload.subarray(2), valueSize, ConfigValueFormat.SignedInteger);
|
|
1584
|
-
return new ConfigurationCCSet_1({
|
|
1585
|
-
nodeId: ctx.sourceNodeId,
|
|
1586
|
-
parameter,
|
|
1587
|
-
resetToDefault,
|
|
1588
|
-
valueSize,
|
|
1589
|
-
value,
|
|
1590
|
-
});
|
|
1591
|
-
}
|
|
1592
|
-
resetToDefault;
|
|
1593
|
-
parameter;
|
|
1594
|
-
valueSize;
|
|
1595
|
-
valueFormat;
|
|
1596
|
-
value;
|
|
1597
|
-
serialize(ctx) {
|
|
1598
|
-
const valueSize = this.resetToDefault ? 1 : this.valueSize;
|
|
1599
|
-
const payloadLength = 2 + valueSize;
|
|
1600
|
-
this.payload = Bytes.alloc(payloadLength, 0);
|
|
1601
|
-
this.payload[0] = this.parameter;
|
|
1602
|
-
this.payload[1] = (this.resetToDefault ? 0b1000_0000 : 0)
|
|
1603
|
-
| (valueSize & 0b111);
|
|
1604
|
-
if (!this.resetToDefault) {
|
|
1605
|
-
// Make sure that the given value fits into the value size
|
|
1606
|
-
if (typeof this.value === "number"
|
|
1607
|
-
&& !isSafeValue(this.value, valueSize, this.valueFormat)) {
|
|
1608
|
-
// If there is a value size configured, check that the given value is compatible
|
|
1609
|
-
throwInvalidValueError(this.value, this.parameter, valueSize, this.valueFormat);
|
|
1610
|
-
}
|
|
1611
|
-
try {
|
|
1612
|
-
serializeValue(this.payload, 2, valueSize, this.valueFormat, this.value);
|
|
1613
|
-
}
|
|
1614
|
-
catch (e) {
|
|
1615
|
-
tryCatchOutOfBoundsError(e, this.value, this.parameter, valueSize, this.valueFormat);
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
return super.serialize(ctx);
|
|
1619
|
-
}
|
|
1620
|
-
toLogEntry(ctx) {
|
|
1621
|
-
const message = {
|
|
1622
|
-
"parameter #": this.parameter,
|
|
1623
|
-
"reset to default": this.resetToDefault,
|
|
1624
|
-
};
|
|
1625
|
-
if (this.valueSize != undefined) {
|
|
1626
|
-
message["value size"] = this.valueSize;
|
|
1622
|
+
parameter;
|
|
1623
|
+
allowUnexpectedResponse;
|
|
1624
|
+
serialize(ctx) {
|
|
1625
|
+
this.payload = Bytes.from([this.parameter]);
|
|
1626
|
+
return super.serialize(ctx);
|
|
1627
1627
|
}
|
|
1628
|
-
|
|
1629
|
-
|
|
1628
|
+
toLogEntry(ctx) {
|
|
1629
|
+
return {
|
|
1630
|
+
...super.toLogEntry(ctx),
|
|
1631
|
+
message: { "parameter #": this.parameter },
|
|
1632
|
+
};
|
|
1630
1633
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1634
|
+
};
|
|
1635
|
+
return ConfigurationCCGet = _classThis;
|
|
1636
|
+
})();
|
|
1637
|
+
export { ConfigurationCCGet };
|
|
1638
|
+
let ConfigurationCCSet = (() => {
|
|
1639
|
+
let _classDecorators = [CCCommand(ConfigurationCommand.Set), useSupervision()];
|
|
1640
|
+
let _classDescriptor;
|
|
1641
|
+
let _classExtraInitializers = [];
|
|
1642
|
+
let _classThis;
|
|
1643
|
+
let _classSuper = ConfigurationCC;
|
|
1644
|
+
var ConfigurationCCSet = class extends _classSuper {
|
|
1645
|
+
static { _classThis = this; }
|
|
1646
|
+
static {
|
|
1647
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1648
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1649
|
+
ConfigurationCCSet = _classThis = _classDescriptor.value;
|
|
1650
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1651
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1652
|
+
}
|
|
1653
|
+
constructor(options) {
|
|
1654
|
+
super(options);
|
|
1655
|
+
this.parameter = options.parameter;
|
|
1656
|
+
this.resetToDefault = !!options.resetToDefault;
|
|
1657
|
+
if (!options.resetToDefault) {
|
|
1658
|
+
// TODO: Default to the stored value size
|
|
1659
|
+
this.valueSize = options.valueSize;
|
|
1660
|
+
this.valueFormat = options.valueFormat
|
|
1661
|
+
?? ConfigValueFormat.SignedInteger;
|
|
1662
|
+
this.value = options.value;
|
|
1663
|
+
}
|
|
1633
1664
|
}
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
super(options);
|
|
1651
|
-
this._parameters = options.parameters;
|
|
1652
|
-
if (this._parameters.length < 1) {
|
|
1653
|
-
throw new ZWaveError(`In a ConfigurationCC.BulkSet, parameters must be a non-empty array`, ZWaveErrorCodes.CC_Invalid);
|
|
1654
|
-
}
|
|
1655
|
-
else if (!isConsecutiveArray(this._parameters)) {
|
|
1656
|
-
throw new ZWaveError(`A ConfigurationCC.BulkSet can only be used for consecutive parameters`, ZWaveErrorCodes.CC_Invalid);
|
|
1657
|
-
}
|
|
1658
|
-
this._handshake = !!options.handshake;
|
|
1659
|
-
this._resetToDefault = !!options.resetToDefault;
|
|
1660
|
-
if (!!options.resetToDefault) {
|
|
1661
|
-
this._valueSize = 1;
|
|
1662
|
-
this._valueFormat = ConfigValueFormat.SignedInteger;
|
|
1663
|
-
this._values = this._parameters.map(() => 0);
|
|
1664
|
-
}
|
|
1665
|
-
else {
|
|
1666
|
-
this._valueSize = options.valueSize;
|
|
1667
|
-
this._valueFormat = options.valueFormat
|
|
1668
|
-
?? ConfigValueFormat.SignedInteger;
|
|
1669
|
-
this._values = options.values;
|
|
1665
|
+
static from(raw, ctx) {
|
|
1666
|
+
validatePayload(raw.payload.length >= 2);
|
|
1667
|
+
const parameter = raw.payload[0];
|
|
1668
|
+
const resetToDefault = !!(raw.payload[1] & 0b1000_0000);
|
|
1669
|
+
const valueSize = raw.payload[1] & 0b111;
|
|
1670
|
+
// Ensure we received a valid report
|
|
1671
|
+
validatePayload(valueSize >= 1, valueSize <= 4, raw.payload.length >= 2 + valueSize);
|
|
1672
|
+
// Parse the value as signed integer. We don't know the format here.
|
|
1673
|
+
const value = parseValue(raw.payload.subarray(2), valueSize, ConfigValueFormat.SignedInteger);
|
|
1674
|
+
return new this({
|
|
1675
|
+
nodeId: ctx.sourceNodeId,
|
|
1676
|
+
parameter,
|
|
1677
|
+
resetToDefault,
|
|
1678
|
+
valueSize,
|
|
1679
|
+
value,
|
|
1680
|
+
});
|
|
1670
1681
|
}
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
get resetToDefault() {
|
|
1685
|
-
return this._resetToDefault;
|
|
1686
|
-
}
|
|
1687
|
-
_valueSize;
|
|
1688
|
-
get valueSize() {
|
|
1689
|
-
return this._valueSize;
|
|
1690
|
-
}
|
|
1691
|
-
_valueFormat;
|
|
1692
|
-
get valueFormat() {
|
|
1693
|
-
return this._valueFormat;
|
|
1694
|
-
}
|
|
1695
|
-
_values;
|
|
1696
|
-
get values() {
|
|
1697
|
-
return this._values;
|
|
1698
|
-
}
|
|
1699
|
-
_handshake;
|
|
1700
|
-
get handshake() {
|
|
1701
|
-
return this._handshake;
|
|
1702
|
-
}
|
|
1703
|
-
serialize(ctx) {
|
|
1704
|
-
const valueSize = this._resetToDefault ? 1 : this.valueSize;
|
|
1705
|
-
const payloadLength = 4 + valueSize * this.parameters.length;
|
|
1706
|
-
this.payload = Bytes.alloc(payloadLength, 0);
|
|
1707
|
-
this.payload.writeUInt16BE(this.parameters[0], 0);
|
|
1708
|
-
this.payload[2] = this.parameters.length;
|
|
1709
|
-
this.payload[3] = (this._resetToDefault ? 0b1000_0000 : 0)
|
|
1710
|
-
| (this.handshake ? 0b0100_0000 : 0)
|
|
1711
|
-
| (valueSize & 0b111);
|
|
1712
|
-
if (!this._resetToDefault) {
|
|
1713
|
-
for (let i = 0; i < this.parameters.length; i++) {
|
|
1714
|
-
const value = this._values[i];
|
|
1715
|
-
const param = this._parameters[i];
|
|
1682
|
+
resetToDefault;
|
|
1683
|
+
parameter;
|
|
1684
|
+
valueSize;
|
|
1685
|
+
valueFormat;
|
|
1686
|
+
value;
|
|
1687
|
+
serialize(ctx) {
|
|
1688
|
+
const valueSize = this.resetToDefault ? 1 : this.valueSize;
|
|
1689
|
+
const payloadLength = 2 + valueSize;
|
|
1690
|
+
this.payload = Bytes.alloc(payloadLength, 0);
|
|
1691
|
+
this.payload[0] = this.parameter;
|
|
1692
|
+
this.payload[1] = (this.resetToDefault ? 0b1000_0000 : 0)
|
|
1693
|
+
| (valueSize & 0b111);
|
|
1694
|
+
if (!this.resetToDefault) {
|
|
1716
1695
|
// Make sure that the given value fits into the value size
|
|
1717
|
-
if (
|
|
1696
|
+
if (typeof this.value === "number"
|
|
1697
|
+
&& !isSafeValue(this.value, valueSize, this.valueFormat)) {
|
|
1718
1698
|
// If there is a value size configured, check that the given value is compatible
|
|
1719
|
-
throwInvalidValueError(value,
|
|
1699
|
+
throwInvalidValueError(this.value, this.parameter, valueSize, this.valueFormat);
|
|
1720
1700
|
}
|
|
1721
1701
|
try {
|
|
1722
|
-
serializeValue(this.payload,
|
|
1702
|
+
serializeValue(this.payload, 2, valueSize, this.valueFormat, this.value);
|
|
1723
1703
|
}
|
|
1724
1704
|
catch (e) {
|
|
1725
|
-
tryCatchOutOfBoundsError(e, value,
|
|
1705
|
+
tryCatchOutOfBoundsError(e, this.value, this.parameter, valueSize, this.valueFormat);
|
|
1726
1706
|
}
|
|
1727
1707
|
}
|
|
1708
|
+
return super.serialize(ctx);
|
|
1728
1709
|
}
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1710
|
+
toLogEntry(ctx) {
|
|
1711
|
+
const message = {
|
|
1712
|
+
"parameter #": this.parameter,
|
|
1713
|
+
"reset to default": this.resetToDefault,
|
|
1714
|
+
};
|
|
1715
|
+
if (this.valueSize != undefined) {
|
|
1716
|
+
message["value size"] = this.valueSize;
|
|
1717
|
+
}
|
|
1718
|
+
if (this.valueFormat != undefined) {
|
|
1719
|
+
message["value format"] = getEnumMemberName(ConfigValueFormat, this.valueFormat);
|
|
1720
|
+
}
|
|
1721
|
+
if (this.value != undefined) {
|
|
1722
|
+
message.value = configValueToString(this.value);
|
|
1723
|
+
}
|
|
1724
|
+
return {
|
|
1725
|
+
...super.toLogEntry(ctx),
|
|
1726
|
+
message,
|
|
1727
|
+
};
|
|
1741
1728
|
}
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
expectedCCResponse(getResponseForBulkSet),
|
|
1751
|
-
|
|
1752
|
-
]
|
|
1729
|
+
};
|
|
1730
|
+
return ConfigurationCCSet = _classThis;
|
|
1731
|
+
})();
|
|
1732
|
+
export { ConfigurationCCSet };
|
|
1733
|
+
function getResponseForBulkSet(cc) {
|
|
1734
|
+
return cc.handshake ? ConfigurationCCBulkReport : undefined;
|
|
1735
|
+
}
|
|
1736
|
+
let ConfigurationCCBulkSet = (() => {
|
|
1737
|
+
let _classDecorators = [CCCommand(ConfigurationCommand.BulkSet), expectedCCResponse(getResponseForBulkSet), useSupervision()];
|
|
1738
|
+
let _classDescriptor;
|
|
1739
|
+
let _classExtraInitializers = [];
|
|
1740
|
+
let _classThis;
|
|
1741
|
+
let _classSuper = ConfigurationCC;
|
|
1742
|
+
var ConfigurationCCBulkSet = class extends _classSuper {
|
|
1743
|
+
static { _classThis = this; }
|
|
1744
|
+
static {
|
|
1745
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1746
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1747
|
+
ConfigurationCCBulkSet = _classThis = _classDescriptor.value;
|
|
1748
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1749
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1750
|
+
}
|
|
1751
|
+
constructor(options) {
|
|
1752
|
+
super(options);
|
|
1753
|
+
this._parameters = options.parameters;
|
|
1754
|
+
if (this._parameters.length < 1) {
|
|
1755
|
+
throw new ZWaveError(`In a ConfigurationCC.BulkSet, parameters must be a non-empty array`, ZWaveErrorCodes.CC_Invalid);
|
|
1756
|
+
}
|
|
1757
|
+
else if (!isConsecutiveArray(this._parameters)) {
|
|
1758
|
+
throw new ZWaveError(`A ConfigurationCC.BulkSet can only be used for consecutive parameters`, ZWaveErrorCodes.CC_Invalid);
|
|
1759
|
+
}
|
|
1760
|
+
this._handshake = !!options.handshake;
|
|
1761
|
+
this._resetToDefault = !!options.resetToDefault;
|
|
1762
|
+
if (!!options.resetToDefault) {
|
|
1763
|
+
this._valueSize = 1;
|
|
1764
|
+
this._valueFormat = ConfigValueFormat.SignedInteger;
|
|
1765
|
+
this._values = this._parameters.map(() => 0);
|
|
1766
|
+
}
|
|
1767
|
+
else {
|
|
1768
|
+
this._valueSize = options.valueSize;
|
|
1769
|
+
this._valueFormat = options.valueFormat
|
|
1770
|
+
?? ConfigValueFormat.SignedInteger;
|
|
1771
|
+
this._values = options.values;
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
static from(_raw, _ctx) {
|
|
1775
|
+
// TODO: Deserialize payload
|
|
1776
|
+
throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
1777
|
+
// return new ConfigurationCCBulkSet({
|
|
1778
|
+
// nodeId: ctx.sourceNodeId,
|
|
1779
|
+
// });
|
|
1780
|
+
}
|
|
1781
|
+
_parameters;
|
|
1782
|
+
get parameters() {
|
|
1783
|
+
return this._parameters;
|
|
1784
|
+
}
|
|
1785
|
+
_resetToDefault;
|
|
1786
|
+
get resetToDefault() {
|
|
1787
|
+
return this._resetToDefault;
|
|
1788
|
+
}
|
|
1789
|
+
_valueSize;
|
|
1790
|
+
get valueSize() {
|
|
1791
|
+
return this._valueSize;
|
|
1792
|
+
}
|
|
1793
|
+
_valueFormat;
|
|
1794
|
+
get valueFormat() {
|
|
1795
|
+
return this._valueFormat;
|
|
1796
|
+
}
|
|
1797
|
+
_values;
|
|
1798
|
+
get values() {
|
|
1799
|
+
return this._values;
|
|
1800
|
+
}
|
|
1801
|
+
_handshake;
|
|
1802
|
+
get handshake() {
|
|
1803
|
+
return this._handshake;
|
|
1804
|
+
}
|
|
1805
|
+
serialize(ctx) {
|
|
1806
|
+
const valueSize = this._resetToDefault ? 1 : this.valueSize;
|
|
1807
|
+
const payloadLength = 4 + valueSize * this.parameters.length;
|
|
1808
|
+
this.payload = Bytes.alloc(payloadLength, 0);
|
|
1809
|
+
this.payload.writeUInt16BE(this.parameters[0], 0);
|
|
1810
|
+
this.payload[2] = this.parameters.length;
|
|
1811
|
+
this.payload[3] = (this._resetToDefault ? 0b1000_0000 : 0)
|
|
1812
|
+
| (this.handshake ? 0b0100_0000 : 0)
|
|
1813
|
+
| (valueSize & 0b111);
|
|
1814
|
+
if (!this._resetToDefault) {
|
|
1815
|
+
for (let i = 0; i < this.parameters.length; i++) {
|
|
1816
|
+
const value = this._values[i];
|
|
1817
|
+
const param = this._parameters[i];
|
|
1818
|
+
// Make sure that the given value fits into the value size
|
|
1819
|
+
if (!isSafeValue(value, valueSize, this._valueFormat)) {
|
|
1820
|
+
// If there is a value size configured, check that the given value is compatible
|
|
1821
|
+
throwInvalidValueError(value, param, valueSize, this._valueFormat);
|
|
1822
|
+
}
|
|
1823
|
+
try {
|
|
1824
|
+
serializeValue(this.payload, 4 + i * valueSize, valueSize, this._valueFormat, value);
|
|
1825
|
+
}
|
|
1826
|
+
catch (e) {
|
|
1827
|
+
tryCatchOutOfBoundsError(e, value, param, valueSize, this._valueFormat);
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
return super.serialize(ctx);
|
|
1832
|
+
}
|
|
1833
|
+
toLogEntry(ctx) {
|
|
1834
|
+
const message = {
|
|
1835
|
+
handshake: this.handshake,
|
|
1836
|
+
"reset to default": this.resetToDefault,
|
|
1837
|
+
"value size": this.valueSize,
|
|
1838
|
+
};
|
|
1839
|
+
if (this._values.length > 0) {
|
|
1840
|
+
message.values = this._values
|
|
1841
|
+
.map((value, i) => `\n· #${this._parameters[i]}: ${configValueToString(value)}`)
|
|
1842
|
+
.join("");
|
|
1843
|
+
}
|
|
1844
|
+
return {
|
|
1845
|
+
...super.toLogEntry(ctx),
|
|
1846
|
+
message,
|
|
1847
|
+
};
|
|
1848
|
+
}
|
|
1849
|
+
};
|
|
1850
|
+
return ConfigurationCCBulkSet = _classThis;
|
|
1851
|
+
})();
|
|
1753
1852
|
export { ConfigurationCCBulkSet };
|
|
1754
|
-
let ConfigurationCCBulkReport =
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1853
|
+
let ConfigurationCCBulkReport = (() => {
|
|
1854
|
+
let _classDecorators = [CCCommand(ConfigurationCommand.BulkReport)];
|
|
1855
|
+
let _classDescriptor;
|
|
1856
|
+
let _classExtraInitializers = [];
|
|
1857
|
+
let _classThis;
|
|
1858
|
+
let _classSuper = ConfigurationCC;
|
|
1859
|
+
var ConfigurationCCBulkReport = class extends _classSuper {
|
|
1860
|
+
static { _classThis = this; }
|
|
1861
|
+
static {
|
|
1862
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1863
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1864
|
+
ConfigurationCCBulkReport = _classThis = _classDescriptor.value;
|
|
1865
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1866
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1867
|
+
}
|
|
1868
|
+
constructor(options) {
|
|
1869
|
+
super(options);
|
|
1870
|
+
// TODO: Check implementation:
|
|
1871
|
+
this.reportsToFollow = options.reportsToFollow;
|
|
1872
|
+
this.defaultValues = options.defaultValues;
|
|
1873
|
+
this.isHandshakeResponse = options.isHandshakeResponse;
|
|
1874
|
+
this.valueSize = options.valueSize;
|
|
1875
|
+
for (const [param, value] of Object.entries(options.values)) {
|
|
1876
|
+
this._values.set(parseInt(param), value);
|
|
1877
|
+
}
|
|
1764
1878
|
}
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
values[param] = parseValue(raw.payload.subarray(5 + i * valueSize), valueSize, ConfigValueFormat.SignedInteger);
|
|
1783
|
-
}
|
|
1784
|
-
return new ConfigurationCCBulkReport_1({
|
|
1785
|
-
nodeId: ctx.sourceNodeId,
|
|
1786
|
-
reportsToFollow,
|
|
1787
|
-
defaultValues,
|
|
1788
|
-
isHandshakeResponse,
|
|
1789
|
-
valueSize,
|
|
1790
|
-
values,
|
|
1791
|
-
});
|
|
1792
|
-
}
|
|
1793
|
-
persistValues(ctx) {
|
|
1794
|
-
if (!super.persistValues(ctx))
|
|
1795
|
-
return false;
|
|
1796
|
-
// Store every received parameter
|
|
1797
|
-
// eslint-disable-next-line prefer-const
|
|
1798
|
-
for (let [parameter, value] of this._values.entries()) {
|
|
1799
|
-
// Check if the initial assumption of SignedInteger holds true
|
|
1800
|
-
const oldParamInformation = this.getParamInformation(ctx, parameter);
|
|
1801
|
-
if (oldParamInformation.format != undefined
|
|
1802
|
-
&& oldParamInformation.format
|
|
1803
|
-
!== ConfigValueFormat.SignedInteger) {
|
|
1804
|
-
// Re-interpret the value with the new format
|
|
1805
|
-
value = reInterpretSignedValue(value, this.valueSize, oldParamInformation.format);
|
|
1806
|
-
this._values.set(parameter, value);
|
|
1879
|
+
static from(raw, ctx) {
|
|
1880
|
+
// Ensure we received enough bytes for the preamble
|
|
1881
|
+
validatePayload(raw.payload.length >= 5);
|
|
1882
|
+
const firstParameter = raw.payload.readUInt16BE(0);
|
|
1883
|
+
const numParams = raw.payload[2];
|
|
1884
|
+
const reportsToFollow = raw.payload[3];
|
|
1885
|
+
const defaultValues = !!(raw.payload[4] & 0b1000_0000);
|
|
1886
|
+
const isHandshakeResponse = !!(raw.payload[4] & 0b0100_0000);
|
|
1887
|
+
const valueSize = raw.payload[4] & 0b111;
|
|
1888
|
+
// Ensure the payload is long enough for all reported values
|
|
1889
|
+
validatePayload(raw.payload.length >= 5 + numParams * valueSize);
|
|
1890
|
+
const values = {};
|
|
1891
|
+
for (let i = 0; i < numParams; i++) {
|
|
1892
|
+
const param = firstParameter + i;
|
|
1893
|
+
// Default to parsing the value as SignedInteger, like the specs say.
|
|
1894
|
+
// We try to re-interpret the value in persistValues()
|
|
1895
|
+
values[param] = parseValue(raw.payload.subarray(5 + i * valueSize), valueSize, ConfigValueFormat.SignedInteger);
|
|
1807
1896
|
}
|
|
1808
|
-
this
|
|
1897
|
+
return new this({
|
|
1898
|
+
nodeId: ctx.sourceNodeId,
|
|
1899
|
+
reportsToFollow,
|
|
1900
|
+
defaultValues,
|
|
1901
|
+
isHandshakeResponse,
|
|
1902
|
+
valueSize,
|
|
1903
|
+
values,
|
|
1904
|
+
});
|
|
1809
1905
|
}
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1906
|
+
persistValues(ctx) {
|
|
1907
|
+
if (!super.persistValues(ctx))
|
|
1908
|
+
return false;
|
|
1909
|
+
// Store every received parameter
|
|
1910
|
+
// eslint-disable-next-line prefer-const
|
|
1911
|
+
for (let [parameter, value] of this._values.entries()) {
|
|
1912
|
+
// Check if the initial assumption of SignedInteger holds true
|
|
1913
|
+
const oldParamInformation = this.getParamInformation(ctx, parameter);
|
|
1914
|
+
if (oldParamInformation.format != undefined
|
|
1915
|
+
&& oldParamInformation.format
|
|
1916
|
+
!== ConfigValueFormat.SignedInteger) {
|
|
1917
|
+
// Re-interpret the value with the new format
|
|
1918
|
+
value = reInterpretSignedValue(value, this.valueSize, oldParamInformation.format);
|
|
1919
|
+
this._values.set(parameter, value);
|
|
1920
|
+
}
|
|
1921
|
+
this.setValue(ctx, ConfigurationCCValues.paramInformation(parameter), value);
|
|
1922
|
+
}
|
|
1923
|
+
return true;
|
|
1924
|
+
}
|
|
1925
|
+
reportsToFollow;
|
|
1926
|
+
defaultValues;
|
|
1927
|
+
isHandshakeResponse;
|
|
1928
|
+
valueSize;
|
|
1929
|
+
_values = new Map();
|
|
1930
|
+
get values() {
|
|
1931
|
+
return this._values;
|
|
1932
|
+
}
|
|
1933
|
+
getPartialCCSessionId() {
|
|
1934
|
+
// We don't expect the applHost to merge CCs but we want to wait until all reports have been received
|
|
1935
|
+
return {};
|
|
1936
|
+
}
|
|
1937
|
+
expectMoreMessages() {
|
|
1938
|
+
return this.reportsToFollow > 0;
|
|
1939
|
+
}
|
|
1940
|
+
toLogEntry(ctx) {
|
|
1941
|
+
const message = {
|
|
1942
|
+
"handshake response": this.isHandshakeResponse,
|
|
1943
|
+
"default values": this.defaultValues,
|
|
1944
|
+
"value size": this.valueSize,
|
|
1945
|
+
"reports to follow": this.reportsToFollow,
|
|
1946
|
+
};
|
|
1947
|
+
if (this._values.size > 0) {
|
|
1948
|
+
message.values = [...this._values]
|
|
1949
|
+
.map(([param, value]) => `
|
|
1837
1950
|
· #${param}: ${configValueToString(value)}`)
|
|
1838
|
-
|
|
1951
|
+
.join("");
|
|
1952
|
+
}
|
|
1953
|
+
return {
|
|
1954
|
+
...super.toLogEntry(ctx),
|
|
1955
|
+
message,
|
|
1956
|
+
};
|
|
1839
1957
|
}
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
};
|
|
1844
|
-
}
|
|
1845
|
-
};
|
|
1846
|
-
ConfigurationCCBulkReport = ConfigurationCCBulkReport_1 = __decorate([
|
|
1847
|
-
CCCommand(ConfigurationCommand.BulkReport)
|
|
1848
|
-
], ConfigurationCCBulkReport);
|
|
1958
|
+
};
|
|
1959
|
+
return ConfigurationCCBulkReport = _classThis;
|
|
1960
|
+
})();
|
|
1849
1961
|
export { ConfigurationCCBulkReport };
|
|
1850
|
-
let ConfigurationCCBulkGet =
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1962
|
+
let ConfigurationCCBulkGet = (() => {
|
|
1963
|
+
let _classDecorators = [CCCommand(ConfigurationCommand.BulkGet), expectedCCResponse(ConfigurationCCBulkReport)];
|
|
1964
|
+
let _classDescriptor;
|
|
1965
|
+
let _classExtraInitializers = [];
|
|
1966
|
+
let _classThis;
|
|
1967
|
+
let _classSuper = ConfigurationCC;
|
|
1968
|
+
var ConfigurationCCBulkGet = class extends _classSuper {
|
|
1969
|
+
static { _classThis = this; }
|
|
1970
|
+
static {
|
|
1971
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1972
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
1973
|
+
ConfigurationCCBulkGet = _classThis = _classDescriptor.value;
|
|
1974
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1975
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1976
|
+
}
|
|
1977
|
+
constructor(options) {
|
|
1978
|
+
super(options);
|
|
1979
|
+
this._parameters = options.parameters.sort();
|
|
1980
|
+
if (!isConsecutiveArray(this.parameters)) {
|
|
1981
|
+
throw new ZWaveError(`A ConfigurationCC.BulkGet can only be used for consecutive parameters`, ZWaveErrorCodes.CC_Invalid);
|
|
1982
|
+
}
|
|
1856
1983
|
}
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
}
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
CCCommand(ConfigurationCommand.BulkGet),
|
|
1884
|
-
expectedCCResponse(ConfigurationCCBulkReport)
|
|
1885
|
-
], ConfigurationCCBulkGet);
|
|
1984
|
+
static from(_raw, _ctx) {
|
|
1985
|
+
// TODO: Deserialize payload
|
|
1986
|
+
throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
|
|
1987
|
+
// return new ConfigurationCCBulkGet({
|
|
1988
|
+
// nodeId: ctx.sourceNodeId,
|
|
1989
|
+
// });
|
|
1990
|
+
}
|
|
1991
|
+
_parameters;
|
|
1992
|
+
get parameters() {
|
|
1993
|
+
return this._parameters;
|
|
1994
|
+
}
|
|
1995
|
+
serialize(ctx) {
|
|
1996
|
+
this.payload = new Bytes(3);
|
|
1997
|
+
this.payload.writeUInt16BE(this.parameters[0], 0);
|
|
1998
|
+
this.payload[2] = this.parameters.length;
|
|
1999
|
+
return super.serialize(ctx);
|
|
2000
|
+
}
|
|
2001
|
+
toLogEntry(ctx) {
|
|
2002
|
+
return {
|
|
2003
|
+
...super.toLogEntry(ctx),
|
|
2004
|
+
message: { parameters: this.parameters.join(", ") },
|
|
2005
|
+
};
|
|
2006
|
+
}
|
|
2007
|
+
};
|
|
2008
|
+
return ConfigurationCCBulkGet = _classThis;
|
|
2009
|
+
})();
|
|
1886
2010
|
export { ConfigurationCCBulkGet };
|
|
1887
|
-
let ConfigurationCCNameReport =
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
label: this.name,
|
|
2011
|
+
let ConfigurationCCNameReport = (() => {
|
|
2012
|
+
let _classDecorators = [CCCommand(ConfigurationCommand.NameReport)];
|
|
2013
|
+
let _classDescriptor;
|
|
2014
|
+
let _classExtraInitializers = [];
|
|
2015
|
+
let _classThis;
|
|
2016
|
+
let _classSuper = ConfigurationCC;
|
|
2017
|
+
var ConfigurationCCNameReport = class extends _classSuper {
|
|
2018
|
+
static { _classThis = this; }
|
|
2019
|
+
static {
|
|
2020
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2021
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2022
|
+
ConfigurationCCNameReport = _classThis = _classDescriptor.value;
|
|
2023
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2024
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2025
|
+
}
|
|
2026
|
+
constructor(options) {
|
|
2027
|
+
super(options);
|
|
2028
|
+
this.parameter = options.parameter;
|
|
2029
|
+
this.name = options.name;
|
|
2030
|
+
this.reportsToFollow = options.reportsToFollow;
|
|
2031
|
+
}
|
|
2032
|
+
static from(raw, ctx) {
|
|
2033
|
+
// Parameter and # of reports must be present
|
|
2034
|
+
validatePayload(raw.payload.length >= 3);
|
|
2035
|
+
const parameter = raw.payload.readUInt16BE(0);
|
|
2036
|
+
const reportsToFollow = raw.payload[2];
|
|
2037
|
+
if (reportsToFollow > 0) {
|
|
2038
|
+
// If more reports follow, the info must at least be one byte
|
|
2039
|
+
validatePayload(raw.payload.length >= 4);
|
|
2040
|
+
}
|
|
2041
|
+
const name = raw.payload.subarray(3).toString("utf8");
|
|
2042
|
+
return new this({
|
|
2043
|
+
nodeId: ctx.sourceNodeId,
|
|
2044
|
+
parameter,
|
|
2045
|
+
reportsToFollow,
|
|
2046
|
+
name,
|
|
1924
2047
|
});
|
|
1925
2048
|
}
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
this.extendParamInformation(ctx,
|
|
1938
|
-
label,
|
|
2049
|
+
parameter;
|
|
2050
|
+
name;
|
|
2051
|
+
reportsToFollow;
|
|
2052
|
+
persistValues(ctx) {
|
|
2053
|
+
if (!super.persistValues(ctx))
|
|
2054
|
+
return false;
|
|
2055
|
+
// Bitfield parameters that are not documented in a config file
|
|
2056
|
+
// are split into multiple partial parameters. We need to set the name for
|
|
2057
|
+
// all of them.
|
|
2058
|
+
const partialParams = this.getPartialParamInfos(ctx, this.parameter);
|
|
2059
|
+
if (partialParams.length === 0) {
|
|
2060
|
+
this.extendParamInformation(ctx, this.parameter, undefined, {
|
|
2061
|
+
label: this.name,
|
|
1939
2062
|
});
|
|
1940
2063
|
}
|
|
2064
|
+
else {
|
|
2065
|
+
for (const param of partialParams) {
|
|
2066
|
+
const paramNumber = param.property;
|
|
2067
|
+
const bitMask = param.propertyKey;
|
|
2068
|
+
const bitNumber = Math.log2(bitMask) % 1 === 0
|
|
2069
|
+
? Math.log2(bitMask)
|
|
2070
|
+
: undefined;
|
|
2071
|
+
let label = `${this.name} - ${bitMask}`;
|
|
2072
|
+
if (bitNumber != undefined) {
|
|
2073
|
+
label += ` (bit ${bitNumber})`;
|
|
2074
|
+
}
|
|
2075
|
+
this.extendParamInformation(ctx, paramNumber, bitMask, {
|
|
2076
|
+
label,
|
|
2077
|
+
});
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
return true;
|
|
1941
2081
|
}
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
};
|
|
1976
|
-
ConfigurationCCNameReport = ConfigurationCCNameReport_1 = __decorate([
|
|
1977
|
-
CCCommand(ConfigurationCommand.NameReport)
|
|
1978
|
-
], ConfigurationCCNameReport);
|
|
2082
|
+
serialize(ctx) {
|
|
2083
|
+
const nameBuffer = Bytes.from(this.name, "utf8");
|
|
2084
|
+
this.payload = new Bytes(3 + nameBuffer.length);
|
|
2085
|
+
this.payload.writeUInt16BE(this.parameter, 0);
|
|
2086
|
+
this.payload[2] = this.reportsToFollow;
|
|
2087
|
+
this.payload.set(nameBuffer, 3);
|
|
2088
|
+
return super.serialize(ctx);
|
|
2089
|
+
}
|
|
2090
|
+
getPartialCCSessionId() {
|
|
2091
|
+
// Distinguish sessions by the parameter number
|
|
2092
|
+
return { parameter: this.parameter };
|
|
2093
|
+
}
|
|
2094
|
+
expectMoreMessages() {
|
|
2095
|
+
return this.reportsToFollow > 0;
|
|
2096
|
+
}
|
|
2097
|
+
mergePartialCCs(partials, _ctx) {
|
|
2098
|
+
// Concat the name
|
|
2099
|
+
this.name = [...partials, this]
|
|
2100
|
+
.map((report) => report.name)
|
|
2101
|
+
.reduce((prev, cur) => prev + cur, "");
|
|
2102
|
+
}
|
|
2103
|
+
toLogEntry(ctx) {
|
|
2104
|
+
return {
|
|
2105
|
+
...super.toLogEntry(ctx),
|
|
2106
|
+
message: {
|
|
2107
|
+
"parameter #": this.parameter,
|
|
2108
|
+
name: this.name,
|
|
2109
|
+
"reports to follow": this.reportsToFollow,
|
|
2110
|
+
},
|
|
2111
|
+
};
|
|
2112
|
+
}
|
|
2113
|
+
};
|
|
2114
|
+
return ConfigurationCCNameReport = _classThis;
|
|
2115
|
+
})();
|
|
1979
2116
|
export { ConfigurationCCNameReport };
|
|
1980
|
-
let ConfigurationCCNameGet =
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
};
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2117
|
+
let ConfigurationCCNameGet = (() => {
|
|
2118
|
+
let _classDecorators = [CCCommand(ConfigurationCommand.NameGet), expectedCCResponse(ConfigurationCCNameReport)];
|
|
2119
|
+
let _classDescriptor;
|
|
2120
|
+
let _classExtraInitializers = [];
|
|
2121
|
+
let _classThis;
|
|
2122
|
+
let _classSuper = ConfigurationCC;
|
|
2123
|
+
var ConfigurationCCNameGet = class extends _classSuper {
|
|
2124
|
+
static { _classThis = this; }
|
|
2125
|
+
static {
|
|
2126
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2127
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2128
|
+
ConfigurationCCNameGet = _classThis = _classDescriptor.value;
|
|
2129
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2130
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2131
|
+
}
|
|
2132
|
+
constructor(options) {
|
|
2133
|
+
super(options);
|
|
2134
|
+
this.parameter = options.parameter;
|
|
2135
|
+
}
|
|
2136
|
+
static from(raw, ctx) {
|
|
2137
|
+
validatePayload(raw.payload.length >= 2);
|
|
2138
|
+
const parameter = raw.payload.readUInt16BE(0);
|
|
2139
|
+
return new this({
|
|
2140
|
+
nodeId: ctx.sourceNodeId,
|
|
2141
|
+
parameter,
|
|
2142
|
+
});
|
|
2143
|
+
}
|
|
2144
|
+
parameter;
|
|
2145
|
+
serialize(ctx) {
|
|
2146
|
+
this.payload = new Bytes(2);
|
|
2147
|
+
this.payload.writeUInt16BE(this.parameter, 0);
|
|
2148
|
+
return super.serialize(ctx);
|
|
2149
|
+
}
|
|
2150
|
+
toLogEntry(ctx) {
|
|
2151
|
+
return {
|
|
2152
|
+
...super.toLogEntry(ctx),
|
|
2153
|
+
message: { "parameter #": this.parameter },
|
|
2154
|
+
};
|
|
2155
|
+
}
|
|
2156
|
+
};
|
|
2157
|
+
return ConfigurationCCNameGet = _classThis;
|
|
2158
|
+
})();
|
|
2010
2159
|
export { ConfigurationCCNameGet };
|
|
2011
|
-
let ConfigurationCCInfoReport =
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
if (partialParams.length === 0) {
|
|
2048
|
-
this.extendParamInformation(ctx, this.parameter, undefined, {
|
|
2049
|
-
description: this.info,
|
|
2160
|
+
let ConfigurationCCInfoReport = (() => {
|
|
2161
|
+
let _classDecorators = [CCCommand(ConfigurationCommand.InfoReport)];
|
|
2162
|
+
let _classDescriptor;
|
|
2163
|
+
let _classExtraInitializers = [];
|
|
2164
|
+
let _classThis;
|
|
2165
|
+
let _classSuper = ConfigurationCC;
|
|
2166
|
+
var ConfigurationCCInfoReport = class extends _classSuper {
|
|
2167
|
+
static { _classThis = this; }
|
|
2168
|
+
static {
|
|
2169
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2170
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2171
|
+
ConfigurationCCInfoReport = _classThis = _classDescriptor.value;
|
|
2172
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2173
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2174
|
+
}
|
|
2175
|
+
constructor(options) {
|
|
2176
|
+
super(options);
|
|
2177
|
+
this.parameter = options.parameter;
|
|
2178
|
+
this.info = options.info;
|
|
2179
|
+
this.reportsToFollow = options.reportsToFollow;
|
|
2180
|
+
}
|
|
2181
|
+
static from(raw, ctx) {
|
|
2182
|
+
// Parameter and # of reports must be present
|
|
2183
|
+
validatePayload(raw.payload.length >= 3);
|
|
2184
|
+
const parameter = raw.payload.readUInt16BE(0);
|
|
2185
|
+
const reportsToFollow = raw.payload[2];
|
|
2186
|
+
if (reportsToFollow > 0) {
|
|
2187
|
+
// If more reports follow, the info must at least be one byte
|
|
2188
|
+
validatePayload(raw.payload.length >= 4);
|
|
2189
|
+
}
|
|
2190
|
+
const info = raw.payload.subarray(3).toString("utf8");
|
|
2191
|
+
return new this({
|
|
2192
|
+
nodeId: ctx.sourceNodeId,
|
|
2193
|
+
parameter,
|
|
2194
|
+
reportsToFollow,
|
|
2195
|
+
info,
|
|
2050
2196
|
});
|
|
2051
2197
|
}
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2198
|
+
parameter;
|
|
2199
|
+
info;
|
|
2200
|
+
reportsToFollow;
|
|
2201
|
+
persistValues(ctx) {
|
|
2202
|
+
if (!super.persistValues(ctx))
|
|
2203
|
+
return false;
|
|
2204
|
+
// Bitfield parameters that are not documented in a config file
|
|
2205
|
+
// are split into multiple partial parameters. We need to set the description for
|
|
2206
|
+
// all of them. However, these can get very long, so we put the reported
|
|
2207
|
+
// description on the first partial param, and refer to it from the others
|
|
2208
|
+
const partialParams = this.getPartialParamInfos(ctx, this.parameter).sort((a, b) => (a.propertyKey ?? 0)
|
|
2209
|
+
- (b.propertyKey ?? 0));
|
|
2210
|
+
if (partialParams.length === 0) {
|
|
2211
|
+
this.extendParamInformation(ctx, this.parameter, undefined, {
|
|
2212
|
+
description: this.info,
|
|
2063
2213
|
});
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2214
|
+
}
|
|
2215
|
+
else {
|
|
2216
|
+
let firstParamLabel;
|
|
2217
|
+
for (const param of partialParams) {
|
|
2218
|
+
const paramNumber = param.property;
|
|
2219
|
+
const bitMask = param.propertyKey;
|
|
2220
|
+
// We put the description on the first partial param
|
|
2221
|
+
const description = firstParamLabel
|
|
2222
|
+
? `Refer to ${firstParamLabel}`
|
|
2223
|
+
: this.info;
|
|
2224
|
+
this.extendParamInformation(ctx, paramNumber, bitMask, {
|
|
2225
|
+
description,
|
|
2226
|
+
});
|
|
2227
|
+
// Then we store the name of the first param to refer to it on the
|
|
2228
|
+
// following partial params
|
|
2229
|
+
if (firstParamLabel == undefined) {
|
|
2230
|
+
firstParamLabel =
|
|
2231
|
+
this.getParamInformation(ctx, paramNumber, bitMask)
|
|
2232
|
+
.label ?? `parameter ${paramNumber} - ${bitMask}`;
|
|
2233
|
+
}
|
|
2070
2234
|
}
|
|
2071
2235
|
}
|
|
2236
|
+
return true;
|
|
2072
2237
|
}
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
};
|
|
2107
|
-
ConfigurationCCInfoReport = ConfigurationCCInfoReport_1 = __decorate([
|
|
2108
|
-
CCCommand(ConfigurationCommand.InfoReport)
|
|
2109
|
-
], ConfigurationCCInfoReport);
|
|
2238
|
+
serialize(ctx) {
|
|
2239
|
+
const infoBuffer = Bytes.from(this.info, "utf8");
|
|
2240
|
+
this.payload = new Bytes(3 + infoBuffer.length);
|
|
2241
|
+
this.payload.writeUInt16BE(this.parameter, 0);
|
|
2242
|
+
this.payload[2] = this.reportsToFollow;
|
|
2243
|
+
this.payload.set(infoBuffer, 3);
|
|
2244
|
+
return super.serialize(ctx);
|
|
2245
|
+
}
|
|
2246
|
+
getPartialCCSessionId() {
|
|
2247
|
+
// Distinguish sessions by the parameter number
|
|
2248
|
+
return { parameter: this.parameter };
|
|
2249
|
+
}
|
|
2250
|
+
expectMoreMessages() {
|
|
2251
|
+
return this.reportsToFollow > 0;
|
|
2252
|
+
}
|
|
2253
|
+
mergePartialCCs(partials, _ctx) {
|
|
2254
|
+
// Concat the info
|
|
2255
|
+
this.info = [...partials, this]
|
|
2256
|
+
.map((report) => report.info)
|
|
2257
|
+
.reduce((prev, cur) => prev + cur, "");
|
|
2258
|
+
}
|
|
2259
|
+
toLogEntry(ctx) {
|
|
2260
|
+
return {
|
|
2261
|
+
...super.toLogEntry(ctx),
|
|
2262
|
+
message: {
|
|
2263
|
+
"parameter #": this.parameter,
|
|
2264
|
+
info: this.info,
|
|
2265
|
+
"reports to follow": this.reportsToFollow,
|
|
2266
|
+
},
|
|
2267
|
+
};
|
|
2268
|
+
}
|
|
2269
|
+
};
|
|
2270
|
+
return ConfigurationCCInfoReport = _classThis;
|
|
2271
|
+
})();
|
|
2110
2272
|
export { ConfigurationCCInfoReport };
|
|
2111
|
-
let ConfigurationCCInfoGet =
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
};
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2273
|
+
let ConfigurationCCInfoGet = (() => {
|
|
2274
|
+
let _classDecorators = [CCCommand(ConfigurationCommand.InfoGet), expectedCCResponse(ConfigurationCCInfoReport)];
|
|
2275
|
+
let _classDescriptor;
|
|
2276
|
+
let _classExtraInitializers = [];
|
|
2277
|
+
let _classThis;
|
|
2278
|
+
let _classSuper = ConfigurationCC;
|
|
2279
|
+
var ConfigurationCCInfoGet = class extends _classSuper {
|
|
2280
|
+
static { _classThis = this; }
|
|
2281
|
+
static {
|
|
2282
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2283
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2284
|
+
ConfigurationCCInfoGet = _classThis = _classDescriptor.value;
|
|
2285
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2286
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2287
|
+
}
|
|
2288
|
+
constructor(options) {
|
|
2289
|
+
super(options);
|
|
2290
|
+
this.parameter = options.parameter;
|
|
2291
|
+
}
|
|
2292
|
+
static from(raw, ctx) {
|
|
2293
|
+
validatePayload(raw.payload.length >= 2);
|
|
2294
|
+
const parameter = raw.payload.readUInt16BE(0);
|
|
2295
|
+
return new this({
|
|
2296
|
+
nodeId: ctx.sourceNodeId,
|
|
2297
|
+
parameter,
|
|
2298
|
+
});
|
|
2299
|
+
}
|
|
2300
|
+
parameter;
|
|
2301
|
+
serialize(ctx) {
|
|
2302
|
+
this.payload = new Bytes(2);
|
|
2303
|
+
this.payload.writeUInt16BE(this.parameter, 0);
|
|
2304
|
+
return super.serialize(ctx);
|
|
2305
|
+
}
|
|
2306
|
+
toLogEntry(ctx) {
|
|
2307
|
+
return {
|
|
2308
|
+
...super.toLogEntry(ctx),
|
|
2309
|
+
message: { "parameter #": this.parameter },
|
|
2310
|
+
};
|
|
2311
|
+
}
|
|
2312
|
+
};
|
|
2313
|
+
return ConfigurationCCInfoGet = _classThis;
|
|
2314
|
+
})();
|
|
2141
2315
|
export { ConfigurationCCInfoGet };
|
|
2142
|
-
let ConfigurationCCPropertiesReport =
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
}
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
this.
|
|
2160
|
-
this.
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2316
|
+
let ConfigurationCCPropertiesReport = (() => {
|
|
2317
|
+
let _classDecorators = [CCCommand(ConfigurationCommand.PropertiesReport)];
|
|
2318
|
+
let _classDescriptor;
|
|
2319
|
+
let _classExtraInitializers = [];
|
|
2320
|
+
let _classThis;
|
|
2321
|
+
let _classSuper = ConfigurationCC;
|
|
2322
|
+
var ConfigurationCCPropertiesReport = class extends _classSuper {
|
|
2323
|
+
static { _classThis = this; }
|
|
2324
|
+
static {
|
|
2325
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2326
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2327
|
+
ConfigurationCCPropertiesReport = _classThis = _classDescriptor.value;
|
|
2328
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2329
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2330
|
+
}
|
|
2331
|
+
constructor(options) {
|
|
2332
|
+
super(options);
|
|
2333
|
+
this.parameter = options.parameter;
|
|
2334
|
+
this.valueSize = options.valueSize;
|
|
2335
|
+
this.valueFormat = options.valueFormat;
|
|
2336
|
+
if (this.valueSize > 0) {
|
|
2337
|
+
if (options.minValue == undefined) {
|
|
2338
|
+
throw new ZWaveError("The minimum value must be set when the value size is non-zero", ZWaveErrorCodes.Argument_Invalid);
|
|
2339
|
+
}
|
|
2340
|
+
else if (options.maxValue == undefined) {
|
|
2341
|
+
throw new ZWaveError("The maximum value must be set when the value size is non-zero", ZWaveErrorCodes.Argument_Invalid);
|
|
2342
|
+
}
|
|
2343
|
+
else if (options.defaultValue == undefined) {
|
|
2344
|
+
throw new ZWaveError("The default value must be set when the value size is non-zero", ZWaveErrorCodes.Argument_Invalid);
|
|
2345
|
+
}
|
|
2346
|
+
this.minValue = options.minValue;
|
|
2347
|
+
this.maxValue = options.maxValue;
|
|
2348
|
+
this.defaultValue = options.defaultValue;
|
|
2349
|
+
}
|
|
2350
|
+
this.nextParameter = options.nextParameter;
|
|
2351
|
+
this.altersCapabilities = options.altersCapabilities;
|
|
2352
|
+
this.isReadonly = options.isReadonly;
|
|
2353
|
+
this.isAdvanced = options.isAdvanced;
|
|
2354
|
+
this.noBulkSupport = options.noBulkSupport;
|
|
2355
|
+
}
|
|
2356
|
+
static from(raw, ctx) {
|
|
2357
|
+
validatePayload(raw.payload.length >= 3);
|
|
2358
|
+
const parameter = raw.payload.readUInt16BE(0);
|
|
2359
|
+
const valueFormat = (raw.payload[2] & 0b111000)
|
|
2360
|
+
>>> 3;
|
|
2361
|
+
const valueSize = raw.payload[2] & 0b111;
|
|
2362
|
+
// GH#1309 Some devices don't tell us the first parameter if we query #0
|
|
2363
|
+
// Instead, they contain 0x000000
|
|
2364
|
+
let nextParameter;
|
|
2365
|
+
if (valueSize === 0 && raw.payload.length < 5) {
|
|
2366
|
+
nextParameter = 0;
|
|
2367
|
+
return new this({
|
|
2368
|
+
nodeId: ctx.sourceNodeId,
|
|
2369
|
+
parameter,
|
|
2370
|
+
valueFormat,
|
|
2371
|
+
valueSize,
|
|
2372
|
+
nextParameter,
|
|
2373
|
+
});
|
|
2374
|
+
}
|
|
2375
|
+
// Ensure the payload contains the two bytes for next parameter
|
|
2376
|
+
const nextParameterOffset = 3 + 3 * valueSize;
|
|
2377
|
+
validatePayload(raw.payload.length >= nextParameterOffset + 2);
|
|
2378
|
+
let minValue;
|
|
2379
|
+
let maxValue;
|
|
2380
|
+
let defaultValue;
|
|
2381
|
+
if (valueSize > 0) {
|
|
2382
|
+
if (valueFormat === ConfigValueFormat.BitField) {
|
|
2383
|
+
minValue = 0;
|
|
2384
|
+
}
|
|
2385
|
+
else {
|
|
2386
|
+
minValue = parseValue(raw.payload.subarray(3), valueSize, valueFormat);
|
|
2387
|
+
}
|
|
2388
|
+
maxValue = parseValue(raw.payload.subarray(3 + valueSize), valueSize, valueFormat);
|
|
2389
|
+
defaultValue = parseValue(raw.payload.subarray(3 + 2 * valueSize), valueSize, valueFormat);
|
|
2390
|
+
}
|
|
2391
|
+
nextParameter = raw.payload.readUInt16BE(nextParameterOffset);
|
|
2392
|
+
let altersCapabilities;
|
|
2393
|
+
let isReadonly;
|
|
2394
|
+
let isAdvanced;
|
|
2395
|
+
let noBulkSupport;
|
|
2396
|
+
if (raw.payload.length >= nextParameterOffset + 3) {
|
|
2397
|
+
// V4 adds an options byte after the next parameter and two bits in byte 2
|
|
2398
|
+
const options1 = raw.payload[2];
|
|
2399
|
+
const options2 = raw.payload[3 + 3 * valueSize + 2];
|
|
2400
|
+
altersCapabilities = !!(options1 & 0b1000_0000);
|
|
2401
|
+
isReadonly = !!(options1 & 0b0100_0000);
|
|
2402
|
+
isAdvanced = !!(options2 & 0b1);
|
|
2403
|
+
noBulkSupport = !!(options2 & 0b10);
|
|
2404
|
+
}
|
|
2405
|
+
return new this({
|
|
2180
2406
|
nodeId: ctx.sourceNodeId,
|
|
2181
2407
|
parameter,
|
|
2182
2408
|
valueFormat,
|
|
2183
2409
|
valueSize,
|
|
2184
2410
|
nextParameter,
|
|
2411
|
+
minValue,
|
|
2412
|
+
maxValue,
|
|
2413
|
+
defaultValue,
|
|
2414
|
+
altersCapabilities,
|
|
2415
|
+
isReadonly,
|
|
2416
|
+
isAdvanced,
|
|
2417
|
+
noBulkSupport,
|
|
2185
2418
|
});
|
|
2186
2419
|
}
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
let noBulkSupport;
|
|
2208
|
-
if (raw.payload.length >= nextParameterOffset + 3) {
|
|
2209
|
-
// V4 adds an options byte after the next parameter and two bits in byte 2
|
|
2210
|
-
const options1 = raw.payload[2];
|
|
2211
|
-
const options2 = raw.payload[3 + 3 * valueSize + 2];
|
|
2212
|
-
altersCapabilities = !!(options1 & 0b1000_0000);
|
|
2213
|
-
isReadonly = !!(options1 & 0b0100_0000);
|
|
2214
|
-
isAdvanced = !!(options2 & 0b1);
|
|
2215
|
-
noBulkSupport = !!(options2 & 0b10);
|
|
2216
|
-
}
|
|
2217
|
-
return new ConfigurationCCPropertiesReport_1({
|
|
2218
|
-
nodeId: ctx.sourceNodeId,
|
|
2219
|
-
parameter,
|
|
2220
|
-
valueFormat,
|
|
2221
|
-
valueSize,
|
|
2222
|
-
nextParameter,
|
|
2223
|
-
minValue,
|
|
2224
|
-
maxValue,
|
|
2225
|
-
defaultValue,
|
|
2226
|
-
altersCapabilities,
|
|
2227
|
-
isReadonly,
|
|
2228
|
-
isAdvanced,
|
|
2229
|
-
noBulkSupport,
|
|
2230
|
-
});
|
|
2231
|
-
}
|
|
2232
|
-
persistValues(ctx) {
|
|
2233
|
-
if (!super.persistValues(ctx))
|
|
2234
|
-
return false;
|
|
2235
|
-
// If we actually received parameter info, store it
|
|
2236
|
-
if (this.valueSize > 0) {
|
|
2237
|
-
const baseInfo = {
|
|
2238
|
-
type: "number",
|
|
2239
|
-
format: this.valueFormat,
|
|
2240
|
-
valueSize: this.valueSize,
|
|
2241
|
-
requiresReInclusion: this.altersCapabilities,
|
|
2242
|
-
readable: true,
|
|
2243
|
-
writeable: !this.isReadonly,
|
|
2244
|
-
allowManualEntry: true,
|
|
2245
|
-
isAdvanced: this.isAdvanced,
|
|
2246
|
-
noBulkSupport: this.noBulkSupport,
|
|
2247
|
-
isFromConfig: false,
|
|
2248
|
-
};
|
|
2249
|
-
if (this.valueFormat !== ConfigValueFormat.BitField) {
|
|
2250
|
-
// Do not override param information from a config file
|
|
2251
|
-
if (!this.paramExistsInConfigFile(ctx, this.parameter)) {
|
|
2252
|
-
const paramInfo = stripUndefined({
|
|
2253
|
-
...baseInfo,
|
|
2254
|
-
min: this.minValue,
|
|
2255
|
-
max: this.maxValue,
|
|
2256
|
-
default: this.defaultValue,
|
|
2257
|
-
});
|
|
2258
|
-
this.extendParamInformation(ctx, this.parameter, undefined, paramInfo);
|
|
2259
|
-
}
|
|
2260
|
-
}
|
|
2261
|
-
else {
|
|
2262
|
-
// Bit fields are split into multiple single-bit partial parameters
|
|
2263
|
-
const bits = this.maxValue;
|
|
2264
|
-
let mask = 1;
|
|
2265
|
-
while (mask <= bits) {
|
|
2266
|
-
if (
|
|
2267
|
-
// Only create partials that exist
|
|
2268
|
-
!!(mask & bits)
|
|
2269
|
-
// Do not override param information from a config file
|
|
2270
|
-
&& !this.paramExistsInConfigFile(ctx, this.parameter, mask)) {
|
|
2420
|
+
persistValues(ctx) {
|
|
2421
|
+
if (!super.persistValues(ctx))
|
|
2422
|
+
return false;
|
|
2423
|
+
// If we actually received parameter info, store it
|
|
2424
|
+
if (this.valueSize > 0) {
|
|
2425
|
+
const baseInfo = {
|
|
2426
|
+
type: "number",
|
|
2427
|
+
format: this.valueFormat,
|
|
2428
|
+
valueSize: this.valueSize,
|
|
2429
|
+
requiresReInclusion: this.altersCapabilities,
|
|
2430
|
+
readable: true,
|
|
2431
|
+
writeable: !this.isReadonly,
|
|
2432
|
+
allowManualEntry: true,
|
|
2433
|
+
isAdvanced: this.isAdvanced,
|
|
2434
|
+
noBulkSupport: this.noBulkSupport,
|
|
2435
|
+
isFromConfig: false,
|
|
2436
|
+
};
|
|
2437
|
+
if (this.valueFormat !== ConfigValueFormat.BitField) {
|
|
2438
|
+
// Do not override param information from a config file
|
|
2439
|
+
if (!this.paramExistsInConfigFile(ctx, this.parameter)) {
|
|
2271
2440
|
const paramInfo = stripUndefined({
|
|
2272
2441
|
...baseInfo,
|
|
2273
|
-
min:
|
|
2274
|
-
max:
|
|
2275
|
-
default: this.defaultValue
|
|
2442
|
+
min: this.minValue,
|
|
2443
|
+
max: this.maxValue,
|
|
2444
|
+
default: this.defaultValue,
|
|
2276
2445
|
});
|
|
2277
|
-
this.extendParamInformation(ctx, this.parameter,
|
|
2446
|
+
this.extendParamInformation(ctx, this.parameter, undefined, paramInfo);
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
else {
|
|
2450
|
+
// Bit fields are split into multiple single-bit partial parameters
|
|
2451
|
+
const bits = this.maxValue;
|
|
2452
|
+
let mask = 1;
|
|
2453
|
+
while (mask <= bits) {
|
|
2454
|
+
if (
|
|
2455
|
+
// Only create partials that exist
|
|
2456
|
+
!!(mask & bits)
|
|
2457
|
+
// Do not override param information from a config file
|
|
2458
|
+
&& !this.paramExistsInConfigFile(ctx, this.parameter, mask)) {
|
|
2459
|
+
const paramInfo = stripUndefined({
|
|
2460
|
+
...baseInfo,
|
|
2461
|
+
min: 0,
|
|
2462
|
+
max: 1,
|
|
2463
|
+
default: this.defaultValue & mask ? 1 : 0,
|
|
2464
|
+
});
|
|
2465
|
+
this.extendParamInformation(ctx, this.parameter, mask, paramInfo);
|
|
2466
|
+
}
|
|
2467
|
+
// We must use multiplication here, as bitwise shifting works on signed 32-bit integers in JS
|
|
2468
|
+
// which would create an infinite loop if maxValue === 0xffff_ffff
|
|
2469
|
+
mask *= 2;
|
|
2278
2470
|
}
|
|
2279
|
-
// We must use multiplication here, as bitwise shifting works on signed 32-bit integers in JS
|
|
2280
|
-
// which would create an infinite loop if maxValue === 0xffff_ffff
|
|
2281
|
-
mask *= 2;
|
|
2282
2471
|
}
|
|
2283
2472
|
}
|
|
2473
|
+
return true;
|
|
2284
2474
|
}
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2475
|
+
parameter;
|
|
2476
|
+
valueSize;
|
|
2477
|
+
valueFormat;
|
|
2478
|
+
minValue;
|
|
2479
|
+
maxValue;
|
|
2480
|
+
defaultValue;
|
|
2481
|
+
nextParameter;
|
|
2482
|
+
altersCapabilities;
|
|
2483
|
+
isReadonly;
|
|
2484
|
+
isAdvanced;
|
|
2485
|
+
noBulkSupport;
|
|
2486
|
+
serialize(ctx) {
|
|
2487
|
+
this.payload = new Bytes(3 // preamble
|
|
2488
|
+
+ 3 * this.valueSize // min, max, default value
|
|
2489
|
+
+ 2 // next parameter
|
|
2490
|
+
+ 1);
|
|
2491
|
+
this.payload.writeUInt16BE(this.parameter, 0);
|
|
2492
|
+
const options1 = (this.altersCapabilities ? 0b1000_0000 : 0)
|
|
2493
|
+
| (this.isReadonly ? 0b0100_0000 : 0)
|
|
2494
|
+
| ((this.valueFormat & 0b111) << 3)
|
|
2495
|
+
| (this.valueSize & 0b111);
|
|
2496
|
+
this.payload[2] = options1;
|
|
2497
|
+
let offset = 3;
|
|
2498
|
+
if (this.valueSize > 0) {
|
|
2499
|
+
serializeValue(this.payload, offset, this.valueSize, this.valueFormat, this.minValue);
|
|
2500
|
+
offset += this.valueSize;
|
|
2501
|
+
serializeValue(this.payload, offset, this.valueSize, this.valueFormat, this.maxValue);
|
|
2502
|
+
offset += this.valueSize;
|
|
2503
|
+
serializeValue(this.payload, offset, this.valueSize, this.valueFormat, this.defaultValue);
|
|
2504
|
+
offset += this.valueSize;
|
|
2505
|
+
}
|
|
2506
|
+
this.payload.writeUInt16BE(this.nextParameter, offset);
|
|
2507
|
+
offset += 2;
|
|
2508
|
+
const options2 = (this.isAdvanced ? 0b1 : 0)
|
|
2509
|
+
| (this.noBulkSupport ? 0b10 : 0);
|
|
2510
|
+
this.payload[offset] = options2;
|
|
2511
|
+
return super.serialize(ctx);
|
|
2512
|
+
}
|
|
2513
|
+
toLogEntry(ctx) {
|
|
2514
|
+
const message = {
|
|
2515
|
+
"parameter #": this.parameter,
|
|
2516
|
+
"next param #": this.nextParameter,
|
|
2517
|
+
"value size": this.valueSize,
|
|
2518
|
+
"value format": getEnumMemberName(ConfigValueFormat, this.valueFormat),
|
|
2519
|
+
};
|
|
2520
|
+
if (this.minValue != undefined) {
|
|
2521
|
+
message["min value"] = configValueToString(this.minValue);
|
|
2522
|
+
}
|
|
2523
|
+
if (this.maxValue != undefined) {
|
|
2524
|
+
message["max value"] = configValueToString(this.maxValue);
|
|
2525
|
+
}
|
|
2526
|
+
if (this.defaultValue != undefined) {
|
|
2527
|
+
message["default value"] = configValueToString(this.defaultValue);
|
|
2528
|
+
}
|
|
2529
|
+
if (this.altersCapabilities != undefined) {
|
|
2530
|
+
message["alters capabilities"] = this.altersCapabilities;
|
|
2531
|
+
}
|
|
2532
|
+
if (this.isReadonly != undefined) {
|
|
2533
|
+
message.readonly = this.isReadonly;
|
|
2534
|
+
}
|
|
2535
|
+
if (this.isAdvanced != undefined) {
|
|
2536
|
+
message.advanced = this.isAdvanced;
|
|
2537
|
+
}
|
|
2538
|
+
if (this.noBulkSupport != undefined) {
|
|
2539
|
+
message["bulk support"] = !this.noBulkSupport;
|
|
2540
|
+
}
|
|
2541
|
+
return {
|
|
2542
|
+
...super.toLogEntry(ctx),
|
|
2543
|
+
message,
|
|
2544
|
+
};
|
|
2343
2545
|
}
|
|
2344
|
-
|
|
2345
|
-
|
|
2546
|
+
};
|
|
2547
|
+
return ConfigurationCCPropertiesReport = _classThis;
|
|
2548
|
+
})();
|
|
2549
|
+
export { ConfigurationCCPropertiesReport };
|
|
2550
|
+
let ConfigurationCCPropertiesGet = (() => {
|
|
2551
|
+
let _classDecorators = [CCCommand(ConfigurationCommand.PropertiesGet), expectedCCResponse(ConfigurationCCPropertiesReport)];
|
|
2552
|
+
let _classDescriptor;
|
|
2553
|
+
let _classExtraInitializers = [];
|
|
2554
|
+
let _classThis;
|
|
2555
|
+
let _classSuper = ConfigurationCC;
|
|
2556
|
+
var ConfigurationCCPropertiesGet = class extends _classSuper {
|
|
2557
|
+
static { _classThis = this; }
|
|
2558
|
+
static {
|
|
2559
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2560
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2561
|
+
ConfigurationCCPropertiesGet = _classThis = _classDescriptor.value;
|
|
2562
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2563
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2564
|
+
}
|
|
2565
|
+
constructor(options) {
|
|
2566
|
+
super(options);
|
|
2567
|
+
this.parameter = options.parameter;
|
|
2568
|
+
}
|
|
2569
|
+
static from(raw, ctx) {
|
|
2570
|
+
validatePayload(raw.payload.length >= 2);
|
|
2571
|
+
const parameter = raw.payload.readUInt16BE(0);
|
|
2572
|
+
return new this({
|
|
2573
|
+
nodeId: ctx.sourceNodeId,
|
|
2574
|
+
parameter,
|
|
2575
|
+
});
|
|
2346
2576
|
}
|
|
2347
|
-
|
|
2348
|
-
|
|
2577
|
+
parameter;
|
|
2578
|
+
serialize(ctx) {
|
|
2579
|
+
this.payload = new Bytes(2);
|
|
2580
|
+
this.payload.writeUInt16BE(this.parameter, 0);
|
|
2581
|
+
return super.serialize(ctx);
|
|
2349
2582
|
}
|
|
2350
|
-
|
|
2351
|
-
|
|
2583
|
+
toLogEntry(ctx) {
|
|
2584
|
+
return {
|
|
2585
|
+
...super.toLogEntry(ctx),
|
|
2586
|
+
message: { "parameter #": this.parameter },
|
|
2587
|
+
};
|
|
2352
2588
|
}
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
};
|
|
2357
|
-
}
|
|
2358
|
-
};
|
|
2359
|
-
ConfigurationCCPropertiesReport = ConfigurationCCPropertiesReport_1 = __decorate([
|
|
2360
|
-
CCCommand(ConfigurationCommand.PropertiesReport)
|
|
2361
|
-
], ConfigurationCCPropertiesReport);
|
|
2362
|
-
export { ConfigurationCCPropertiesReport };
|
|
2363
|
-
let ConfigurationCCPropertiesGet = ConfigurationCCPropertiesGet_1 = class ConfigurationCCPropertiesGet extends ConfigurationCC {
|
|
2364
|
-
constructor(options) {
|
|
2365
|
-
super(options);
|
|
2366
|
-
this.parameter = options.parameter;
|
|
2367
|
-
}
|
|
2368
|
-
static from(raw, ctx) {
|
|
2369
|
-
validatePayload(raw.payload.length >= 2);
|
|
2370
|
-
const parameter = raw.payload.readUInt16BE(0);
|
|
2371
|
-
return new ConfigurationCCPropertiesGet_1({
|
|
2372
|
-
nodeId: ctx.sourceNodeId,
|
|
2373
|
-
parameter,
|
|
2374
|
-
});
|
|
2375
|
-
}
|
|
2376
|
-
parameter;
|
|
2377
|
-
serialize(ctx) {
|
|
2378
|
-
this.payload = new Bytes(2);
|
|
2379
|
-
this.payload.writeUInt16BE(this.parameter, 0);
|
|
2380
|
-
return super.serialize(ctx);
|
|
2381
|
-
}
|
|
2382
|
-
toLogEntry(ctx) {
|
|
2383
|
-
return {
|
|
2384
|
-
...super.toLogEntry(ctx),
|
|
2385
|
-
message: { "parameter #": this.parameter },
|
|
2386
|
-
};
|
|
2387
|
-
}
|
|
2388
|
-
};
|
|
2389
|
-
ConfigurationCCPropertiesGet = ConfigurationCCPropertiesGet_1 = __decorate([
|
|
2390
|
-
CCCommand(ConfigurationCommand.PropertiesGet),
|
|
2391
|
-
expectedCCResponse(ConfigurationCCPropertiesReport)
|
|
2392
|
-
], ConfigurationCCPropertiesGet);
|
|
2589
|
+
};
|
|
2590
|
+
return ConfigurationCCPropertiesGet = _classThis;
|
|
2591
|
+
})();
|
|
2393
2592
|
export { ConfigurationCCPropertiesGet };
|
|
2394
|
-
let ConfigurationCCDefaultReset =
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2593
|
+
let ConfigurationCCDefaultReset = (() => {
|
|
2594
|
+
let _classDecorators = [CCCommand(ConfigurationCommand.DefaultReset)];
|
|
2595
|
+
let _classDescriptor;
|
|
2596
|
+
let _classExtraInitializers = [];
|
|
2597
|
+
let _classThis;
|
|
2598
|
+
let _classSuper = ConfigurationCC;
|
|
2599
|
+
var ConfigurationCCDefaultReset = class extends _classSuper {
|
|
2600
|
+
static { _classThis = this; }
|
|
2601
|
+
static {
|
|
2602
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
2603
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
2604
|
+
ConfigurationCCDefaultReset = _classThis = _classDescriptor.value;
|
|
2605
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
2606
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2607
|
+
}
|
|
2608
|
+
};
|
|
2609
|
+
return ConfigurationCCDefaultReset = _classThis;
|
|
2610
|
+
})();
|
|
2399
2611
|
export { ConfigurationCCDefaultReset };
|
|
2400
2612
|
function isSafeValue(value, size, format) {
|
|
2401
2613
|
let minValue;
|