Skip to content

Commit

Permalink
Attribute Type Information in Cluster Objects (#10398)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjerryjohns authored Oct 14, 2021
1 parent 24ad104 commit f0cc672
Show file tree
Hide file tree
Showing 6 changed files with 15,043 additions and 4,611 deletions.
28 changes: 28 additions & 0 deletions src/app/zap-templates/templates/app/cluster-objects.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <app-common/zap-generated/enums.h>
#include <app-common/zap-generated/ids/Commands.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app-common/zap-generated/ids/Attributes.h>

namespace chip {
namespace app {
Expand Down Expand Up @@ -114,6 +115,33 @@ public:
} // namespace Commands
{{/last}}
{{/zcl_commands}}

{{#zcl_attributes_server}}
{{#if (hasSpecificAttributes)}}
{{#first}}
namespace Attributes {
{{/first}}
{{#if clusterRef}}
namespace {{asUpperCamelCase label}} {
struct TypeInfo {
{{#if entryType}}
using Type = DataModel::List<{{zapTypeToEncodableClusterObjectType entryType}}>;
using DecodableType = DataModel::DecodableList<{{zapTypeToDecodableClusterObjectType entryType}}>;
{{else}}
using Type = {{zapTypeToEncodableClusterObjectType type}};
using DecodableType = {{zapTypeToDecodableClusterObjectType type}};;
{{/if}}

static constexpr ClusterId GetClusterId() { return {{asUpperCamelCase parent.name}}::Id; }
static constexpr AttributeId GetAttributeId() { return Attributes::{{asUpperCamelCase label}}::Id; }
};
} // namespace {{asUpperCamelCase label}}
{{/if}}
{{#last}}
} // namespace Attributes
{{/last}}
{{/if}}
{{/zcl_attributes_server}}
} // namespace {{asUpperCamelCase name}}
{{/zcl_clusters}}

Expand Down
4 changes: 4 additions & 0 deletions src/app/zap-templates/templates/app/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ async function zapTypeToClusterObjectType(type, isDecodable, options)
return 'chip::Span<const char>';
}

if (type == 'single') {
return 'float';
}

async function fn(pkgId)
{
const ns = options.hash.ns ? ('chip::app::Clusters::' + asUpperCamelCase(options.hash.ns) + '::') : '';
Expand Down
2 changes: 1 addition & 1 deletion src/app/zap-templates/zcl/data-model/silabs/general.xml
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ limitations under the License.
<attribute side="server" code="0x0003" define="SCENE_VALID" type="BOOLEAN" min="0x00" max="0x01" writable="false" default="0x00" optional="false">scene valid</attribute>
<attribute side="server" code="0x0004" define="SCENE_NAME_SUPPORT" type="BITMAP8" min="0x00" max="0x80" writable="false" optional="false">name support</attribute>
<!-- NAME_SUPPORT -->
<attribute side="server" code="0x0005" define="LAST_CONFIGURED_BY" type="EUI64" writable="false" optional="true">last configured by</attribute>
<attribute side="server" code="0x0005" define="LAST_CONFIGURED_BY" type="NODE_ID" writable="false" optional="true">last configured by</attribute>
<command source="client" code="0x00" name="AddScene" optional="false" cli="zcl scenes add">
<description>
Add a scene to the scene table. Extension field sets are supported, and are inputed as arrays of the form [[cluster ID] [length] [value0...n] ...]
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f0cc672

Please sign in to comment.