Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
JIRa: ZAPP-757
  • Loading branch information
brdandu committed May 11, 2022
1 parent 7a58516 commit b9dec36
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions src/app/zap-templates/templates/chip/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions src/controller/java/templates/partials/decode_value.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -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<jsize>({{source}}.size()));
Expand Down

0 comments on commit b9dec36

Please sign in to comment.