Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix PR comments
Browse files Browse the repository at this point in the history
jepenven-silabs committed Nov 4, 2020
1 parent 85f0e79 commit 641509c
Showing 7 changed files with 16 additions and 15 deletions.
8 changes: 4 additions & 4 deletions third_party/zap/templates/README.md
Original file line number Diff line number Diff line change
@@ -6,21 +6,21 @@ This directory contains generation templates for ZAP, ZCL Advanced Platform.

**IMPORTANT**: Changes to templates will affect all examples.

# Usefull command for CHIP
# Useful command for CHIP

Run ZAP with UI to configure endpoints and clusters

```
<Inside /third_party/zap/repo/>
cd ./third_party/zap/repo/
node src-script/zap-start.js --logToStdout --gen ../templates/chip-templates.json
```

Generate files in headless mode

```
<Inside /third_party/zap/repo/>
cd ./third_party/zap/repo/
node src-script/zap-generate.js -z ./zcl-builtin/silabs/zcl.json -g ../templates/chip_templates.json -i <path to *.zap file> -o <Path to /gen/ folder>
```

For more information please see the documentation under
third_party/zap/repo/docs/
`docs/` in [ZAP](https://github.com/project-chip/zap)
8 changes: 4 additions & 4 deletions third_party/zap/templates/call-command-handler-src.zapt
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
#include "util.h"

{{#all_user_clusters}}
{{#if (isEnable enabled)}}
{{#if (isEnabled enabled)}}
EmberAfStatus emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}CommandParse(EmberAfClusterCommand * cmd);
{{/if}}
{{/all_user_clusters}}
@@ -46,7 +46,7 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
switch (cmd->apsFrame->clusterId)
{
{{#all_user_clusters}}
{{#if (isEnable enabled)}}
{{#if (isEnabled enabled)}}
{{#if (isClient side) }}
case ZCL_{{asDelimitedMacro define}}_ID :
result = emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}CommandParse(cmd);
@@ -65,7 +65,7 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
switch (cmd->apsFrame->clusterId)
{
{{#all_user_clusters}}
{{#if (isEnable enabled)}}
{{#if (isEnabled enabled)}}
{{#unless (isClient side) }}
case ZCL_{{asDelimitedMacro define}}_ID :
result = emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}CommandParse(cmd);
@@ -85,7 +85,7 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
// Cluster specific command parsing

{{#all_user_clusters}}
{{#if (isEnable enabled)}}
{{#if (isEnabled enabled)}}
EmberAfStatus emberAf{{asCamelCased name false}}Cluster{{asCamelCased side false}}CommandParse(EmberAfClusterCommand * cmd)
{
bool wasHandled = false;
2 changes: 1 addition & 1 deletion third_party/zap/templates/callback-stub-src.zapt
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ void __attribute__((weak)) emberAf{{asCamelCased name false}}ClusterInitCallback
// Cluster Command callback

{{#all_user_clusters}}
{{#if (isEnable enabled)}}
{{#if (isEnabled enabled)}}
{{#all_user_cluster_commands}}
{{#if (isStrEqual clusterName parent.name)}}
{{#if (isCommandAvailable parent.side incoming outgoing commandSource)}}
2 changes: 1 addition & 1 deletion third_party/zap/templates/callback.zapt
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ void emberAf{{asCamelCased name false}}ClusterInitCallback(uint8_t endpoint);
// CLuster Commands Callback

{{#all_user_clusters}}
{{#if (isEnable enabled)}}
{{#if (isEnabled enabled)}}
{{#all_user_cluster_commands}}
{{#if (isStrEqual clusterName parent.name)}}
{{#if (isCommandAvailable parent.side incoming outgoing commandSource)}}
1 change: 1 addition & 0 deletions third_party/zap/templates/gen_config.zapt
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

#ifndef __ZAP_GEN_CONFIG__
#define __ZAP_GEN_CONFIG__

// User options for plugin Binding Table Library
#define EMBER_BINDING_TABLE_SIZE 10

4 changes: 2 additions & 2 deletions third_party/zap/templates/helper-chip.js
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ function isLastElement(index, count) {
return index == count - 1;
}

function isEnable(enable) {
function isEnabled(enable) {
return 1 == enable;
}

@@ -89,5 +89,5 @@ exports.isClient = isClient;
exports.isServer = isServer;
exports.isStrEqual = isStrEqual;
exports.isLastElement = isLastElement;
exports.isEnable = isEnable;
exports.isEnabled = isEnabled;
exports.isCommandAvailable = isCommandAvailable;
6 changes: 3 additions & 3 deletions third_party/zap/templates/print-cluster.zapt
Original file line number Diff line number Diff line change
@@ -12,16 +12,16 @@

{{#zcl_clusters}}
#if defined(ZCL_USING_{{asDelimitedMacro this.define}}_SERVER) || defined(ZCL_USING_{{asDelimitedMacro this.define}}_CLIENT)
#define SILABS_PRINTCLUSTER_{{asDelimitedMacro this.define}} {ZCL_{{asDelimitedMacro this.define}}_ID, {{this.code}}, "{{this.label}}" },
#define CHIP_PRINTCLUSTER_{{asDelimitedMacro this.define}} {ZCL_{{asDelimitedMacro this.define}}_ID, {{this.code}}, "{{this.label}}" },
#else
#define SILABS_PRINTCLUSTER_{{asDelimitedMacro this.define}}
#define CHIP_PRINTCLUSTER_{{asDelimitedMacro this.define}}
#endif

{{/zcl_clusters}}

#define CLUSTER_IDS_TO_NAMES \
{{#zcl_clusters}}
SILABS_PRINTCLUSTER_{{asDelimitedMacro this.define}} \
CHIP_PRINTCLUSTER_{{asDelimitedMacro this.define}} \
{{/zcl_clusters}}

#define MAX_CLUSTER_NAME_LENGTH {{zcl_cluster_largest_label_length}}

0 comments on commit 641509c

Please sign in to comment.