@zwave-js/cc 10.19.0 → 10.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cc/BasicCC.d.ts +3 -0
- package/build/cc/BasicCC.d.ts.map +1 -1
- package/build/cc/BasicCC.js +3 -0
- package/build/cc/BasicCC.js.map +1 -1
- package/build/cc/ConfigurationCC.d.ts +48 -37
- package/build/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/cc/ConfigurationCC.js +202 -152
- package/build/cc/ConfigurationCC.js.map +1 -1
- package/build/cc/EnergyProductionCC.d.ts +7 -1
- package/build/cc/EnergyProductionCC.d.ts.map +1 -1
- package/build/cc/EnergyProductionCC.js +19 -5
- package/build/cc/EnergyProductionCC.js.map +1 -1
- package/build/cc/IndicatorCC.d.ts +3 -0
- package/build/cc/IndicatorCC.d.ts.map +1 -1
- package/build/cc/IndicatorCC.js +3 -0
- package/build/cc/IndicatorCC.js.map +1 -1
- package/build/cc/IrrigationCC.d.ts +7 -0
- package/build/cc/IrrigationCC.d.ts.map +1 -1
- package/build/cc/IrrigationCC.js +7 -0
- package/build/cc/IrrigationCC.js.map +1 -1
- package/build/cc/MeterCC.d.ts +6 -0
- package/build/cc/MeterCC.d.ts.map +1 -1
- package/build/cc/MeterCC.js +6 -0
- package/build/cc/MeterCC.js.map +1 -1
- package/build/cc/MultilevelSwitchCC.d.ts +11 -0
- package/build/cc/MultilevelSwitchCC.d.ts.map +1 -1
- package/build/cc/MultilevelSwitchCC.js +11 -0
- package/build/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/cc/WindowCoveringCC.d.ts +12 -0
- package/build/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/cc/WindowCoveringCC.js +12 -0
- package/build/cc/WindowCoveringCC.js.map +1 -1
- package/package.json +6 -6
|
@@ -1368,30 +1368,38 @@ exports.ConfigurationCC = ConfigurationCC;
|
|
|
1368
1368
|
let ConfigurationCCReport = class ConfigurationCCReport extends ConfigurationCC {
|
|
1369
1369
|
constructor(host, options) {
|
|
1370
1370
|
super(host, options);
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1371
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
1372
|
+
// All fields must be present
|
|
1373
|
+
(0, safe_1.validatePayload)(this.payload.length > 2);
|
|
1374
|
+
this.parameter = this.payload[0];
|
|
1375
|
+
this.valueSize = this.payload[1] & 0b111;
|
|
1376
|
+
// Ensure we received a valid report
|
|
1377
|
+
(0, safe_1.validatePayload)(this.valueSize >= 1, this.valueSize <= 4, this.payload.length >= 2 + this.valueSize);
|
|
1378
|
+
// Default to parsing the value as SignedInteger, like the specs say.
|
|
1379
|
+
// We try to re-interpret the value in persistValues()
|
|
1380
|
+
this.value = parseValue(this.payload.slice(2), this.valueSize, safe_1.ConfigValueFormat.SignedInteger);
|
|
1381
|
+
}
|
|
1382
|
+
else {
|
|
1383
|
+
this.parameter = options.parameter;
|
|
1384
|
+
this.value = options.value;
|
|
1385
|
+
this.valueSize = options.valueSize;
|
|
1386
|
+
this.valueFormat = options.valueFormat;
|
|
1387
|
+
}
|
|
1380
1388
|
}
|
|
1381
1389
|
persistValues(applHost) {
|
|
1382
1390
|
if (!super.persistValues(applHost))
|
|
1383
1391
|
return false;
|
|
1384
1392
|
const valueDB = this.getValueDB(applHost);
|
|
1385
1393
|
// Check if the initial assumption of SignedInteger holds true
|
|
1386
|
-
const oldParamInformation = this.getParamInformation(applHost, this.
|
|
1394
|
+
const oldParamInformation = this.getParamInformation(applHost, this.parameter);
|
|
1387
1395
|
if (oldParamInformation.format != undefined &&
|
|
1388
1396
|
oldParamInformation.format !== safe_1.ConfigValueFormat.SignedInteger) {
|
|
1389
1397
|
// Re-interpret the value with the new format
|
|
1390
|
-
this.
|
|
1398
|
+
this.value = reInterpretSignedValue(this.value, this.valueSize, oldParamInformation.format);
|
|
1391
1399
|
}
|
|
1392
1400
|
// Store the parameter size and value
|
|
1393
|
-
this.extendParamInformation(applHost, this.
|
|
1394
|
-
valueSize: this.
|
|
1401
|
+
this.extendParamInformation(applHost, this.parameter, undefined, {
|
|
1402
|
+
valueSize: this.valueSize,
|
|
1395
1403
|
type: oldParamInformation.format === safe_1.ConfigValueFormat.BitField
|
|
1396
1404
|
? "number[]"
|
|
1397
1405
|
: "number",
|
|
@@ -1402,19 +1410,19 @@ let ConfigurationCCReport = class ConfigurationCCReport extends ConfigurationCC
|
|
|
1402
1410
|
oldParamInformation.max == undefined) {
|
|
1403
1411
|
const isSigned = oldParamInformation.format == undefined ||
|
|
1404
1412
|
oldParamInformation.format === safe_1.ConfigValueFormat.SignedInteger;
|
|
1405
|
-
this.extendParamInformation(applHost, this.
|
|
1413
|
+
this.extendParamInformation(applHost, this.parameter, undefined, (0, safe_1.getIntegerLimits)(this.valueSize, isSigned));
|
|
1406
1414
|
}
|
|
1407
1415
|
// And store the value itself
|
|
1408
1416
|
// If we have partial config params defined, we need to split the value
|
|
1409
|
-
const partialParams = this.getPartialParamInfos(applHost, this.
|
|
1417
|
+
const partialParams = this.getPartialParamInfos(applHost, this.parameter);
|
|
1410
1418
|
if (partialParams.length > 0) {
|
|
1411
1419
|
for (const param of partialParams) {
|
|
1412
1420
|
if (typeof param.propertyKey === "number") {
|
|
1413
1421
|
valueDB.setValue({
|
|
1414
1422
|
commandClass: this.ccId,
|
|
1415
|
-
property: this.
|
|
1423
|
+
property: this.parameter,
|
|
1416
1424
|
propertyKey: param.propertyKey,
|
|
1417
|
-
}, (0, safe_1.parsePartial)(this.
|
|
1425
|
+
}, (0, safe_1.parsePartial)(this.value, param.propertyKey, isSignedPartial(param.propertyKey, param.metadata.format)));
|
|
1418
1426
|
}
|
|
1419
1427
|
}
|
|
1420
1428
|
}
|
|
@@ -1422,19 +1430,21 @@ let ConfigurationCCReport = class ConfigurationCCReport extends ConfigurationCC
|
|
|
1422
1430
|
// This is a single param
|
|
1423
1431
|
valueDB.setValue({
|
|
1424
1432
|
commandClass: this.ccId,
|
|
1425
|
-
property: this.
|
|
1426
|
-
}, this.
|
|
1433
|
+
property: this.parameter,
|
|
1434
|
+
}, this.value);
|
|
1427
1435
|
}
|
|
1428
1436
|
return true;
|
|
1429
1437
|
}
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
+
serialize() {
|
|
1439
|
+
this.payload = Buffer.concat([
|
|
1440
|
+
Buffer.from([this.parameter, this.valueSize & 0b111]),
|
|
1441
|
+
Buffer.allocUnsafe(this.valueSize),
|
|
1442
|
+
]);
|
|
1443
|
+
const valueFormat = typeof this.value === "number"
|
|
1444
|
+
? this.valueFormat ?? safe_1.ConfigValueFormat.SignedInteger
|
|
1445
|
+
: safe_1.ConfigValueFormat.BitField;
|
|
1446
|
+
serializeValue(this.payload, 2, this.valueSize, valueFormat, this.value);
|
|
1447
|
+
return super.serialize();
|
|
1438
1448
|
}
|
|
1439
1449
|
toLogEntry(applHost) {
|
|
1440
1450
|
return {
|
|
@@ -1459,8 +1469,9 @@ let ConfigurationCCGet = class ConfigurationCCGet extends ConfigurationCC {
|
|
|
1459
1469
|
constructor(host, options) {
|
|
1460
1470
|
super(host, options);
|
|
1461
1471
|
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
1462
|
-
|
|
1463
|
-
|
|
1472
|
+
(0, safe_1.validatePayload)(this.payload.length >= 1);
|
|
1473
|
+
this.parameter = this.payload[0];
|
|
1474
|
+
this.allowUnexpectedResponse = false;
|
|
1464
1475
|
}
|
|
1465
1476
|
else {
|
|
1466
1477
|
this.parameter = options.parameter;
|
|
@@ -1488,8 +1499,14 @@ let ConfigurationCCSet = class ConfigurationCCSet extends ConfigurationCC {
|
|
|
1488
1499
|
constructor(host, options) {
|
|
1489
1500
|
super(host, options);
|
|
1490
1501
|
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
1491
|
-
|
|
1492
|
-
|
|
1502
|
+
(0, safe_1.validatePayload)(this.payload.length >= 2);
|
|
1503
|
+
this.parameter = this.payload[0];
|
|
1504
|
+
this.resetToDefault = !!(this.payload[1] & 128);
|
|
1505
|
+
this.valueSize = this.payload[1] & 0b111;
|
|
1506
|
+
// Ensure we received a valid report
|
|
1507
|
+
(0, safe_1.validatePayload)(this.valueSize >= 1, this.valueSize <= 4, this.payload.length >= 2 + this.valueSize);
|
|
1508
|
+
// Parse the value as signed integer. We don't know the format here.
|
|
1509
|
+
this.value = parseValue(this.payload.slice(2), this.valueSize, safe_1.ConfigValueFormat.SignedInteger);
|
|
1493
1510
|
}
|
|
1494
1511
|
else {
|
|
1495
1512
|
this.parameter = options.parameter;
|
|
@@ -1809,6 +1826,7 @@ let ConfigurationCCNameReport = class ConfigurationCCNameReport extends Configur
|
|
|
1809
1826
|
return false;
|
|
1810
1827
|
this.extendParamInformation(applHost, this.parameter, undefined, {
|
|
1811
1828
|
name: this.name,
|
|
1829
|
+
label: this.name,
|
|
1812
1830
|
});
|
|
1813
1831
|
return true;
|
|
1814
1832
|
}
|
|
@@ -1879,44 +1897,51 @@ exports.ConfigurationCCNameGet = ConfigurationCCNameGet;
|
|
|
1879
1897
|
let ConfigurationCCInfoReport = class ConfigurationCCInfoReport extends ConfigurationCC {
|
|
1880
1898
|
constructor(host, options) {
|
|
1881
1899
|
super(host, options);
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1900
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
1901
|
+
// Parameter and # of reports must be present
|
|
1902
|
+
(0, safe_1.validatePayload)(this.payload.length >= 3);
|
|
1903
|
+
this.parameter = this.payload.readUInt16BE(0);
|
|
1904
|
+
this.reportsToFollow = this.payload[2];
|
|
1905
|
+
if (this.reportsToFollow > 0) {
|
|
1906
|
+
// If more reports follow, the info must at least be one byte
|
|
1907
|
+
(0, safe_1.validatePayload)(this.payload.length >= 4);
|
|
1908
|
+
}
|
|
1909
|
+
this.info = this.payload.slice(3).toString("utf8");
|
|
1910
|
+
}
|
|
1911
|
+
else {
|
|
1912
|
+
this.parameter = options.parameter;
|
|
1913
|
+
this.info = options.info;
|
|
1914
|
+
this.reportsToFollow = options.reportsToFollow;
|
|
1889
1915
|
}
|
|
1890
|
-
this._info = this.payload.slice(3).toString("utf8");
|
|
1891
1916
|
}
|
|
1892
1917
|
persistValues(applHost) {
|
|
1893
1918
|
if (!super.persistValues(applHost))
|
|
1894
1919
|
return false;
|
|
1895
|
-
this.extendParamInformation(applHost, this.
|
|
1896
|
-
info: this.
|
|
1920
|
+
this.extendParamInformation(applHost, this.parameter, undefined, {
|
|
1921
|
+
info: this.info,
|
|
1922
|
+
description: this.info,
|
|
1897
1923
|
});
|
|
1898
1924
|
return true;
|
|
1899
1925
|
}
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
return this._reportsToFollow;
|
|
1926
|
+
serialize() {
|
|
1927
|
+
const infoBuffer = Buffer.from(this.info, "utf8");
|
|
1928
|
+
this.payload = Buffer.allocUnsafe(3 + infoBuffer.length);
|
|
1929
|
+
this.payload.writeUInt16BE(this.parameter, 0);
|
|
1930
|
+
this.payload[2] = this.reportsToFollow;
|
|
1931
|
+
infoBuffer.copy(this.payload, 3);
|
|
1932
|
+
return super.serialize();
|
|
1908
1933
|
}
|
|
1909
1934
|
getPartialCCSessionId() {
|
|
1910
1935
|
// Distinguish sessions by the parameter number
|
|
1911
|
-
return { parameter: this.
|
|
1936
|
+
return { parameter: this.parameter };
|
|
1912
1937
|
}
|
|
1913
1938
|
expectMoreMessages() {
|
|
1914
|
-
return this.
|
|
1939
|
+
return this.reportsToFollow > 0;
|
|
1915
1940
|
}
|
|
1916
1941
|
mergePartialCCs(applHost, partials) {
|
|
1917
1942
|
// Concat the info
|
|
1918
|
-
this.
|
|
1919
|
-
.map((report) => report.
|
|
1943
|
+
this.info = [...partials, this]
|
|
1944
|
+
.map((report) => report.info)
|
|
1920
1945
|
.reduce((prev, cur) => prev + cur, "");
|
|
1921
1946
|
}
|
|
1922
1947
|
toLogEntry(applHost) {
|
|
@@ -1938,8 +1963,8 @@ let ConfigurationCCInfoGet = class ConfigurationCCInfoGet extends ConfigurationC
|
|
|
1938
1963
|
constructor(host, options) {
|
|
1939
1964
|
super(host, options);
|
|
1940
1965
|
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
1941
|
-
|
|
1942
|
-
|
|
1966
|
+
(0, safe_1.validatePayload)(this.payload.length >= 2);
|
|
1967
|
+
this.parameter = this.payload.readUInt16BE(0);
|
|
1943
1968
|
}
|
|
1944
1969
|
else {
|
|
1945
1970
|
this.parameter = options.parameter;
|
|
@@ -1965,128 +1990,153 @@ exports.ConfigurationCCInfoGet = ConfigurationCCInfoGet;
|
|
|
1965
1990
|
let ConfigurationCCPropertiesReport = class ConfigurationCCPropertiesReport extends ConfigurationCC {
|
|
1966
1991
|
constructor(host, options) {
|
|
1967
1992
|
super(host, options);
|
|
1968
|
-
(0,
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
this.
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
if (this.
|
|
1983
|
-
this.
|
|
1993
|
+
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
1994
|
+
(0, safe_1.validatePayload)(this.payload.length >= 3);
|
|
1995
|
+
this.parameter = this.payload.readUInt16BE(0);
|
|
1996
|
+
this.valueFormat = (this.payload[2] & 0b111000) >>> 3;
|
|
1997
|
+
this.valueSize = this.payload[2] & 0b111;
|
|
1998
|
+
// GH#1309 Some devices don't tell us the first parameter if we query #0
|
|
1999
|
+
// Instead, they contain 0x000000
|
|
2000
|
+
if (this.valueSize === 0 && this.payload.length < 5) {
|
|
2001
|
+
this.nextParameter = 0;
|
|
2002
|
+
return;
|
|
2003
|
+
}
|
|
2004
|
+
// Ensure the payload contains the two bytes for next parameter
|
|
2005
|
+
const nextParameterOffset = 3 + 3 * this.valueSize;
|
|
2006
|
+
(0, safe_1.validatePayload)(this.payload.length >= nextParameterOffset + 2);
|
|
2007
|
+
if (this.valueSize > 0) {
|
|
2008
|
+
if (this.valueFormat !== safe_1.ConfigValueFormat.BitField) {
|
|
2009
|
+
this.minValue = parseValue(this.payload.slice(3), this.valueSize, this.valueFormat);
|
|
2010
|
+
}
|
|
2011
|
+
this.maxValue = parseValue(this.payload.slice(3 + this.valueSize), this.valueSize, this.valueFormat);
|
|
2012
|
+
this.defaultValue = parseValue(this.payload.slice(3 + 2 * this.valueSize), this.valueSize, this.valueFormat);
|
|
2013
|
+
}
|
|
2014
|
+
if (this.version < 4) {
|
|
2015
|
+
// Read the last 2 bytes to work around nodes not omitting min/max value when their size is 0
|
|
2016
|
+
this.nextParameter = this.payload.readUInt16BE(this.payload.length - 2);
|
|
2017
|
+
}
|
|
2018
|
+
else {
|
|
2019
|
+
this.nextParameter =
|
|
2020
|
+
this.payload.readUInt16BE(nextParameterOffset);
|
|
2021
|
+
// Ensure the payload contains a byte for the 2nd option flags
|
|
2022
|
+
(0, safe_1.validatePayload)(this.payload.length >= nextParameterOffset + 3);
|
|
2023
|
+
const options1 = this.payload[2];
|
|
2024
|
+
const options2 = this.payload[3 + 3 * this.valueSize + 2];
|
|
2025
|
+
this.altersCapabilities = !!(options1 & 128);
|
|
2026
|
+
this.isReadonly = !!(options1 & 64);
|
|
2027
|
+
this.isAdvanced = !!(options2 & 0b1);
|
|
2028
|
+
this.noBulkSupport = !!(options2 & 0b10);
|
|
1984
2029
|
}
|
|
1985
|
-
this._maxValue = parseValue(this.payload.slice(3 + this._valueSize), this._valueSize, this._valueFormat);
|
|
1986
|
-
this._defaultValue = parseValue(this.payload.slice(3 + 2 * this._valueSize), this._valueSize, this._valueFormat);
|
|
1987
|
-
}
|
|
1988
|
-
if (this.version < 4) {
|
|
1989
|
-
// Read the last 2 bytes to work around nodes not omitting min/max value when their size is 0
|
|
1990
|
-
this._nextParameter = this.payload.readUInt16BE(this.payload.length - 2);
|
|
1991
2030
|
}
|
|
1992
2031
|
else {
|
|
1993
|
-
this.
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2032
|
+
this.parameter = options.parameter;
|
|
2033
|
+
this.valueSize = options.valueSize;
|
|
2034
|
+
this.valueFormat = options.valueFormat;
|
|
2035
|
+
if (this.valueSize > 0) {
|
|
2036
|
+
if (options.minValue == undefined) {
|
|
2037
|
+
throw new safe_1.ZWaveError("The minimum value must be set when the value size is non-zero", safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
2038
|
+
}
|
|
2039
|
+
else if (options.maxValue == undefined) {
|
|
2040
|
+
throw new safe_1.ZWaveError("The maximum value must be set when the value size is non-zero", safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
2041
|
+
}
|
|
2042
|
+
else if (options.defaultValue == undefined) {
|
|
2043
|
+
throw new safe_1.ZWaveError("The default value must be set when the value size is non-zero", safe_1.ZWaveErrorCodes.Argument_Invalid);
|
|
2044
|
+
}
|
|
2045
|
+
this.minValue = options.minValue;
|
|
2046
|
+
this.maxValue = options.maxValue;
|
|
2047
|
+
this.defaultValue = options.defaultValue;
|
|
2048
|
+
}
|
|
2049
|
+
this.nextParameter = options.nextParameter;
|
|
2050
|
+
this.altersCapabilities = options.altersCapabilities;
|
|
2051
|
+
this.isReadonly = options.isReadonly;
|
|
2052
|
+
this.isAdvanced = options.isAdvanced;
|
|
2053
|
+
this.noBulkSupport = options.noBulkSupport;
|
|
2003
2054
|
}
|
|
2004
2055
|
}
|
|
2005
2056
|
persistValues(applHost) {
|
|
2006
2057
|
if (!super.persistValues(applHost))
|
|
2007
2058
|
return false;
|
|
2008
2059
|
// If we actually received parameter info, store it
|
|
2009
|
-
if (this.
|
|
2010
|
-
const valueType = this.
|
|
2011
|
-
this.
|
|
2060
|
+
if (this.valueSize > 0) {
|
|
2061
|
+
const valueType = this.valueFormat === safe_1.ConfigValueFormat.SignedInteger ||
|
|
2062
|
+
this.valueFormat === safe_1.ConfigValueFormat.UnsignedInteger
|
|
2012
2063
|
? "number"
|
|
2013
2064
|
: "number[]";
|
|
2014
2065
|
const paramInfo = (0, safe_1.stripUndefined)({
|
|
2015
2066
|
type: valueType,
|
|
2016
|
-
|
|
2017
|
-
valueSize: this.
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
requiresReInclusion: this.
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2067
|
+
format: this.valueFormat,
|
|
2068
|
+
valueSize: this.valueSize,
|
|
2069
|
+
min: this.minValue,
|
|
2070
|
+
max: this.maxValue,
|
|
2071
|
+
default: this.defaultValue,
|
|
2072
|
+
requiresReInclusion: this.altersCapabilities,
|
|
2073
|
+
readable: true,
|
|
2074
|
+
writeable: !this.isReadonly,
|
|
2075
|
+
allowManualEntry: true,
|
|
2076
|
+
isAdvanced: this.isAdvanced,
|
|
2077
|
+
noBulkSupport: this.noBulkSupport,
|
|
2078
|
+
isFromConfig: false,
|
|
2025
2079
|
});
|
|
2026
|
-
this.extendParamInformation(applHost, this.
|
|
2080
|
+
this.extendParamInformation(applHost, this.parameter, undefined, paramInfo);
|
|
2027
2081
|
}
|
|
2028
2082
|
return true;
|
|
2029
2083
|
}
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
return this._isAdvanced;
|
|
2059
|
-
}
|
|
2060
|
-
get noBulkSupport() {
|
|
2061
|
-
return this._noBulkSupport;
|
|
2084
|
+
serialize() {
|
|
2085
|
+
this.payload = Buffer.allocUnsafe(3 + // preamble
|
|
2086
|
+
3 * this.valueSize + // min, max, default value
|
|
2087
|
+
2);
|
|
2088
|
+
this.payload.writeUInt16BE(this.parameter, 0);
|
|
2089
|
+
const options1 = (this.altersCapabilities ? 128 : 0) |
|
|
2090
|
+
(this.isReadonly ? 64 : 0) |
|
|
2091
|
+
((this.valueFormat & 0b111) << 3) |
|
|
2092
|
+
(this.valueSize & 0b111);
|
|
2093
|
+
this.payload[2] = options1;
|
|
2094
|
+
let offset = 3;
|
|
2095
|
+
if (this.valueSize > 0) {
|
|
2096
|
+
serializeValue(this.payload, offset, this.valueSize, this.valueFormat, this.minValue);
|
|
2097
|
+
offset += this.valueSize;
|
|
2098
|
+
serializeValue(this.payload, offset, this.valueSize, this.valueFormat, this.maxValue);
|
|
2099
|
+
offset += this.valueSize;
|
|
2100
|
+
serializeValue(this.payload, offset, this.valueSize, this.valueFormat, this.defaultValue);
|
|
2101
|
+
offset += this.valueSize;
|
|
2102
|
+
}
|
|
2103
|
+
this.payload.writeUInt16BE(this.nextParameter, offset);
|
|
2104
|
+
if (this.version >= 4) {
|
|
2105
|
+
const options2 = (this.isAdvanced ? 0b1 : 0) | (this.noBulkSupport ? 0b10 : 0);
|
|
2106
|
+
this.payload = Buffer.concat([
|
|
2107
|
+
this.payload,
|
|
2108
|
+
Buffer.from([options2]),
|
|
2109
|
+
]);
|
|
2110
|
+
}
|
|
2111
|
+
return super.serialize();
|
|
2062
2112
|
}
|
|
2063
2113
|
toLogEntry(applHost) {
|
|
2064
2114
|
const message = {
|
|
2065
|
-
"parameter #": this.
|
|
2066
|
-
"next param #": this.
|
|
2067
|
-
"value size": this.
|
|
2068
|
-
"value format": (0, safe_2.getEnumMemberName)(safe_1.ConfigValueFormat, this.
|
|
2115
|
+
"parameter #": this.parameter,
|
|
2116
|
+
"next param #": this.nextParameter,
|
|
2117
|
+
"value size": this.valueSize,
|
|
2118
|
+
"value format": (0, safe_2.getEnumMemberName)(safe_1.ConfigValueFormat, this.valueFormat),
|
|
2069
2119
|
};
|
|
2070
|
-
if (this.
|
|
2071
|
-
message["min value"] = configValueToString(this.
|
|
2120
|
+
if (this.minValue != undefined) {
|
|
2121
|
+
message["min value"] = configValueToString(this.minValue);
|
|
2072
2122
|
}
|
|
2073
|
-
if (this.
|
|
2074
|
-
message["max value"] = configValueToString(this.
|
|
2123
|
+
if (this.maxValue != undefined) {
|
|
2124
|
+
message["max value"] = configValueToString(this.maxValue);
|
|
2075
2125
|
}
|
|
2076
|
-
if (this.
|
|
2077
|
-
message["default value"] = configValueToString(this.
|
|
2126
|
+
if (this.defaultValue != undefined) {
|
|
2127
|
+
message["default value"] = configValueToString(this.defaultValue);
|
|
2078
2128
|
}
|
|
2079
|
-
if (this.
|
|
2080
|
-
message["alters capabilities"] = this.
|
|
2129
|
+
if (this.altersCapabilities != undefined) {
|
|
2130
|
+
message["alters capabilities"] = this.altersCapabilities;
|
|
2081
2131
|
}
|
|
2082
|
-
if (this.
|
|
2083
|
-
message.readonly = this.
|
|
2132
|
+
if (this.isReadonly != undefined) {
|
|
2133
|
+
message.readonly = this.isReadonly;
|
|
2084
2134
|
}
|
|
2085
|
-
if (this.
|
|
2086
|
-
message.advanced = this.
|
|
2135
|
+
if (this.isAdvanced != undefined) {
|
|
2136
|
+
message.advanced = this.isAdvanced;
|
|
2087
2137
|
}
|
|
2088
|
-
if (this.
|
|
2089
|
-
message["bulk support"] = !this.
|
|
2138
|
+
if (this.noBulkSupport != undefined) {
|
|
2139
|
+
message["bulk support"] = !this.noBulkSupport;
|
|
2090
2140
|
}
|
|
2091
2141
|
return {
|
|
2092
2142
|
...super.toLogEntry(applHost),
|
|
@@ -2102,8 +2152,8 @@ let ConfigurationCCPropertiesGet = class ConfigurationCCPropertiesGet extends Co
|
|
|
2102
2152
|
constructor(host, options) {
|
|
2103
2153
|
super(host, options);
|
|
2104
2154
|
if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
|
|
2105
|
-
|
|
2106
|
-
|
|
2155
|
+
(0, safe_1.validatePayload)(this.payload.length >= 2);
|
|
2156
|
+
this.parameter = this.payload.readUInt16BE(0);
|
|
2107
2157
|
}
|
|
2108
2158
|
else {
|
|
2109
2159
|
this.parameter = options.parameter;
|