diff --git a/src/app/zap-templates/templates/chip/helper.js b/src/app/zap-templates/templates/chip/helper.js index 352f9b39a36029..f2b7ccfb663bc3 100644 --- a/src/app/zap-templates/templates/chip/helper.js +++ b/src/app/zap-templates/templates/chip/helper.js @@ -447,8 +447,8 @@ async function chip_endpoint_clusters(options) } /** - * Helper checks if the type for the bitmap is Bitflags. This generally includes - * all inherited bitmaps i.e. all bitmaps apart from + * Helper checks if the type for the bitmap is BitFlags. This generally includes + * all bitmaps apart from * bitmap8/16/32(generally defined in types.xml) * example: * {{#if_is_strongly_typed_bitmap type}} @@ -488,8 +488,8 @@ async function if_is_strongly_typed_bitmap(type, options) } /** - * This function retrieves all the strongly typed enums from the database. This - * generally includes all inherited enums i.e. all enums apart from + * Helper to a handlebar helper function which checks if an enum is a strongly + * typed enum or not. This generally includes all enums apart from * enum8/16/32(generally defined in types.xml) * * * example for if_is_strongly_typed_enum: @@ -508,6 +508,7 @@ async function if_is_strongly_typed_enum_common(type, options, context) { let packageId = await templateUtil.ensureZclPackageId(context) let enumRes + // Retrieving the enum from the enum table if (type && typeof type === 'string') { enumRes = await queryZcl.selectEnumByName(context.global.db, type, packageId) @@ -517,6 +518,8 @@ async function if_is_strongly_typed_enum_common(type, options, context) enumRes = await queryZcl.selectEnumById(context.global.db, type) } + // Checking if an enum is atomic. If an eunm is not atomic then the enum + // is a strongly typed enum if (enumRes) { let a = await queryZcl.selectAtomicType(context.global.db, packageId, enumRes.name) if (a) @@ -533,7 +536,7 @@ async function if_is_strongly_typed_enum_common(type, options, context) /** * Helper that checks if an enum is a strongly typed enum or not - * This generally includes all inherited enums i.e. all enums apart from + * This generally includes all enums apart from * enum8/16/32(generally defined in types.xml) * * * example: diff --git a/src/controller/java/templates/partials/decode_value.zapt b/src/controller/java/templates/partials/decode_value.zapt index 817d096afba482..60c179152dcee8 100644 --- a/src/controller/java/templates/partials/decode_value.zapt +++ b/src/controller/java/templates/partials/decode_value.zapt @@ -51,9 +51,9 @@ if ({{source}}.IsNull()) { ); {{else}} {{#if_is_strongly_typed_chip_enum type}} - std::string {{target}}ClassName = "{{asJniClassName type null cluster}}"; - std::string {{target}}CtorSignature = "({{asJniSignature type null cluster false}})V"; - chip::JniReferences::GetInstance().CreateBoxedObject<{{asUnderlyingBasicType type}}>({{target}}ClassName.c_str(), {{target}}CtorSignature.c_str(), static_cast<{{asUnderlyingBasicType type}}>({{source}}), {{target}}); + std::string {{target}}ClassName = "{{asJniClassName type null cluster}}"; + std::string {{target}}CtorSignature = "({{asJniSignature type null cluster false}})V"; + chip::JniReferences::GetInstance().CreateBoxedObject<{{asUnderlyingBasicType type}}>({{target}}ClassName.c_str(), {{target}}CtorSignature.c_str(), static_cast<{{asUnderlyingBasicType type}}>({{source}}), {{target}}); {{else}} {{#if (isOctetString type)}} jbyteArray {{target}}ByteArray = env->NewByteArray(static_cast({{source}}.size()));