From 79498ed16928480b3281a6b1bb160f8a35272663 Mon Sep 17 00:00:00 2001 From: jfpenven <jean-francois.penven@silabs.com> Date: Thu, 17 Dec 2020 12:37:01 -0500 Subject: [PATCH] Add generated defaults count helper --- src-electron/generator/helper-endpointconfig.js | 5 +++++ test/endpoint-config.test.js | 3 +++ test/gen-template/zigbee/zap-config.zapt | 1 + 3 files changed, 9 insertions(+) diff --git a/src-electron/generator/helper-endpointconfig.js b/src-electron/generator/helper-endpointconfig.js index fa0684ca..cb064a98 100644 --- a/src-electron/generator/helper-endpointconfig.js +++ b/src-electron/generator/helper-endpointconfig.js @@ -283,6 +283,10 @@ function endpoint_reporting_config_default_count(options) { return this.reportList.length } +function endpoint_attribute_long_defaults_count(options) { + return this.longDefaultsList.length +} + function endpoint_attribute_long_defaults(options) { var littleEndian = true if (options.hash.endian == 'big') { @@ -621,6 +625,7 @@ function endpoint_config(options) { return templateUtil.templatePromise(this.global, promise) } +exports.endpoint_attribute_long_defaults_count = endpoint_attribute_long_defaults_count exports.endpoint_attribute_long_defaults = endpoint_attribute_long_defaults exports.endpoint_config = endpoint_config exports.endpoint_attribute_min_max_list = endpoint_attribute_min_max_list diff --git a/test/endpoint-config.test.js b/test/endpoint-config.test.js index 16fe34c2..bad0c46d 100644 --- a/test/endpoint-config.test.js +++ b/test/endpoint-config.test.js @@ -200,6 +200,9 @@ test( expect( epc.includes('#define FIXED_ENDPOINT_TYPES { 0, 1, 2 }') ).toBeTruthy() + expect( + epc.includes('#define GENERATED_DEFAULTS_COUNT (70)') + ).toBeTruthy() expect(epcLines.length).toBeGreaterThan(100) var cnt = 0 epcLines.forEach((line) => { diff --git a/test/gen-template/zigbee/zap-config.zapt b/test/gen-template/zigbee/zap-config.zapt index 8636b424..36323b1f 100644 --- a/test/gen-template/zigbee/zap-config.zapt +++ b/test/gen-template/zigbee/zap-config.zapt @@ -9,6 +9,7 @@ // Default values for the attributes longer than a pointer, // in a form of a binary blob // Separate block is generated for big-endian and little-endian cases. +#define GENERATED_DEFAULTS_COUNT ({{endpoint_attribute_long_defaults_count}}) #if BIGENDIAN_CPU #define GENERATED_DEFAULTS {{endpoint_attribute_long_defaults endian="big"}} -- GitLab