Skip to content

Commit

Permalink
[controller] Update codegen for Chip Device Controller after project-…
Browse files Browse the repository at this point in the history
  • Loading branch information
erjiaqing committed Apr 15, 2021
1 parent e83fc45 commit 55ccada
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
"gcc_release") GN_ARGS='is_debug=false';;
"clang") GN_ARGS='is_clang=true';;
"mbedtls") GN_ARGS='chip_crypto="mbedtls"';;
"clang_experimental") GN_ARGS='is_clang=true chip_enable_interaction_model=true';;
*) ;;
esac
Expand Down
14 changes: 5 additions & 9 deletions src/app/zap-templates/templates/chip/CHIPClusters-src.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,26 @@ CHIP_ERROR {{asCamelCased clusterName false}}Cluster::{{asCamelCased name false}
#if CHIP_ENABLE_INTERACTION_MODEL
VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
(void) onSuccessCallback;
(void) onFailureCallback;
(void) onFailureCallback;

app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, k{{asCamelCased name false}}CommandId,
(chip::app::Command::CommandPathFlags::kEndpointIdValid) };
app::Command * ZCLcommand = mDevice->GetCommandSender();

TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();

TLV::TLVType dummyType = TLV::kTLVType_NotSpecified;
ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, dummyType));
ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams));

{{#chip_server_cluster_command_arguments}}
{{#first}}
TLV::TLVWriter * writer = ZCLcommand->GetCommandDataElementTLVWriter();
uint8_t argSeqNumber = 0;
{{/first}}
// {{asCamelCased label}}: {{asCamelCased type}}
ReturnErrorOnFailure(writer.Put(TLV::ContextTag(argSeqNumber++), {{asCamelCased label}}));
ReturnErrorOnFailure(writer->Put(TLV::ContextTag(argSeqNumber++), {{asCamelCased label}}));
{{else}}
// Command takes no arguments.
{{/chip_server_cluster_command_arguments}}

ReturnErrorOnFailure(writer.EndContainer(dummyType));
ReturnErrorOnFailure(writer.Finalize());
ReturnErrorOnFailure(ZCLcommand->AddCommand(cmdParams));
ReturnErrorOnFailure(ZCLcommand->FinishCommand());

return mDevice->SendCommands();
#else
Expand Down

0 comments on commit 55ccada

Please sign in to comment.