diff --git a/src-electron/generator/helper-endpointconfig.js b/src-electron/generator/helper-endpointconfig.js index a24d8ae20a..d0e265cee9 100644 --- a/src-electron/generator/helper-endpointconfig.js +++ b/src-electron/generator/helper-endpointconfig.js @@ -100,11 +100,15 @@ function endpoint_fixed_profile_id_array(options) { * @returns C array including the { } brackets */ function endpoint_fixed_parent_id_array(options) { - return ( - '{ ' + - this.endpoints.map((ep) => ep.parentEndpointIdentifier).join(', ') + - ' }' - ) + let parentIds = [] + this.endpoints.forEach((ep) => { + if (ep.parentEndpointIdentifier == null) { + parentIds.push('NULL') + } else { + parentIds.push(ep.parentEndpointIdentifier) + } + }) + return '{ ' + parentIds.join(', ') + ' }' } /** diff --git a/test/gen-matter-4.test.js b/test/gen-matter-4.test.js index c78fd3c8e0..58b0913bec 100644 --- a/test/gen-matter-4.test.js +++ b/test/gen-matter-4.test.js @@ -158,6 +158,7 @@ test( expect(ept).toContain( '#define FIXED_PROFILE_IDS { 0x0103, 0x0103, 0x0103, 0x0103 }' ) + expect(ept).toContain('#define FIXED_PARENT_IDS { NULL, 0, 1, NULL }') expect(ept).toContain( '#define FIXED_DEVICE_TYPES {{0x00000016,1},{0x00000100,1},{0x00000100,1},{0x0000F002,1}}' ) @@ -264,6 +265,7 @@ test( expect(ept).toContain( '#define FIXED_PROFILE_IDS { 0x0103, 0x0103, 0x0103, 0x0103 }' ) + expect(ept).toContain('#define FIXED_PARENT_IDS { NULL, NULL, NULL, NULL }') expect(ept).toContain( '#define FIXED_DEVICE_TYPES {{0x00000016,1},{0x00000100,1},{0x00000100,1},{0x0000F002,1}}' ) diff --git a/test/gen-template/matter/endpoint-config.zapt b/test/gen-template/matter/endpoint-config.zapt index c893b4af1b..03c5bd71d4 100644 --- a/test/gen-template/matter/endpoint-config.zapt +++ b/test/gen-template/matter/endpoint-config.zapt @@ -98,6 +98,9 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, // Array of profile ids #define FIXED_PROFILE_IDS {{endpoint_fixed_profile_id_array}} +// Array of parent endpoint ids +#define FIXED_PARENT_IDS {{endpoint_fixed_parent_id_array}} + // Array of device types #define FIXED_DEVICE_TYPES {{endpoint_fixed_device_type_array}} diff --git a/test/gen-template/matter3/endpoint_config.zapt b/test/gen-template/matter3/endpoint_config.zapt index 7d5b4a7d5f..eba57ead63 100644 --- a/test/gen-template/matter3/endpoint_config.zapt +++ b/test/gen-template/matter3/endpoint_config.zapt @@ -101,6 +101,9 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, // Array of profile ids #define FIXED_PROFILE_IDS {{endpoint_fixed_profile_id_array}} +/ Array of parent endpoint ids +#define FIXED_PARENT_IDS {{endpoint_fixed_parent_id_array}} + // Array of device types #define FIXED_DEVICE_TYPES {{endpoint_fixed_device_type_array}}