From 2874185b4c1aed78df8c793e5cbf2baff2ed6a74 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Tue, 25 Jan 2022 21:24:16 -0800 Subject: [PATCH] Updating zap --- .../lighting-common/lighting-app.matter | 29 ++-- .../zap-generated/cluster/Commands.h | 4 +- .../zap-generated/CHIPClusters.cpp | 125 ++++++++++++++++++ .../lighting-app/zap-generated/CHIPClusters.h | 7 + .../zap-generated/IMClusterCommandHandler.cpp | 27 ---- 5 files changed, 149 insertions(+), 43 deletions(-) diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index ff7ef39e3ccd87..ebe4e52623dc33 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -1012,6 +1012,21 @@ client cluster OnOff = 6 { attribute enum8 startUpOnOff = 16387; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; + + request struct OffWithEffectRequest { + OnOffEffectIdentifier effectId = 0; + OnOffDelayedAllOffEffectVariant effectVariant = 1; + } + + request struct OnWithTimedOffRequest { + OnOffControl onOffControl = 0; + int16u onTime = 1; + int16u offWaitTime = 2; + } + + command OffWithEffect(OffWithEffectRequest): DefaultSuccess = 64; + command OnWithRecallGlobalScene(): DefaultSuccess = 65; + command OnWithTimedOff(OnWithTimedOffRequest): DefaultSuccess = 66; } server cluster OnOff = 6 { @@ -1038,22 +1053,8 @@ server cluster OnOff = 6 { readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; - request struct OffWithEffectRequest { - OnOffEffectIdentifier effectId = 0; - OnOffDelayedAllOffEffectVariant effectVariant = 1; - } - - request struct OnWithTimedOffRequest { - OnOffControl onOffControl = 0; - int16u onTime = 1; - int16u offWaitTime = 2; - } - command Off(): DefaultSuccess = 0; - command OffWithEffect(OffWithEffectRequest): DefaultSuccess = 64; command On(): DefaultSuccess = 1; - command OnWithRecallGlobalScene(): DefaultSuccess = 65; - command OnWithTimedOff(OnWithTimedOffRequest): DefaultSuccess = 66; command Toggle(): DefaultSuccess = 2; } diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index a2ca4f2071128d..37432392522eaf 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -46326,7 +46326,7 @@ class WriteTestClusterGeneralErrorBoolean : public ModelCommand class ReportTestClusterGeneralErrorBoolean : public ModelCommand { public: - ReportTestClusterGeneralErrorBoolean() : ModelCommand("report") + ReportTestClusterGeneralErrorBoolean() : ModelCommand("subscribe") { AddArgument("attr-name", "general-error-boolean"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); @@ -46421,7 +46421,7 @@ class WriteTestClusterClusterErrorBoolean : public ModelCommand class ReportTestClusterClusterErrorBoolean : public ModelCommand { public: - ReportTestClusterClusterErrorBoolean() : ModelCommand("report") + ReportTestClusterClusterErrorBoolean() : ModelCommand("subscribe") { AddArgument("attr-name", "cluster-error-boolean"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); diff --git a/zzz_generated/lighting-app/zap-generated/CHIPClusters.cpp b/zzz_generated/lighting-app/zap-generated/CHIPClusters.cpp index 90cf539961408b..6d321d5a482e0a 100644 --- a/zzz_generated/lighting-app/zap-generated/CHIPClusters.cpp +++ b/zzz_generated/lighting-app/zap-generated/CHIPClusters.cpp @@ -185,6 +185,131 @@ CHIP_ERROR OtaSoftwareUpdateProviderCluster::QueryImage(Callback::Cancelable * o } // OnOff Cluster Commands +CHIP_ERROR OnOffCluster::OffWithEffect(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t effectId, uint8_t effectVariant) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, OnOff::Commands::OffWithEffect::Id, + (app::CommandPathFlags::kEndpointIdValid) }; + + CommandSenderHandle sender( + Platform::New(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); + + VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + // effectId: onOffEffectIdentifier + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), effectId)); + // effectVariant: onOffDelayedAllOffEffectVariant + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), effectVariant)); + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); + + SuccessOrExit(err = mDevice->SendCommands(sender.get(), mTimeout)); + + // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object + // now. + sender.release(); +exit: + return err; +} + +CHIP_ERROR OnOffCluster::OnWithRecallGlobalScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, OnOff::Commands::OnWithRecallGlobalScene::Id, + (app::CommandPathFlags::kEndpointIdValid) }; + + CommandSenderHandle sender( + Platform::New(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); + + VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + // Command takes no arguments. + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); + + SuccessOrExit(err = mDevice->SendCommands(sender.get(), mTimeout)); + + // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object + // now. + sender.release(); +exit: + return err; +} + +CHIP_ERROR OnOffCluster::OnWithTimedOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t onOffControl, uint16_t onTime, uint16_t offWaitTime) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, OnOff::Commands::OnWithTimedOff::Id, + (app::CommandPathFlags::kEndpointIdValid) }; + + CommandSenderHandle sender( + Platform::New(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); + + VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + // onOffControl: onOffControl + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), onOffControl)); + // onTime: int16u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), onTime)); + // offWaitTime: int16u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), offWaitTime)); + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); + + SuccessOrExit(err = mDevice->SendCommands(sender.get(), mTimeout)); + + // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object + // now. + sender.release(); +exit: + return err; +} } // namespace Controller } // namespace chip diff --git a/zzz_generated/lighting-app/zap-generated/CHIPClusters.h b/zzz_generated/lighting-app/zap-generated/CHIPClusters.h index df0b4acf88ec9c..1af89f64c5c90a 100644 --- a/zzz_generated/lighting-app/zap-generated/CHIPClusters.h +++ b/zzz_generated/lighting-app/zap-generated/CHIPClusters.h @@ -52,6 +52,13 @@ class DLL_EXPORT OnOffCluster : public ClusterBase public: OnOffCluster() : ClusterBase(app::Clusters::OnOff::Id) {} ~OnOffCluster() {} + + // Cluster Commands + CHIP_ERROR OffWithEffect(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t effectId, + uint8_t effectVariant); + CHIP_ERROR OnWithRecallGlobalScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR OnWithTimedOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t onOffControl, uint16_t onTime, uint16_t offWaitTime); }; } // namespace Controller diff --git a/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp index 0378e5df3ce3d7..b8bdd001f0bf62 100644 --- a/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp @@ -1039,15 +1039,6 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } break; } - case Commands::OffWithEffect::Id: { - Commands::OffWithEffect::DecodableType commandData; - TLVError = DataModel::Decode(aDataTlv, commandData); - if (TLVError == CHIP_NO_ERROR) - { - wasHandled = emberAfOnOffClusterOffWithEffectCallback(apCommandObj, aCommandPath, commandData); - } - break; - } case Commands::On::Id: { Commands::On::DecodableType commandData; TLVError = DataModel::Decode(aDataTlv, commandData); @@ -1057,24 +1048,6 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } break; } - case Commands::OnWithRecallGlobalScene::Id: { - Commands::OnWithRecallGlobalScene::DecodableType commandData; - TLVError = DataModel::Decode(aDataTlv, commandData); - if (TLVError == CHIP_NO_ERROR) - { - wasHandled = emberAfOnOffClusterOnWithRecallGlobalSceneCallback(apCommandObj, aCommandPath, commandData); - } - break; - } - case Commands::OnWithTimedOff::Id: { - Commands::OnWithTimedOff::DecodableType commandData; - TLVError = DataModel::Decode(aDataTlv, commandData); - if (TLVError == CHIP_NO_ERROR) - { - wasHandled = emberAfOnOffClusterOnWithTimedOffCallback(apCommandObj, aCommandPath, commandData); - } - break; - } case Commands::Toggle::Id: { Commands::Toggle::DecodableType commandData; TLVError = DataModel::Decode(aDataTlv, commandData);