From 6eba50d94952b83c3de21061f59effc76c097f31 Mon Sep 17 00:00:00 2001 From: Bharat Raju Date: Wed, 23 Aug 2023 14:15:51 -0400 Subject: [PATCH] Adding device type constraints per endpoint in Matter (#1104) - Add Class, Scope and superset to the device type table - Updating the loader to insert the above into the database properly - Create a trigger for the device type constraint which can be used while creating a new endpoint or updating an existing one - Catching the above constraints and throwing those as notifications into the front end - Updating the schema - Github: ZAP#1090 --- docs/zap-schema.svg | 2359 +++++++++-------- src-electron/db/query-config.js | 95 +- src-electron/db/query-loader.js | 13 +- src-electron/db/query-session-notification.js | 1 + src-electron/db/zap-schema.sql | 80 + src-electron/zcl/zcl-loader-silabs.js | 54 +- 6 files changed, 1421 insertions(+), 1181 deletions(-) diff --git a/docs/zap-schema.svg b/docs/zap-schema.svg index 164019c872..9961fcffe9 100644 --- a/docs/zap-schema.svg +++ b/docs/zap-schema.svg @@ -1,164 +1,164 @@ - - - + + SchemaCrawler_Diagram - + generated by SchemaCrawler 16.19.9 generated on -2023-06-13 17:33:39 +2023-08-09 18:50:48 access_72bb1dc3 - -ACCESS - -[table] -ACCESS_ID - -INTEGER - -auto-incremented -OPERATION_REF - -INTEGER -ROLE_REF - -INTEGER -ACCESS_MODIFIER_REF - -INTEGER - + +ACCESS + +[table] +ACCESS_ID + +INTEGER + +auto-incremented +OPERATION_REF + +INTEGER +ROLE_REF + +INTEGER +ACCESS_MODIFIER_REF + +INTEGER + access_modifier_f63f3fb1 - -ACCESS_MODIFIER - -[table] -ACCESS_MODIFIER_ID - -INTEGER - -auto-incremented -PACKAGE_REF - -INTEGER -NAME - -TEXT -DESCRIPTION - -TEXT - + +ACCESS_MODIFIER + +[table] +ACCESS_MODIFIER_ID + +INTEGER + +auto-incremented +PACKAGE_REF + +INTEGER +NAME + +TEXT +DESCRIPTION + +TEXT + access_72bb1dc3:w->access_modifier_f63f3fb1:e - - - - -SCHCRWLR_F63ECB52_72BAA964 + + + + +SCHCRWLR_F63ECB52_72BAA964 operation_93359a6 - -OPERATION - -[table] -OPERATION_ID - -INTEGER - -auto-incremented -PACKAGE_REF - -INTEGER -NAME - -TEXT -DESCRIPTION - -TEXT - + +OPERATION + +[table] +OPERATION_ID + +INTEGER + +auto-incremented +PACKAGE_REF + +INTEGER +NAME + +TEXT +DESCRIPTION + +TEXT + access_72bb1dc3:w->operation_93359a6:e - - - - -SCHCRWLR_0932E547_72BAA964 + + + + +SCHCRWLR_0932E547_72BAA964 - + role_26ecd5 - -ROLE - -[table] -ROLE_ID - -INTEGER - -auto-incremented -PACKAGE_REF - -INTEGER -LEVEL - -INTEGER -NAME - -TEXT -DESCRIPTION - -TEXT - + +ROLE + +[table] +ROLE_ID + +INTEGER + +auto-incremented +PACKAGE_REF + +INTEGER +LEVEL + +INTEGER +NAME + +TEXT +DESCRIPTION + +TEXT + - + access_72bb1dc3:w->role_26ecd5:e - - - - -SCHCRWLR_00267876_72BAA964 + + + + +SCHCRWLR_00267876_72BAA964 attribute_access_b017dce6 - -ATTRIBUTE_ACCESS - -[table] -ATTRIBUTE_REF - -INTEGER -ACCESS_REF - -INTEGER - + +ATTRIBUTE_ACCESS + +[table] +ATTRIBUTE_REF + +INTEGER +ACCESS_REF + +INTEGER + attribute_access_b017dce6:w->access_72bb1dc3:e - - - - -SCHCRWLR_72BAA964_B0176887 + + + + +SCHCRWLR_72BAA964_B0176887 @@ -258,11 +258,11 @@ attribute_access_b017dce6:w->attribute_a6e02edb:e - - - - -SCHCRWLR_A6DFBA7C_B0176887 + + + + +SCHCRWLR_A6DFBA7C_B0176887 @@ -282,159 +282,159 @@ cluster_access_38ea13c8:w->access_72bb1dc3:e - - - - -SCHCRWLR_72BAA964_38E99F69 + + + + +SCHCRWLR_72BAA964_38E99F69 cluster_5ec71239 - -CLUSTER - -[table] -CLUSTER_ID - -INTEGER - -auto-incremented -PACKAGE_REF - -INTEGER -DOMAIN_NAME - -TEXT -CODE - -INTEGER -MANUFACTURER_CODE - -INTEGER -NAME - -TEXT -DESCRIPTION - -TEXT -DEFINE - -TEXT -IS_SINGLETON - -INTEGER -REVISION - -INTEGER -INTRODUCED_IN_REF - -INTEGER -REMOVED_IN_REF - -INTEGER - + +CLUSTER + +[table] +CLUSTER_ID + +INTEGER + +auto-incremented +PACKAGE_REF + +INTEGER +DOMAIN_NAME + +TEXT +CODE + +INTEGER +MANUFACTURER_CODE + +INTEGER +NAME + +TEXT +DESCRIPTION + +TEXT +DEFINE + +TEXT +IS_SINGLETON + +INTEGER +REVISION + +INTEGER +INTRODUCED_IN_REF + +INTEGER +REMOVED_IN_REF + +INTEGER + cluster_access_38ea13c8:w->cluster_5ec71239:e - - - - -SCHCRWLR_5EC69DDA_38E99F69 + + + + +SCHCRWLR_5EC69DDA_38E99F69 command_access_b02dd957 - -COMMAND_ACCESS - -[table] -COMMAND_REF - -INTEGER -ACCESS_REF - -INTEGER - + +COMMAND_ACCESS + +[table] +COMMAND_REF + +INTEGER +ACCESS_REF + +INTEGER + command_access_b02dd957:w->access_72bb1dc3:e - - - - -SCHCRWLR_72BAA964_B02D64F8 + + + + +SCHCRWLR_72BAA964_B02D64F8 command_6371df8a - -COMMAND - -[table] -COMMAND_ID - -INTEGER - -auto-incremented -CLUSTER_REF - -INTEGER -PACKAGE_REF - -INTEGER -CODE - -INTEGER -MANUFACTURER_CODE - -INTEGER -NAME - -TEXT -DESCRIPTION - -TEXT -SOURCE - -TEXT -IS_OPTIONAL - -INTEGER -MUST_USE_TIMED_INVOKE - -INTEGER -IS_FABRIC_SCOPED - -INTEGER -INTRODUCED_IN_REF - -INTEGER -REMOVED_IN_REF - -INTEGER -RESPONSE_NAME - -INTEGER -RESPONSE_REF - -INTEGER -IS_DEFAULT_RESPONSE_ENABLED - -INTEGER - + +COMMAND + +[table] +COMMAND_ID + +INTEGER + +auto-incremented +CLUSTER_REF + +INTEGER +PACKAGE_REF + +INTEGER +CODE + +INTEGER +MANUFACTURER_CODE + +INTEGER +NAME + +TEXT +DESCRIPTION + +TEXT +SOURCE + +TEXT +IS_OPTIONAL + +INTEGER +MUST_USE_TIMED_INVOKE + +INTEGER +IS_FABRIC_SCOPED + +INTEGER +INTRODUCED_IN_REF + +INTEGER +REMOVED_IN_REF + +INTEGER +RESPONSE_NAME + +INTEGER +RESPONSE_REF + +INTEGER +IS_DEFAULT_RESPONSE_ENABLED + +INTEGER + command_access_b02dd957:w->command_6371df8a:e - - - - -SCHCRWLR_63716B2B_B02D64F8 + + + + +SCHCRWLR_63716B2B_B02D64F8 @@ -457,79 +457,79 @@ default_access_7ba041a1:w->access_72bb1dc3:e - + - - + + SCHCRWLR_72BAA964_7B9FCD42 package_fab13485 - -PACKAGE - -[table] -PACKAGE_ID - -INTEGER - -auto-incremented -PARENT_PACKAGE_REF - -INTEGER -PATH - -TEXT NOT NULL -TYPE - -TEXT -CRC - -INTEGER -VERSION - -INTEGER -CATEGORY - -TEXT -DESCRIPTION - -TEXT - + +PACKAGE + +[table] +PACKAGE_ID + +INTEGER + +auto-incremented +PARENT_PACKAGE_REF + +INTEGER +PATH + +TEXT NOT NULL +TYPE + +TEXT +CRC + +INTEGER +VERSION + +INTEGER +CATEGORY + +TEXT +DESCRIPTION + +TEXT + default_access_7ba041a1:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_7B9FCD42 + + + + +SCHCRWLR_FAB0C026_7B9FCD42 event_access_4668c328 - -EVENT_ACCESS - -[table] -EVENT_REF - -INTEGER -ACCESS_REF - -INTEGER - + +EVENT_ACCESS + +[table] +EVENT_REF + +INTEGER +ACCESS_REF + +INTEGER + event_access_4668c328:w->access_72bb1dc3:e - - - - -SCHCRWLR_72BAA964_46684EC9 + + + + +SCHCRWLR_72BAA964_46684EC9 @@ -584,162 +584,162 @@ event_access_4668c328:w->event_3f4eed9:e - - - + + + -SCHCRWLR_03F47A7A_46684EC9 +SCHCRWLR_03F47A7A_46684EC9 access_modifier_f63f3fb1:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_F63ECB52 + + + + +SCHCRWLR_FAB0C026_F63ECB52 atomic_73b03e8a - -"ATOMIC" - -[table] -ATOMIC_ID - -INTEGER - -auto-incremented -PACKAGE_REF - -INTEGER -NAME - -TEXT -DESCRIPTION - -TEXT -ATOMIC_IDENTIFIER - -INTEGER -ATOMIC_SIZE - -INTEGER -IS_DISCRETE - -INTEGER -IS_STRING - -INTEGER -IS_LONG - -INTEGER -IS_CHAR - -INTEGER -IS_SIGNED - -INTEGER - + +"ATOMIC" + +[table] +ATOMIC_ID + +INTEGER + +auto-incremented +PACKAGE_REF + +INTEGER +NAME + +TEXT +DESCRIPTION + +TEXT +ATOMIC_IDENTIFIER + +INTEGER +ATOMIC_SIZE + +INTEGER +IS_DISCRETE + +INTEGER +IS_STRING + +INTEGER +IS_LONG + +INTEGER +IS_CHAR + +INTEGER +IS_SIGNED + +INTEGER + atomic_73b03e8a:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_CE3170F5 + + + + +SCHCRWLR_FAB0C026_CE3170F5 attribute_a6e02edb:w->cluster_5ec71239:e - - - - -SCHCRWLR_5EC69DDA_A6DFBA7C + + + + +SCHCRWLR_5EC69DDA_A6DFBA7C attribute_a6e02edb:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_A6DFBA7C + + + + +SCHCRWLR_FAB0C026_A6DFBA7C - + spec_27641a - -SPEC - -[table] -SPEC_ID - -INTEGER - -auto-incremented -PACKAGE_REF - -INTEGER -CODE - -TEXT NOT NULL -DESCRIPTION - -TEXT -CERTIFIABLE - -INTEGER - + +SPEC + +[table] +SPEC_ID + +INTEGER + +auto-incremented +PACKAGE_REF + +INTEGER +CODE + +TEXT NOT NULL +DESCRIPTION + +TEXT +CERTIFIABLE + +INTEGER + - + attribute_a6e02edb:w->spec_27641a:e - - - - -SCHCRWLR_0026EFBB_A6DFBA7C + + + + +SCHCRWLR_0026EFBB_A6DFBA7C - + attribute_a6e02edb:w->spec_27641a:e - - - - -SCHCRWLR_0026EFBB_A6DFBA7C + + + + +SCHCRWLR_0026EFBB_A6DFBA7C device_type_attribute_ce5151f - -DEVICE_TYPE_ATTRIBUTE - -[table] -DEVICE_TYPE_CLUSTER_REF - -INTEGER -ATTRIBUTE_REF - -INTEGER -ATTRIBUTE_NAME - -TEXT - + +DEVICE_TYPE_ATTRIBUTE + +[table] +DEVICE_TYPE_CLUSTER_REF + +INTEGER +ATTRIBUTE_REF + +INTEGER +ATTRIBUTE_NAME + +TEXT + device_type_attribute_ce5151f:w->attribute_a6e02edb:e - - - - -SCHCRWLR_A6DFBA7C_0CE4A0C0 + + + + +SCHCRWLR_A6DFBA7C_0CE4A0C0 @@ -779,11 +779,11 @@ device_type_attribute_ce5151f:w->device_type_cluster_7298b97d:e - - - - -SCHCRWLR_7298451E_0CE4A0C0 + + + + +SCHCRWLR_7298451E_0CE4A0C0 @@ -838,11 +838,11 @@ endpoint_type_attribute_c265400:w->attribute_a6e02edb:e - - - - -SCHCRWLR_A6DFBA7C_0C25DFA1 + + + + +SCHCRWLR_A6DFBA7C_0C25DFA1 @@ -873,11 +873,11 @@ endpoint_type_attribute_c265400:w->endpoint_type_cluster_c12e3c9e:e - - - - -SCHCRWLR_C12DC83F_0C25DFA1 + + + + +SCHCRWLR_C12DC83F_0C25DFA1 @@ -911,42 +911,42 @@ global_attribute_default_73c65a21 - -GLOBAL_ATTRIBUTE_DEFAULT - -[table] -GLOBAL_ATTRIBUTE_DEFAULT_ID - -INTEGER - -auto-incremented -CLUSTER_REF - -INTEGER NOT NULL -ATTRIBUTE_REF - -INTEGER NOT NULL -DEFAULT_VALUE - -TEXT - + +GLOBAL_ATTRIBUTE_DEFAULT + +[table] +GLOBAL_ATTRIBUTE_DEFAULT_ID + +INTEGER + +auto-incremented +CLUSTER_REF + +INTEGER NOT NULL +ATTRIBUTE_REF + +INTEGER NOT NULL +DEFAULT_VALUE + +TEXT + global_attribute_default_73c65a21:w->attribute_a6e02edb:e - - - - -SCHCRWLR_A6DFBA7C_73C5E5C2 + + + + +SCHCRWLR_A6DFBA7C_73C5E5C2 global_attribute_default_73c65a21:w->cluster_5ec71239:e - - - - + + + + SCHCRWLR_5EC69DDA_73C5E5C2 @@ -1040,263 +1040,272 @@ cluster_5ec71239:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_5EC69DDA + + + + +SCHCRWLR_FAB0C026_5EC69DDA - + cluster_5ec71239:w->spec_27641a:e - - - - -SCHCRWLR_0026EFBB_5EC69DDA + + + + +SCHCRWLR_0026EFBB_5EC69DDA - + cluster_5ec71239:w->spec_27641a:e - - - - -SCHCRWLR_0026EFBB_5EC69DDA + + + + +SCHCRWLR_0026EFBB_5EC69DDA command_6371df8a:w->cluster_5ec71239:e - - - - -SCHCRWLR_5EC69DDA_63716B2B + + + + +SCHCRWLR_5EC69DDA_63716B2B command_6371df8a:w->command_6371df8a:e - - - - -SCHCRWLR_63716B2B_63716B2B + + + + +SCHCRWLR_63716B2B_63716B2B command_6371df8a:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_63716B2B + + + + +SCHCRWLR_FAB0C026_63716B2B - + command_6371df8a:w->spec_27641a:e - - - - -SCHCRWLR_0026EFBB_63716B2B + + + + +SCHCRWLR_0026EFBB_63716B2B - + command_6371df8a:w->spec_27641a:e - - - - -SCHCRWLR_0026EFBB_63716B2B + + + + +SCHCRWLR_0026EFBB_63716B2B data_type_cluster_8d9f2ca9 - -DATA_TYPE_CLUSTER - -[table] -DATA_TYPE_CLUSTER_ID - -INTEGER NOT NULL - -auto-incremented -CLUSTER_REF + +DATA_TYPE_CLUSTER + +[table] +DATA_TYPE_CLUSTER_ID -INTEGER -CLUSTER_CODE +INTEGER NOT NULL -INTEGER -DATA_TYPE_REF +auto-incremented +CLUSTER_REF INTEGER - +CLUSTER_CODE + +INTEGER +DATA_TYPE_REF + +INTEGER + data_type_cluster_8d9f2ca9:w->cluster_5ec71239:e - - - - -SCHCRWLR_5EC69DDA_8D9EB84A + + + + +SCHCRWLR_5EC69DDA_8D9EB84A data_type_cluster_8d9f2ca9:w->data_type_9233070e:e - - - + + + -SCHCRWLR_923292AF_8D9EB84A +SCHCRWLR_923292AF_8D9EB84A device_type_cluster_7298b97d:w->cluster_5ec71239:e - - - - -SCHCRWLR_5EC69DDA_7298451E + + + + +SCHCRWLR_5EC69DDA_7298451E device_type_2620a7e2 - -DEVICE_TYPE - -[table] -DEVICE_TYPE_ID - -INTEGER - -auto-incremented -PACKAGE_REF - -INTEGER -DOMAIN - -TEXT -CODE - -INTEGER -PROFILE_ID - -INTEGER -NAME - -TEXT -DESCRIPTION - -TEXT - + +DEVICE_TYPE + +[table] +DEVICE_TYPE_ID + +INTEGER + +auto-incremented +PACKAGE_REF + +INTEGER +DOMAIN + +TEXT +CODE + +INTEGER +PROFILE_ID + +INTEGER +NAME + +TEXT +DESCRIPTION + +TEXT +CLASS + +TEXT +"SCOPE" + +TEXT +SUPERSET + +TEXT + device_type_cluster_7298b97d:w->device_type_2620a7e2:e - - - - -SCHCRWLR_26203383_7298451E + + + + +SCHCRWLR_26203383_7298451E endpoint_type_cluster_c12e3c9e:w->cluster_5ec71239:e - - - - -SCHCRWLR_5EC69DDA_C12DC83F + + + + +SCHCRWLR_5EC69DDA_C12DC83F endpoint_type_cluster_c12e3c9e:w->endpoint_type_9857dc03:e - - - - + + + + SCHCRWLR_985767A4_C12DC83F event_3f4eed9:w->cluster_5ec71239:e - - - - -SCHCRWLR_5EC69DDA_03F47A7A + + + + +SCHCRWLR_5EC69DDA_03F47A7A event_3f4eed9:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_03F47A7A + + + + +SCHCRWLR_FAB0C026_03F47A7A - + event_3f4eed9:w->spec_27641a:e - - - - -SCHCRWLR_0026EFBB_03F47A7A + + + + +SCHCRWLR_0026EFBB_03F47A7A - + event_3f4eed9:w->spec_27641a:e - - - - -SCHCRWLR_0026EFBB_03F47A7A + + + + +SCHCRWLR_0026EFBB_03F47A7A tag_1b7d9 - -TAG - -[table] -TAG_ID - -INTEGER - -auto-incremented -PACKAGE_REF - -INTEGER -CLUSTER_REF - -INTEGER -NAME - -TEXT -DESCRIPTION - -TEXT - + +TAG + +[table] +TAG_ID + +INTEGER + +auto-incremented +PACKAGE_REF + +INTEGER +CLUSTER_REF + +INTEGER +NAME + +TEXT +DESCRIPTION + +TEXT + tag_1b7d9:w->cluster_5ec71239:e - - - - -SCHCRWLR_5EC69DDA_0001437A + + + + +SCHCRWLR_5EC69DDA_0001437A - + tag_1b7d9:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_0001437A + + + + +SCHCRWLR_FAB0C026_0001437A @@ -1355,65 +1364,65 @@ command_arg_294e7f81:w->command_6371df8a:e - - - - -SCHCRWLR_63716B2B_294E0B22 + + + + +SCHCRWLR_63716B2B_294E0B22 - + command_arg_294e7f81:w->spec_27641a:e - - - - -SCHCRWLR_0026EFBB_294E0B22 + + + + +SCHCRWLR_0026EFBB_294E0B22 - + command_arg_294e7f81:w->spec_27641a:e - - - - -SCHCRWLR_0026EFBB_294E0B22 + + + + +SCHCRWLR_0026EFBB_294E0B22 device_type_command_774386ce - -DEVICE_TYPE_COMMAND - -[table] -DEVICE_TYPE_CLUSTER_REF - -INTEGER -COMMAND_REF - -INTEGER -COMMAND_NAME - -TEXT - + +DEVICE_TYPE_COMMAND + +[table] +DEVICE_TYPE_CLUSTER_REF + +INTEGER +COMMAND_REF + +INTEGER +COMMAND_NAME + +TEXT + device_type_command_774386ce:w->command_6371df8a:e - - - - -SCHCRWLR_63716B2B_7743126F + + + + +SCHCRWLR_63716B2B_7743126F device_type_command_774386ce:w->device_type_cluster_7298b97d:e - - - - -SCHCRWLR_7298451E_7743126F + + + + +SCHCRWLR_7298451E_7743126F @@ -1447,11 +1456,11 @@ endpoint_type_command_c5d909ef:w->command_6371df8a:e - - - - -SCHCRWLR_63716B2B_C5D89590 + + + + +SCHCRWLR_63716B2B_C5D89590 @@ -1465,49 +1474,49 @@ endpoint_type_command_c5d909ef:w->endpoint_type_9857dc03:e - - - - -SCHCRWLR_985767A4_C5D89590 + + + + +SCHCRWLR_985767A4_C5D89590 discriminator_4931d2db - -DISCRIMINATOR - -[table] -DISCRIMINATOR_ID - -INTEGER NOT NULL - -auto-incremented -NAME - -TEXT -PACKAGE_REF - -INTEGER - + +DISCRIMINATOR + +[table] +DISCRIMINATOR_ID + +INTEGER NOT NULL + +auto-incremented +NAME + +TEXT +PACKAGE_REF + +INTEGER + data_type_9233070e:w->discriminator_4931d2db:e - - - - -SCHCRWLR_49315E7C_923292AF + + + + +SCHCRWLR_49315E7C_923292AF data_type_9233070e:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_923292AF + + + + +SCHCRWLR_FAB0C026_923292AF @@ -1680,7 +1689,7 @@ SCHCRWLR_923292AF_D6E4493D - + struct_item_d6e4bd9c:w->struct_9268f434:e @@ -1691,11 +1700,11 @@ device_type_2620a7e2:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_26203383 + + + + +SCHCRWLR_FAB0C026_26203383 @@ -1729,11 +1738,11 @@ endpoint_type_device_e685fbb0:w->device_type_2620a7e2:e - - - - -SCHCRWLR_26203383_E6858751 + + + + +SCHCRWLR_26203383_E6858751 @@ -1747,52 +1756,52 @@ discriminator_4931d2db:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_49315E7C + + + + +SCHCRWLR_FAB0C026_49315E7C domain_78873d23 - -DOMAIN - -[table] -DOMAIN_ID - -INTEGER - -auto-incremented -PACKAGE_REF - -INTEGER -NAME - -TEXT -LATEST_SPEC_REF - -INTEGER - + +DOMAIN + +[table] +DOMAIN_ID + +INTEGER + +auto-incremented +PACKAGE_REF + +INTEGER +NAME + +TEXT +LATEST_SPEC_REF + +INTEGER + domain_78873d23:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_7886C8C4 + + + + +SCHCRWLR_FAB0C026_7886C8C4 - + domain_78873d23:w->spec_27641a:e - - - - -SCHCRWLR_0026EFBB_7886C8C4 + + + + +SCHCRWLR_0026EFBB_7886C8C4 @@ -1833,7 +1842,7 @@ SCHCRWLR_985767A4_966D0D95 - + session_a11c82d5 SESSION @@ -1859,16 +1868,16 @@ - + endpoint_966d81f4:w->session_a11c82d5:e - - + + -SCHCRWLR_A11C0E76_966D0D95 +SCHCRWLR_A11C0E76_966D0D95 - + endpoint_type_9857dc03:w->session_a11c82d5:e @@ -1923,11 +1932,11 @@ endpoint_type_event_e67d6e7e:w->endpoint_type_9857dc03:e - - - - -SCHCRWLR_985767A4_E67CFA1F + + + + +SCHCRWLR_985767A4_E67CFA1F @@ -1970,385 +1979,420 @@ event_field_d102b734 - -EVENT_FIELD - -[table] -EVENT_REF - -INTEGER -FIELD_IDENTIFIER - -INTEGER -NAME - -TEXT -TYPE - -TEXT -IS_ARRAY - -INTEGER -IS_NULLABLE - -INTEGER -IS_OPTIONAL - -INTEGER -INTRODUCED_IN_REF - -INTEGER -REMOVED_IN_REF - -INTEGER - + +EVENT_FIELD + +[table] +EVENT_REF + +INTEGER +FIELD_IDENTIFIER + +INTEGER +NAME + +TEXT +TYPE + +TEXT +IS_ARRAY + +INTEGER +IS_NULLABLE + +INTEGER +IS_OPTIONAL + +INTEGER +INTRODUCED_IN_REF + +INTEGER +REMOVED_IN_REF + +INTEGER + event_field_d102b734:w->event_3f4eed9:e - - - - -SCHCRWLR_03F47A7A_D10242D5 + + + + +SCHCRWLR_03F47A7A_D10242D5 - + event_field_d102b734:w->spec_27641a:e - - - - -SCHCRWLR_0026EFBB_D10242D5 + + + + +SCHCRWLR_0026EFBB_D10242D5 - + event_field_d102b734:w->spec_27641a:e - - - - -SCHCRWLR_0026EFBB_D10242D5 + + + + +SCHCRWLR_0026EFBB_D10242D5 global_attribute_bit_e934f16d - -GLOBAL_ATTRIBUTE_BIT - -[table] -GLOBAL_ATTRIBUTE_DEFAULT_REF - -INTEGER NOT NULL -BIT - -INTEGER NOT NULL -"VALUE" - -INTEGER -TAG_REF - -INTEGER NOT NULL - + +GLOBAL_ATTRIBUTE_BIT + +[table] +GLOBAL_ATTRIBUTE_DEFAULT_REF + +INTEGER NOT NULL +BIT + +INTEGER NOT NULL +"VALUE" + +INTEGER +TAG_REF + +INTEGER NOT NULL + global_attribute_bit_e934f16d:w->global_attribute_default_73c65a21:e - - - - -SCHCRWLR_73C5E5C2_E9347D0E + + + + +SCHCRWLR_73C5E5C2_E9347D0E - + global_attribute_bit_e934f16d:w->tag_1b7d9:e - - - - -SCHCRWLR_0001437A_E9347D0E + + + + +SCHCRWLR_0001437A_E9347D0E operation_93359a6:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_0932E547 + + + + +SCHCRWLR_FAB0C026_0932E547 package_fab13485:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_FAB0C026 + + + + +SCHCRWLR_FAB0C026_FAB0C026 package_extension_2789e3a5 - -PACKAGE_EXTENSION - -[table] -PACKAGE_EXTENSION_ID - -INTEGER - -auto-incremented -PACKAGE_REF - -INTEGER -ENTITY - -TEXT -PROPERTY - -TEXT -TYPE - -TEXT -CONFIGURABILITY - -TEXT -LABEL - -TEXT -GLOBAL_DEFAULT - -TEXT - + +PACKAGE_EXTENSION + +[table] +PACKAGE_EXTENSION_ID + +INTEGER + +auto-incremented +PACKAGE_REF + +INTEGER +ENTITY + +TEXT +PROPERTY + +TEXT +TYPE + +TEXT +CONFIGURABILITY + +TEXT +LABEL + +TEXT +GLOBAL_DEFAULT + +TEXT + package_extension_2789e3a5:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_27896F46 + + + + +SCHCRWLR_FAB0C026_27896F46 - + +package_notice_176ee570 + +PACKAGE_NOTICE + +[table] +PACKAGE_REF + +INTEGER +NOTICE_TYPE + +TEXT +NOTICE_MESSAGE + +TEXT +NOTICE_SEVERITY + +INTEGER +NOTICE_ID + +INTEGER + +auto-incremented + + + + +package_notice_176ee570:w->package_fab13485:e + + + + +SCHCRWLR_FAB0C026_176E7111 + + + package_option_1931d70d - -PACKAGE_OPTION - -[table] -OPTION_ID - -INTEGER - -auto-incremented -PACKAGE_REF - -INTEGER -OPTION_CATEGORY - -TEXT -OPTION_CODE - -TEXT -OPTION_LABEL - -TEXT - + +PACKAGE_OPTION + +[table] +OPTION_ID + +INTEGER + +auto-incremented +PACKAGE_REF + +INTEGER +OPTION_CATEGORY + +TEXT +OPTION_CODE + +TEXT +OPTION_LABEL + +TEXT + - + package_option_1931d70d:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_193162AE + + + + +SCHCRWLR_FAB0C026_193162AE - + package_option_default_64a251ef - -PACKAGE_OPTION_DEFAULT - -[table] -OPTION_DEFAULT_ID - -INTEGER - -auto-incremented -PACKAGE_REF - -INTEGER -OPTION_CATEGORY - -TEXT -OPTION_REF - -INTEGER - + +PACKAGE_OPTION_DEFAULT + +[table] +OPTION_DEFAULT_ID + +INTEGER + +auto-incremented +PACKAGE_REF + +INTEGER +OPTION_CATEGORY + +TEXT +OPTION_REF + +INTEGER + - + package_option_default_64a251ef:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_64A1DD90 + + + + +SCHCRWLR_FAB0C026_64A1DD90 - + package_option_default_64a251ef:w->package_option_1931d70d:e - - - - -SCHCRWLR_193162AE_64A1DD90 + + + + +SCHCRWLR_193162AE_64A1DD90 - + role_26ecd5:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_00267876 + + + + +SCHCRWLR_FAB0C026_00267876 - + session_package_61fa13bc - -SESSION_PACKAGE - -[table] -SESSION_REF - -INTEGER -PACKAGE_REF - -INTEGER -REQUIRED - -INTEGER -ENABLED - -INTEGER - + +SESSION_PACKAGE + +[table] +SESSION_REF + +INTEGER +PACKAGE_REF + +INTEGER +REQUIRED + +INTEGER +ENABLED + +INTEGER + - + session_package_61fa13bc:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_61F99F5D + + + + +SCHCRWLR_FAB0C026_61F99F5D - + session_package_61fa13bc:w->session_a11c82d5:e - - - - + + + + SCHCRWLR_A11C0E76_61F99F5D - + spec_27641a:w->package_fab13485:e - - - - -SCHCRWLR_FAB0C026_0026EFBB + + + + +SCHCRWLR_FAB0C026_0026EFBB - + package_extension_default_d8d04687 - -PACKAGE_EXTENSION_DEFAULT - -[table] -PACKAGE_EXTENSION_REF - -INTEGER -ENTITY_CODE - -INTEGER -ENTITY_QUALIFIER - -TEXT -PARENT_CODE - -INTEGER -MANUFACTURER_CODE - -INTEGER -"VALUE" - -TEXT - + +PACKAGE_EXTENSION_DEFAULT + +[table] +PACKAGE_EXTENSION_REF + +INTEGER +ENTITY_CODE + +INTEGER +ENTITY_QUALIFIER + +TEXT +PARENT_CODE + +INTEGER +MANUFACTURER_CODE + +INTEGER +"VALUE" + +TEXT + - + package_extension_default_d8d04687:w->package_extension_2789e3a5:e - - - - -SCHCRWLR_27896F46_D8CFD228 + + + + +SCHCRWLR_27896F46_D8CFD228 - + package_extension_value_8e65d377 - -PACKAGE_EXTENSION_VALUE - -[table] -PACKAGE_EXTENSION_VALUE_ID - -INTEGER - -auto-incremented -PACKAGE_EXTENSION_REF - -INTEGER -SESSION_REF - -INTEGER -ENTITY_CODE - -INTEGER -PARENT_CODE - -INTEGER -"VALUE" - -TEXT - + +PACKAGE_EXTENSION_VALUE + +[table] +PACKAGE_EXTENSION_VALUE_ID + +INTEGER + +auto-incremented +PACKAGE_EXTENSION_REF + +INTEGER +SESSION_REF + +INTEGER +ENTITY_CODE + +INTEGER +PARENT_CODE + +INTEGER +"VALUE" + +TEXT + - + package_extension_value_8e65d377:w->package_extension_2789e3a5:e - - - - -SCHCRWLR_27896F46_8E655F18 + + + + +SCHCRWLR_27896F46_8E655F18 - + package_extension_value_8e65d377:w->session_a11c82d5:e - - - - -SCHCRWLR_A11C0E76_8E655F18 + + + + +SCHCRWLR_A11C0E76_8E655F18 - + user_28582a "USER" @@ -2368,7 +2412,7 @@ - + session_a11c82d5:w->user_28582a:e @@ -2377,114 +2421,117 @@ SCHCRWLR_3ED95AD5_A11C0E76 - + session_key_value_334d9527 - -SESSION_KEY_VALUE - -[table] -SESSION_REF - -INTEGER -KEY - -TEXT -"VALUE" - -TEXT - + +SESSION_KEY_VALUE + +[table] +SESSION_REF + +INTEGER +KEY + +TEXT +"VALUE" + +TEXT + - + session_key_value_334d9527:w->session_a11c82d5:e - - - - -SCHCRWLR_A11C0E76_334D20C8 + + + + +SCHCRWLR_A11C0E76_334D20C8 - + session_log_7f10ae3a - -SESSION_LOG - -[table] -SESSION_REF - -INTEGER -"TIMESTAMP" - -TEXT -LOG - -TEXT - + +SESSION_LOG + +[table] +SESSION_REF + +INTEGER +"TIMESTAMP" + +TEXT +LOG + +TEXT + - + session_log_7f10ae3a:w->session_a11c82d5:e - - - - -SCHCRWLR_A11C0E76_7F1039DB + + + + +SCHCRWLR_A11C0E76_7F1039DB - + session_notice_84addd20 - -SESSION_NOTICE - -[table] -SESSION_REF - -INTEGER -NOTICE_TYPE - -TEXT -NOTICE_MESSAGE - -TEXT -NOTICE_SEVERITY - -INTEGER -NOTICE_ORDER - -INTEGER - -auto-incremented -DISPLAY - -INTEGER - + +SESSION_NOTICE + +[table] +SESSION_REF + +INTEGER +NOTICE_TYPE + +TEXT +NOTICE_MESSAGE + +TEXT +NOTICE_SEVERITY + +INTEGER +NOTICE_ID + +INTEGER + +auto-incremented +DISPLAY + +INTEGER +SEEN + +INTEGER + - + session_notice_84addd20:w->session_a11c82d5:e - - - - -SCHCRWLR_A11C0E76_84AD68C1 + + + + +SCHCRWLR_A11C0E76_84AD68C1 - + setting_a12b0e8f - -SETTING - -[table] -CATEGORY - -TEXT -KEY - -TEXT -"VALUE" - -TEXT - + +SETTING + +[table] +CATEGORY + +TEXT +KEY + +TEXT +"VALUE" + +TEXT + diff --git a/src-electron/db/query-config.js b/src-electron/db/query-config.js index 5c910a36a4..743431c02d 100644 --- a/src-electron/db/query-config.js +++ b/src-electron/db/query-config.js @@ -29,6 +29,7 @@ const queryDeviceType = require('./query-device-type') const queryCommand = require('./query-command.js') const restApi = require('../../src-shared/rest-api.js') const _ = require('lodash') +const notification = require('../db/query-session-notification.js') /** * Promises to update the cluster include/exclude state. @@ -563,11 +564,35 @@ async function insertEndpointType( } // Insert into endpoint_type_device - let etd = await dbApi.dbMultiInsert( - db, - 'INSERT INTO ENDPOINT_TYPE_DEVICE (ENDPOINT_TYPE_REF, DEVICE_TYPE_REF, DEVICE_IDENTIFIER, DEVICE_VERSION, DEVICE_TYPE_ORDER) VALUES (?, ?, ?, ?, ?)', - newEndpointTypeIdDeviceCombination - ) + try { + let etd = await dbApi.dbMultiInsert( + db, + 'INSERT INTO ENDPOINT_TYPE_DEVICE (ENDPOINT_TYPE_REF, DEVICE_TYPE_REF, DEVICE_IDENTIFIER, DEVICE_VERSION, DEVICE_TYPE_ORDER) VALUES (?, ?, ?, ?, ?)', + newEndpointTypeIdDeviceCombination + ) + } catch (err) { + // Catching an error from a sql trigger + let isErrorStringPresent = err.includes('Error:') + notification.setNotification( + db, + 'ERROR', + isErrorStringPresent ? err.split('Error:')[1] : err, + sessionId, + 1, + 1 + ) + await dbApi.dbMultiInsert( + db, + 'DELETE FROM ENDPOINT_TYPE_DEVICE WHERE ENDPOINT_TYPE_REF = ? AND DEVICE_TYPE_REF = ? AND DEVICE_IDENTIFIER = ? AND DEVICE_VERSION =? AND DEVICE_TYPE_ORDER = ?', + newEndpointTypeIdDeviceCombination + ) + await dbApi.dbRemove( + db, + 'DELETE FROM ENDPOINT_TYPE WHERE ENDPOINT_TYPE_ID = ?', + newEndpointTypeId + ) + throw new Error(err) + } // Resolve endpointDefaults based on device type order. for (const dtRef of deviceTypeRefs) { @@ -688,6 +713,17 @@ async function updateEndpointType(db, sessionId, endpointTypeId, changesArray) { let existingDeviceVersions = existingDeviceTypeInfo.map( (dt) => dt.DEVICE_VERSION ) + + let existingEndpointTypeDeviceInfoValues = [] + for (let j = 0; j < existingDeviceTypeInfo.length; j++) { + existingEndpointTypeDeviceInfoValues.push([ + endpointTypeId, + existingDeviceTypeInfo[j]['DEVICE_TYPE_REF'], + existingDeviceTypeInfo[j]['DEVICE_VERSION'], + existingDeviceTypeInfo[j]['DEVICE_IDENTIFIER'], + j, + ]) + } let updatedDeviceTypeRefs = updatedValues[0] let updatedDeviceVersions = updatedValues[1] let isDeviceTypeRefsUpdated = @@ -723,15 +759,46 @@ async function updateEndpointType(db, sessionId, endpointTypeId, changesArray) { ]) } - await dbApi.dbMultiInsert( - db, - ` - INSERT INTO - ENDPOINT_TYPE_DEVICE (ENDPOINT_TYPE_REF, DEVICE_TYPE_REF, DEVICE_VERSION, DEVICE_IDENTIFIER, DEVICE_TYPE_ORDER) - VALUES - (?, ?, ?, ?, ?)`, - endpointTypeDeviceInfoValues - ) + try { + await dbApi.dbMultiInsert( + db, + ` + INSERT INTO + ENDPOINT_TYPE_DEVICE (ENDPOINT_TYPE_REF, DEVICE_TYPE_REF, DEVICE_VERSION, DEVICE_IDENTIFIER, DEVICE_TYPE_ORDER) + VALUES + (?, ?, ?, ?, ?)`, + endpointTypeDeviceInfoValues + ) + } catch (err) { + // Catching an error from a sql trigger + let isErrorStringPresent = err.includes('Error:') + notification.setNotification( + db, + 'ERROR', + isErrorStringPresent ? err.split('Error:')[1] : err, + sessionId, + 1, + 1 + ) + // Delete endpoint type devices with the latest updates + let test = await dbApi.dbMultiInsert( + db, + 'DELETE FROM ENDPOINT_TYPE_DEVICE WHERE ENDPOINT_TYPE_REF = ? AND DEVICE_TYPE_REF = ? AND DEVICE_VERSION =? AND DEVICE_IDENTIFIER = ? AND DEVICE_TYPE_ORDER = ?', + endpointTypeDeviceInfoValues + ) + + // Re add the old device types on the endpoint before the update + await dbApi.dbMultiInsert( + db, + ` + INSERT INTO + ENDPOINT_TYPE_DEVICE (ENDPOINT_TYPE_REF, DEVICE_TYPE_REF, DEVICE_VERSION, DEVICE_IDENTIFIER, DEVICE_TYPE_ORDER) + VALUES + (?, ?, ?, ?, ?)`, + existingEndpointTypeDeviceInfoValues + ) + throw new Error(err) + } // When updating the zcl device types, overwrite on top of existing configuration // Note: Here the existing selections are not removed. For eg: the clusters which diff --git a/src-electron/db/query-loader.js b/src-electron/db/query-loader.js index de6709f755..907a1f55e4 100644 --- a/src-electron/db/query-loader.js +++ b/src-electron/db/query-loader.js @@ -544,7 +544,13 @@ async function insertClusterExtensions(db, packageId, knownPackages, data) { exist. Check clusterExtension meta data in xml file. Cluster Code: ${data[i].code}` env.logWarning(message) - queryNotification.setNotification(db, "WARNING", message, packageId, 2) + queryNotification.setNotification( + db, + 'WARNING', + message, + packageId, + 2 + ) } } let pCommand = insertCommands(db, packageId, commands) @@ -831,7 +837,7 @@ async function insertDeviceTypes(db, packageId, data) { return dbApi .dbMultiInsert( db, - 'INSERT INTO DEVICE_TYPE (PACKAGE_REF, DOMAIN, CODE, PROFILE_ID, NAME, DESCRIPTION) VALUES (?, ?, ?, ?, ?, ?)', + 'INSERT INTO DEVICE_TYPE (PACKAGE_REF, DOMAIN, CODE, PROFILE_ID, NAME, DESCRIPTION, CLASS, SCOPE, SUPERSET) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)', data.map((dt) => { return [ packageId, @@ -840,6 +846,9 @@ async function insertDeviceTypes(db, packageId, data) { dt.profileId, dt.name, dt.description, + dt.class, + dt.scope, + dt.superset, ] }) ) diff --git a/src-electron/db/query-session-notification.js b/src-electron/db/query-session-notification.js index dd7240a923..4f340044a9 100644 --- a/src-electron/db/query-session-notification.js +++ b/src-electron/db/query-session-notification.js @@ -33,6 +33,7 @@ const dbEnum = require('../../src-shared/db-enum.js') * @param {*} status * @param {*} sessionId * @param {*} severity + * @param {*} display */ async function setNotification( db, diff --git a/src-electron/db/zap-schema.sql b/src-electron/db/zap-schema.sql index 67071c6e8a..b7dd3ea055 100644 --- a/src-electron/db/zap-schema.sql +++ b/src-electron/db/zap-schema.sql @@ -331,6 +331,9 @@ CREATE TABLE IF NOT EXISTS "DEVICE_TYPE" ( "PROFILE_ID" integer, "NAME" text, "DESCRIPTION" text, + "CLASS" text, + "SCOPE" text, + "SUPERSET" text, foreign key (PACKAGE_REF) references PACKAGE(PACKAGE_ID) on delete cascade ); /* @@ -736,6 +739,83 @@ CREATE TABLE IF NOT EXISTS "ENDPOINT_TYPE_DEVICE" ( UNIQUE("ENDPOINT_TYPE_REF", "DEVICE_TYPE_REF") ); +/** +SQL Trigger for device type triggers per endpoint. +From Matter Data Model Spec 9.2 Endpoint Composition +Each simple endpoint SHALL support only one Application device type with these exceptions: +- The endpoint MAY support additional device types which are subsets of the Application +device type (the superset). +- The endpoint MAY support additional device types (application, utility or node device types) +as defined by each additional device type. +*/ +CREATE TRIGGER ENDPOINT_TYPE_SIMPLE_DEVICE_CHECK +BEFORE + INSERT ON ENDPOINT_TYPE_DEVICE +WHEN + (SELECT + CLASS + FROM + DEVICE_TYPE + WHERE + DEVICE_TYPE.DEVICE_TYPE_ID = NEW.DEVICE_TYPE_REF) = "Simple" + AND + ((SELECT + CLASS + FROM + DEVICE_TYPE + WHERE + DEVICE_TYPE.DEVICE_TYPE_ID = NEW.DEVICE_TYPE_REF) + IN + (SELECT + CLASS + FROM + DEVICE_TYPE + INNER JOIN + ENDPOINT_TYPE_DEVICE + ON + DEVICE_TYPE.DEVICE_TYPE_ID = ENDPOINT_TYPE_DEVICE.DEVICE_TYPE_REF + WHERE + ENDPOINT_TYPE_DEVICE.ENDPOINT_TYPE_REF = NEW.ENDPOINT_TYPE_REF)) + AND + ((SELECT + SUPERSET + FROM + DEVICE_TYPE + WHERE + DEVICE_TYPE.DEVICE_TYPE_ID = NEW.DEVICE_TYPE_REF) + NOT IN + (SELECT + DESCRIPTION + FROM + DEVICE_TYPE + INNER JOIN + ENDPOINT_TYPE_DEVICE + ON + DEVICE_TYPE.DEVICE_TYPE_ID = ENDPOINT_TYPE_DEVICE.DEVICE_TYPE_REF + WHERE + ENDPOINT_TYPE_DEVICE.ENDPOINT_TYPE_REF = NEW.ENDPOINT_TYPE_REF)) + AND + ((SELECT + DESCRIPTION + FROM + DEVICE_TYPE + WHERE + DEVICE_TYPE.DEVICE_TYPE_ID = NEW.DEVICE_TYPE_REF) + NOT IN + (SELECT + SUPERSET + FROM + DEVICE_TYPE + INNER JOIN + ENDPOINT_TYPE_DEVICE + ON + DEVICE_TYPE.DEVICE_TYPE_ID = ENDPOINT_TYPE_DEVICE.DEVICE_TYPE_REF + WHERE + ENDPOINT_TYPE_DEVICE.ENDPOINT_TYPE_REF = NEW.ENDPOINT_TYPE_REF)) +BEGIN + SELECT RAISE(ROLLBACK, 'Simple endpoint cannot have more than one application device type'); +END; + /* ENDPOINT table contains the toplevel configured endpoints. */ diff --git a/src-electron/zcl/zcl-loader-silabs.js b/src-electron/zcl/zcl-loader-silabs.js index a6a8e7e4be..a9f2a591a9 100644 --- a/src-electron/zcl/zcl-loader-silabs.js +++ b/src-electron/zcl/zcl-loader-silabs.js @@ -1041,8 +1041,13 @@ async function processDataType( env.logError( 'Could not find the discriminator for the data type: ' + dataType ) - queryPackageNotification.setNotification(dnb, "ERROR", - 'Could not find the discriminator for the data type: ' + dataType, packageId, 1) + queryPackageNotification.setNotification( + dnb, + 'ERROR', + 'Could not find the discriminator for the data type: ' + dataType, + packageId, + 1 + ) } } @@ -1207,10 +1212,19 @@ function prepareEnumOrBitmap(db, packageId, a, dataType, typeMap) { (a.$.type.toLowerCase().includes('int') || a.$.type.toLowerCase().includes(dbEnum.zclType.bitmap)) ) { - let message = 'Check type contradiction in XML metadata for ' + - a.$.name + ' with type ' + a.$.type + let message = + 'Check type contradiction in XML metadata for ' + + a.$.name + + ' with type ' + + a.$.type env.logWarning(message) - queryPackageNotification.setNotification(db, "WARNING", message, packageId, 2) + queryPackageNotification.setNotification( + db, + 'WARNING', + message, + packageId, + 2 + ) a.$.type = 'enum' + a.$.type.toLowerCase().match(/\d+/g).join('') } return { @@ -1238,7 +1252,13 @@ async function processEnum(db, filePath, packageId, knownPackages, data) { db, knownPackages, data.map((x) => - prepareEnumOrBitmap(db, packageId, x, typeMap.get(dbEnum.zclType.enum), typeMap) + prepareEnumOrBitmap( + db, + packageId, + x, + typeMap.get(dbEnum.zclType.enum), + typeMap + ) ) ) } @@ -1325,7 +1345,13 @@ async function processBitmap(db, filePath, packageId, knownPackages, data) { db, knownPackages, data.map((x) => - prepareEnumOrBitmap(db, packageId, x, typeMap.get(dbEnum.zclType.bitmap), typeMap) + prepareEnumOrBitmap( + db, + packageId, + x, + typeMap.get(dbEnum.zclType.bitmap), + typeMap + ) ) ) } @@ -1486,6 +1512,9 @@ function prepareDeviceType(deviceType) { domain: deviceType.domain[0], name: deviceType.name[0], description: deviceType.typeName[0], + class: deviceType.class ? deviceType.class[0] : '', + scope: deviceType.scope ? deviceType.scope[0] : '', + superset: deviceType.superset ? deviceType.superset[0] : '', } if ('clusters' in deviceType) { ret.clusters = [] @@ -2161,7 +2190,14 @@ async function loadIndividualSilabsFile(db, filePath, sessionId) { return { succeeded: true, packageId: pkgId } } catch (err) { env.logError(`Error reading xml file: ${filePath}\n` + err.message) - querySessionNotification.setNotification(db, "ERROR", `Error reading xml file: ${filePath}\n` + err.message, sessionId, 1, 0) + querySessionNotification.setNotification( + db, + 'ERROR', + `Error reading xml file: ${filePath}\n` + err.message, + sessionId, + 1, + 0 + ) return { succeeded: false, err: err } } } @@ -2303,7 +2339,7 @@ async function loadSilabsZcl(db, metafile, isJson = false) { } } catch (err) { env.logError(err) - queryPackageNotification.setNotification(db, "ERROR", err, ctx.packageId, 1) + queryPackageNotification.setNotification(db, 'ERROR', err, ctx.packageId, 1) throw err } finally { if (!isTransactionAlreadyExisting) await dbApi.dbCommit(db)