diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.matter b/examples/light-switch-app/light-switch-common/light-switch-app.matter index 2c39578a5616d5..4bbe4d6b6b253f 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.matter +++ b/examples/light-switch-app/light-switch-common/light-switch-app.matter @@ -580,35 +580,6 @@ client cluster Groups = 4 { readonly attribute bitmap8 nameSupport = 0; readonly global attribute attrib_id attributeList[] = 65531; readonly global attribute int16u clusterRevision = 65533; - - request struct AddGroupRequest { - INT16U groupId = 0; - CHAR_STRING groupName = 1; - } - - request struct AddGroupIfIdentifyingRequest { - INT16U groupId = 0; - CHAR_STRING groupName = 1; - } - - request struct GetGroupMembershipRequest { - INT16U groupList[] = 0; - } - - request struct RemoveGroupRequest { - INT16U groupId = 0; - } - - request struct ViewGroupRequest { - INT16U groupId = 0; - } - - command AddGroup(AddGroupRequest): AddGroupResponse = 0; - command AddGroupIfIdentifying(AddGroupIfIdentifyingRequest): DefaultSuccess = 5; - command GetGroupMembership(GetGroupMembershipRequest): GetGroupMembershipResponse = 2; - command RemoveAllGroups(): DefaultSuccess = 4; - command RemoveGroup(RemoveGroupRequest): RemoveGroupResponse = 3; - command ViewGroup(ViewGroupRequest): ViewGroupResponse = 1; } client cluster Identify = 3 { @@ -968,10 +939,6 @@ client cluster OnOff = 6 { readonly global attribute attrib_id attributeList[] = 65531; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; - - command Off(): DefaultSuccess = 0; - command On(): DefaultSuccess = 1; - command Toggle(): DefaultSuccess = 2; } server cluster OperationalCredentials = 62 { @@ -991,7 +958,7 @@ server cluster OperationalCredentials = 62 { struct NOCStruct { fabric_idx fabricIndex = 0; OCTET_STRING noc = 1; - OCTET_STRING icac = 2; + nullable OCTET_STRING icac = 2; } struct FabricDescriptor { @@ -1097,91 +1064,6 @@ client cluster Scenes = 5 { readonly attribute bitmap8 nameSupport = 4; readonly global attribute attrib_id attributeList[] = 65531; readonly global attribute int16u clusterRevision = 65533; - - request struct AddSceneRequest { - INT16U groupId = 0; - INT8U sceneId = 1; - INT16U transitionTime = 2; - CHAR_STRING sceneName = 3; - SceneExtensionFieldSet extensionFieldSets[] = 4; - } - - request struct GetSceneMembershipRequest { - INT16U groupId = 0; - } - - request struct RecallSceneRequest { - INT16U groupId = 0; - INT8U sceneId = 1; - INT16U transitionTime = 2; - } - - request struct RemoveAllScenesRequest { - INT16U groupId = 0; - } - - request struct RemoveSceneRequest { - INT16U groupId = 0; - INT8U sceneId = 1; - } - - request struct StoreSceneRequest { - INT16U groupId = 0; - INT8U sceneId = 1; - } - - request struct ViewSceneRequest { - INT16U groupId = 0; - INT8U sceneId = 1; - } - - response struct AddSceneResponse { - ENUM8 status = 0; - INT16U groupId = 1; - INT8U sceneId = 2; - } - - response struct GetSceneMembershipResponse { - ENUM8 status = 0; - INT8U capacity = 1; - INT16U groupId = 2; - INT8U sceneCount = 3; - INT8U sceneList[] = 4; - } - - response struct RemoveAllScenesResponse { - ENUM8 status = 0; - INT16U groupId = 1; - } - - response struct RemoveSceneResponse { - ENUM8 status = 0; - INT16U groupId = 1; - INT8U sceneId = 2; - } - - response struct StoreSceneResponse { - ENUM8 status = 0; - INT16U groupId = 1; - INT8U sceneId = 2; - } - - response struct ViewSceneResponse { - ENUM8 status = 0; - INT16U groupId = 1; - INT8U sceneId = 2; - INT16U transitionTime = 3; - CHAR_STRING sceneName = 4; - SceneExtensionFieldSet extensionFieldSets[] = 5; - } - - command AddScene(AddSceneRequest): AddSceneResponse = 0; - command GetSceneMembership(GetSceneMembershipRequest): GetSceneMembershipResponse = 6; - command RecallScene(RecallSceneRequest): DefaultSuccess = 5; - command RemoveAllScenes(RemoveAllScenesRequest): RemoveAllScenesResponse = 3; - command RemoveScene(RemoveSceneRequest): RemoveSceneResponse = 2; - command StoreScene(StoreSceneRequest): StoreSceneResponse = 4; - command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; } server cluster SoftwareDiagnostics = 52 { diff --git a/zzz_generated/light-switch-app/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/light-switch-app/zap-generated/CHIPClientCallbacks.cpp index f1cea3d5d57726..625230556c915c 100644 --- a/zzz_generated/light-switch-app/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/light-switch-app/zap-generated/CHIPClientCallbacks.cpp @@ -256,106 +256,3 @@ bool emberAfOtaSoftwareUpdateProviderClusterQueryImageResponseCallback(EndpointI userConsentNeeded, metadataForRequestor); return true; } - -bool emberAfScenesClusterAddSceneResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, uint8_t status, - uint16_t groupId, uint8_t sceneId) -{ - ChipLogProgress(Zcl, "AddSceneResponse:"); - ChipLogProgress(Zcl, " status: %" PRIu8 "", status); - ChipLogProgress(Zcl, " groupId: %" PRIu16 "", groupId); - ChipLogProgress(Zcl, " sceneId: %" PRIu8 "", sceneId); - - GET_CLUSTER_RESPONSE_CALLBACKS("ScenesClusterAddSceneResponseCallback"); - - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, status, groupId, sceneId); - return true; -} - -bool emberAfScenesClusterGetSceneMembershipResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, uint8_t status, - uint8_t capacity, uint16_t groupId, uint8_t sceneCount, - /* TYPE WARNING: array array defaults to */ uint8_t * sceneList) -{ - ChipLogProgress(Zcl, "GetSceneMembershipResponse:"); - ChipLogProgress(Zcl, " status: %" PRIu8 "", status); - ChipLogProgress(Zcl, " capacity: %" PRIu8 "", capacity); - ChipLogProgress(Zcl, " groupId: %" PRIu16 "", groupId); - ChipLogProgress(Zcl, " sceneCount: %" PRIu8 "", sceneCount); - ChipLogProgress(Zcl, " sceneList: %p", sceneList); - - GET_CLUSTER_RESPONSE_CALLBACKS("ScenesClusterGetSceneMembershipResponseCallback"); - - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, status, capacity, groupId, sceneCount, sceneList); - return true; -} - -bool emberAfScenesClusterRemoveAllScenesResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, uint8_t status, - uint16_t groupId) -{ - ChipLogProgress(Zcl, "RemoveAllScenesResponse:"); - ChipLogProgress(Zcl, " status: %" PRIu8 "", status); - ChipLogProgress(Zcl, " groupId: %" PRIu16 "", groupId); - - GET_CLUSTER_RESPONSE_CALLBACKS("ScenesClusterRemoveAllScenesResponseCallback"); - - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, status, groupId); - return true; -} - -bool emberAfScenesClusterRemoveSceneResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, uint8_t status, - uint16_t groupId, uint8_t sceneId) -{ - ChipLogProgress(Zcl, "RemoveSceneResponse:"); - ChipLogProgress(Zcl, " status: %" PRIu8 "", status); - ChipLogProgress(Zcl, " groupId: %" PRIu16 "", groupId); - ChipLogProgress(Zcl, " sceneId: %" PRIu8 "", sceneId); - - GET_CLUSTER_RESPONSE_CALLBACKS("ScenesClusterRemoveSceneResponseCallback"); - - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, status, groupId, sceneId); - return true; -} - -bool emberAfScenesClusterStoreSceneResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, uint8_t status, - uint16_t groupId, uint8_t sceneId) -{ - ChipLogProgress(Zcl, "StoreSceneResponse:"); - ChipLogProgress(Zcl, " status: %" PRIu8 "", status); - ChipLogProgress(Zcl, " groupId: %" PRIu16 "", groupId); - ChipLogProgress(Zcl, " sceneId: %" PRIu8 "", sceneId); - - GET_CLUSTER_RESPONSE_CALLBACKS("ScenesClusterStoreSceneResponseCallback"); - - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, status, groupId, sceneId); - return true; -} - -bool emberAfScenesClusterViewSceneResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, uint8_t status, - uint16_t groupId, uint8_t sceneId, uint16_t transitionTime, - chip::CharSpan sceneName, - /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets) -{ - ChipLogProgress(Zcl, "ViewSceneResponse:"); - ChipLogProgress(Zcl, " status: %" PRIu8 "", status); - ChipLogProgress(Zcl, " groupId: %" PRIu16 "", groupId); - ChipLogProgress(Zcl, " sceneId: %" PRIu8 "", sceneId); - ChipLogProgress(Zcl, " transitionTime: %" PRIu16 "", transitionTime); - ChipLogProgress(Zcl, " sceneName: %.*s", static_cast(sceneName.size()), sceneName.data()); - ChipLogProgress(Zcl, " extensionFieldSets: %p", extensionFieldSets); - - GET_CLUSTER_RESPONSE_CALLBACKS("ScenesClusterViewSceneResponseCallback"); - - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); - cb->mCall(cb->mContext, status, groupId, sceneId, transitionTime, sceneName, extensionFieldSets); - return true; -} diff --git a/zzz_generated/light-switch-app/zap-generated/CHIPClientCallbacks.h b/zzz_generated/light-switch-app/zap-generated/CHIPClientCallbacks.h index 52886db35056a9..ac615ac541dd1e 100644 --- a/zzz_generated/light-switch-app/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/light-switch-app/zap-generated/CHIPClientCallbacks.h @@ -40,16 +40,6 @@ typedef void (*OtaSoftwareUpdateProviderClusterApplyUpdateResponseCallback)(void typedef void (*OtaSoftwareUpdateProviderClusterQueryImageResponseCallback)( void * context, uint8_t status, uint32_t delayedActionTime, chip::CharSpan imageURI, uint32_t softwareVersion, chip::CharSpan softwareVersionString, chip::ByteSpan updateToken, bool userConsentNeeded, chip::ByteSpan metadataForRequestor); -typedef void (*ScenesClusterAddSceneResponseCallback)(void * context, uint8_t status, uint16_t groupId, uint8_t sceneId); -typedef void (*ScenesClusterGetSceneMembershipResponseCallback)(void * context, uint8_t status, uint8_t capacity, uint16_t groupId, - uint8_t sceneCount, - /* TYPE WARNING: array array defaults to */ uint8_t * sceneList); -typedef void (*ScenesClusterRemoveAllScenesResponseCallback)(void * context, uint8_t status, uint16_t groupId); -typedef void (*ScenesClusterRemoveSceneResponseCallback)(void * context, uint8_t status, uint16_t groupId, uint8_t sceneId); -typedef void (*ScenesClusterStoreSceneResponseCallback)(void * context, uint8_t status, uint16_t groupId, uint8_t sceneId); -typedef void (*ScenesClusterViewSceneResponseCallback)(void * context, uint8_t status, uint16_t groupId, uint8_t sceneId, - uint16_t transitionTime, chip::CharSpan sceneName, - /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets); // List specific responses void GroupsClusterAttributeListListAttributeFilter(chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, diff --git a/zzz_generated/light-switch-app/zap-generated/CHIPClusters.cpp b/zzz_generated/light-switch-app/zap-generated/CHIPClusters.cpp index c6f5c67dfa1fdf..92e3a41d9d826c 100644 --- a/zzz_generated/light-switch-app/zap-generated/CHIPClusters.cpp +++ b/zzz_generated/light-switch-app/zap-generated/CHIPClusters.cpp @@ -828,252 +828,6 @@ CHIP_ERROR ColorControlCluster::StepSaturation(Callback::Cancelable * onSuccessC } // Groups Cluster Commands -CHIP_ERROR GroupsCluster::AddGroup(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t groupId, chip::CharSpan groupName) -{ - 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, Groups::Commands::AddGroup::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); - // groupId: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupId)); - // groupName: charString - SuccessOrExit(err = writer->PutString(TLV::ContextTag(argSeqNumber++), groupName)); - - 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 GroupsCluster::AddGroupIfIdentifying(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t groupId, chip::CharSpan groupName) -{ - 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, Groups::Commands::AddGroupIfIdentifying::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); - // groupId: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupId)); - // groupName: charString - SuccessOrExit(err = writer->PutString(TLV::ContextTag(argSeqNumber++), groupName)); - - 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 GroupsCluster::GetGroupMembership(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t groupList) -{ - 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, Groups::Commands::GetGroupMembership::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); - // groupList: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupList)); - - 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 GroupsCluster::RemoveAllGroups(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, Groups::Commands::RemoveAllGroups::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 GroupsCluster::RemoveGroup(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t groupId) -{ - 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, Groups::Commands::RemoveGroup::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); - // groupId: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupId)); - - 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 GroupsCluster::ViewGroup(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t groupId) -{ - 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, Groups::Commands::ViewGroup::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); - // groupId: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupId)); - - 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; -} // Identify Cluster Commands @@ -1228,430 +982,8 @@ CHIP_ERROR OtaSoftwareUpdateProviderCluster::QueryImage(Callback::Cancelable * o } // OnOff Cluster Commands -CHIP_ERROR OnOffCluster::Off(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::Off::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::On(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::On::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::Toggle(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::Toggle::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; -} // Scenes Cluster Commands -CHIP_ERROR ScenesCluster::AddScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t groupId, uint8_t sceneId, uint16_t transitionTime, chip::CharSpan sceneName, - chip::ClusterId clusterId, uint8_t length, uint8_t value) -{ - 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, Scenes::Commands::AddScene::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); - // groupId: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupId)); - // sceneId: int8u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), sceneId)); - // transitionTime: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), transitionTime)); - // sceneName: charString - SuccessOrExit(err = writer->PutString(TLV::ContextTag(argSeqNumber++), sceneName)); - // clusterId: clusterId - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), clusterId)); - // length: int8u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), length)); - // value: int8u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), value)); - - 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 ScenesCluster::GetSceneMembership(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t groupId) -{ - 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, Scenes::Commands::GetSceneMembership::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); - // groupId: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupId)); - - 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 ScenesCluster::RecallScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t groupId, uint8_t sceneId, uint16_t transitionTime) -{ - 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, Scenes::Commands::RecallScene::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); - // groupId: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupId)); - // sceneId: int8u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), sceneId)); - // transitionTime: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), transitionTime)); - - 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 ScenesCluster::RemoveAllScenes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t groupId) -{ - 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, Scenes::Commands::RemoveAllScenes::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); - // groupId: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupId)); - - 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 ScenesCluster::RemoveScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t groupId, uint8_t sceneId) -{ - 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, Scenes::Commands::RemoveScene::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); - // groupId: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupId)); - // sceneId: int8u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), sceneId)); - - 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 ScenesCluster::StoreScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t groupId, uint8_t sceneId) -{ - 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, Scenes::Commands::StoreScene::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); - // groupId: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupId)); - // sceneId: int8u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), sceneId)); - - 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 ScenesCluster::ViewScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t groupId, uint8_t sceneId) -{ - 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, Scenes::Commands::ViewScene::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); - // groupId: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupId)); - // sceneId: int8u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), sceneId)); - - 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/light-switch-app/zap-generated/CHIPClusters.h b/zzz_generated/light-switch-app/zap-generated/CHIPClusters.h index ca77038da925eb..5c327026f9878e 100644 --- a/zzz_generated/light-switch-app/zap-generated/CHIPClusters.h +++ b/zzz_generated/light-switch-app/zap-generated/CHIPClusters.h @@ -81,17 +81,6 @@ class DLL_EXPORT GroupsCluster : public ClusterBase public: GroupsCluster() : ClusterBase(app::Clusters::Groups::Id) {} ~GroupsCluster() {} - - // Cluster Commands - CHIP_ERROR AddGroup(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId, - chip::CharSpan groupName); - CHIP_ERROR AddGroupIfIdentifying(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t groupId, chip::CharSpan groupName); - CHIP_ERROR GetGroupMembership(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t groupList); - CHIP_ERROR RemoveAllGroups(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); - CHIP_ERROR RemoveGroup(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId); - CHIP_ERROR ViewGroup(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId); }; class DLL_EXPORT IdentifyCluster : public ClusterBase @@ -123,11 +112,6 @@ class DLL_EXPORT OnOffCluster : public ClusterBase public: OnOffCluster() : ClusterBase(app::Clusters::OnOff::Id) {} ~OnOffCluster() {} - - // Cluster Commands - CHIP_ERROR Off(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); - CHIP_ERROR On(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); - CHIP_ERROR Toggle(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); }; class DLL_EXPORT ScenesCluster : public ClusterBase @@ -135,23 +119,6 @@ class DLL_EXPORT ScenesCluster : public ClusterBase public: ScenesCluster() : ClusterBase(app::Clusters::Scenes::Id) {} ~ScenesCluster() {} - - // Cluster Commands - CHIP_ERROR AddScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId, - uint8_t sceneId, uint16_t transitionTime, chip::CharSpan sceneName, chip::ClusterId clusterId, - uint8_t length, uint8_t value); - CHIP_ERROR GetSceneMembership(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t groupId); - CHIP_ERROR RecallScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId, - uint8_t sceneId, uint16_t transitionTime); - CHIP_ERROR RemoveAllScenes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t groupId); - CHIP_ERROR RemoveScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId, - uint8_t sceneId); - CHIP_ERROR StoreScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId, - uint8_t sceneId); - CHIP_ERROR ViewScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId, - uint8_t sceneId); }; } // namespace Controller diff --git a/zzz_generated/light-switch-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/light-switch-app/zap-generated/IMClusterCommandHandler.cpp index 7a84fd28021068..78156a06a97767 100644 --- a/zzz_generated/light-switch-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/light-switch-app/zap-generated/IMClusterCommandHandler.cpp @@ -792,459 +792,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP namespace Scenes { -void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) -{ - // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV - // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. - // Any error value TLVUnpackError means we have received an illegal value. - // The following variables are used for all commands to save code size. - CHIP_ERROR TLVError = CHIP_NO_ERROR; - CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint32_t validArgumentCount = 0; - uint32_t expectArgumentCount = 0; - uint32_t currentDecodeTagId = 0; - bool wasHandled = false; - { - switch (aCommandPath.mCommandId) - { - case Commands::AddSceneResponse::Id: { - expectArgumentCount = 3; - uint8_t status; - uint16_t groupId; - uint8_t sceneId; - bool argExists[3]; - - memset(argExists, 0, sizeof argExists); - - while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) - { - // Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element. - // Skip this element if it is not a ContextTag, not consider it as an error if other values are valid. - if (!TLV::IsContextTag(aDataTlv.GetTag())) - { - continue; - } - currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag()); - if (currentDecodeTagId < 3) - { - if (argExists[currentDecodeTagId]) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - else - { - argExists[currentDecodeTagId] = true; - validArgumentCount++; - } - } - switch (currentDecodeTagId) - { - case 0: - TLVUnpackError = aDataTlv.Get(status); - break; - case 1: - TLVUnpackError = aDataTlv.Get(groupId); - break; - case 2: - TLVUnpackError = aDataTlv.Get(sceneId); - break; - default: - // Unsupported tag, ignore it. - ChipLogProgress(Zcl, "Unknown TLV tag during processing."); - break; - } - if (CHIP_NO_ERROR != TLVUnpackError) - { - break; - } - } - - if (CHIP_END_OF_TLV == TLVError) - { - // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. - TLVError = CHIP_NO_ERROR; - } - - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount) - { - wasHandled = - emberAfScenesClusterAddSceneResponseCallback(aCommandPath.mEndpointId, apCommandObj, status, groupId, sceneId); - } - break; - } - case Commands::GetSceneMembershipResponse::Id: { - expectArgumentCount = 5; - uint8_t status; - uint8_t capacity; - uint16_t groupId; - uint8_t sceneCount; - /* TYPE WARNING: array array defaults to */ uint8_t * sceneList; - bool argExists[5]; - - memset(argExists, 0, sizeof argExists); - - while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) - { - // Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element. - // Skip this element if it is not a ContextTag, not consider it as an error if other values are valid. - if (!TLV::IsContextTag(aDataTlv.GetTag())) - { - continue; - } - currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag()); - if (currentDecodeTagId < 5) - { - if (argExists[currentDecodeTagId]) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - else - { - argExists[currentDecodeTagId] = true; - validArgumentCount++; - } - } - switch (currentDecodeTagId) - { - case 0: - TLVUnpackError = aDataTlv.Get(status); - break; - case 1: - TLVUnpackError = aDataTlv.Get(capacity); - break; - case 2: - TLVUnpackError = aDataTlv.Get(groupId); - break; - case 3: - TLVUnpackError = aDataTlv.Get(sceneCount); - break; - case 4: - // Just for compatibility, we will add array type support in IM later. - TLVUnpackError = aDataTlv.GetDataPtr(const_cast(sceneList)); - break; - default: - // Unsupported tag, ignore it. - ChipLogProgress(Zcl, "Unknown TLV tag during processing."); - break; - } - if (CHIP_NO_ERROR != TLVUnpackError) - { - break; - } - } - - if (CHIP_END_OF_TLV == TLVError) - { - // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. - TLVError = CHIP_NO_ERROR; - } - - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount) - { - wasHandled = emberAfScenesClusterGetSceneMembershipResponseCallback(aCommandPath.mEndpointId, apCommandObj, status, - capacity, groupId, sceneCount, sceneList); - } - break; - } - case Commands::RemoveAllScenesResponse::Id: { - expectArgumentCount = 2; - uint8_t status; - uint16_t groupId; - bool argExists[2]; - - memset(argExists, 0, sizeof argExists); - - while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) - { - // Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element. - // Skip this element if it is not a ContextTag, not consider it as an error if other values are valid. - if (!TLV::IsContextTag(aDataTlv.GetTag())) - { - continue; - } - currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag()); - if (currentDecodeTagId < 2) - { - if (argExists[currentDecodeTagId]) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - else - { - argExists[currentDecodeTagId] = true; - validArgumentCount++; - } - } - switch (currentDecodeTagId) - { - case 0: - TLVUnpackError = aDataTlv.Get(status); - break; - case 1: - TLVUnpackError = aDataTlv.Get(groupId); - break; - default: - // Unsupported tag, ignore it. - ChipLogProgress(Zcl, "Unknown TLV tag during processing."); - break; - } - if (CHIP_NO_ERROR != TLVUnpackError) - { - break; - } - } - - if (CHIP_END_OF_TLV == TLVError) - { - // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. - TLVError = CHIP_NO_ERROR; - } - - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) - { - wasHandled = - emberAfScenesClusterRemoveAllScenesResponseCallback(aCommandPath.mEndpointId, apCommandObj, status, groupId); - } - break; - } - case Commands::RemoveSceneResponse::Id: { - expectArgumentCount = 3; - uint8_t status; - uint16_t groupId; - uint8_t sceneId; - bool argExists[3]; - - memset(argExists, 0, sizeof argExists); - - while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) - { - // Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element. - // Skip this element if it is not a ContextTag, not consider it as an error if other values are valid. - if (!TLV::IsContextTag(aDataTlv.GetTag())) - { - continue; - } - currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag()); - if (currentDecodeTagId < 3) - { - if (argExists[currentDecodeTagId]) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - else - { - argExists[currentDecodeTagId] = true; - validArgumentCount++; - } - } - switch (currentDecodeTagId) - { - case 0: - TLVUnpackError = aDataTlv.Get(status); - break; - case 1: - TLVUnpackError = aDataTlv.Get(groupId); - break; - case 2: - TLVUnpackError = aDataTlv.Get(sceneId); - break; - default: - // Unsupported tag, ignore it. - ChipLogProgress(Zcl, "Unknown TLV tag during processing."); - break; - } - if (CHIP_NO_ERROR != TLVUnpackError) - { - break; - } - } - - if (CHIP_END_OF_TLV == TLVError) - { - // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. - TLVError = CHIP_NO_ERROR; - } - - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount) - { - wasHandled = emberAfScenesClusterRemoveSceneResponseCallback(aCommandPath.mEndpointId, apCommandObj, status, - groupId, sceneId); - } - break; - } - case Commands::StoreSceneResponse::Id: { - expectArgumentCount = 3; - uint8_t status; - uint16_t groupId; - uint8_t sceneId; - bool argExists[3]; - - memset(argExists, 0, sizeof argExists); - - while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) - { - // Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element. - // Skip this element if it is not a ContextTag, not consider it as an error if other values are valid. - if (!TLV::IsContextTag(aDataTlv.GetTag())) - { - continue; - } - currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag()); - if (currentDecodeTagId < 3) - { - if (argExists[currentDecodeTagId]) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - else - { - argExists[currentDecodeTagId] = true; - validArgumentCount++; - } - } - switch (currentDecodeTagId) - { - case 0: - TLVUnpackError = aDataTlv.Get(status); - break; - case 1: - TLVUnpackError = aDataTlv.Get(groupId); - break; - case 2: - TLVUnpackError = aDataTlv.Get(sceneId); - break; - default: - // Unsupported tag, ignore it. - ChipLogProgress(Zcl, "Unknown TLV tag during processing."); - break; - } - if (CHIP_NO_ERROR != TLVUnpackError) - { - break; - } - } - - if (CHIP_END_OF_TLV == TLVError) - { - // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. - TLVError = CHIP_NO_ERROR; - } - - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount) - { - wasHandled = emberAfScenesClusterStoreSceneResponseCallback(aCommandPath.mEndpointId, apCommandObj, status, groupId, - sceneId); - } - break; - } - case Commands::ViewSceneResponse::Id: { - expectArgumentCount = 6; - uint8_t status; - uint16_t groupId; - uint8_t sceneId; - uint16_t transitionTime; - chip::CharSpan sceneName; - /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets; - bool argExists[6]; - - memset(argExists, 0, sizeof argExists); - - while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) - { - // Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element. - // Skip this element if it is not a ContextTag, not consider it as an error if other values are valid. - if (!TLV::IsContextTag(aDataTlv.GetTag())) - { - continue; - } - currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag()); - if (currentDecodeTagId < 6) - { - if (argExists[currentDecodeTagId]) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - else - { - argExists[currentDecodeTagId] = true; - validArgumentCount++; - } - } - switch (currentDecodeTagId) - { - case 0: - TLVUnpackError = aDataTlv.Get(status); - break; - case 1: - TLVUnpackError = aDataTlv.Get(groupId); - break; - case 2: - TLVUnpackError = aDataTlv.Get(sceneId); - break; - case 3: - TLVUnpackError = aDataTlv.Get(transitionTime); - break; - case 4: - TLVUnpackError = aDataTlv.Get(sceneName); - break; - case 5: - // Just for compatibility, we will add array type support in IM later. - TLVUnpackError = aDataTlv.GetDataPtr(const_cast(extensionFieldSets)); - break; - default: - // Unsupported tag, ignore it. - ChipLogProgress(Zcl, "Unknown TLV tag during processing."); - break; - } - if (CHIP_NO_ERROR != TLVUnpackError) - { - break; - } - } - - if (CHIP_END_OF_TLV == TLVError) - { - // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. - TLVError = CHIP_NO_ERROR; - } - - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 6 == validArgumentCount) - { - wasHandled = emberAfScenesClusterViewSceneResponseCallback(aCommandPath.mEndpointId, apCommandObj, status, groupId, - sceneId, transitionTime, sceneName, extensionFieldSets); - } - break; - } - default: { - return; - } - } - } - - if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) - { - ChipLogProgress(Zcl, - "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT - ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, - validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId); - // A command with no arguments would never write currentDecodeTagId. If - // progress logging is also disabled, it would look unused. Silence that - // warning. - UNUSED_VAR(currentDecodeTagId); - } -} +void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) {} } // namespace Scenes