Skip to content

Commit bbe4485

Browse files
authored
Set the order of token attributes for minimal diff upon resetting token config (#957)
The token attributes are being set in the following order: For Standard attributes: - All singleton attributes - All non singleton attributes - Both of the above are followed by subsequent ordering of cluster mfg code, attribute mfg code, endpoint identifier(smallest endpoint identifier for singleton), cluster code, attribute code Configuring the tests according to the above order
1 parent f838810 commit bbe4485

File tree

2 files changed

+39
-23
lines changed

2 files changed

+39
-23
lines changed

src-electron/db/query-attribute.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,15 +1086,31 @@ AND
10861086
ROW_NUMBER() OVER() + 45055 AS TOKEN_ID
10871087
FROM
10881088
(
1089-
${tokenSqlQuery} AND ENDPOINT_TYPE_ATTRIBUTE.SINGLETON = 0
1090-
UNION
1091-
${tokenSqlQuery} AND ENDPOINT_TYPE_ATTRIBUTE.SINGLETON = 1
1092-
GROUP BY
1093-
CLUSTER.CODE,
1094-
CLUSTER.MANUFACTURER_CODE,
1095-
ATTRIBUTE.CODE,
1096-
ATTRIBUTE.MANUFACTURER_CODE,
1097-
ATTRIBUTE.SIDE
1089+
SELECT * FROM (
1090+
${tokenSqlQuery} AND ENDPOINT_TYPE_ATTRIBUTE.SINGLETON = 0
1091+
UNION
1092+
${tokenSqlQuery} AND ENDPOINT_TYPE_ATTRIBUTE.SINGLETON = 1
1093+
GROUP BY
1094+
CLUSTER.CODE,
1095+
CLUSTER.MANUFACTURER_CODE,
1096+
ATTRIBUTE.CODE,
1097+
ATTRIBUTE.MANUFACTURER_CODE,
1098+
ATTRIBUTE.SIDE
1099+
)
1100+
ORDER BY
1101+
SINGLETON DESC,
1102+
CLUSTER_MANUFACTURER_CODE,
1103+
MANUFACTURER_CODE,
1104+
CASE
1105+
WHEN
1106+
SINGLETON = 1
1107+
THEN
1108+
SMALLEST_ENDPOINT_IDENTIFIER
1109+
ELSE
1110+
ENDPOINT_IDENTIFIER
1111+
END,
1112+
CLUSTER_CODE,
1113+
CODE
10981114
)
10991115
ORDER BY
11001116
TOKEN_ID

test/tokens.test.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -339,37 +339,37 @@ test(
339339
let header = genResult.content['zap-tokens-version-2.h']
340340

341341
// Singletons
342-
expect(header).toContain('#define CREATOR_STACK_VERSION_SINGLETON 0xB008')
342+
expect(header).toContain('#define CREATOR_STACK_VERSION_SINGLETON 0xB000')
343343
expect(header).toContain(
344-
'#define NVM3KEY_STACK_VERSION_SINGLETON (NVM3KEY_DOMAIN_ZIGBEE | 0xB008)'
344+
'#define NVM3KEY_STACK_VERSION_SINGLETON (NVM3KEY_DOMAIN_ZIGBEE | 0xB000)'
345345
)
346346

347-
expect(header).toContain('#define CREATOR_HW_VERSION_SINGLETON 0xB003')
347+
expect(header).toContain('#define CREATOR_HW_VERSION_SINGLETON 0xB001')
348348
expect(header).toContain(
349-
'#define NVM3KEY_HW_VERSION_SINGLETON (NVM3KEY_DOMAIN_ZIGBEE | 0xB003)'
349+
'#define NVM3KEY_HW_VERSION_SINGLETON (NVM3KEY_DOMAIN_ZIGBEE | 0xB001)'
350350
)
351351

352352
// Non-singletons
353-
expect(header).toContain('#define CREATOR_APPLICATION_VERSION_1 0xB000')
353+
expect(header).toContain('#define CREATOR_APPLICATION_VERSION_1 0xB002')
354354
expect(header).toContain(
355-
'#define NVM3KEY_APPLICATION_VERSION_1 (NVM3KEY_DOMAIN_ZIGBEE | 0xB000)'
355+
'#define NVM3KEY_APPLICATION_VERSION_1 (NVM3KEY_DOMAIN_ZIGBEE | 0xB002)'
356356
)
357357

358-
expect(header).toContain('#define CREATOR_APPLICATION_VERSION_7 0xB001')
358+
expect(header).toContain('#define CREATOR_APPLICATION_VERSION_7 0xB004')
359359
expect(header).toContain(
360-
'#define NVM3KEY_APPLICATION_VERSION_7 (NVM3KEY_DOMAIN_ZIGBEE | 0xB001)'
360+
'#define NVM3KEY_APPLICATION_VERSION_7 (NVM3KEY_DOMAIN_ZIGBEE | 0xB004)'
361361
)
362362

363-
expect(header).toContain('#define CREATOR_PRODUCT_CODE_1 0xB004')
363+
expect(header).toContain('#define CREATOR_PRODUCT_CODE_1 0xB003')
364364
expect(header).toContain(
365-
'#define NVM3KEY_PRODUCT_CODE_1 (NVM3KEY_DOMAIN_ZIGBEE | 0xB004)'
365+
'#define NVM3KEY_PRODUCT_CODE_1 (NVM3KEY_DOMAIN_ZIGBEE | 0xB003)'
366366
)
367367

368368
expect(header).toContain(
369-
'#define CREATOR_COLOR_CONTROL_COLOR_MODE_7 0xB002'
369+
'#define CREATOR_COLOR_CONTROL_COLOR_MODE_7 0xB008'
370370
)
371371
expect(header).toContain(
372-
'#define NVM3KEY_COLOR_CONTROL_COLOR_MODE_7 (NVM3KEY_DOMAIN_ZIGBEE | 0xB002)'
372+
'#define NVM3KEY_COLOR_CONTROL_COLOR_MODE_7 (NVM3KEY_DOMAIN_ZIGBEE | 0xB008)'
373373
)
374374

375375
expect(header).toContain(
@@ -380,10 +380,10 @@ test(
380380
)
381381

382382
expect(header).toContain(
383-
'#define CREATOR_COLOR_CONTROL_REMAINING_TIME_7 0xB006'
383+
'#define CREATOR_COLOR_CONTROL_REMAINING_TIME_7 0xB007'
384384
)
385385
expect(header).toContain(
386-
'#define NVM3KEY_COLOR_CONTROL_REMAINING_TIME_7 (NVM3KEY_DOMAIN_ZIGBEE | 0xB006)'
386+
'#define NVM3KEY_COLOR_CONTROL_REMAINING_TIME_7 (NVM3KEY_DOMAIN_ZIGBEE | 0xB007)'
387387
)
388388

389389
// DEFINETYPES

0 commit comments

Comments
 (0)