Skip to content

Commit

Permalink
Expose device class for device types.
Browse files Browse the repository at this point in the history
Also fixes endpoint-config codegen for the device type array: These are 32-bit
values, not 16-bit.
  • Loading branch information
bzbarsky-apple committed Oct 23, 2023
1 parent 1642f1b commit 2781563
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions src-electron/db/db-mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ exports.map = {
label: x.NAME,
name: x.NAME,
caption: x.DESCRIPTION,
class: x.CLASS,
}
},

Expand Down
8 changes: 4 additions & 4 deletions src-electron/db/query-device-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src-electron/generator/helper-endpointconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
Expand Down

0 comments on commit 2781563

Please sign in to comment.