-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05f7bb8
commit 849d0df
Showing
13 changed files
with
4,586 additions
and
2,198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/app/zap-templates/templates/app/cluster-enums-check.zapt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{{> header}} | ||
|
||
#pragma once | ||
|
||
#include <app-common/zap-generated/cluster-enums.h> | ||
|
||
namespace chip { | ||
namespace app { | ||
namespace Clusters { | ||
{{#zcl_clusters}} | ||
{{#zcl_enums}} | ||
static auto __attribute__((unused)) EnsureKnownEnumValue({{asUpperCamelCase ../name}}::{{asType label}} val) | ||
{ | ||
using EnumType = {{asUpperCamelCase ../name}}::{{asType label}}; | ||
switch (val) { | ||
{{#if (isWeaklyTypedEnum label)}} | ||
// Need to convert consumers to using the new enum classes, so we | ||
// don't just have casts all over. | ||
#ifdef CHIP_USE_ENUM_CLASS_FOR_IM_ENUM | ||
{{/if}} | ||
{{#zcl_enum_items}} | ||
case EnumType::k{{asUpperCamelCase label}}: | ||
{{/zcl_enum_items}} | ||
{{#if (isWeaklyTypedEnum label)}} | ||
#else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM | ||
{{#zcl_enum_items}} | ||
case EMBER_ZCL_{{asDelimitedMacro parent.label}}_{{asDelimitedMacro label}}: | ||
{{/zcl_enum_items}} | ||
#endif // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM | ||
{{/if}} | ||
return val; | ||
default: | ||
return static_cast<EnumType>({{first_unused_enum_value mode="first_unused"}}); | ||
} | ||
} | ||
{{/zcl_enums}} | ||
|
||
{{/zcl_clusters}} | ||
} // namespace Clusters | ||
} // namespace app | ||
} // namespace chip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.