diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4b0a566e104ca2..bde00893f349da 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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 diff --git a/src/app/zap-templates/templates/app/im-cluster-command-handler.zapt b/src/app/zap-templates/templates/app/im-cluster-command-handler.zapt index 63ea80adc7c82b..3f24d72be3a4a3 100644 --- a/src/app/zap-templates/templates/app/im-cluster-command-handler.zapt +++ b/src/app/zap-templates/templates/app/im-cluster-command-handler.zapt @@ -70,6 +70,8 @@ void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aC ChipLogDetail(Zcl, "Received Cluster Command: Cluster=%" PRIx16 " Command=%" PRIx8 " Endpoint=%" PRIx8, aClusterId, aCommandId, aEndPointId); Compatibility::SetupEmberAfObjects(apCommandObj, aClusterId, aCommandId, aEndPointId); + TLV::TLVType dataTlvType; + SuccessOrExit(aReader.EnterContainer(dataTlvType)); switch (aClusterId) { {{#all_user_clusters}} @@ -88,7 +90,9 @@ void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aC ChipLogError(Zcl, "Unknown cluster %" PRIx16, aClusterId); break; } +exit: Compatibility::ResetEmberAfObjects(); + aReader.ExitContainer(dataTlvType); } } // namespace app diff --git a/src/app/zap-templates/templates/chip/CHIPClusters-src.zapt b/src/app/zap-templates/templates/chip/CHIPClusters-src.zapt index 840f1b50d835be..ae06c35cb14f3b 100644 --- a/src/app/zap-templates/templates/chip/CHIPClusters-src.zapt +++ b/src/app/zap-templates/templates/chip/CHIPClusters-src.zapt @@ -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