Skip to content

Commit 3e60df7

Browse files
committed
Making sure the same named feature codes which exist on different bits of the cluster are handled correctly
Updating the zap schema as per the new changes JIRA: ZAPP-1346
1 parent 7fa6886 commit 3e60df7

File tree

7 files changed

+4358
-4059
lines changed

7 files changed

+4358
-4059
lines changed

docs/zap-schema.svg

+2,107-2,109
Loading

src-electron/db/query-device-type.js

+9
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,15 @@ SET
333333
FEATURE
334334
WHERE
335335
upper(FEATURE.CODE) = upper(DEVICE_TYPE_FEATURE.FEATURE_CODE)
336+
AND
337+
FEATURE.CLUSTER_REF = (
338+
SELECT
339+
DEVICE_TYPE_CLUSTER.CLUSTER_REF
340+
FROM
341+
DEVICE_TYPE_CLUSTER
342+
WHERE
343+
DEVICE_TYPE_CLUSTER_ID = DEVICE_TYPE_FEATURE.DEVICE_TYPE_CLUSTER_REF
344+
)
336345
AND
337346
FEATURE.PACKAGE_REF = ?
338347
)

src-electron/db/query-loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ async function insertDeviceTypeFeatures(db, dtClusterRefDataPairs) {
945945
dtClusterRefDataPairs.map((dtClusterRefDataPair) => {
946946
let dtClusterRef = dtClusterRefDataPair.dtClusterRef
947947
let clusterData = dtClusterRefDataPair.clusterData
948-
if ('features' in clusterData) {
948+
if ('features' in clusterData && clusterData.features.length > 0) {
949949
clusterData.features.forEach((featureCode) => {
950950
features.push([dtClusterRef, featureCode])
951951
})

test/multi-protocol.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ test(
166166
// Tests for the feature Map attribute compliance based on device type cluster features
167167
expect(
168168
sessionNotificationMessages.includes(
169-
'⚠ Check Device Type Compliance on endpoint: 1, device type: MA-onofflight, cluster: On/Off server needs bit 1 enabled in the Feature Map attribute'
169+
'⚠ Check Device Type Compliance on endpoint: 1, device type: MA-onofflight, cluster: On/Off server needs bit 0 enabled in the Feature Map attribute'
170170
)
171171
).toBeTruthy()
172172

@@ -184,7 +184,7 @@ test(
184184

185185
expect(
186186
sessionNotificationMessages.includes(
187-
'⚠ Check Device Type Compliance on endpoint: 1, device type: MA-dimmablelight, cluster: On/Off server needs bit 1 enabled in the Feature Map attribute'
187+
'⚠ Check Device Type Compliance on endpoint: 1, device type: MA-dimmablelight, cluster: On/Off server needs bit 0 enabled in the Feature Map attribute'
188188
)
189189
).toBeTruthy()
190190

zap-schema.dot

+147-9
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ digraph "SchemaCrawler_Diagram" {
2929
</tr>
3030
<tr>
3131
<td align='right'>generated on</td>
32-
<td align='left'>2023-11-30 15:16:08</td>
32+
<td align='left'>2024-04-15 15:19:11</td>
3333
</tr>
3434
</table>
3535
>
@@ -545,6 +545,7 @@ digraph "SchemaCrawler_Diagram" {
545545
"data_type_cluster_8d9f2ca9":"cluster_ref_62a2f505.start":w -> "cluster_5ec71239":"cluster_id_a557fe87.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
546546
"device_type_cluster_7298b97d":"cluster_ref_1cdb02b1.start":w -> "cluster_5ec71239":"cluster_id_a557fe87.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
547547
"endpoint_type_cluster_c12e3c9e":"cluster_ref_a0f5e3b0.start":w -> "cluster_5ec71239":"cluster_id_a557fe87.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
548+
"feature_f06e7b35":"cluster_ref_59bd77f9.start":w -> "cluster_5ec71239":"cluster_id_a557fe87.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
548549
"global_attribute_default_73c65a21":"cluster_ref_4161768d.start":w -> "cluster_5ec71239":"cluster_id_a557fe87.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
549550
"tag_1b7d9":"cluster_ref_3c91cfd5.start":w -> "cluster_5ec71239":"cluster_id_a557fe87.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
550551
"attribute_a6e02edb":"cluster_ref_71823913.start":w -> "cluster_5ec71239":"cluster_id_a557fe87.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
@@ -1071,6 +1072,7 @@ digraph "SchemaCrawler_Diagram" {
10711072

10721073
"device_type_attribute_ce5151f":"device_type_cluster_ref_c47e8093.start":w -> "device_type_cluster_7298b97d":"device_type_cluster_id_665321ff.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
10731074
"device_type_command_774386ce":"device_type_cluster_ref_a5ee44c4.start":w -> "device_type_cluster_7298b97d":"device_type_cluster_id_665321ff.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
1075+
"device_type_feature_4402279":"device_type_cluster_ref_b8851e79.start":w -> "device_type_cluster_7298b97d":"device_type_cluster_id_665321ff.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
10741076

10751077

10761078
/* DEVICE_TYPE_COMMAND -=-=-=-=-=-=-=-=-=-=-=-=-=- */
@@ -1102,6 +1104,35 @@ digraph "SchemaCrawler_Diagram" {
11021104

11031105

11041106

1107+
/* DEVICE_TYPE_FEATURE -=-=-=-=-=-=-=-=-=-=-=-=-=- */
1108+
"device_type_feature_4402279" [
1109+
label=<
1110+
<table border="1" cellborder="0" cellspacing="0" color="#888888">
1111+
<tr>
1112+
<td colspan='2' bgcolor='#F2E6C2' align='left'><b><i>DEVICE_TYPE_FEATURE</i></b></td>
1113+
<td bgcolor='#F2E6C2' align='right'>[table]</td>
1114+
</tr>
1115+
<tr>
1116+
<td port='device_type_cluster_ref_b8851e79.start' align='left'>DEVICE_TYPE_CLUSTER_REF</td>
1117+
<td align='left'> </td>
1118+
<td port='device_type_cluster_ref_b8851e79.end' align='left'>INTEGER</td>
1119+
</tr>
1120+
<tr>
1121+
<td port='feature_ref_edb34431.start' align='left'>FEATURE_REF</td>
1122+
<td align='left'> </td>
1123+
<td port='feature_ref_edb34431.end' align='left'>INTEGER</td>
1124+
</tr>
1125+
<tr>
1126+
<td port='feature_code_57b15a5d.start' align='left'>FEATURE_CODE</td>
1127+
<td align='left'> </td>
1128+
<td port='feature_code_57b15a5d.end' align='left'>TEXT</td>
1129+
</tr>
1130+
</table>
1131+
>
1132+
];
1133+
1134+
1135+
11051136
/* DISCRIMINATOR -=-=-=-=-=-=-=-=-=-=-=-=-=- */
11061137
"discriminator_4931d2db" [
11071138
label=<
@@ -1219,10 +1250,16 @@ digraph "SchemaCrawler_Diagram" {
12191250
<td align='left'> </td>
12201251
<td port='network_identifier_beb21006.end' align='left'>INTEGER</td>
12211252
</tr>
1253+
<tr>
1254+
<td port='parent_endpoint_ref_600434ca.start' align='left'>PARENT_ENDPOINT_REF</td>
1255+
<td align='left'> </td>
1256+
<td port='parent_endpoint_ref_600434ca.end' align='left'>INTEGER</td>
1257+
</tr>
12221258
</table>
12231259
>
12241260
];
12251261

1262+
"endpoint_966d81f4":"parent_endpoint_ref_600434ca.start":w -> "endpoint_966d81f4":"endpoint_id_73e3b891.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
12261263

12271264

12281265
/* ENDPOINT_TYPE -=-=-=-=-=-=-=-=-=-=-=-=-=- */
@@ -1244,9 +1281,9 @@ digraph "SchemaCrawler_Diagram" {
12441281
<td align='left'>auto-incremented</td>
12451282
</tr>
12461283
<tr>
1247-
<td port='session_ref_f1b3f387.start' align='left'>SESSION_REF</td>
1284+
<td port='session_partition_ref_83bb17d2.start' align='left'>SESSION_PARTITION_REF</td>
12481285
<td align='left'> </td>
1249-
<td port='session_ref_f1b3f387.end' align='left'>INTEGER</td>
1286+
<td port='session_partition_ref_83bb17d2.end' align='left'>INTEGER</td>
12501287
</tr>
12511288
<tr>
12521289
<td port='name_72c816e8.start' align='left'>NAME</td>
@@ -1257,9 +1294,9 @@ digraph "SchemaCrawler_Diagram" {
12571294
>
12581295
];
12591296

1260-
"endpoint_966d81f4":"endpoint_type_ref_80c21de4.start":w -> "endpoint_type_9857dc03":"endpoint_type_id_960ad7f3.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
12611297
"endpoint_type_cluster_c12e3c9e":"endpoint_type_ref_ae18b87a.start":w -> "endpoint_type_9857dc03":"endpoint_type_id_960ad7f3.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
12621298
"endpoint_type_device_e685fbb0":"endpoint_type_ref_33b8dba8.start":w -> "endpoint_type_9857dc03":"endpoint_type_id_960ad7f3.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
1299+
"endpoint_966d81f4":"endpoint_type_ref_80c21de4.start":w -> "endpoint_type_9857dc03":"endpoint_type_id_960ad7f3.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
12631300
"endpoint_type_attribute_c265400":"endpoint_type_ref_c2238d58.start":w -> "endpoint_type_9857dc03":"endpoint_type_id_960ad7f3.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
12641301
"endpoint_type_command_c5d909ef":"endpoint_type_ref_3ec79549.start":w -> "endpoint_type_9857dc03":"endpoint_type_id_960ad7f3.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
12651302
"endpoint_type_event_e67d6e7e":"endpoint_type_ref_32afc29a.start":w -> "endpoint_type_9857dc03":"endpoint_type_id_960ad7f3.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
@@ -1782,6 +1819,71 @@ digraph "SchemaCrawler_Diagram" {
17821819

17831820

17841821

1822+
/* FEATURE -=-=-=-=-=-=-=-=-=-=-=-=-=- */
1823+
"feature_f06e7b35" [
1824+
label=<
1825+
<table border="1" cellborder="0" cellspacing="0" color="#888888">
1826+
<tr>
1827+
<td colspan='2' bgcolor='#F2E6C2' align='left'><b><i>FEATURE</i></b></td>
1828+
<td bgcolor='#F2E6C2' align='right'>[table]</td>
1829+
</tr>
1830+
<tr>
1831+
<td port='feature_id_314fda8f.start' align='left'><b><i>FEATURE_ID</i></b></td>
1832+
<td align='left'> </td>
1833+
<td port='feature_id_314fda8f.end' align='left'>INTEGER</td>
1834+
</tr>
1835+
<tr>
1836+
<td align='left'></td>
1837+
<td align='left'> </td>
1838+
<td align='left'>auto-incremented</td>
1839+
</tr>
1840+
<tr>
1841+
<td port='name_1d855df6.start' align='left'>NAME</td>
1842+
<td align='left'> </td>
1843+
<td port='name_1d855df6.end' align='left'>TEXT</td>
1844+
</tr>
1845+
<tr>
1846+
<td port='code_1d809158.start' align='left'>CODE</td>
1847+
<td align='left'> </td>
1848+
<td port='code_1d809158.end' align='left'>TEXT</td>
1849+
</tr>
1850+
<tr>
1851+
<td port='bit_1d61ec58.start' align='left'>BIT</td>
1852+
<td align='left'> </td>
1853+
<td port='bit_1d61ec58.end' align='left'>INTEGER</td>
1854+
</tr>
1855+
<tr>
1856+
<td port='default_value_5c536d1e.start' align='left'>DEFAULT_VALUE</td>
1857+
<td align='left'> </td>
1858+
<td port='default_value_5c536d1e.end' align='left'>INTEGER</td>
1859+
</tr>
1860+
<tr>
1861+
<td port='description_36ea0347.start' align='left'>DESCRIPTION</td>
1862+
<td align='left'> </td>
1863+
<td port='description_36ea0347.end' align='left'>TEXT</td>
1864+
</tr>
1865+
<tr>
1866+
<td port='conformance_efa72ae0.start' align='left'>CONFORMANCE</td>
1867+
<td align='left'> </td>
1868+
<td port='conformance_efa72ae0.end' align='left'>TEXT</td>
1869+
</tr>
1870+
<tr>
1871+
<td port='package_ref_d3f59445.start' align='left'>PACKAGE_REF</td>
1872+
<td align='left'> </td>
1873+
<td port='package_ref_d3f59445.end' align='left'>INTEGER</td>
1874+
</tr>
1875+
<tr>
1876+
<td port='cluster_ref_59bd77f9.start' align='left'>CLUSTER_REF</td>
1877+
<td align='left'> </td>
1878+
<td port='cluster_ref_59bd77f9.end' align='left'>INTEGER</td>
1879+
</tr>
1880+
</table>
1881+
>
1882+
];
1883+
1884+
"device_type_feature_4402279":"feature_ref_edb34431.start":w -> "feature_f06e7b35":"feature_id_314fda8f.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
1885+
1886+
17851887
/* GLOBAL_ATTRIBUTE_BIT -=-=-=-=-=-=-=-=-=-=-=-=-=- */
17861888
"global_attribute_bit_e934f16d" [
17871889
label=<
@@ -1996,6 +2098,7 @@ digraph "SchemaCrawler_Diagram" {
19962098
"data_type_9233070e":"package_ref_6ac2838c.start":w -> "package_fab13485":"package_id_7a1f4fef.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
19972099
"default_access_7ba041a1":"package_ref_aefc9b59.start":w -> "package_fab13485":"package_id_7a1f4fef.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
19982100
"domain_78873d23":"package_ref_4ef51017.start":w -> "package_fab13485":"package_id_7a1f4fef.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
2101+
"feature_f06e7b35":"package_ref_d3f59445.start":w -> "package_fab13485":"package_id_7a1f4fef.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
19992102
"package_option_default_64a251ef":"package_ref_e63c94cb.start":w -> "package_fab13485":"package_id_7a1f4fef.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
20002103
"session_package_61fa13bc":"package_ref_93dd0c9e.start":w -> "package_fab13485":"package_id_7a1f4fef.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
20012104
"tag_1b7d9":"package_ref_b6c9ec21.start":w -> "package_fab13485":"package_id_7a1f4fef.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
@@ -2379,13 +2482,12 @@ digraph "SchemaCrawler_Diagram" {
23792482
>
23802483
];
23812484

2382-
"endpoint_type_9857dc03":"session_ref_f1b3f387.start":w -> "session_a11c82d5":"session_id_26c1b4f.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
23832485
"session_key_value_334d9527":"session_ref_b5755ee3.start":w -> "session_a11c82d5":"session_id_26c1b4f.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
23842486
"session_log_7f10ae3a":"session_ref_e2156830.start":w -> "session_a11c82d5":"session_id_26c1b4f.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
23852487
"session_notice_84addd20":"session_ref_901e160a.start":w -> "session_a11c82d5":"session_id_26c1b4f.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
2386-
"endpoint_966d81f4":"session_ref_b6530bb6.start":w -> "session_a11c82d5":"session_id_26c1b4f.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
2488+
"session_partition_f35f84a0":"session_ref_f7a15e8a.start":w -> "session_a11c82d5":"session_id_26c1b4f.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
23872489
"package_extension_value_8e65d377":"session_ref_bd64ea93.start":w -> "session_a11c82d5":"session_id_26c1b4f.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
2388-
"session_package_61fa13bc":"session_ref_5c58b2ee.start":w -> "session_a11c82d5":"session_id_26c1b4f.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
2490+
"endpoint_966d81f4":"session_ref_b6530bb6.start":w -> "session_a11c82d5":"session_id_26c1b4f.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
23892491

23902492

23912493
/* SESSION_KEY_VALUE -=-=-=-=-=-=-=-=-=-=-=-=-=- */
@@ -2509,9 +2611,9 @@ digraph "SchemaCrawler_Diagram" {
25092611
<td bgcolor='#F2E6C2' align='right'>[table]</td>
25102612
</tr>
25112613
<tr>
2512-
<td port='session_ref_5c58b2ee.start' align='left'>SESSION_REF</td>
2614+
<td port='session_partition_ref_ee5fd739.start' align='left'>SESSION_PARTITION_REF</td>
25132615
<td align='left'> </td>
2514-
<td port='session_ref_5c58b2ee.end' align='left'>INTEGER</td>
2616+
<td port='session_partition_ref_ee5fd739.end' align='left'>INTEGER</td>
25152617
</tr>
25162618
<tr>
25172619
<td port='package_ref_93dd0c9e.start' align='left'>PACKAGE_REF</td>
@@ -2534,6 +2636,42 @@ digraph "SchemaCrawler_Diagram" {
25342636

25352637

25362638

2639+
/* SESSION_PARTITION -=-=-=-=-=-=-=-=-=-=-=-=-=- */
2640+
"session_partition_f35f84a0" [
2641+
label=<
2642+
<table border="1" cellborder="0" cellspacing="0" color="#888888">
2643+
<tr>
2644+
<td colspan='2' bgcolor='#F2E6C2' align='left'><b><i>SESSION_PARTITION</i></b></td>
2645+
<td bgcolor='#F2E6C2' align='right'>[table]</td>
2646+
</tr>
2647+
<tr>
2648+
<td port='session_partition_id_dc36f939.start' align='left'><b><i>SESSION_PARTITION_ID</i></b></td>
2649+
<td align='left'> </td>
2650+
<td port='session_partition_id_dc36f939.end' align='left'>INTEGER</td>
2651+
</tr>
2652+
<tr>
2653+
<td align='left'></td>
2654+
<td align='left'> </td>
2655+
<td align='left'>auto-incremented</td>
2656+
</tr>
2657+
<tr>
2658+
<td port='session_partition_number_6aa83067.start' align='left'>SESSION_PARTITION_NUMBER</td>
2659+
<td align='left'> </td>
2660+
<td port='session_partition_number_6aa83067.end' align='left'>INTEGER</td>
2661+
</tr>
2662+
<tr>
2663+
<td port='session_ref_f7a15e8a.start' align='left'>SESSION_REF</td>
2664+
<td align='left'> </td>
2665+
<td port='session_ref_f7a15e8a.end' align='left'>INTEGER</td>
2666+
</tr>
2667+
</table>
2668+
>
2669+
];
2670+
2671+
"endpoint_type_9857dc03":"session_partition_ref_83bb17d2.start":w -> "session_partition_f35f84a0":"session_partition_id_dc36f939.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
2672+
"session_package_61fa13bc":"session_partition_ref_ee5fd739.start":w -> "session_partition_f35f84a0":"session_partition_id_dc36f939.end":e [label=<> style="solid" dir="both" arrowhead="teetee" arrowtail="crowodot"];
2673+
2674+
25372675
/* SETTING -=-=-=-=-=-=-=-=-=-=-=-=-=- */
25382676
"setting_a12b0e8f" [
25392677
label=<

0 commit comments

Comments
 (0)