Skip to content

Commit

Permalink
Update ZAP to tip. (#14677)
Browse files Browse the repository at this point in the history
Slightly smaller data in endpoint_config.
  • Loading branch information
bzbarsky-apple authored Feb 3, 2022
1 parent 6c00d7a commit 4267a9b
Show file tree
Hide file tree
Showing 19 changed files with 1,162 additions and 2,204 deletions.
5 changes: 4 additions & 1 deletion src/app/util/attribute-storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ constexpr const EmberAfAttributeMinMaxValue minMaxDefaults[] = GENERATED_MIN_MAX
GENERATED_FUNCTION_ARRAYS
#endif

constexpr const chip::CommandId generatedCommands[] = GENERATED_COMMANDS;
#ifdef GENERATED_COMMANDS
constexpr const chip::CommandId generatedCommands[] = GENERATED_COMMANDS;
#endif // GENERATED_COMMANDS

constexpr const EmberAfAttributeMetadata generatedAttributes[] = GENERATED_ATTRIBUTES;
constexpr const EmberAfCluster generatedClusters[] = GENERATED_CLUSTERS;
constexpr const EmberAfEndpointType generatedEmberAfEndpointTypes[] = GENERATED_ENDPOINT_TYPES;
Expand Down
11 changes: 10 additions & 1 deletion src/app/zap-templates/templates/app/endpoint_config.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,18 @@
// Cluster function static arrays
#define GENERATED_FUNCTION_ARRAYS {{chip_endpoint_generated_functions}}

{{#chip_endpoint_generated_commands_list}}
{{#first}}
// clang-format off
#define GENERATED_COMMANDS {{chip_endpoint_generated_commands_list}}
#define GENERATED_COMMANDS { \
{{/first}}
{{text}}
{{#last}}
}

// clang-format on
{{/last}}
{{/chip_endpoint_generated_commands_list}}

#define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_ ## mask
#define GENERATED_CLUSTER_COUNT {{endpoint_cluster_count}}
Expand Down
12 changes: 6 additions & 6 deletions src/app/zap-templates/templates/app/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ function chip_endpoint_generated_functions()
return ret.concat('\n');
}

function chip_endpoint_generated_commands_list()
function chip_endpoint_generated_commands_list(options)
{
let ret = '{ \\\n';
let ret = [];
this.clusterList.forEach((c) => {
let clientGeneratedCommands = [];
let serverGeneratedCommands = [];
Expand All @@ -197,18 +197,18 @@ function chip_endpoint_generated_commands_list()
});

if (clientGeneratedCommands.length > 0 || serverGeneratedCommands.length > 0) {
ret = ret.concat(` /* ${c.comment} */\\\n`);
ret.push({ text : ` /* ${c.comment} */\\` });
}
if (clientGeneratedCommands.length > 0) {
clientGeneratedCommands.push('chip::kInvalidCommandId /* end of list */')
ret = ret.concat(` /* client_generated */ \\\n ${clientGeneratedCommands.join(', \\\n ')}, \\\n`);
ret.push({ text : ` /* client_generated */ \\\n ${clientGeneratedCommands.join(', \\\n ')}, \\` });
}
if (serverGeneratedCommands.length > 0) {
serverGeneratedCommands.push('chip::kInvalidCommandId /* end of list */')
ret = ret.concat(` /* server_generated */ \\\n ${serverGeneratedCommands.join(', \\\n ')}, \\\n`);
ret.push({ text : ` /* server_generated */ \\\n ${serverGeneratedCommands.join(', \\\n ')}, \\` });
}
})
return ret.concat('}\n');
return templateUtil.collectBlocks(ret, options, this);
}

/**
Expand Down
Loading

0 comments on commit 4267a9b

Please sign in to comment.