From 27815630c692f837434e88dbdfc5089333d18387 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 23 Oct 2023 15:57:22 -0400 Subject: [PATCH] Expose device class for device types. Also fixes endpoint-config codegen for the device type array: These are 32-bit values, not 16-bit. --- src-electron/db/db-mapping.js | 1 + src-electron/db/query-device-type.js | 8 ++++---- src-electron/generator/helper-endpointconfig.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src-electron/db/db-mapping.js b/src-electron/db/db-mapping.js index fcb813b84a..4b493b18cc 100644 --- a/src-electron/db/db-mapping.js +++ b/src-electron/db/db-mapping.js @@ -381,6 +381,7 @@ exports.map = { label: x.NAME, name: x.NAME, caption: x.DESCRIPTION, + class: x.CLASS, } }, diff --git a/src-electron/db/query-device-type.js b/src-electron/db/query-device-type.js index 70819958e7..cde005ad44 100644 --- a/src-electron/db/query-device-type.js +++ b/src-electron/db/query-device-type.js @@ -34,7 +34,7 @@ async function selectAllDeviceTypes(db, packageId) { return dbApi .dbAll( db, - 'SELECT DEVICE_TYPE_ID, DOMAIN, CODE, PROFILE_ID, NAME, DESCRIPTION FROM DEVICE_TYPE WHERE PACKAGE_REF = ? ORDER BY DOMAIN, CODE', + 'SELECT DEVICE_TYPE_ID, DOMAIN, CODE, PROFILE_ID, NAME, DESCRIPTION, CLASS FROM DEVICE_TYPE WHERE PACKAGE_REF = ? ORDER BY DOMAIN, CODE', [packageId] ) .then((rows) => rows.map(dbMapping.map.deviceType)) @@ -51,7 +51,7 @@ async function selectDeviceTypeById(db, id) { return dbApi .dbGet( db, - 'SELECT DEVICE_TYPE_ID, DOMAIN, CODE, PROFILE_ID, NAME, DESCRIPTION FROM DEVICE_TYPE WHERE DEVICE_TYPE_ID = ?', + 'SELECT DEVICE_TYPE_ID, DOMAIN, CODE, PROFILE_ID, NAME, DESCRIPTION, CLASS FROM DEVICE_TYPE WHERE DEVICE_TYPE_ID = ?', [id] ) .then(dbMapping.map.deviceType) @@ -70,7 +70,7 @@ async function selectDeviceTypeByCodeAndName(db, packageId, code, name) { return dbApi .dbGet( db, - 'SELECT DEVICE_TYPE_ID, DOMAIN, CODE, PROFILE_ID, NAME, DESCRIPTION FROM DEVICE_TYPE WHERE CODE = ? AND NAME = ? AND PACKAGE_REF = ? ', + 'SELECT DEVICE_TYPE_ID, DOMAIN, CODE, PROFILE_ID, NAME, DESCRIPTION, CLASS FROM DEVICE_TYPE WHERE CODE = ? AND NAME = ? AND PACKAGE_REF = ? ', [code, name, packageId] ) .then(dbMapping.map.deviceType) @@ -89,7 +89,7 @@ async function selectDeviceTypeByCode(db, packageId, code) { return dbApi .dbGet( db, - 'SELECT DEVICE_TYPE_ID, DOMAIN, CODE, PROFILE_ID, NAME, DESCRIPTION FROM DEVICE_TYPE WHERE CODE = ? AND PACKAGE_REF = ? ', + 'SELECT DEVICE_TYPE_ID, DOMAIN, CODE, PROFILE_ID, NAME, DESCRIPTION, CLASS FROM DEVICE_TYPE WHERE CODE = ? AND PACKAGE_REF = ? ', [code, packageId] ) .then(dbMapping.map.deviceType) diff --git a/src-electron/generator/helper-endpointconfig.js b/src-electron/generator/helper-endpointconfig.js index 4f6594debc..8401e43d97 100644 --- a/src-electron/generator/helper-endpointconfig.js +++ b/src-electron/generator/helper-endpointconfig.js @@ -361,7 +361,7 @@ async function endpoint_fixed_device_type_array(options) { ret += '{' + '0x' + - bin.int16ToHex(deviceList[i].deviceId) + + bin.int32ToHex(deviceList[i].deviceId) + ',' + deviceList[i].deviceVersion.toString() + endpointIdentifier +