diff --git a/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp b/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp index 3edeb0a239c183..ff4687805a023e 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp @@ -511,8 +511,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/examples/all-clusters-app/all-clusters-common/gen/callback.h b/examples/all-clusters-app/all-clusters-common/gen/callback.h index 1baf35248f386a..a5bfa046f711f4 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/callback.h +++ b/examples/all-clusters-app/all-clusters-common/gen/callback.h @@ -278,9 +278,9 @@ void emberAfApplicationBasicClusterServerManufacturerSpecificAttributeChangedCal * @param message The message that was sent * @param status The status of the sent message */ -void emberAfApplicationBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfApplicationBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Application Basic Cluster Server Pre Attribute Changed * @@ -349,7 +349,7 @@ void emberAfBarrierControlClusterServerManufacturerSpecificAttributeChangedCallb * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBarrierControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBarrierControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -419,7 +419,7 @@ void emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip: * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Basic Cluster Server Pre Attribute Changed @@ -488,7 +488,7 @@ void emberAfBindingClusterServerManufacturerSpecificAttributeChangedCallback(chi * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBindingClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBindingClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -558,7 +558,7 @@ void emberAfColorControlClusterServerManufacturerSpecificAttributeChangedCallbac * @param message The message that was sent * @param status The status of the sent message */ -void emberAfColorControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfColorControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -628,7 +628,7 @@ void emberAfDescriptorClusterServerManufacturerSpecificAttributeChangedCallback( * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDescriptorClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDescriptorClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -698,7 +698,7 @@ void emberAfDoorLockClusterServerManufacturerSpecificAttributeChangedCallback(ch * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDoorLockClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDoorLockClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -768,9 +768,9 @@ void emberAfGeneralCommissioningClusterServerManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Server Pre Attribute Changed * @@ -839,9 +839,9 @@ void emberAfGroupKeyManagementClusterServerManufacturerSpecificAttributeChangedC * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupKeyManagementClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGroupKeyManagementClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Group Key Management Cluster Server Pre Attribute Changed * @@ -910,7 +910,7 @@ void emberAfGroupsClusterServerManufacturerSpecificAttributeChangedCallback(chip * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupsClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfGroupsClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -980,7 +980,7 @@ void emberAfIasZoneClusterServerManufacturerSpecificAttributeChangedCallback(chi * @param message The message that was sent * @param status The status of the sent message */ -void emberAfIasZoneClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfIasZoneClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1050,7 +1050,7 @@ void emberAfIdentifyClusterServerManufacturerSpecificAttributeChangedCallback(ch * @param message The message that was sent * @param status The status of the sent message */ -void emberAfIdentifyClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfIdentifyClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1120,7 +1120,7 @@ void emberAfLevelControlClusterServerManufacturerSpecificAttributeChangedCallbac * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1190,7 +1190,7 @@ void emberAfLowPowerClusterServerManufacturerSpecificAttributeChangedCallback(ch * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLowPowerClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLowPowerClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1260,9 +1260,9 @@ void emberAfNetworkCommissioningClusterServerManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Server Pre Attribute Changed * @@ -1331,7 +1331,8 @@ void emberAfOtaSoftwareUpdateClientClusterServerManufacturerSpecificAttributeCha * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOtaSoftwareUpdateClientClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOtaSoftwareUpdateClientClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1402,7 +1403,8 @@ void emberAfOtaSoftwareUpdateServerClusterServerManufacturerSpecificAttributeCha * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOtaSoftwareUpdateServerClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOtaSoftwareUpdateServerClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1472,7 +1474,7 @@ void emberAfOnOffClusterServerManufacturerSpecificAttributeChangedCallback(chip: * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief On/off Cluster Server Pre Attribute Changed @@ -1541,7 +1543,8 @@ void emberAfOperationalCredentialsClusterServerManufacturerSpecificAttributeChan * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOperationalCredentialsClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOperationalCredentialsClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1613,7 +1616,8 @@ void emberAfPumpConfigurationAndControlClusterServerManufacturerSpecificAttribut * @param message The message that was sent * @param status The status of the sent message */ -void emberAfPumpConfigurationAndControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfPumpConfigurationAndControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1684,7 +1688,7 @@ void emberAfScenesClusterServerManufacturerSpecificAttributeChangedCallback(chip * @param message The message that was sent * @param status The status of the sent message */ -void emberAfScenesClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfScenesClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1754,7 +1758,7 @@ void emberAfSwitchClusterServerManufacturerSpecificAttributeChangedCallback(chip * @param message The message that was sent * @param status The status of the sent message */ -void emberAfSwitchClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfSwitchClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1824,7 +1828,8 @@ void emberAfTemperatureMeasurementClusterServerManufacturerSpecificAttributeChan * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTemperatureMeasurementClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTemperatureMeasurementClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1895,7 +1900,7 @@ void emberAfThermostatClusterServerManufacturerSpecificAttributeChangedCallback( * @param message The message that was sent * @param status The status of the sent message */ -void emberAfThermostatClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfThermostatClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2971,7 +2976,7 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/examples/bridge-app/bridge-common/gen/callback-stub.cpp b/examples/bridge-app/bridge-common/gen/callback-stub.cpp index fbfb4a965efa56..f246082e4f9ef8 100644 --- a/examples/bridge-app/bridge-common/gen/callback-stub.cpp +++ b/examples/bridge-app/bridge-common/gen/callback-stub.cpp @@ -359,8 +359,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/examples/bridge-app/bridge-common/gen/callback.h b/examples/bridge-app/bridge-common/gen/callback.h index ae79c2614e9d67..5889547ce17cb5 100644 --- a/examples/bridge-app/bridge-common/gen/callback.h +++ b/examples/bridge-app/bridge-common/gen/callback.h @@ -125,7 +125,7 @@ void emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip: * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Basic Cluster Server Pre Attribute Changed @@ -194,9 +194,9 @@ void emberAfGeneralCommissioningClusterServerManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Server Pre Attribute Changed * @@ -265,7 +265,7 @@ void emberAfLevelControlClusterServerManufacturerSpecificAttributeChangedCallbac * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -335,9 +335,9 @@ void emberAfNetworkCommissioningClusterServerManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Server Pre Attribute Changed * @@ -405,7 +405,7 @@ void emberAfOnOffClusterServerManufacturerSpecificAttributeChangedCallback(chip: * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief On/off Cluster Server Pre Attribute Changed @@ -891,7 +891,7 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/examples/chip-tool/gen/CHIPClientCallbacks.cpp b/examples/chip-tool/gen/CHIPClientCallbacks.cpp index 70a488cb90df99..667b0af91593ac 100644 --- a/examples/chip-tool/gen/CHIPClientCallbacks.cpp +++ b/examples/chip-tool/gen/CHIPClientCallbacks.cpp @@ -61,7 +61,7 @@ using namespace ::chip; #define GET_RESPONSE_CALLBACKS(name) \ Callback::Cancelable * onSuccessCallback = nullptr; \ Callback::Cancelable * onFailureCallback = nullptr; \ - NodeId sourceId = emberAfCurrentCommand()->source; \ + NodeId sourceId = emberAfCurrentCommand()->SourceNodeId(); \ uint8_t sequenceNumber = emberAfCurrentCommand()->seqNum; \ CHIP_ERROR err = gCallbacks.GetResponseCallback(sourceId, sequenceNumber, &onSuccessCallback, &onFailureCallback); \ \ @@ -2057,7 +2057,7 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin ChipLogProgress(Zcl, "emberAfReportAttributeCallback:"); ChipLogProgress(Zcl, " ClusterId: 0x%04x", clusterId); - NodeId sourceId = emberAfCurrentCommand()->source; + NodeId sourceId = emberAfCurrentCommand()->SourceNodeId(); ChipLogProgress(Zcl, " Source NodeId: %" PRIu64, sourceId); EndpointId endpointId = emberAfCurrentCommand()->apsFrame->sourceEndpoint; diff --git a/examples/chip-tool/gen/callback-stub.cpp b/examples/chip-tool/gen/callback-stub.cpp index 3f1208e57cdb23..f0601515a9b8d6 100644 --- a/examples/chip-tool/gen/callback-stub.cpp +++ b/examples/chip-tool/gen/callback-stub.cpp @@ -567,8 +567,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/examples/chip-tool/gen/callback.h b/examples/chip-tool/gen/callback.h index d7cf625829ce43..762d9cfa394927 100644 --- a/examples/chip-tool/gen/callback.h +++ b/examples/chip-tool/gen/callback.h @@ -334,7 +334,7 @@ void emberAfAccountLoginClusterClientManufacturerSpecificAttributeChangedCallbac * @param message The message that was sent * @param status The status of the sent message */ -void emberAfAccountLoginClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfAccountLoginClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -404,9 +404,9 @@ void emberAfApplicationBasicClusterClientManufacturerSpecificAttributeChangedCal * @param message The message that was sent * @param status The status of the sent message */ -void emberAfApplicationBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfApplicationBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Application Basic Cluster Client Pre Attribute Changed * @@ -475,9 +475,9 @@ void emberAfApplicationLauncherClusterClientManufacturerSpecificAttributeChanged * @param message The message that was sent * @param status The status of the sent message */ -void emberAfApplicationLauncherClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfApplicationLauncherClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Application Launcher Cluster Client Pre Attribute Changed * @@ -546,7 +546,7 @@ void emberAfAudioOutputClusterClientManufacturerSpecificAttributeChangedCallback * @param message The message that was sent * @param status The status of the sent message */ -void emberAfAudioOutputClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfAudioOutputClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -616,7 +616,7 @@ void emberAfBarrierControlClusterClientManufacturerSpecificAttributeChangedCallb * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBarrierControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBarrierControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -686,7 +686,7 @@ void emberAfBasicClusterClientManufacturerSpecificAttributeChangedCallback(chip: * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Basic Cluster Client Pre Attribute Changed @@ -755,7 +755,7 @@ void emberAfBindingClusterClientManufacturerSpecificAttributeChangedCallback(chi * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBindingClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBindingClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -825,7 +825,7 @@ void emberAfColorControlClusterClientManufacturerSpecificAttributeChangedCallbac * @param message The message that was sent * @param status The status of the sent message */ -void emberAfColorControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfColorControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -895,7 +895,7 @@ void emberAfContentLaunchClusterClientManufacturerSpecificAttributeChangedCallba * @param message The message that was sent * @param status The status of the sent message */ -void emberAfContentLaunchClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfContentLaunchClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -965,7 +965,7 @@ void emberAfDescriptorClusterClientManufacturerSpecificAttributeChangedCallback( * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDescriptorClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDescriptorClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1035,7 +1035,7 @@ void emberAfDoorLockClusterClientManufacturerSpecificAttributeChangedCallback(ch * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDoorLockClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDoorLockClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1105,9 +1105,9 @@ void emberAfGeneralCommissioningClusterClientManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Client Pre Attribute Changed * @@ -1176,9 +1176,9 @@ void emberAfGroupKeyManagementClusterClientManufacturerSpecificAttributeChangedC * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupKeyManagementClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGroupKeyManagementClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Group Key Management Cluster Client Pre Attribute Changed * @@ -1247,7 +1247,7 @@ void emberAfGroupsClusterClientManufacturerSpecificAttributeChangedCallback(chip * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupsClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfGroupsClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1317,7 +1317,7 @@ void emberAfIdentifyClusterClientManufacturerSpecificAttributeChangedCallback(ch * @param message The message that was sent * @param status The status of the sent message */ -void emberAfIdentifyClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfIdentifyClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1387,7 +1387,7 @@ void emberAfKeypadInputClusterClientManufacturerSpecificAttributeChangedCallback * @param message The message that was sent * @param status The status of the sent message */ -void emberAfKeypadInputClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfKeypadInputClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1457,7 +1457,7 @@ void emberAfLevelControlClusterClientManufacturerSpecificAttributeChangedCallbac * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLevelControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLevelControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1527,7 +1527,7 @@ void emberAfLowPowerClusterClientManufacturerSpecificAttributeChangedCallback(ch * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLowPowerClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLowPowerClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1597,7 +1597,7 @@ void emberAfMediaInputClusterClientManufacturerSpecificAttributeChangedCallback( * @param message The message that was sent * @param status The status of the sent message */ -void emberAfMediaInputClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfMediaInputClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1667,7 +1667,7 @@ void emberAfMediaPlaybackClusterClientManufacturerSpecificAttributeChangedCallba * @param message The message that was sent * @param status The status of the sent message */ -void emberAfMediaPlaybackClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfMediaPlaybackClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1737,9 +1737,9 @@ void emberAfNetworkCommissioningClusterClientManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Client Pre Attribute Changed * @@ -1807,7 +1807,7 @@ void emberAfOnOffClusterClientManufacturerSpecificAttributeChangedCallback(chip: * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOnOffClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOnOffClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief On/off Cluster Client Pre Attribute Changed @@ -1876,7 +1876,8 @@ void emberAfOperationalCredentialsClusterClientManufacturerSpecificAttributeChan * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOperationalCredentialsClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOperationalCredentialsClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1948,7 +1949,8 @@ void emberAfPumpConfigurationAndControlClusterClientManufacturerSpecificAttribut * @param message The message that was sent * @param status The status of the sent message */ -void emberAfPumpConfigurationAndControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfPumpConfigurationAndControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2019,7 +2021,7 @@ void emberAfScenesClusterClientManufacturerSpecificAttributeChangedCallback(chip * @param message The message that was sent * @param status The status of the sent message */ -void emberAfScenesClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfScenesClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2089,7 +2091,7 @@ void emberAfSwitchClusterClientManufacturerSpecificAttributeChangedCallback(chip * @param message The message that was sent * @param status The status of the sent message */ -void emberAfSwitchClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfSwitchClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2159,7 +2161,7 @@ void emberAfTvChannelClusterClientManufacturerSpecificAttributeChangedCallback(c * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTvChannelClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTvChannelClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2229,7 +2231,7 @@ void emberAfTargetNavigatorClusterClientManufacturerSpecificAttributeChangedCall * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTargetNavigatorClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTargetNavigatorClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2300,7 +2302,8 @@ void emberAfTemperatureMeasurementClusterClientManufacturerSpecificAttributeChan * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTemperatureMeasurementClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTemperatureMeasurementClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2371,7 +2374,7 @@ void emberAfThermostatClusterClientManufacturerSpecificAttributeChangedCallback( * @param message The message that was sent * @param status The status of the sent message */ -void emberAfThermostatClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfThermostatClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2441,7 +2444,7 @@ void emberAfWakeOnLanClusterClientManufacturerSpecificAttributeChangedCallback(c * @param message The message that was sent * @param status The status of the sent message */ -void emberAfWakeOnLanClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfWakeOnLanClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -3293,7 +3296,7 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/examples/lighting-app/lighting-common/gen/callback-stub.cpp b/examples/lighting-app/lighting-common/gen/callback-stub.cpp index fbfb4a965efa56..f246082e4f9ef8 100644 --- a/examples/lighting-app/lighting-common/gen/callback-stub.cpp +++ b/examples/lighting-app/lighting-common/gen/callback-stub.cpp @@ -359,8 +359,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/examples/lighting-app/lighting-common/gen/callback.h b/examples/lighting-app/lighting-common/gen/callback.h index ae79c2614e9d67..5889547ce17cb5 100644 --- a/examples/lighting-app/lighting-common/gen/callback.h +++ b/examples/lighting-app/lighting-common/gen/callback.h @@ -125,7 +125,7 @@ void emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip: * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Basic Cluster Server Pre Attribute Changed @@ -194,9 +194,9 @@ void emberAfGeneralCommissioningClusterServerManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Server Pre Attribute Changed * @@ -265,7 +265,7 @@ void emberAfLevelControlClusterServerManufacturerSpecificAttributeChangedCallbac * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -335,9 +335,9 @@ void emberAfNetworkCommissioningClusterServerManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Server Pre Attribute Changed * @@ -405,7 +405,7 @@ void emberAfOnOffClusterServerManufacturerSpecificAttributeChangedCallback(chip: * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief On/off Cluster Server Pre Attribute Changed @@ -891,7 +891,7 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/examples/lock-app/lock-common/gen/callback-stub.cpp b/examples/lock-app/lock-common/gen/callback-stub.cpp index 2377bbfdff0cc2..e1f7d62f243421 100644 --- a/examples/lock-app/lock-common/gen/callback-stub.cpp +++ b/examples/lock-app/lock-common/gen/callback-stub.cpp @@ -351,8 +351,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/examples/lock-app/lock-common/gen/callback.h b/examples/lock-app/lock-common/gen/callback.h index 8d5f1c26b408c2..a5442715f0ca14 100644 --- a/examples/lock-app/lock-common/gen/callback.h +++ b/examples/lock-app/lock-common/gen/callback.h @@ -117,7 +117,7 @@ void emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip: * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Basic Cluster Server Pre Attribute Changed @@ -186,9 +186,9 @@ void emberAfGeneralCommissioningClusterServerManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Server Pre Attribute Changed * @@ -257,9 +257,9 @@ void emberAfNetworkCommissioningClusterServerManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Server Pre Attribute Changed * @@ -327,7 +327,7 @@ void emberAfOnOffClusterServerManufacturerSpecificAttributeChangedCallback(chip: * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief On/off Cluster Server Pre Attribute Changed @@ -738,7 +738,7 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/examples/temperature-measurement-app/esp32/main/gen/callback-stub.cpp b/examples/temperature-measurement-app/esp32/main/gen/callback-stub.cpp index 516f3eb3cbfbd8..7e1040d84aea25 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/callback-stub.cpp +++ b/examples/temperature-measurement-app/esp32/main/gen/callback-stub.cpp @@ -351,8 +351,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/examples/temperature-measurement-app/esp32/main/gen/callback.h b/examples/temperature-measurement-app/esp32/main/gen/callback.h index 82466588b77916..f11be5a9964428 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/callback.h +++ b/examples/temperature-measurement-app/esp32/main/gen/callback.h @@ -117,7 +117,7 @@ void emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip: * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Basic Cluster Server Pre Attribute Changed @@ -186,9 +186,9 @@ void emberAfGeneralCommissioningClusterServerManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Server Pre Attribute Changed * @@ -257,9 +257,9 @@ void emberAfNetworkCommissioningClusterServerManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Server Pre Attribute Changed * @@ -328,7 +328,8 @@ void emberAfTemperatureMeasurementClusterServerManufacturerSpecificAttributeChan * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTemperatureMeasurementClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTemperatureMeasurementClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -723,7 +724,7 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/examples/tv-app/tv-common/gen/IMClusterCommandHandler.cpp b/examples/tv-app/tv-common/gen/IMClusterCommandHandler.cpp index 55d9dba3be7e88..bf48808926fa17 100644 --- a/examples/tv-app/tv-common/gen/IMClusterCommandHandler.cpp +++ b/examples/tv-app/tv-common/gen/IMClusterCommandHandler.cpp @@ -213,23 +213,23 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // namespace AccountLogin -namespace ApplicationLauncher { +namespace AudioOutput { void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) { { switch (aCommandId) { - case ZCL_LAUNCH_APP_COMMAND_ID: { + case ZCL_RENAME_OUTPUT_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - const uint8_t * data; - bool dataExists = false; - /* TYPE WARNING: array array defaults to */ uint8_t * application; - bool applicationExists = false; + uint8_t index; + bool indexExists = false; + const uint8_t * name; + bool nameExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -237,32 +237,31 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (dataExists) + if (indexExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. - TLVUnpackError = aDataTlv.GetDataPtr(data); + TLVUnpackError = aDataTlv.Get(index); if (CHIP_NO_ERROR == TLVUnpackError) { - dataExists = true; + indexExists = true; validArgumentCount++; } break; case 1: - if (applicationExists) + if (nameExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - // Just for compatibility, we will add array type support in IM later. - TLVUnpackError = aDataTlv.GetDataPtr(const_cast(application)); + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = aDataTlv.GetDataPtr(name); if (CHIP_NO_ERROR == TLVUnpackError) { - applicationExists = true; + nameExists = true; validArgumentCount++; } break; @@ -293,7 +292,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfApplicationLauncherClusterLaunchAppCallback(apCommandObj, const_cast(data), application); + emberAfAudioOutputClusterRenameOutputCallback(apCommandObj, index, const_cast(name)); } else { @@ -305,36 +304,14 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - default: { - // Unrecognized command ID, error status will apply. - apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, - Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); - ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_APPLICATION_LAUNCHER_CLUSTER_ID); - break; - } - } - } -} - -} // namespace ApplicationLauncher - -namespace AudioOutput { - -void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) -{ - { - switch (aCommandId) - { - case ZCL_RENAME_OUTPUT_COMMAND_ID: { + case ZCL_SELECT_OUTPUT_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; uint8_t index; - bool indexExists = false; - const uint8_t * name; - bool nameExists = false; + bool indexExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -355,21 +332,6 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En validArgumentCount++; } break; - case 1: - if (nameExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. - TLVUnpackError = aDataTlv.GetDataPtr(name); - if (CHIP_NO_ERROR == TLVUnpackError) - { - nameExists = true; - validArgumentCount++; - } - break; default: // Unsupported tag, ignore it. ChipLogProgress(Zcl, "Unknown TLV tag during processing."); @@ -394,10 +356,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfAudioOutputClusterRenameOutputCallback(apCommandObj, index, const_cast(name)); + emberAfAudioOutputClusterSelectOutputCallback(apCommandObj, index); } else { @@ -405,18 +367,38 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 2, validArgumentCount, TLVError, TLVUnpackError); + 1, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_SELECT_OUTPUT_COMMAND_ID: { + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_AUDIO_OUTPUT_CLUSTER_ID); + break; + } + } + } +} + +} // namespace AudioOutput + +namespace BarrierControl { + +void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) +{ + { + switch (aCommandId) + { + case ZCL_BARRIER_CONTROL_GO_TO_PERCENT_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t index; - bool indexExists = false; + uint8_t percentOpen; + bool percentOpenExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -424,16 +406,16 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (indexExists) + if (percentOpenExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(index); + TLVUnpackError = aDataTlv.Get(percentOpen); if (CHIP_NO_ERROR == TLVUnpackError) { - indexExists = true; + percentOpenExists = true; validArgumentCount++; } break; @@ -464,7 +446,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfAudioOutputClusterSelectOutputCallback(apCommandObj, index); + emberAfBarrierControlClusterBarrierControlGoToPercentCallback(apCommandObj, percentOpen); } else { @@ -476,18 +458,24 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } + case ZCL_BARRIER_CONTROL_STOP_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfBarrierControlClusterBarrierControlStopCallback(apCommandObj); + break; + } default: { // Unrecognized command ID, error status will apply. apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); - ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_AUDIO_OUTPUT_CLUSTER_ID); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_BARRIER_CONTROL_CLUSTER_ID); break; } } } } -} // namespace AudioOutput +} // namespace BarrierControl namespace Binding { @@ -746,20 +734,16 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En { switch (aCommandId) { - case ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID: { + case ZCL_MOVE_COLOR_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t moveMode; - bool moveModeExists = false; - uint16_t rate; - bool rateExists = false; - uint16_t colorTemperatureMinimum; - bool colorTemperatureMinimumExists = false; - uint16_t colorTemperatureMaximum; - bool colorTemperatureMaximumExists = false; + int16_t rateX; + bool rateXExists = false; + int16_t rateY; + bool rateYExists = false; uint8_t optionsMask; bool optionsMaskExists = false; uint8_t optionsOverride; @@ -771,62 +755,34 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (moveModeExists) + if (rateXExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(moveMode); + TLVUnpackError = aDataTlv.Get(rateX); if (CHIP_NO_ERROR == TLVUnpackError) { - moveModeExists = true; + rateXExists = true; validArgumentCount++; } break; case 1: - if (rateExists) + if (rateYExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(rate); + TLVUnpackError = aDataTlv.Get(rateY); if (CHIP_NO_ERROR == TLVUnpackError) { - rateExists = true; + rateYExists = true; validArgumentCount++; } break; case 2: - if (colorTemperatureMinimumExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(colorTemperatureMinimum); - if (CHIP_NO_ERROR == TLVUnpackError) - { - colorTemperatureMinimumExists = true; - validArgumentCount++; - } - break; - case 3: - if (colorTemperatureMaximumExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(colorTemperatureMaximum); - if (CHIP_NO_ERROR == TLVUnpackError) - { - colorTemperatureMaximumExists = true; - validArgumentCount++; - } - break; - case 4: if (optionsMaskExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); @@ -840,7 +796,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En validArgumentCount++; } break; - case 5: + case 3: if (optionsOverrideExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); @@ -878,11 +834,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 6 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfColorControlClusterMoveColorTemperatureCallback(apCommandObj, moveMode, rate, colorTemperatureMinimum, - colorTemperatureMaximum, optionsMask, optionsOverride); + emberAfColorControlClusterMoveColorCallback(apCommandObj, rateX, rateY, optionsMask, optionsOverride); } else { @@ -890,11 +845,11 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 6, validArgumentCount, TLVError, TLVUnpackError); + 4, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_MOVE_HUE_COMMAND_ID: { + case ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID: { // 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. @@ -902,8 +857,12 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; uint8_t moveMode; bool moveModeExists = false; - uint8_t rate; + uint16_t rate; bool rateExists = false; + uint16_t colorTemperatureMinimum; + bool colorTemperatureMinimumExists = false; + uint16_t colorTemperatureMaximum; + bool colorTemperatureMaximumExists = false; uint8_t optionsMask; bool optionsMaskExists = false; uint8_t optionsOverride; @@ -943,6 +902,34 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; case 2: + if (colorTemperatureMinimumExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(colorTemperatureMinimum); + if (CHIP_NO_ERROR == TLVUnpackError) + { + colorTemperatureMinimumExists = true; + validArgumentCount++; + } + break; + case 3: + if (colorTemperatureMaximumExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(colorTemperatureMaximum); + if (CHIP_NO_ERROR == TLVUnpackError) + { + colorTemperatureMaximumExists = true; + validArgumentCount++; + } + break; + case 4: if (optionsMaskExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); @@ -956,7 +943,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En validArgumentCount++; } break; - case 3: + case 5: if (optionsOverrideExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); @@ -994,10 +981,11 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 6 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfColorControlClusterMoveHueCallback(apCommandObj, moveMode, rate, optionsMask, optionsOverride); + emberAfColorControlClusterMoveColorTemperatureCallback(apCommandObj, moveMode, rate, colorTemperatureMinimum, + colorTemperatureMaximum, optionsMask, optionsOverride); } else { @@ -1005,11 +993,11 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 4, validArgumentCount, TLVError, TLVUnpackError); + 6, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_MOVE_SATURATION_COMMAND_ID: { + case ZCL_MOVE_HUE_COMMAND_ID: { // 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. @@ -1112,7 +1100,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfColorControlClusterMoveSaturationCallback(apCommandObj, moveMode, rate, optionsMask, optionsOverride); + emberAfColorControlClusterMoveHueCallback(apCommandObj, moveMode, rate, optionsMask, optionsOverride); } else { @@ -1124,16 +1112,16 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - case ZCL_MOVE_TO_COLOR_TEMPERATURE_COMMAND_ID: { + case ZCL_MOVE_SATURATION_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint16_t colorTemperature; - bool colorTemperatureExists = false; - uint16_t transitionTime; - bool transitionTimeExists = false; + uint8_t moveMode; + bool moveModeExists = false; + uint8_t rate; + bool rateExists = false; uint8_t optionsMask; bool optionsMaskExists = false; uint8_t optionsOverride; @@ -1145,30 +1133,30 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (colorTemperatureExists) + if (moveModeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(colorTemperature); + TLVUnpackError = aDataTlv.Get(moveMode); if (CHIP_NO_ERROR == TLVUnpackError) { - colorTemperatureExists = true; + moveModeExists = true; validArgumentCount++; } break; case 1: - if (transitionTimeExists) + if (rateExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(transitionTime); + TLVUnpackError = aDataTlv.Get(rate); if (CHIP_NO_ERROR == TLVUnpackError) { - transitionTimeExists = true; + rateExists = true; validArgumentCount++; } break; @@ -1227,8 +1215,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfColorControlClusterMoveToColorTemperatureCallback(apCommandObj, colorTemperature, transitionTime, - optionsMask, optionsOverride); + emberAfColorControlClusterMoveSaturationCallback(apCommandObj, moveMode, rate, optionsMask, optionsOverride); } else { @@ -1240,16 +1227,16 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - case ZCL_MOVE_TO_HUE_COMMAND_ID: { + case ZCL_MOVE_TO_COLOR_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t hue; - bool hueExists = false; - uint8_t direction; - bool directionExists = false; + uint16_t colorX; + bool colorXExists = false; + uint16_t colorY; + bool colorYExists = false; uint16_t transitionTime; bool transitionTimeExists = false; uint8_t optionsMask; @@ -1263,30 +1250,30 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (hueExists) + if (colorXExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(hue); + TLVUnpackError = aDataTlv.Get(colorX); if (CHIP_NO_ERROR == TLVUnpackError) { - hueExists = true; + colorXExists = true; validArgumentCount++; } break; case 1: - if (directionExists) + if (colorYExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(direction); + TLVUnpackError = aDataTlv.Get(colorY); if (CHIP_NO_ERROR == TLVUnpackError) { - directionExists = true; + colorYExists = true; validArgumentCount++; } break; @@ -1359,8 +1346,8 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfColorControlClusterMoveToHueCallback(apCommandObj, hue, direction, transitionTime, optionsMask, - optionsOverride); + emberAfColorControlClusterMoveToColorCallback(apCommandObj, colorX, colorY, transitionTime, optionsMask, + optionsOverride); } else { @@ -1372,16 +1359,14 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - case ZCL_MOVE_TO_HUE_AND_SATURATION_COMMAND_ID: { + case ZCL_MOVE_TO_COLOR_TEMPERATURE_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t hue; - bool hueExists = false; - uint8_t saturation; - bool saturationExists = false; + uint16_t colorTemperature; + bool colorTemperatureExists = false; uint16_t transitionTime; bool transitionTimeExists = false; uint8_t optionsMask; @@ -1395,48 +1380,34 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (hueExists) + if (colorTemperatureExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(hue); + TLVUnpackError = aDataTlv.Get(colorTemperature); if (CHIP_NO_ERROR == TLVUnpackError) { - hueExists = true; + colorTemperatureExists = true; validArgumentCount++; } break; case 1: - if (saturationExists) + if (transitionTimeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(saturation); + TLVUnpackError = aDataTlv.Get(transitionTime); if (CHIP_NO_ERROR == TLVUnpackError) { - saturationExists = true; + transitionTimeExists = true; validArgumentCount++; } break; case 2: - if (transitionTimeExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(transitionTime); - if (CHIP_NO_ERROR == TLVUnpackError) - { - transitionTimeExists = true; - validArgumentCount++; - } - break; - case 3: if (optionsMaskExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); @@ -1450,7 +1421,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En validArgumentCount++; } break; - case 4: + case 3: if (optionsOverrideExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); @@ -1488,11 +1459,11 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfColorControlClusterMoveToHueAndSaturationCallback(apCommandObj, hue, saturation, transitionTime, optionsMask, - optionsOverride); + emberAfColorControlClusterMoveToColorTemperatureCallback(apCommandObj, colorTemperature, transitionTime, + optionsMask, optionsOverride); } else { @@ -1500,18 +1471,20 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 5, validArgumentCount, TLVError, TLVUnpackError); + 4, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_MOVE_TO_SATURATION_COMMAND_ID: { + case ZCL_MOVE_TO_HUE_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t saturation; - bool saturationExists = false; + uint8_t hue; + bool hueExists = false; + uint8_t direction; + bool directionExists = false; uint16_t transitionTime; bool transitionTimeExists = false; uint8_t optionsMask; @@ -1525,20 +1498,34 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (saturationExists) + if (hueExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(saturation); + TLVUnpackError = aDataTlv.Get(hue); if (CHIP_NO_ERROR == TLVUnpackError) { - saturationExists = true; + hueExists = true; validArgumentCount++; } break; case 1: + if (directionExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(direction); + if (CHIP_NO_ERROR == TLVUnpackError) + { + directionExists = true; + validArgumentCount++; + } + break; + case 2: if (transitionTimeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); @@ -1552,7 +1539,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En validArgumentCount++; } break; - case 2: + case 3: if (optionsMaskExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); @@ -1566,7 +1553,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En validArgumentCount++; } break; - case 3: + case 4: if (optionsOverrideExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); @@ -1604,11 +1591,11 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfColorControlClusterMoveToSaturationCallback(apCommandObj, saturation, transitionTime, optionsMask, - optionsOverride); + emberAfColorControlClusterMoveToHueCallback(apCommandObj, hue, direction, transitionTime, optionsMask, + optionsOverride); } else { @@ -1616,26 +1603,22 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 4, validArgumentCount, TLVError, TLVUnpackError); + 5, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID: { + case ZCL_MOVE_TO_HUE_AND_SATURATION_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t stepMode; - bool stepModeExists = false; - uint16_t stepSize; - bool stepSizeExists = false; + uint8_t hue; + bool hueExists = false; + uint8_t saturation; + bool saturationExists = false; uint16_t transitionTime; bool transitionTimeExists = false; - uint16_t colorTemperatureMinimum; - bool colorTemperatureMinimumExists = false; - uint16_t colorTemperatureMaximum; - bool colorTemperatureMaximumExists = false; uint8_t optionsMask; bool optionsMaskExists = false; uint8_t optionsOverride; @@ -1647,30 +1630,30 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (stepModeExists) + if (hueExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(stepMode); + TLVUnpackError = aDataTlv.Get(hue); if (CHIP_NO_ERROR == TLVUnpackError) { - stepModeExists = true; + hueExists = true; validArgumentCount++; } break; case 1: - if (stepSizeExists) + if (saturationExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(stepSize); + TLVUnpackError = aDataTlv.Get(saturation); if (CHIP_NO_ERROR == TLVUnpackError) { - stepSizeExists = true; + saturationExists = true; validArgumentCount++; } break; @@ -1689,34 +1672,6 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; case 3: - if (colorTemperatureMinimumExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(colorTemperatureMinimum); - if (CHIP_NO_ERROR == TLVUnpackError) - { - colorTemperatureMinimumExists = true; - validArgumentCount++; - } - break; - case 4: - if (colorTemperatureMaximumExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(colorTemperatureMaximum); - if (CHIP_NO_ERROR == TLVUnpackError) - { - colorTemperatureMaximumExists = true; - validArgumentCount++; - } - break; - case 5: if (optionsMaskExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); @@ -1730,7 +1685,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En validArgumentCount++; } break; - case 6: + case 4: if (optionsOverrideExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); @@ -1768,12 +1723,11 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 7 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfColorControlClusterStepColorTemperatureCallback(apCommandObj, stepMode, stepSize, transitionTime, - colorTemperatureMinimum, colorTemperatureMaximum, - optionsMask, optionsOverride); + emberAfColorControlClusterMoveToHueAndSaturationCallback(apCommandObj, hue, saturation, transitionTime, optionsMask, + optionsOverride); } else { @@ -1781,21 +1735,19 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 7, validArgumentCount, TLVError, TLVUnpackError); + 5, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_STEP_HUE_COMMAND_ID: { + case ZCL_MOVE_TO_SATURATION_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t stepMode; - bool stepModeExists = false; - uint8_t stepSize; - bool stepSizeExists = false; - uint8_t transitionTime; + uint8_t saturation; + bool saturationExists = false; + uint16_t transitionTime; bool transitionTimeExists = false; uint8_t optionsMask; bool optionsMaskExists = false; @@ -1808,34 +1760,20 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (stepModeExists) + if (saturationExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(stepMode); + TLVUnpackError = aDataTlv.Get(saturation); if (CHIP_NO_ERROR == TLVUnpackError) { - stepModeExists = true; + saturationExists = true; validArgumentCount++; } break; case 1: - if (stepSizeExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(stepSize); - if (CHIP_NO_ERROR == TLVUnpackError) - { - stepSizeExists = true; - validArgumentCount++; - } - break; - case 2: if (transitionTimeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); @@ -1849,7 +1787,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En validArgumentCount++; } break; - case 3: + case 2: if (optionsMaskExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); @@ -1863,7 +1801,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En validArgumentCount++; } break; - case 4: + case 3: if (optionsOverrideExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); @@ -1901,11 +1839,11 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfColorControlClusterStepHueCallback(apCommandObj, stepMode, stepSize, transitionTime, optionsMask, - optionsOverride); + emberAfColorControlClusterMoveToSaturationCallback(apCommandObj, saturation, transitionTime, optionsMask, + optionsOverride); } else { @@ -1913,21 +1851,21 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 5, validArgumentCount, TLVError, TLVUnpackError); + 4, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_STEP_SATURATION_COMMAND_ID: { + case ZCL_STEP_COLOR_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t stepMode; - bool stepModeExists = false; - uint8_t stepSize; - bool stepSizeExists = false; - uint8_t transitionTime; + int16_t stepX; + bool stepXExists = false; + int16_t stepY; + bool stepYExists = false; + uint16_t transitionTime; bool transitionTimeExists = false; uint8_t optionsMask; bool optionsMaskExists = false; @@ -1940,30 +1878,30 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (stepModeExists) + if (stepXExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(stepMode); + TLVUnpackError = aDataTlv.Get(stepX); if (CHIP_NO_ERROR == TLVUnpackError) { - stepModeExists = true; + stepXExists = true; validArgumentCount++; } break; case 1: - if (stepSizeExists) + if (stepYExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(stepSize); + TLVUnpackError = aDataTlv.Get(stepY); if (CHIP_NO_ERROR == TLVUnpackError) { - stepSizeExists = true; + stepYExists = true; validArgumentCount++; } break; @@ -2036,8 +1974,8 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfColorControlClusterStepSaturationCallback(apCommandObj, stepMode, stepSize, transitionTime, optionsMask, - optionsOverride); + emberAfColorControlClusterStepColorCallback(apCommandObj, stepX, stepY, transitionTime, optionsMask, + optionsOverride); } else { @@ -2049,12 +1987,22 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - case ZCL_STOP_MOVE_STEP_COMMAND_ID: { + case ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t stepMode; + bool stepModeExists = false; + uint16_t stepSize; + bool stepSizeExists = false; + uint16_t transitionTime; + bool transitionTimeExists = false; + uint16_t colorTemperatureMinimum; + bool colorTemperatureMinimumExists = false; + uint16_t colorTemperatureMaximum; + bool colorTemperatureMaximumExists = false; uint8_t optionsMask; bool optionsMaskExists = false; uint8_t optionsOverride; @@ -2066,61 +2014,1337 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (optionsMaskExists) + if (stepModeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(optionsMask); + TLVUnpackError = aDataTlv.Get(stepMode); if (CHIP_NO_ERROR == TLVUnpackError) { - optionsMaskExists = true; + stepModeExists = true; validArgumentCount++; } break; case 1: - if (optionsOverrideExists) + if (stepSizeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(optionsOverride); + TLVUnpackError = aDataTlv.Get(stepSize); if (CHIP_NO_ERROR == TLVUnpackError) { - optionsOverrideExists = true; + stepSizeExists = true; validArgumentCount++; } break; - default: - // Unsupported tag, ignore it. - ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + case 2: + if (transitionTimeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(transitionTime); + if (CHIP_NO_ERROR == TLVUnpackError) + { + transitionTimeExists = true; + validArgumentCount++; + } break; - } - if (TLVUnpackError != CHIP_NO_ERROR) - { - ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, - TLV::TagNumFromTag(aDataTlv.GetTag()), TLVUnpackError); + case 3: + if (colorTemperatureMinimumExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(colorTemperatureMinimum); + if (CHIP_NO_ERROR == TLVUnpackError) + { + colorTemperatureMinimumExists = true; + validArgumentCount++; + } 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; - } - else - { - ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); - } + case 4: + if (colorTemperatureMaximumExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(colorTemperatureMaximum); + if (CHIP_NO_ERROR == TLVUnpackError) + { + colorTemperatureMaximumExists = true; + validArgumentCount++; + } + break; + case 5: + if (optionsMaskExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(optionsMask); + if (CHIP_NO_ERROR == TLVUnpackError) + { + optionsMaskExists = true; + validArgumentCount++; + } + break; + case 6: + if (optionsOverrideExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(optionsOverride); + if (CHIP_NO_ERROR == TLVUnpackError) + { + optionsOverrideExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 7 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfColorControlClusterStepColorTemperatureCallback(apCommandObj, stepMode, stepSize, transitionTime, + colorTemperatureMinimum, colorTemperatureMaximum, + optionsMask, optionsOverride); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 7, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + case ZCL_STEP_HUE_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t stepMode; + bool stepModeExists = false; + uint8_t stepSize; + bool stepSizeExists = false; + uint8_t transitionTime; + bool transitionTimeExists = false; + uint8_t optionsMask; + bool optionsMaskExists = false; + uint8_t optionsOverride; + bool optionsOverrideExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (stepModeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(stepMode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + stepModeExists = true; + validArgumentCount++; + } + break; + case 1: + if (stepSizeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(stepSize); + if (CHIP_NO_ERROR == TLVUnpackError) + { + stepSizeExists = true; + validArgumentCount++; + } + break; + case 2: + if (transitionTimeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(transitionTime); + if (CHIP_NO_ERROR == TLVUnpackError) + { + transitionTimeExists = true; + validArgumentCount++; + } + break; + case 3: + if (optionsMaskExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(optionsMask); + if (CHIP_NO_ERROR == TLVUnpackError) + { + optionsMaskExists = true; + validArgumentCount++; + } + break; + case 4: + if (optionsOverrideExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(optionsOverride); + if (CHIP_NO_ERROR == TLVUnpackError) + { + optionsOverrideExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfColorControlClusterStepHueCallback(apCommandObj, stepMode, stepSize, transitionTime, optionsMask, + optionsOverride); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 5, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + case ZCL_STEP_SATURATION_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t stepMode; + bool stepModeExists = false; + uint8_t stepSize; + bool stepSizeExists = false; + uint8_t transitionTime; + bool transitionTimeExists = false; + uint8_t optionsMask; + bool optionsMaskExists = false; + uint8_t optionsOverride; + bool optionsOverrideExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (stepModeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(stepMode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + stepModeExists = true; + validArgumentCount++; + } + break; + case 1: + if (stepSizeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(stepSize); + if (CHIP_NO_ERROR == TLVUnpackError) + { + stepSizeExists = true; + validArgumentCount++; + } + break; + case 2: + if (transitionTimeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(transitionTime); + if (CHIP_NO_ERROR == TLVUnpackError) + { + transitionTimeExists = true; + validArgumentCount++; + } + break; + case 3: + if (optionsMaskExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(optionsMask); + if (CHIP_NO_ERROR == TLVUnpackError) + { + optionsMaskExists = true; + validArgumentCount++; + } + break; + case 4: + if (optionsOverrideExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(optionsOverride); + if (CHIP_NO_ERROR == TLVUnpackError) + { + optionsOverrideExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfColorControlClusterStepSaturationCallback(apCommandObj, stepMode, stepSize, transitionTime, optionsMask, + optionsOverride); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 5, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + case ZCL_STOP_MOVE_STEP_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t optionsMask; + bool optionsMaskExists = false; + uint8_t optionsOverride; + bool optionsOverrideExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (optionsMaskExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(optionsMask); + if (CHIP_NO_ERROR == TLVUnpackError) + { + optionsMaskExists = true; + validArgumentCount++; + } + break; + case 1: + if (optionsOverrideExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(optionsOverride); + if (CHIP_NO_ERROR == TLVUnpackError) + { + optionsOverrideExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfColorControlClusterStopMoveStepCallback(apCommandObj, optionsMask, optionsOverride); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 2, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_COLOR_CONTROL_CLUSTER_ID); + break; + } + } + } +} + +} // namespace ColorControl + +namespace ContentLaunch { + +void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) +{ + { + switch (aCommandId) + { + case ZCL_LAUNCH_CONTENT_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t autoPlay; + bool autoPlayExists = false; + const uint8_t * data; + bool dataExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (autoPlayExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(autoPlay); + if (CHIP_NO_ERROR == TLVUnpackError) + { + autoPlayExists = true; + validArgumentCount++; + } + break; + case 1: + if (dataExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = aDataTlv.GetDataPtr(data); + if (CHIP_NO_ERROR == TLVUnpackError) + { + dataExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfContentLaunchClusterLaunchContentCallback(apCommandObj, autoPlay, const_cast(data)); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 2, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + case ZCL_LAUNCH_URL_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + const uint8_t * contentURL; + bool contentURLExists = false; + const uint8_t * displayString; + bool displayStringExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (contentURLExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = aDataTlv.GetDataPtr(contentURL); + if (CHIP_NO_ERROR == TLVUnpackError) + { + contentURLExists = true; + validArgumentCount++; + } + break; + case 1: + if (displayStringExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = aDataTlv.GetDataPtr(displayString); + if (CHIP_NO_ERROR == TLVUnpackError) + { + displayStringExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfContentLaunchClusterLaunchURLCallback(apCommandObj, const_cast(contentURL), + const_cast(displayString)); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 2, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_CONTENT_LAUNCH_CLUSTER_ID); + break; + } + } + } +} + +} // namespace ContentLaunch + +namespace DoorLock { + +void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) +{ + { + switch (aCommandId) + { + case ZCL_CLEAR_ALL_PINS_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfDoorLockClusterClearAllPinsCallback(apCommandObj); + break; + } + case ZCL_CLEAR_ALL_RFIDS_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfDoorLockClusterClearAllRfidsCallback(apCommandObj); + break; + } + case ZCL_CLEAR_HOLIDAY_SCHEDULE_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t scheduleId; + bool scheduleIdExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (scheduleIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(scheduleId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + scheduleIdExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfDoorLockClusterClearHolidayScheduleCallback(apCommandObj, scheduleId); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 1, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + case ZCL_CLEAR_PIN_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint16_t userId; + bool userIdExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (userIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(userId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + userIdExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfDoorLockClusterClearPinCallback(apCommandObj, userId); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 1, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + case ZCL_CLEAR_RFID_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint16_t userId; + bool userIdExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (userIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(userId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + userIdExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfDoorLockClusterClearRfidCallback(apCommandObj, userId); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 1, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + case ZCL_CLEAR_WEEKDAY_SCHEDULE_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t scheduleId; + bool scheduleIdExists = false; + uint16_t userId; + bool userIdExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (scheduleIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(scheduleId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + scheduleIdExists = true; + validArgumentCount++; + } + break; + case 1: + if (userIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(userId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + userIdExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfDoorLockClusterClearWeekdayScheduleCallback(apCommandObj, scheduleId, userId); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 2, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + case ZCL_CLEAR_YEARDAY_SCHEDULE_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t scheduleId; + bool scheduleIdExists = false; + uint16_t userId; + bool userIdExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (scheduleIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(scheduleId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + scheduleIdExists = true; + validArgumentCount++; + } + break; + case 1: + if (userIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(userId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + userIdExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfDoorLockClusterClearYeardayScheduleCallback(apCommandObj, scheduleId, userId); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 2, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + case ZCL_GET_HOLIDAY_SCHEDULE_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t scheduleId; + bool scheduleIdExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (scheduleIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(scheduleId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + scheduleIdExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfDoorLockClusterGetHolidayScheduleCallback(apCommandObj, scheduleId); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 1, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + case ZCL_GET_LOG_RECORD_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint16_t logIndex; + bool logIndexExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (logIndexExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(logIndex); + if (CHIP_NO_ERROR == TLVUnpackError) + { + logIndexExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfDoorLockClusterGetLogRecordCallback(apCommandObj, logIndex); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 1, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + case ZCL_GET_PIN_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint16_t userId; + bool userIdExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (userIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(userId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + userIdExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfDoorLockClusterGetPinCallback(apCommandObj, userId); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 1, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + case ZCL_GET_RFID_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint16_t userId; + bool userIdExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (userIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(userId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + userIdExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfColorControlClusterStopMoveStepCallback(apCommandObj, optionsMask, optionsOverride); + emberAfDoorLockClusterGetRfidCallback(apCommandObj, userId); } else { @@ -2128,40 +3352,170 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 2, validArgumentCount, TLVError, TLVUnpackError); + 1, validArgumentCount, TLVError, TLVUnpackError); } break; } - default: { - // Unrecognized command ID, error status will apply. - apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, - Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); - ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_COLOR_CONTROL_CLUSTER_ID); + case ZCL_GET_USER_TYPE_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint16_t userId; + bool userIdExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (userIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(userId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + userIdExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfDoorLockClusterGetUserTypeCallback(apCommandObj, userId); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 1, validArgumentCount, TLVError, TLVUnpackError); + } break; } - } - } -} + case ZCL_GET_WEEKDAY_SCHEDULE_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t scheduleId; + bool scheduleIdExists = false; + uint16_t userId; + bool userIdExists = false; + uint32_t validArgumentCount = 0; -} // namespace ColorControl + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (scheduleIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(scheduleId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + scheduleIdExists = true; + validArgumentCount++; + } + break; + case 1: + if (userIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(userId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + userIdExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), TLVUnpackError); + break; + } + } -namespace ContentLaunch { + 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } -void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) -{ - { - switch (aCommandId) - { - case ZCL_LAUNCH_CONTENT_COMMAND_ID: { + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfDoorLockClusterGetWeekdayScheduleCallback(apCommandObj, scheduleId, userId); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 2, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + case ZCL_GET_YEARDAY_SCHEDULE_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t autoPlay; - bool autoPlayExists = false; - const uint8_t * data; - bool dataExists = false; + uint8_t scheduleId; + bool scheduleIdExists = false; + uint16_t userId; + bool userIdExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -2169,31 +3523,30 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (autoPlayExists) + if (scheduleIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(autoPlay); + TLVUnpackError = aDataTlv.Get(scheduleId); if (CHIP_NO_ERROR == TLVUnpackError) { - autoPlayExists = true; + scheduleIdExists = true; validArgumentCount++; } break; case 1: - if (dataExists) + if (userIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. - TLVUnpackError = aDataTlv.GetDataPtr(data); + TLVUnpackError = aDataTlv.Get(userId); if (CHIP_NO_ERROR == TLVUnpackError) { - dataExists = true; + userIdExists = true; validArgumentCount++; } break; @@ -2224,7 +3577,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfContentLaunchClusterLaunchContentCallback(apCommandObj, autoPlay, const_cast(data)); + emberAfDoorLockClusterGetYeardayScheduleCallback(apCommandObj, scheduleId, userId); } else { @@ -2236,16 +3589,14 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - case ZCL_LAUNCH_URL_COMMAND_ID: { + case ZCL_LOCK_DOOR_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - const uint8_t * contentURL; - bool contentURLExists = false; - const uint8_t * displayString; - bool displayStringExists = false; + const uint8_t * PIN; + bool PINExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -2253,32 +3604,17 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (contentURLExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. - TLVUnpackError = aDataTlv.GetDataPtr(contentURL); - if (CHIP_NO_ERROR == TLVUnpackError) - { - contentURLExists = true; - validArgumentCount++; - } - break; - case 1: - if (displayStringExists) + if (PINExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. - TLVUnpackError = aDataTlv.GetDataPtr(displayString); + TLVUnpackError = aDataTlv.GetDataPtr(PIN); if (CHIP_NO_ERROR == TLVUnpackError) { - displayStringExists = true; + PINExists = true; validArgumentCount++; } break; @@ -2306,11 +3642,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfContentLaunchClusterLaunchURLCallback(apCommandObj, const_cast(contentURL), - const_cast(displayString)); + emberAfDoorLockClusterLockDoorCallback(apCommandObj, const_cast(PIN)); } else { @@ -2318,51 +3653,25 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 2, validArgumentCount, TLVError, TLVUnpackError); + 1, validArgumentCount, TLVError, TLVUnpackError); } break; } - default: { - // Unrecognized command ID, error status will apply. - apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, - Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); - ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_CONTENT_LAUNCH_CLUSTER_ID); - break; - } - } - } -} - -} // namespace ContentLaunch - -namespace DoorLock { - -void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) -{ - { - switch (aCommandId) - { - case ZCL_CLEAR_ALL_PINS_COMMAND_ID: { - - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterClearAllPinsCallback(apCommandObj); - break; - } - case ZCL_CLEAR_ALL_RFIDS_COMMAND_ID: { - - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterClearAllRfidsCallback(apCommandObj); - break; - } - case ZCL_CLEAR_HOLIDAY_SCHEDULE_COMMAND_ID: { + case ZCL_SET_HOLIDAY_SCHEDULE_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; uint8_t scheduleId; - bool scheduleIdExists = false; - uint32_t validArgumentCount = 0; + bool scheduleIdExists = false; + uint32_t localStartTime; + bool localStartTimeExists = false; + uint32_t localEndTime; + bool localEndTimeExists = false; + uint8_t operatingModeDuringHoliday; + bool operatingModeDuringHolidayExists = false; + uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) { @@ -2382,6 +3691,48 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En validArgumentCount++; } break; + case 1: + if (localStartTimeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(localStartTime); + if (CHIP_NO_ERROR == TLVUnpackError) + { + localStartTimeExists = true; + validArgumentCount++; + } + break; + case 2: + if (localEndTimeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(localEndTime); + if (CHIP_NO_ERROR == TLVUnpackError) + { + localEndTimeExists = true; + validArgumentCount++; + } + break; + case 3: + if (operatingModeDuringHolidayExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(operatingModeDuringHoliday); + if (CHIP_NO_ERROR == TLVUnpackError) + { + operatingModeDuringHolidayExists = true; + validArgumentCount++; + } + break; default: // Unsupported tag, ignore it. ChipLogProgress(Zcl, "Unknown TLV tag during processing."); @@ -2406,10 +3757,11 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterClearHolidayScheduleCallback(apCommandObj, scheduleId); + emberAfDoorLockClusterSetHolidayScheduleCallback(apCommandObj, scheduleId, localStartTime, localEndTime, + operatingModeDuringHoliday); } else { @@ -2417,18 +3769,24 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 1, validArgumentCount, TLVError, TLVUnpackError); + 4, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_CLEAR_PIN_COMMAND_ID: { + case ZCL_SET_PIN_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; uint16_t userId; - bool userIdExists = false; + bool userIdExists = false; + uint8_t userStatus; + bool userStatusExists = false; + uint8_t userType; + bool userTypeExists = false; + const uint8_t * pin; + bool pinExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -2449,6 +3807,49 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En validArgumentCount++; } break; + case 1: + if (userStatusExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(userStatus); + if (CHIP_NO_ERROR == TLVUnpackError) + { + userStatusExists = true; + validArgumentCount++; + } + break; + case 2: + if (userTypeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(userType); + if (CHIP_NO_ERROR == TLVUnpackError) + { + userTypeExists = true; + validArgumentCount++; + } + break; + case 3: + if (pinExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = aDataTlv.GetDataPtr(pin); + if (CHIP_NO_ERROR == TLVUnpackError) + { + pinExists = true; + validArgumentCount++; + } + break; default: // Unsupported tag, ignore it. ChipLogProgress(Zcl, "Unknown TLV tag during processing."); @@ -2473,10 +3874,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterClearPinCallback(apCommandObj, userId); + emberAfDoorLockClusterSetPinCallback(apCommandObj, userId, userStatus, userType, const_cast(pin)); } else { @@ -2484,18 +3885,24 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 1, validArgumentCount, TLVError, TLVUnpackError); + 4, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_CLEAR_RFID_COMMAND_ID: { + case ZCL_SET_RFID_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; uint16_t userId; - bool userIdExists = false; + bool userIdExists = false; + uint8_t userStatus; + bool userStatusExists = false; + uint8_t userType; + bool userTypeExists = false; + const uint8_t * id; + bool idExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -2516,6 +3923,49 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En validArgumentCount++; } break; + case 1: + if (userStatusExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(userStatus); + if (CHIP_NO_ERROR == TLVUnpackError) + { + userStatusExists = true; + validArgumentCount++; + } + break; + case 2: + if (userTypeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(userType); + if (CHIP_NO_ERROR == TLVUnpackError) + { + userTypeExists = true; + validArgumentCount++; + } + break; + case 3: + if (idExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = aDataTlv.GetDataPtr(id); + if (CHIP_NO_ERROR == TLVUnpackError) + { + idExists = true; + validArgumentCount++; + } + break; default: // Unsupported tag, ignore it. ChipLogProgress(Zcl, "Unknown TLV tag during processing."); @@ -2540,10 +3990,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterClearRfidCallback(apCommandObj, userId); + emberAfDoorLockClusterSetRfidCallback(apCommandObj, userId, userStatus, userType, const_cast(id)); } else { @@ -2551,20 +4001,20 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 1, validArgumentCount, TLVError, TLVUnpackError); + 4, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_CLEAR_WEEKDAY_SCHEDULE_COMMAND_ID: { + case ZCL_SET_USER_TYPE_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t scheduleId; - bool scheduleIdExists = false; uint16_t userId; - bool userIdExists = false; + bool userIdExists = false; + uint8_t userType; + bool userTypeExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -2572,30 +4022,30 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (scheduleIdExists) + if (userIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(scheduleId); + TLVUnpackError = aDataTlv.Get(userId); if (CHIP_NO_ERROR == TLVUnpackError) { - scheduleIdExists = true; + userIdExists = true; validArgumentCount++; } break; case 1: - if (userIdExists) + if (userTypeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(userId); + TLVUnpackError = aDataTlv.Get(userType); if (CHIP_NO_ERROR == TLVUnpackError) { - userIdExists = true; + userTypeExists = true; validArgumentCount++; } break; @@ -2626,7 +4076,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterClearWeekdayScheduleCallback(apCommandObj, scheduleId, userId); + emberAfDoorLockClusterSetUserTypeCallback(apCommandObj, userId, userType); } else { @@ -2638,7 +4088,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - case ZCL_CLEAR_YEARDAY_SCHEDULE_COMMAND_ID: { + case ZCL_SET_WEEKDAY_SCHEDULE_COMMAND_ID: { // 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. @@ -2647,7 +4097,17 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En uint8_t scheduleId; bool scheduleIdExists = false; uint16_t userId; - bool userIdExists = false; + bool userIdExists = false; + uint8_t daysMask; + bool daysMaskExists = false; + uint8_t startHour; + bool startHourExists = false; + uint8_t startMinute; + bool startMinuteExists = false; + uint8_t endHour; + bool endHourExists = false; + uint8_t endMinute; + bool endMinuteExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -2682,6 +4142,76 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En validArgumentCount++; } break; + case 2: + if (daysMaskExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(daysMask); + if (CHIP_NO_ERROR == TLVUnpackError) + { + daysMaskExists = true; + validArgumentCount++; + } + break; + case 3: + if (startHourExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(startHour); + if (CHIP_NO_ERROR == TLVUnpackError) + { + startHourExists = true; + validArgumentCount++; + } + break; + case 4: + if (startMinuteExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(startMinute); + if (CHIP_NO_ERROR == TLVUnpackError) + { + startMinuteExists = true; + validArgumentCount++; + } + break; + case 5: + if (endHourExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(endHour); + if (CHIP_NO_ERROR == TLVUnpackError) + { + endHourExists = true; + validArgumentCount++; + } + break; + case 6: + if (endMinuteExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(endMinute); + if (CHIP_NO_ERROR == TLVUnpackError) + { + endMinuteExists = true; + validArgumentCount++; + } + break; default: // Unsupported tag, ignore it. ChipLogProgress(Zcl, "Unknown TLV tag during processing."); @@ -2706,10 +4236,11 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 7 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterClearYeardayScheduleCallback(apCommandObj, scheduleId, userId); + emberAfDoorLockClusterSetWeekdayScheduleCallback(apCommandObj, scheduleId, userId, daysMask, startHour, startMinute, + endHour, endMinute); } else { @@ -2717,18 +4248,24 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 2, validArgumentCount, TLVError, TLVUnpackError); + 7, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_GET_HOLIDAY_SCHEDULE_COMMAND_ID: { + case ZCL_SET_YEARDAY_SCHEDULE_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; uint8_t scheduleId; - bool scheduleIdExists = false; + bool scheduleIdExists = false; + uint16_t userId; + bool userIdExists = false; + uint32_t localStartTime; + bool localStartTimeExists = false; + uint32_t localEndTime; + bool localEndTimeExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -2749,6 +4286,48 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En validArgumentCount++; } break; + case 1: + if (userIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(userId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + userIdExists = true; + validArgumentCount++; + } + break; + case 2: + if (localStartTimeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(localStartTime); + if (CHIP_NO_ERROR == TLVUnpackError) + { + localStartTimeExists = true; + validArgumentCount++; + } + break; + case 3: + if (localEndTimeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(localEndTime); + if (CHIP_NO_ERROR == TLVUnpackError) + { + localEndTimeExists = true; + validArgumentCount++; + } + break; default: // Unsupported tag, ignore it. ChipLogProgress(Zcl, "Unknown TLV tag during processing."); @@ -2773,10 +4352,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterGetHolidayScheduleCallback(apCommandObj, scheduleId); + emberAfDoorLockClusterSetYeardayScheduleCallback(apCommandObj, scheduleId, userId, localStartTime, localEndTime); } else { @@ -2784,18 +4363,18 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 1, validArgumentCount, TLVError, TLVUnpackError); + 4, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_GET_LOG_RECORD_COMMAND_ID: { + case ZCL_UNLOCK_DOOR_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint16_t logIndex; - bool logIndexExists = false; + const uint8_t * PIN; + bool PINExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -2803,16 +4382,17 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (logIndexExists) + if (PINExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(logIndex); + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = aDataTlv.GetDataPtr(PIN); if (CHIP_NO_ERROR == TLVUnpackError) { - logIndexExists = true; + PINExists = true; validArgumentCount++; } break; @@ -2843,7 +4423,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterGetLogRecordCallback(apCommandObj, logIndex); + emberAfDoorLockClusterUnlockDoorCallback(apCommandObj, const_cast(PIN)); } else { @@ -2855,14 +4435,16 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - case ZCL_GET_PIN_COMMAND_ID: { + case ZCL_UNLOCK_WITH_TIMEOUT_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint16_t userId; - bool userIdExists = false; + uint16_t timeoutInSeconds; + bool timeoutInSecondsExists = false; + const uint8_t * pin; + bool pinExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -2870,16 +4452,31 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (userIdExists) + if (timeoutInSecondsExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(userId); + TLVUnpackError = aDataTlv.Get(timeoutInSeconds); if (CHIP_NO_ERROR == TLVUnpackError) { - userIdExists = true; + timeoutInSecondsExists = true; + validArgumentCount++; + } + break; + case 1: + if (pinExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = aDataTlv.GetDataPtr(pin); + if (CHIP_NO_ERROR == TLVUnpackError) + { + pinExists = true; validArgumentCount++; } break; @@ -2907,10 +4504,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterGetPinCallback(apCommandObj, userId); + emberAfDoorLockClusterUnlockWithTimeoutCallback(apCommandObj, timeoutInSeconds, const_cast(pin)); } else { @@ -2918,18 +4515,42 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 1, validArgumentCount, TLVError, TLVUnpackError); + 2, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_GET_RFID_COMMAND_ID: { + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_DOOR_LOCK_CLUSTER_ID); + break; + } + } + } +} + +} // namespace DoorLock + +namespace GeneralCommissioning { + +void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) +{ + { + switch (aCommandId) + { + case ZCL_ARM_FAIL_SAFE_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint16_t userId; - bool userIdExists = false; + uint16_t expiryLengthSeconds; + bool expiryLengthSecondsExists = false; + uint64_t breadcrumb; + bool breadcrumbExists = false; + uint32_t timeoutMs; + bool timeoutMsExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -2937,16 +4558,44 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (userIdExists) + if (expiryLengthSecondsExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(expiryLengthSeconds); + if (CHIP_NO_ERROR == TLVUnpackError) + { + expiryLengthSecondsExists = true; + validArgumentCount++; + } + break; + case 1: + if (breadcrumbExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(breadcrumb); + if (CHIP_NO_ERROR == TLVUnpackError) + { + breadcrumbExists = true; + validArgumentCount++; + } + break; + case 2: + if (timeoutMsExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(userId); + TLVUnpackError = aDataTlv.Get(timeoutMs); if (CHIP_NO_ERROR == TLVUnpackError) { - userIdExists = true; + timeoutMsExists = true; validArgumentCount++; } break; @@ -2974,10 +4623,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterGetRfidCallback(apCommandObj, userId); + emberAfGeneralCommissioningClusterArmFailSafeCallback(apCommandObj, expiryLengthSeconds, breadcrumb, timeoutMs); } else { @@ -2985,18 +4634,30 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 1, validArgumentCount, TLVError, TLVUnpackError); + 3, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_GET_USER_TYPE_COMMAND_ID: { + case ZCL_COMMISSIONING_COMPLETE_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfGeneralCommissioningClusterCommissioningCompleteCallback(apCommandObj); + break; + } + case ZCL_SET_REGULATORY_CONFIG_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint16_t userId; - bool userIdExists = false; + uint8_t location; + bool locationExists = false; + const uint8_t * countryCode; + bool countryCodeExists = false; + uint64_t breadcrumb; + bool breadcrumbExists = false; + uint32_t timeoutMs; + bool timeoutMsExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -3004,16 +4665,59 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (userIdExists) + if (locationExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(userId); + TLVUnpackError = aDataTlv.Get(location); if (CHIP_NO_ERROR == TLVUnpackError) { - userIdExists = true; + locationExists = true; + validArgumentCount++; + } + break; + case 1: + if (countryCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = aDataTlv.GetDataPtr(countryCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + countryCodeExists = true; + validArgumentCount++; + } + break; + case 2: + if (breadcrumbExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(breadcrumb); + if (CHIP_NO_ERROR == TLVUnpackError) + { + breadcrumbExists = true; + validArgumentCount++; + } + break; + case 3: + if (timeoutMsExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(timeoutMs); + if (CHIP_NO_ERROR == TLVUnpackError) + { + timeoutMsExists = true; validArgumentCount++; } break; @@ -3041,10 +4745,11 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterGetUserTypeCallback(apCommandObj, userId); + emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback( + apCommandObj, location, const_cast(countryCode), breadcrumb, timeoutMs); } else { @@ -3052,20 +4757,40 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 1, validArgumentCount, TLVError, TLVUnpackError); + 4, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_GET_WEEKDAY_SCHEDULE_COMMAND_ID: { + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_GENERAL_COMMISSIONING_CLUSTER_ID); + break; + } + } + } +} + +} // namespace GeneralCommissioning + +namespace Groups { + +void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) +{ + { + switch (aCommandId) + { + case ZCL_ADD_GROUP_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t scheduleId; - bool scheduleIdExists = false; - uint16_t userId; - bool userIdExists = false; + uint16_t groupId; + bool groupIdExists = false; + const uint8_t * groupName; + bool groupNameExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -3073,30 +4798,31 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (scheduleIdExists) + if (groupIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(scheduleId); + TLVUnpackError = aDataTlv.Get(groupId); if (CHIP_NO_ERROR == TLVUnpackError) { - scheduleIdExists = true; + groupIdExists = true; validArgumentCount++; } break; case 1: - if (userIdExists) + if (groupNameExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(userId); + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = aDataTlv.GetDataPtr(groupName); if (CHIP_NO_ERROR == TLVUnpackError) { - userIdExists = true; + groupNameExists = true; validArgumentCount++; } break; @@ -3127,7 +4853,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterGetWeekdayScheduleCallback(apCommandObj, scheduleId, userId); + emberAfGroupsClusterAddGroupCallback(apCommandObj, groupId, const_cast(groupName)); } else { @@ -3139,16 +4865,16 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - case ZCL_GET_YEARDAY_SCHEDULE_COMMAND_ID: { + case ZCL_ADD_GROUP_IF_IDENTIFYING_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t scheduleId; - bool scheduleIdExists = false; - uint16_t userId; - bool userIdExists = false; + uint16_t groupId; + bool groupIdExists = false; + const uint8_t * groupName; + bool groupNameExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -3156,30 +4882,31 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (scheduleIdExists) + if (groupIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(scheduleId); + TLVUnpackError = aDataTlv.Get(groupId); if (CHIP_NO_ERROR == TLVUnpackError) { - scheduleIdExists = true; + groupIdExists = true; validArgumentCount++; } break; case 1: - if (userIdExists) + if (groupNameExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(userId); + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = aDataTlv.GetDataPtr(groupName); if (CHIP_NO_ERROR == TLVUnpackError) { - userIdExists = true; + groupNameExists = true; validArgumentCount++; } break; @@ -3210,7 +4937,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterGetYeardayScheduleCallback(apCommandObj, scheduleId, userId); + emberAfGroupsClusterAddGroupIfIdentifyingCallback(apCommandObj, groupId, const_cast(groupName)); } else { @@ -3222,79 +4949,48 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - case ZCL_SET_HOLIDAY_SCHEDULE_COMMAND_ID: { + case ZCL_GET_GROUP_MEMBERSHIP_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t scheduleId; - bool scheduleIdExists = false; - uint32_t localStartTime; - bool localStartTimeExists = false; - uint32_t localEndTime; - bool localEndTimeExists = false; - uint8_t operatingModeDuringHoliday; - bool operatingModeDuringHolidayExists = false; - uint32_t validArgumentCount = 0; + uint8_t groupCount; + bool groupCountExists = false; + /* TYPE WARNING: array array defaults to */ uint8_t * groupList; + bool groupListExists = false; + uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) { switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (scheduleIdExists) + if (groupCountExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(scheduleId); + TLVUnpackError = aDataTlv.Get(groupCount); if (CHIP_NO_ERROR == TLVUnpackError) { - scheduleIdExists = true; + groupCountExists = true; validArgumentCount++; } break; case 1: - if (localStartTimeExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(localStartTime); - if (CHIP_NO_ERROR == TLVUnpackError) - { - localStartTimeExists = true; - validArgumentCount++; - } - break; - case 2: - if (localEndTimeExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(localEndTime); - if (CHIP_NO_ERROR == TLVUnpackError) - { - localEndTimeExists = true; - validArgumentCount++; - } - break; - case 3: - if (operatingModeDuringHolidayExists) + if (groupListExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(operatingModeDuringHoliday); + // Just for compatibility, we will add array type support in IM later. + TLVUnpackError = aDataTlv.GetDataPtr(const_cast(groupList)); if (CHIP_NO_ERROR == TLVUnpackError) { - operatingModeDuringHolidayExists = true; + groupListExists = true; validArgumentCount++; } break; @@ -3322,11 +5018,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterSetHolidayScheduleCallback(apCommandObj, scheduleId, localStartTime, localEndTime, - operatingModeDuringHoliday); + emberAfGroupsClusterGetGroupMembershipCallback(apCommandObj, groupCount, groupList); } else { @@ -3334,24 +5029,24 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 4, validArgumentCount, TLVError, TLVUnpackError); + 2, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_SET_PIN_COMMAND_ID: { + case ZCL_REMOVE_ALL_GROUPS_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfGroupsClusterRemoveAllGroupsCallback(apCommandObj); + break; + } + case ZCL_REMOVE_GROUP_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint16_t userId; - bool userIdExists = false; - uint8_t userStatus; - bool userStatusExists = false; - uint8_t userType; - bool userTypeExists = false; - const uint8_t * pin; - bool pinExists = false; + uint16_t groupId; + bool groupIdExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -3359,59 +5054,83 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (userIdExists) + if (groupIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(userId); + TLVUnpackError = aDataTlv.Get(groupId); if (CHIP_NO_ERROR == TLVUnpackError) { - userIdExists = true; + groupIdExists = true; validArgumentCount++; } break; - case 1: - if (userStatusExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(userStatus); - if (CHIP_NO_ERROR == TLVUnpackError) - { - userStatusExists = true; - validArgumentCount++; - } + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); break; - case 2: - if (userTypeExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(userType); - if (CHIP_NO_ERROR == TLVUnpackError) - { - userTypeExists = true; - validArgumentCount++; - } + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), TLVUnpackError); break; - case 3: - if (pinExists) + } + } + + 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfGroupsClusterRemoveGroupCallback(apCommandObj, groupId); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 1, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + case ZCL_VIEW_GROUP_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint16_t groupId; + bool groupIdExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (groupIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. - TLVUnpackError = aDataTlv.GetDataPtr(pin); + TLVUnpackError = aDataTlv.Get(groupId); if (CHIP_NO_ERROR == TLVUnpackError) { - pinExists = true; + groupIdExists = true; validArgumentCount++; } break; @@ -3439,10 +5158,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterSetPinCallback(apCommandObj, userId, userStatus, userType, const_cast(pin)); + emberAfGroupsClusterViewGroupCallback(apCommandObj, groupId); } else { @@ -3450,24 +5169,40 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 4, validArgumentCount, TLVError, TLVUnpackError); + 1, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_SET_RFID_COMMAND_ID: { + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_GROUPS_CLUSTER_ID); + break; + } + } + } +} + +} // namespace Groups + +namespace IasZone { + +void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) +{ + { + switch (aCommandId) + { + case ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint16_t userId; - bool userIdExists = false; - uint8_t userStatus; - bool userStatusExists = false; - uint8_t userType; - bool userTypeExists = false; - const uint8_t * id; - bool idExists = false; + uint8_t enrollResponseCode; + bool enrollResponseCodeExists = false; + uint8_t zoneId; + bool zoneIdExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -3475,59 +5210,30 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (userIdExists) + if (enrollResponseCodeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(userId); + TLVUnpackError = aDataTlv.Get(enrollResponseCode); if (CHIP_NO_ERROR == TLVUnpackError) { - userIdExists = true; + enrollResponseCodeExists = true; validArgumentCount++; } break; case 1: - if (userStatusExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(userStatus); - if (CHIP_NO_ERROR == TLVUnpackError) - { - userStatusExists = true; - validArgumentCount++; - } - break; - case 2: - if (userTypeExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(userType); - if (CHIP_NO_ERROR == TLVUnpackError) - { - userTypeExists = true; - validArgumentCount++; - } - break; - case 3: - if (idExists) + if (zoneIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. - TLVUnpackError = aDataTlv.GetDataPtr(id); + TLVUnpackError = aDataTlv.Get(zoneId); if (CHIP_NO_ERROR == TLVUnpackError) { - idExists = true; + zoneIdExists = true; validArgumentCount++; } break; @@ -3555,10 +5261,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterSetRfidCallback(apCommandObj, userId, userStatus, userType, const_cast(id)); + emberAfIasZoneClusterZoneEnrollResponseCallback(apCommandObj, enrollResponseCode, zoneId); } else { @@ -3566,20 +5272,38 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 4, validArgumentCount, TLVError, TLVUnpackError); + 2, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_SET_USER_TYPE_COMMAND_ID: { + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_IAS_ZONE_CLUSTER_ID); + break; + } + } + } +} + +} // namespace IasZone + +namespace Identify { + +void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) +{ + { + switch (aCommandId) + { + case ZCL_IDENTIFY_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint16_t userId; - bool userIdExists = false; - uint8_t userType; - bool userTypeExists = false; + uint16_t identifyTime; + bool identifyTimeExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -3587,30 +5311,16 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (userIdExists) + if (identifyTimeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(userId); - if (CHIP_NO_ERROR == TLVUnpackError) - { - userIdExists = true; - validArgumentCount++; - } - break; - case 1: - if (userTypeExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(userType); + TLVUnpackError = aDataTlv.Get(identifyTime); if (CHIP_NO_ERROR == TLVUnpackError) { - userTypeExists = true; + identifyTimeExists = true; validArgumentCount++; } break; @@ -3638,10 +5348,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterSetUserTypeCallback(apCommandObj, userId, userType); + emberAfIdentifyClusterIdentifyCallback(apCommandObj, identifyTime); } else { @@ -3649,30 +5359,50 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 2, validArgumentCount, TLVError, TLVUnpackError); + 1, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_SET_WEEKDAY_SCHEDULE_COMMAND_ID: { + case ZCL_IDENTIFY_QUERY_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfIdentifyClusterIdentifyQueryCallback(apCommandObj); + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_IDENTIFY_CLUSTER_ID); + break; + } + } + } +} + +} // namespace Identify + +namespace LevelControl { + +void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) +{ + { + switch (aCommandId) + { + case ZCL_MOVE_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t scheduleId; - bool scheduleIdExists = false; - uint16_t userId; - bool userIdExists = false; - uint8_t daysMask; - bool daysMaskExists = false; - uint8_t startHour; - bool startHourExists = false; - uint8_t startMinute; - bool startMinuteExists = false; - uint8_t endHour; - bool endHourExists = false; - uint8_t endMinute; - bool endMinuteExists = false; + uint8_t moveMode; + bool moveModeExists = false; + uint8_t rate; + bool rateExists = false; + uint8_t optionMask; + bool optionMaskExists = false; + uint8_t optionOverride; + bool optionOverrideExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -3680,100 +5410,58 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (scheduleIdExists) + if (moveModeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(scheduleId); + TLVUnpackError = aDataTlv.Get(moveMode); if (CHIP_NO_ERROR == TLVUnpackError) { - scheduleIdExists = true; + moveModeExists = true; validArgumentCount++; } break; case 1: - if (userIdExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(userId); - if (CHIP_NO_ERROR == TLVUnpackError) - { - userIdExists = true; - validArgumentCount++; - } - break; - case 2: - if (daysMaskExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(daysMask); - if (CHIP_NO_ERROR == TLVUnpackError) - { - daysMaskExists = true; - validArgumentCount++; - } - break; - case 3: - if (startHourExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(startHour); - if (CHIP_NO_ERROR == TLVUnpackError) - { - startHourExists = true; - validArgumentCount++; - } - break; - case 4: - if (startMinuteExists) + if (rateExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(startMinute); + TLVUnpackError = aDataTlv.Get(rate); if (CHIP_NO_ERROR == TLVUnpackError) { - startMinuteExists = true; + rateExists = true; validArgumentCount++; } break; - case 5: - if (endHourExists) + case 2: + if (optionMaskExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(endHour); + TLVUnpackError = aDataTlv.Get(optionMask); if (CHIP_NO_ERROR == TLVUnpackError) { - endHourExists = true; + optionMaskExists = true; validArgumentCount++; } break; - case 6: - if (endMinuteExists) + case 3: + if (optionOverrideExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(endMinute); + TLVUnpackError = aDataTlv.Get(optionOverride); if (CHIP_NO_ERROR == TLVUnpackError) { - endMinuteExists = true; + optionOverrideExists = true; validArgumentCount++; } break; @@ -3801,11 +5489,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 7 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterSetWeekdayScheduleCallback(apCommandObj, scheduleId, userId, daysMask, startHour, startMinute, - endHour, endMinute); + emberAfLevelControlClusterMoveCallback(apCommandObj, moveMode, rate, optionMask, optionOverride); } else { @@ -3813,24 +5500,24 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 7, validArgumentCount, TLVError, TLVUnpackError); + 4, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_SET_YEARDAY_SCHEDULE_COMMAND_ID: { + case ZCL_MOVE_TO_LEVEL_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t scheduleId; - bool scheduleIdExists = false; - uint16_t userId; - bool userIdExists = false; - uint32_t localStartTime; - bool localStartTimeExists = false; - uint32_t localEndTime; - bool localEndTimeExists = false; + uint8_t level; + bool levelExists = false; + uint16_t transitionTime; + bool transitionTimeExists = false; + uint8_t optionMask; + bool optionMaskExists = false; + uint8_t optionOverride; + bool optionOverrideExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -3838,58 +5525,58 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (scheduleIdExists) + if (levelExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(scheduleId); + TLVUnpackError = aDataTlv.Get(level); if (CHIP_NO_ERROR == TLVUnpackError) { - scheduleIdExists = true; + levelExists = true; validArgumentCount++; } break; case 1: - if (userIdExists) + if (transitionTimeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(userId); + TLVUnpackError = aDataTlv.Get(transitionTime); if (CHIP_NO_ERROR == TLVUnpackError) { - userIdExists = true; + transitionTimeExists = true; validArgumentCount++; } break; case 2: - if (localStartTimeExists) + if (optionMaskExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(localStartTime); + TLVUnpackError = aDataTlv.Get(optionMask); if (CHIP_NO_ERROR == TLVUnpackError) { - localStartTimeExists = true; + optionMaskExists = true; validArgumentCount++; } break; case 3: - if (localEndTimeExists) + if (optionOverrideExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(localEndTime); + TLVUnpackError = aDataTlv.Get(optionOverride); if (CHIP_NO_ERROR == TLVUnpackError) { - localEndTimeExists = true; + optionOverrideExists = true; validArgumentCount++; } break; @@ -3920,7 +5607,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterSetYeardayScheduleCallback(apCommandObj, scheduleId, userId, localStartTime, localEndTime); + emberAfLevelControlClusterMoveToLevelCallback(apCommandObj, level, transitionTime, optionMask, optionOverride); } else { @@ -3932,16 +5619,16 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - case ZCL_UNLOCK_WITH_TIMEOUT_COMMAND_ID: { + case ZCL_MOVE_TO_LEVEL_WITH_ON_OFF_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint16_t timeoutInSeconds; - bool timeoutInSecondsExists = false; - const uint8_t * pin; - bool pinExists = false; + uint8_t level; + bool levelExists = false; + uint16_t transitionTime; + bool transitionTimeExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -3949,31 +5636,30 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (timeoutInSecondsExists) + if (levelExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(timeoutInSeconds); + TLVUnpackError = aDataTlv.Get(level); if (CHIP_NO_ERROR == TLVUnpackError) { - timeoutInSecondsExists = true; + levelExists = true; validArgumentCount++; } break; case 1: - if (pinExists) + if (transitionTimeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. - TLVUnpackError = aDataTlv.GetDataPtr(pin); + TLVUnpackError = aDataTlv.Get(transitionTime); if (CHIP_NO_ERROR == TLVUnpackError) { - pinExists = true; + transitionTimeExists = true; validArgumentCount++; } break; @@ -4004,7 +5690,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfDoorLockClusterUnlockWithTimeoutCallback(apCommandObj, timeoutInSeconds, const_cast(pin)); + emberAfLevelControlClusterMoveToLevelWithOnOffCallback(apCommandObj, level, transitionTime); } else { @@ -4016,38 +5702,105 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - default: { - // Unrecognized command ID, error status will apply. - apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, - Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); - ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_DOOR_LOCK_CLUSTER_ID); - break; - } - } - } -} + case ZCL_MOVE_WITH_ON_OFF_COMMAND_ID: { + // 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. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t moveMode; + bool moveModeExists = false; + uint8_t rate; + bool rateExists = false; + uint32_t validArgumentCount = 0; -} // namespace DoorLock + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(aDataTlv.GetTag())) + { + case 0: + if (moveModeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(moveMode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + moveModeExists = true; + validArgumentCount++; + } + break; + case 1: + if (rateExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(rate); + if (CHIP_NO_ERROR == TLVUnpackError) + { + rateExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(aDataTlv.GetTag()), TLVUnpackError); + break; + } + } -namespace GeneralCommissioning { + 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; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } -void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) -{ - { - switch (aCommandId) - { - case ZCL_ARM_FAIL_SAFE_COMMAND_ID: { + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfLevelControlClusterMoveWithOnOffCallback(apCommandObj, moveMode, rate); + } + else + { + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kBadRequest, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogProgress( + Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, + 2, validArgumentCount, TLVError, TLVUnpackError); + } + break; + } + case ZCL_STEP_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint16_t expiryLengthSeconds; - bool expiryLengthSecondsExists = false; - uint64_t breadcrumb; - bool breadcrumbExists = false; - uint32_t timeoutMs; - bool timeoutMsExists = false; + uint8_t stepMode; + bool stepModeExists = false; + uint8_t stepSize; + bool stepSizeExists = false; + uint16_t transitionTime; + bool transitionTimeExists = false; + uint8_t optionMask; + bool optionMaskExists = false; + uint8_t optionOverride; + bool optionOverrideExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -4055,44 +5808,72 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (expiryLengthSecondsExists) + if (stepModeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(expiryLengthSeconds); + TLVUnpackError = aDataTlv.Get(stepMode); if (CHIP_NO_ERROR == TLVUnpackError) { - expiryLengthSecondsExists = true; + stepModeExists = true; validArgumentCount++; } break; case 1: - if (breadcrumbExists) + if (stepSizeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(breadcrumb); + TLVUnpackError = aDataTlv.Get(stepSize); if (CHIP_NO_ERROR == TLVUnpackError) { - breadcrumbExists = true; + stepSizeExists = true; validArgumentCount++; } break; case 2: - if (timeoutMsExists) + if (transitionTimeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(timeoutMs); + TLVUnpackError = aDataTlv.Get(transitionTime); if (CHIP_NO_ERROR == TLVUnpackError) { - timeoutMsExists = true; + transitionTimeExists = true; + validArgumentCount++; + } + break; + case 3: + if (optionMaskExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(optionMask); + if (CHIP_NO_ERROR == TLVUnpackError) + { + optionMaskExists = true; + validArgumentCount++; + } + break; + case 4: + if (optionOverrideExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(optionOverride); + if (CHIP_NO_ERROR == TLVUnpackError) + { + optionOverrideExists = true; validArgumentCount++; } break; @@ -4120,10 +5901,11 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfGeneralCommissioningClusterArmFailSafeCallback(apCommandObj, expiryLengthSeconds, breadcrumb, timeoutMs); + emberAfLevelControlClusterStepCallback(apCommandObj, stepMode, stepSize, transitionTime, optionMask, + optionOverride); } else { @@ -4131,30 +5913,22 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 3, validArgumentCount, TLVError, TLVUnpackError); + 5, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_COMMISSIONING_COMPLETE_COMMAND_ID: { - - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfGeneralCommissioningClusterCommissioningCompleteCallback(apCommandObj); - break; - } - case ZCL_SET_REGULATORY_CONFIG_COMMAND_ID: { + case ZCL_STEP_WITH_ON_OFF_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t location; - bool locationExists = false; - const uint8_t * countryCode; - bool countryCodeExists = false; - uint64_t breadcrumb; - bool breadcrumbExists = false; - uint32_t timeoutMs; - bool timeoutMsExists = false; + uint8_t stepMode; + bool stepModeExists = false; + uint8_t stepSize; + bool stepSizeExists = false; + uint16_t transitionTime; + bool transitionTimeExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -4162,59 +5936,44 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (locationExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(location); - if (CHIP_NO_ERROR == TLVUnpackError) - { - locationExists = true; - validArgumentCount++; - } - break; - case 1: - if (countryCodeExists) + if (stepModeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. - TLVUnpackError = aDataTlv.GetDataPtr(countryCode); + TLVUnpackError = aDataTlv.Get(stepMode); if (CHIP_NO_ERROR == TLVUnpackError) { - countryCodeExists = true; + stepModeExists = true; validArgumentCount++; } break; - case 2: - if (breadcrumbExists) + case 1: + if (stepSizeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(breadcrumb); + TLVUnpackError = aDataTlv.Get(stepSize); if (CHIP_NO_ERROR == TLVUnpackError) { - breadcrumbExists = true; + stepSizeExists = true; validArgumentCount++; } break; - case 3: - if (timeoutMsExists) + case 2: + if (transitionTimeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(timeoutMs); + TLVUnpackError = aDataTlv.Get(transitionTime); if (CHIP_NO_ERROR == TLVUnpackError) { - timeoutMsExists = true; + transitionTimeExists = true; validArgumentCount++; } break; @@ -4242,11 +6001,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback( - apCommandObj, location, const_cast(countryCode), breadcrumb, timeoutMs); + emberAfLevelControlClusterStepWithOnOffCallback(apCommandObj, stepMode, stepSize, transitionTime); } else { @@ -4254,40 +6012,20 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 4, validArgumentCount, TLVError, TLVUnpackError); + 3, validArgumentCount, TLVError, TLVUnpackError); } break; } - default: { - // Unrecognized command ID, error status will apply. - apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, - Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); - ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_GENERAL_COMMISSIONING_CLUSTER_ID); - break; - } - } - } -} - -} // namespace GeneralCommissioning - -namespace IasZone { - -void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) -{ - { - switch (aCommandId) - { - case ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID: { + case ZCL_STOP_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t enrollResponseCode; - bool enrollResponseCodeExists = false; - uint8_t zoneId; - bool zoneIdExists = false; + uint8_t optionMask; + bool optionMaskExists = false; + uint8_t optionOverride; + bool optionOverrideExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -4295,30 +6033,30 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (enrollResponseCodeExists) + if (optionMaskExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(enrollResponseCode); + TLVUnpackError = aDataTlv.Get(optionMask); if (CHIP_NO_ERROR == TLVUnpackError) { - enrollResponseCodeExists = true; + optionMaskExists = true; validArgumentCount++; } break; case 1: - if (zoneIdExists) + if (optionOverrideExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(zoneId); + TLVUnpackError = aDataTlv.Get(optionOverride); if (CHIP_NO_ERROR == TLVUnpackError) { - zoneIdExists = true; + optionOverrideExists = true; validArgumentCount++; } break; @@ -4349,7 +6087,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfIasZoneClusterZoneEnrollResponseCallback(apCommandObj, enrollResponseCode, zoneId); + emberAfLevelControlClusterStopCallback(apCommandObj, optionMask, optionOverride); } else { @@ -4361,51 +6099,93 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } + case ZCL_STOP_WITH_ON_OFF_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfLevelControlClusterStopWithOnOffCallback(apCommandObj); + break; + } default: { // Unrecognized command ID, error status will apply. apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); - ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_IAS_ZONE_CLUSTER_ID); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_LEVEL_CONTROL_CLUSTER_ID); break; } } } } -} // namespace IasZone +} // namespace LevelControl -namespace KeypadInput { +namespace MediaPlayback { void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) { { switch (aCommandId) { - case ZCL_SEND_KEY_COMMAND_ID: { + case ZCL_MEDIA_FAST_FORWARD_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfMediaPlaybackClusterMediaFastForwardCallback(apCommandObj); + break; + } + case ZCL_MEDIA_NEXT_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfMediaPlaybackClusterMediaNextCallback(apCommandObj); + break; + } + case ZCL_MEDIA_PAUSE_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfMediaPlaybackClusterMediaPauseCallback(apCommandObj); + break; + } + case ZCL_MEDIA_PLAY_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfMediaPlaybackClusterMediaPlayCallback(apCommandObj); + break; + } + case ZCL_MEDIA_PREVIOUS_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfMediaPlaybackClusterMediaPreviousCallback(apCommandObj); + break; + } + case ZCL_MEDIA_REWIND_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfMediaPlaybackClusterMediaRewindCallback(apCommandObj); + break; + } + case ZCL_MEDIA_SKIP_BACKWARD_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t keyCode; - bool keyCodeExists = false; - uint32_t validArgumentCount = 0; + uint64_t deltaPositionMilliseconds; + bool deltaPositionMillisecondsExists = false; + uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) { switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (keyCodeExists) + if (deltaPositionMillisecondsExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(keyCode); + TLVUnpackError = aDataTlv.Get(deltaPositionMilliseconds); if (CHIP_NO_ERROR == TLVUnpackError) { - keyCodeExists = true; + deltaPositionMillisecondsExists = true; validArgumentCount++; } break; @@ -4436,7 +6216,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfKeypadInputClusterSendKeyCallback(apCommandObj, keyCode); + emberAfMediaPlaybackClusterMediaSkipBackwardCallback(apCommandObj, deltaPositionMilliseconds); } else { @@ -4448,100 +6228,31 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - default: { - // Unrecognized command ID, error status will apply. - apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, - Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); - ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_KEYPAD_INPUT_CLUSTER_ID); - break; - } - } - } -} - -} // namespace KeypadInput - -namespace LowPower { - -void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) -{ - { - switch (aCommandId) - { - case ZCL_SLEEP_COMMAND_ID: { - - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfLowPowerClusterSleepCallback(apCommandObj); - break; - } - default: { - // Unrecognized command ID, error status will apply. - apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, - Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); - ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_LOW_POWER_CLUSTER_ID); - break; - } - } - } -} - -} // namespace LowPower - -namespace MediaInput { - -void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) -{ - { - switch (aCommandId) - { - case ZCL_HIDE_INPUT_STATUS_COMMAND_ID: { - - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfMediaInputClusterHideInputStatusCallback(apCommandObj); - break; - } - case ZCL_RENAME_INPUT_COMMAND_ID: { + case ZCL_MEDIA_SKIP_FORWARD_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t index; - bool indexExists = false; - const uint8_t * name; - bool nameExists = false; - uint32_t validArgumentCount = 0; + uint64_t deltaPositionMilliseconds; + bool deltaPositionMillisecondsExists = false; + uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) { switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (indexExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(index); - if (CHIP_NO_ERROR == TLVUnpackError) - { - indexExists = true; - validArgumentCount++; - } - break; - case 1: - if (nameExists) + if (deltaPositionMillisecondsExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. - TLVUnpackError = aDataTlv.GetDataPtr(name); + TLVUnpackError = aDataTlv.Get(deltaPositionMilliseconds); if (CHIP_NO_ERROR == TLVUnpackError) { - nameExists = true; + deltaPositionMillisecondsExists = true; validArgumentCount++; } break; @@ -4569,10 +6280,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfMediaInputClusterRenameInputCallback(apCommandObj, index, const_cast(name)); + emberAfMediaPlaybackClusterMediaSkipForwardCallback(apCommandObj, deltaPositionMilliseconds); } else { @@ -4580,18 +6291,18 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 2, validArgumentCount, TLVError, TLVUnpackError); + 1, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_SELECT_INPUT_COMMAND_ID: { + case ZCL_MEDIA_SKIP_SEEK_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t index; - bool indexExists = false; + uint64_t position; + bool positionExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -4599,16 +6310,16 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (indexExists) + if (positionExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(index); + TLVUnpackError = aDataTlv.Get(position); if (CHIP_NO_ERROR == TLVUnpackError) { - indexExists = true; + positionExists = true; validArgumentCount++; } break; @@ -4639,7 +6350,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfMediaInputClusterSelectInputCallback(apCommandObj, index); + emberAfMediaPlaybackClusterMediaSkipSeekCallback(apCommandObj, position); } else { @@ -4651,93 +6362,99 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - case ZCL_SHOW_INPUT_STATUS_COMMAND_ID: { + case ZCL_MEDIA_START_OVER_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfMediaPlaybackClusterMediaStartOverCallback(apCommandObj); + break; + } + case ZCL_MEDIA_STOP_COMMAND_ID: { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfMediaInputClusterShowInputStatusCallback(apCommandObj); + emberAfMediaPlaybackClusterMediaStopCallback(apCommandObj); break; } default: { // Unrecognized command ID, error status will apply. apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); - ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_MEDIA_INPUT_CLUSTER_ID); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_MEDIA_PLAYBACK_CLUSTER_ID); break; } } } } -} // namespace MediaInput +} // namespace MediaPlayback -namespace MediaPlayback { +namespace NetworkCommissioning { void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) { { switch (aCommandId) { - case ZCL_MEDIA_FAST_FORWARD_COMMAND_ID: { - - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfMediaPlaybackClusterMediaFastForwardCallback(apCommandObj); - break; - } - case ZCL_MEDIA_NEXT_COMMAND_ID: { - - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfMediaPlaybackClusterMediaNextCallback(apCommandObj); - break; - } - case ZCL_MEDIA_PAUSE_COMMAND_ID: { - - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfMediaPlaybackClusterMediaPauseCallback(apCommandObj); - break; - } - case ZCL_MEDIA_PLAY_COMMAND_ID: { - - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfMediaPlaybackClusterMediaPlayCallback(apCommandObj); - break; - } - case ZCL_MEDIA_PREVIOUS_COMMAND_ID: { - - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfMediaPlaybackClusterMediaPreviousCallback(apCommandObj); - break; - } - case ZCL_MEDIA_REWIND_COMMAND_ID: { - - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfMediaPlaybackClusterMediaRewindCallback(apCommandObj); - break; - } - case ZCL_MEDIA_SKIP_BACKWARD_COMMAND_ID: { + case ZCL_DISABLE_NETWORK_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint64_t deltaPositionMilliseconds; - bool deltaPositionMillisecondsExists = false; - uint32_t validArgumentCount = 0; + chip::ByteSpan networkID; + bool networkIDExists = false; + uint64_t breadcrumb; + bool breadcrumbExists = false; + uint32_t timeoutMs; + bool timeoutMsExists = false; + uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) { switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (deltaPositionMillisecondsExists) + if (networkIDExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(deltaPositionMilliseconds); + { + const uint8_t * data = nullptr; + TLVUnpackError = aDataTlv.GetDataPtr(data); + networkID = chip::ByteSpan(data, aDataTlv.GetLength()); + } if (CHIP_NO_ERROR == TLVUnpackError) { - deltaPositionMillisecondsExists = true; + networkIDExists = true; + validArgumentCount++; + } + break; + case 1: + if (breadcrumbExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(breadcrumb); + if (CHIP_NO_ERROR == TLVUnpackError) + { + breadcrumbExists = true; + validArgumentCount++; + } + break; + case 2: + if (timeoutMsExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(timeoutMs); + if (CHIP_NO_ERROR == TLVUnpackError) + { + timeoutMsExists = true; validArgumentCount++; } break; @@ -4765,10 +6482,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfMediaPlaybackClusterMediaSkipBackwardCallback(apCommandObj, deltaPositionMilliseconds); + emberAfNetworkCommissioningClusterDisableNetworkCallback(apCommandObj, networkID, breadcrumb, timeoutMs); } else { @@ -4776,35 +6493,71 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 1, validArgumentCount, TLVError, TLVUnpackError); + 3, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_MEDIA_SKIP_FORWARD_COMMAND_ID: { + case ZCL_ENABLE_NETWORK_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint64_t deltaPositionMilliseconds; - bool deltaPositionMillisecondsExists = false; - uint32_t validArgumentCount = 0; + chip::ByteSpan networkID; + bool networkIDExists = false; + uint64_t breadcrumb; + bool breadcrumbExists = false; + uint32_t timeoutMs; + bool timeoutMsExists = false; + uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) { switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (deltaPositionMillisecondsExists) + if (networkIDExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(deltaPositionMilliseconds); + { + const uint8_t * data = nullptr; + TLVUnpackError = aDataTlv.GetDataPtr(data); + networkID = chip::ByteSpan(data, aDataTlv.GetLength()); + } if (CHIP_NO_ERROR == TLVUnpackError) { - deltaPositionMillisecondsExists = true; + networkIDExists = true; + validArgumentCount++; + } + break; + case 1: + if (breadcrumbExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(breadcrumb); + if (CHIP_NO_ERROR == TLVUnpackError) + { + breadcrumbExists = true; + validArgumentCount++; + } + break; + case 2: + if (timeoutMsExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(timeoutMs); + if (CHIP_NO_ERROR == TLVUnpackError) + { + timeoutMsExists = true; validArgumentCount++; } break; @@ -4832,10 +6585,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfMediaPlaybackClusterMediaSkipForwardCallback(apCommandObj, deltaPositionMilliseconds); + emberAfNetworkCommissioningClusterEnableNetworkCallback(apCommandObj, networkID, breadcrumb, timeoutMs); } else { @@ -4843,18 +6596,18 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 1, validArgumentCount, TLVError, TLVUnpackError); + 3, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_MEDIA_SKIP_SEEK_COMMAND_ID: { + case ZCL_GET_LAST_NETWORK_COMMISSIONING_RESULT_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint64_t position; - bool positionExists = false; + uint32_t timeoutMs; + bool timeoutMsExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -4862,16 +6615,16 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (positionExists) + if (timeoutMsExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(position); + TLVUnpackError = aDataTlv.Get(timeoutMs); if (CHIP_NO_ERROR == TLVUnpackError) { - positionExists = true; + timeoutMsExists = true; validArgumentCount++; } break; @@ -4902,7 +6655,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfMediaPlaybackClusterMediaSkipSeekCallback(apCommandObj, position); + emberAfNetworkCommissioningClusterGetLastNetworkCommissioningResultCallback(apCommandObj, timeoutMs); } else { @@ -4914,50 +6667,18 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - case ZCL_MEDIA_START_OVER_COMMAND_ID: { - - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfMediaPlaybackClusterMediaStartOverCallback(apCommandObj); - break; - } - case ZCL_MEDIA_STOP_COMMAND_ID: { - - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfMediaPlaybackClusterMediaStopCallback(apCommandObj); - break; - } - default: { - // Unrecognized command ID, error status will apply. - apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, - Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); - ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_MEDIA_PLAYBACK_CLUSTER_ID); - break; - } - } - } -} - -} // namespace MediaPlayback - -namespace NetworkCommissioning { - -void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) -{ - { - switch (aCommandId) - { - case ZCL_DISABLE_NETWORK_COMMAND_ID: { + case ZCL_REMOVE_NETWORK_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - chip::ByteSpan networkID; - bool networkIDExists = false; - uint64_t breadcrumb; - bool breadcrumbExists = false; - uint32_t timeoutMs; - bool timeoutMsExists = false; + chip::ByteSpan NetworkID; + bool NetworkIDExists = false; + uint64_t Breadcrumb; + bool BreadcrumbExists = false; + uint32_t TimeoutMs; + bool TimeoutMsExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -4965,7 +6686,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (networkIDExists) + if (NetworkIDExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; @@ -4974,39 +6695,39 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En { const uint8_t * data = nullptr; TLVUnpackError = aDataTlv.GetDataPtr(data); - networkID = chip::ByteSpan(data, aDataTlv.GetLength()); + NetworkID = chip::ByteSpan(data, aDataTlv.GetLength()); } if (CHIP_NO_ERROR == TLVUnpackError) { - networkIDExists = true; + NetworkIDExists = true; validArgumentCount++; } break; case 1: - if (breadcrumbExists) + if (BreadcrumbExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(breadcrumb); + TLVUnpackError = aDataTlv.Get(Breadcrumb); if (CHIP_NO_ERROR == TLVUnpackError) { - breadcrumbExists = true; + BreadcrumbExists = true; validArgumentCount++; } break; case 2: - if (timeoutMsExists) + if (TimeoutMsExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(timeoutMs); + TLVUnpackError = aDataTlv.Get(TimeoutMs); if (CHIP_NO_ERROR == TLVUnpackError) { - timeoutMsExists = true; + TimeoutMsExists = true; validArgumentCount++; } break; @@ -5037,7 +6758,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfNetworkCommissioningClusterDisableNetworkCallback(apCommandObj, networkID, breadcrumb, timeoutMs); + emberAfNetworkCommissioningClusterRemoveNetworkCallback(apCommandObj, NetworkID, Breadcrumb, TimeoutMs); } else { @@ -5049,14 +6770,14 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - case ZCL_ENABLE_NETWORK_COMMAND_ID: { + case ZCL_SCAN_NETWORKS_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - chip::ByteSpan networkID; - bool networkIDExists = false; + chip::ByteSpan ssid; + bool ssidExists = false; uint64_t breadcrumb; bool breadcrumbExists = false; uint32_t timeoutMs; @@ -5068,7 +6789,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (networkIDExists) + if (ssidExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; @@ -5077,11 +6798,11 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En { const uint8_t * data = nullptr; TLVUnpackError = aDataTlv.GetDataPtr(data); - networkID = chip::ByteSpan(data, aDataTlv.GetLength()); + ssid = chip::ByteSpan(data, aDataTlv.GetLength()); } if (CHIP_NO_ERROR == TLVUnpackError) { - networkIDExists = true; + ssidExists = true; validArgumentCount++; } break; @@ -5140,7 +6861,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfNetworkCommissioningClusterEnableNetworkCallback(apCommandObj, networkID, breadcrumb, timeoutMs); + emberAfNetworkCommissioningClusterScanNetworksCallback(apCommandObj, ssid, breadcrumb, timeoutMs); } else { @@ -5152,31 +6873,155 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - case ZCL_GET_LAST_NETWORK_COMMISSIONING_RESULT_COMMAND_ID: { + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_NETWORK_COMMISSIONING_CLUSTER_ID); + break; + } + } + } +} + +} // namespace NetworkCommissioning + +namespace OnOff { + +void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) +{ + { + switch (aCommandId) + { + case ZCL_OFF_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfOnOffClusterOffCallback(apCommandObj); + break; + } + case ZCL_ON_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfOnOffClusterOnCallback(apCommandObj); + break; + } + case ZCL_TOGGLE_COMMAND_ID: { + + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfOnOffClusterToggleCallback(apCommandObj); + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_ON_OFF_CLUSTER_ID); + break; + } + } + } +} + +} // namespace OnOff + +namespace Scenes { + +void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) +{ + { + switch (aCommandId) + { + case ZCL_ADD_SCENE_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint32_t timeoutMs; - bool timeoutMsExists = false; - uint32_t validArgumentCount = 0; + uint16_t groupId; + bool groupIdExists = false; + uint8_t sceneId; + bool sceneIdExists = false; + uint16_t transitionTime; + bool transitionTimeExists = false; + const uint8_t * sceneName; + bool sceneNameExists = false; + /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets; + bool extensionFieldSetsExists = false; + uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) { switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (timeoutMsExists) + if (groupIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(timeoutMs); + TLVUnpackError = aDataTlv.Get(groupId); if (CHIP_NO_ERROR == TLVUnpackError) { - timeoutMsExists = true; + groupIdExists = true; + validArgumentCount++; + } + break; + case 1: + if (sceneIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(sceneId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + sceneIdExists = true; + validArgumentCount++; + } + break; + case 2: + if (transitionTimeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(transitionTime); + if (CHIP_NO_ERROR == TLVUnpackError) + { + transitionTimeExists = true; + validArgumentCount++; + } + break; + case 3: + if (sceneNameExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = aDataTlv.GetDataPtr(sceneName); + if (CHIP_NO_ERROR == TLVUnpackError) + { + sceneNameExists = true; + validArgumentCount++; + } + break; + case 4: + if (extensionFieldSetsExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // Just for compatibility, we will add array type support in IM later. + TLVUnpackError = aDataTlv.GetDataPtr(const_cast(extensionFieldSets)); + if (CHIP_NO_ERROR == TLVUnpackError) + { + extensionFieldSetsExists = true; validArgumentCount++; } break; @@ -5204,10 +7049,11 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfNetworkCommissioningClusterGetLastNetworkCommissioningResultCallback(apCommandObj, timeoutMs); + emberAfScenesClusterAddSceneCallback(apCommandObj, groupId, sceneId, transitionTime, + const_cast(sceneName), extensionFieldSets); } else { @@ -5215,22 +7061,18 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 1, validArgumentCount, TLVError, TLVUnpackError); + 5, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_REMOVE_NETWORK_COMMAND_ID: { + case ZCL_GET_SCENE_MEMBERSHIP_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - chip::ByteSpan NetworkID; - bool NetworkIDExists = false; - uint64_t Breadcrumb; - bool BreadcrumbExists = false; - uint32_t TimeoutMs; - bool TimeoutMsExists = false; + uint16_t groupId; + bool groupIdExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -5238,48 +7080,16 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (NetworkIDExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - { - const uint8_t * data = nullptr; - TLVUnpackError = aDataTlv.GetDataPtr(data); - NetworkID = chip::ByteSpan(data, aDataTlv.GetLength()); - } - if (CHIP_NO_ERROR == TLVUnpackError) - { - NetworkIDExists = true; - validArgumentCount++; - } - break; - case 1: - if (BreadcrumbExists) - { - ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); - TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; - break; - } - TLVUnpackError = aDataTlv.Get(Breadcrumb); - if (CHIP_NO_ERROR == TLVUnpackError) - { - BreadcrumbExists = true; - validArgumentCount++; - } - break; - case 2: - if (TimeoutMsExists) + if (groupIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(TimeoutMs); + TLVUnpackError = aDataTlv.Get(groupId); if (CHIP_NO_ERROR == TLVUnpackError) { - TimeoutMsExists = true; + groupIdExists = true; validArgumentCount++; } break; @@ -5307,10 +7117,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfNetworkCommissioningClusterRemoveNetworkCallback(apCommandObj, NetworkID, Breadcrumb, TimeoutMs); + emberAfScenesClusterGetSceneMembershipCallback(apCommandObj, groupId); } else { @@ -5318,22 +7128,22 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 3, validArgumentCount, TLVError, TLVUnpackError); + 1, validArgumentCount, TLVError, TLVUnpackError); } break; } - case ZCL_SCAN_NETWORKS_COMMAND_ID: { + case ZCL_RECALL_SCENE_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - chip::ByteSpan ssid; - bool ssidExists = false; - uint64_t breadcrumb; - bool breadcrumbExists = false; - uint32_t timeoutMs; - bool timeoutMsExists = false; + uint16_t groupId; + bool groupIdExists = false; + uint8_t sceneId; + bool sceneIdExists = false; + uint16_t transitionTime; + bool transitionTimeExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -5341,48 +7151,44 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (ssidExists) + if (groupIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - { - const uint8_t * data = nullptr; - TLVUnpackError = aDataTlv.GetDataPtr(data); - ssid = chip::ByteSpan(data, aDataTlv.GetLength()); - } + TLVUnpackError = aDataTlv.Get(groupId); if (CHIP_NO_ERROR == TLVUnpackError) { - ssidExists = true; + groupIdExists = true; validArgumentCount++; } break; case 1: - if (breadcrumbExists) + if (sceneIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(breadcrumb); + TLVUnpackError = aDataTlv.Get(sceneId); if (CHIP_NO_ERROR == TLVUnpackError) { - breadcrumbExists = true; + sceneIdExists = true; validArgumentCount++; } break; case 2: - if (timeoutMsExists) + if (transitionTimeExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(timeoutMs); + TLVUnpackError = aDataTlv.Get(transitionTime); if (CHIP_NO_ERROR == TLVUnpackError) { - timeoutMsExists = true; + transitionTimeExists = true; validArgumentCount++; } break; @@ -5413,7 +7219,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfNetworkCommissioningClusterScanNetworksCallback(apCommandObj, ssid, breadcrumb, timeoutMs); + emberAfScenesClusterRecallSceneCallback(apCommandObj, groupId, sceneId, transitionTime); } else { @@ -5425,72 +7231,14 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - default: { - // Unrecognized command ID, error status will apply. - apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, - Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); - ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_NETWORK_COMMISSIONING_CLUSTER_ID); - break; - } - } - } -} - -} // namespace NetworkCommissioning - -namespace OnOff { - -void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) -{ - { - switch (aCommandId) - { - case ZCL_OFF_COMMAND_ID: { - - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfOnOffClusterOffCallback(apCommandObj); - break; - } - case ZCL_ON_COMMAND_ID: { - - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfOnOffClusterOnCallback(apCommandObj); - break; - } - case ZCL_TOGGLE_COMMAND_ID: { - - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfOnOffClusterToggleCallback(apCommandObj); - break; - } - default: { - // Unrecognized command ID, error status will apply. - apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, - Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); - ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_ON_OFF_CLUSTER_ID); - break; - } - } - } -} - -} // namespace OnOff - -namespace TvChannel { - -void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) -{ - { - switch (aCommandId) - { - case ZCL_CHANGE_CHANNEL_COMMAND_ID: { + case ZCL_REMOVE_ALL_SCENES_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - const uint8_t * match; - bool matchExists = false; + uint16_t groupId; + bool groupIdExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -5498,17 +7246,16 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (matchExists) + if (groupIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. - TLVUnpackError = aDataTlv.GetDataPtr(match); + TLVUnpackError = aDataTlv.Get(groupId); if (CHIP_NO_ERROR == TLVUnpackError) { - matchExists = true; + groupIdExists = true; validArgumentCount++; } break; @@ -5539,7 +7286,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfTvChannelClusterChangeChannelCallback(apCommandObj, const_cast(match)); + emberAfScenesClusterRemoveAllScenesCallback(apCommandObj, groupId); } else { @@ -5551,16 +7298,16 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - case ZCL_CHANGE_CHANNEL_BY_NUMBER_COMMAND_ID: { + case ZCL_REMOVE_SCENE_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint16_t majorNumber; - bool majorNumberExists = false; - uint16_t minorNumber; - bool minorNumberExists = false; + uint16_t groupId; + bool groupIdExists = false; + uint8_t sceneId; + bool sceneIdExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -5568,30 +7315,30 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (majorNumberExists) + if (groupIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(majorNumber); + TLVUnpackError = aDataTlv.Get(groupId); if (CHIP_NO_ERROR == TLVUnpackError) { - majorNumberExists = true; + groupIdExists = true; validArgumentCount++; } break; case 1: - if (minorNumberExists) + if (sceneIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(minorNumber); + TLVUnpackError = aDataTlv.Get(sceneId); if (CHIP_NO_ERROR == TLVUnpackError) { - minorNumberExists = true; + sceneIdExists = true; validArgumentCount++; } break; @@ -5622,7 +7369,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfTvChannelClusterChangeChannelByNumberCallback(apCommandObj, majorNumber, minorNumber); + emberAfScenesClusterRemoveSceneCallback(apCommandObj, groupId, sceneId); } else { @@ -5634,14 +7381,16 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } break; } - case ZCL_SKIP_CHANNEL_COMMAND_ID: { + case ZCL_STORE_SCENE_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint16_t Count; - bool CountExists = false; + uint16_t groupId; + bool groupIdExists = false; + uint8_t sceneId; + bool sceneIdExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -5649,16 +7398,30 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (CountExists) + if (groupIdExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = aDataTlv.Get(groupId); + if (CHIP_NO_ERROR == TLVUnpackError) + { + groupIdExists = true; + validArgumentCount++; + } + break; + case 1: + if (sceneIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(Count); + TLVUnpackError = aDataTlv.Get(sceneId); if (CHIP_NO_ERROR == TLVUnpackError) { - CountExists = true; + sceneIdExists = true; validArgumentCount++; } break; @@ -5686,10 +7449,10 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En } // TODO(#5590) We should encode a response of status code for invalid TLV. - if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfTvChannelClusterSkipChannelCallback(apCommandObj, Count); + emberAfScenesClusterStoreSceneCallback(apCommandObj, groupId, sceneId); } else { @@ -5697,40 +7460,20 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); ChipLogProgress( Zcl, "Failed to dispatch command, %d/%" PRIu32 " arguments parsed, TLVError=%" PRIu32 ", UnpackError=%" PRIu32, - 1, validArgumentCount, TLVError, TLVUnpackError); + 2, validArgumentCount, TLVError, TLVUnpackError); } break; } - default: { - // Unrecognized command ID, error status will apply. - apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, - Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); - ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_TV_CHANNEL_CLUSTER_ID); - break; - } - } - } -} - -} // namespace TvChannel - -namespace TargetNavigator { - -void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv) -{ - { - switch (aCommandId) - { - case ZCL_NAVIGATE_TARGET_COMMAND_ID: { + case ZCL_VIEW_SCENE_COMMAND_ID: { // 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. CHIP_ERROR TLVError = CHIP_NO_ERROR; CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; - uint8_t target; - bool targetExists = false; - const uint8_t * data; - bool dataExists = false; + uint16_t groupId; + bool groupIdExists = false; + uint8_t sceneId; + bool sceneIdExists = false; uint32_t validArgumentCount = 0; while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) @@ -5738,31 +7481,30 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En switch (TLV::TagNumFromTag(aDataTlv.GetTag())) { case 0: - if (targetExists) + if (groupIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - TLVUnpackError = aDataTlv.Get(target); + TLVUnpackError = aDataTlv.Get(groupId); if (CHIP_NO_ERROR == TLVUnpackError) { - targetExists = true; + groupIdExists = true; validArgumentCount++; } break; case 1: - if (dataExists) + if (sceneIdExists) { ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; break; } - // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. - TLVUnpackError = aDataTlv.GetDataPtr(data); + TLVUnpackError = aDataTlv.Get(sceneId); if (CHIP_NO_ERROR == TLVUnpackError) { - dataExists = true; + sceneIdExists = true; validArgumentCount++; } break; @@ -5793,7 +7535,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) { // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfTargetNavigatorClusterNavigateTargetCallback(apCommandObj, target, const_cast(data)); + emberAfScenesClusterViewSceneCallback(apCommandObj, groupId, sceneId); } else { @@ -5809,14 +7551,14 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En // Unrecognized command ID, error status will apply. apCommandObj->AddStatusCode(nullptr, Protocols::SecureChannel::GeneralStatusCode::kNotFound, Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); - ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_TARGET_NAVIGATOR_CLUSTER_ID); + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, aCommandId, ZCL_SCENES_CLUSTER_ID); break; } } } } -} // namespace TargetNavigator +} // namespace Scenes } // namespace clusters @@ -5833,12 +7575,12 @@ void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aC case ZCL_ACCOUNT_LOGIN_CLUSTER_ID: clusters::AccountLogin::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); break; - case ZCL_APPLICATION_LAUNCHER_CLUSTER_ID: - clusters::ApplicationLauncher::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); - break; case ZCL_AUDIO_OUTPUT_CLUSTER_ID: clusters::AudioOutput::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); break; + case ZCL_BARRIER_CONTROL_CLUSTER_ID: + clusters::BarrierControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); + break; case ZCL_BINDING_CLUSTER_ID: clusters::Binding::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); break; @@ -5854,17 +7596,17 @@ void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aC case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID: clusters::GeneralCommissioning::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); break; + case ZCL_GROUPS_CLUSTER_ID: + clusters::Groups::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); + break; case ZCL_IAS_ZONE_CLUSTER_ID: clusters::IasZone::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); break; - case ZCL_KEYPAD_INPUT_CLUSTER_ID: - clusters::KeypadInput::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); + case ZCL_IDENTIFY_CLUSTER_ID: + clusters::Identify::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); break; - case ZCL_LOW_POWER_CLUSTER_ID: - clusters::LowPower::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); - break; - case ZCL_MEDIA_INPUT_CLUSTER_ID: - clusters::MediaInput::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); + case ZCL_LEVEL_CONTROL_CLUSTER_ID: + clusters::LevelControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); break; case ZCL_MEDIA_PLAYBACK_CLUSTER_ID: clusters::MediaPlayback::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); @@ -5875,11 +7617,8 @@ void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aC case ZCL_ON_OFF_CLUSTER_ID: clusters::OnOff::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); break; - case ZCL_TV_CHANNEL_CLUSTER_ID: - clusters::TvChannel::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); - break; - case ZCL_TARGET_NAVIGATOR_CLUSTER_ID: - clusters::TargetNavigator::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); + case ZCL_SCENES_CLUSTER_ID: + clusters::Scenes::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader); break; default: // Unrecognized cluster ID, error status will apply. diff --git a/examples/tv-app/tv-common/gen/call-command-handler.cpp b/examples/tv-app/tv-common/gen/call-command-handler.cpp index 17b5393e5ac11e..aed7b40f3a0f17 100644 --- a/examples/tv-app/tv-common/gen/call-command-handler.cpp +++ b/examples/tv-app/tv-common/gen/call-command-handler.cpp @@ -102,14 +102,14 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) result = status(false, true, cmd->mfgSpecific); break; case ZCL_APPLICATION_LAUNCHER_CLUSTER_ID: - result = emberAfApplicationLauncherClusterServerCommandParse(cmd); + // No commands are enabled for cluster Application Launcher + result = status(false, true, cmd->mfgSpecific); break; case ZCL_AUDIO_OUTPUT_CLUSTER_ID: result = emberAfAudioOutputClusterServerCommandParse(cmd); break; case ZCL_BARRIER_CONTROL_CLUSTER_ID: - // No commands are enabled for cluster Barrier Control - result = status(false, true, cmd->mfgSpecific); + result = emberAfBarrierControlClusterServerCommandParse(cmd); break; case ZCL_BINDING_CLUSTER_ID: result = emberAfBindingClusterServerCommandParse(cmd); @@ -131,28 +131,28 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) result = status(false, true, cmd->mfgSpecific); break; case ZCL_GROUPS_CLUSTER_ID: - // No commands are enabled for cluster Groups - result = status(false, true, cmd->mfgSpecific); + result = emberAfGroupsClusterServerCommandParse(cmd); break; case ZCL_IAS_ZONE_CLUSTER_ID: result = emberAfIasZoneClusterServerCommandParse(cmd); break; case ZCL_IDENTIFY_CLUSTER_ID: - // No commands are enabled for cluster Identify - result = status(false, true, cmd->mfgSpecific); + result = emberAfIdentifyClusterServerCommandParse(cmd); break; case ZCL_KEYPAD_INPUT_CLUSTER_ID: - result = emberAfKeypadInputClusterServerCommandParse(cmd); + // No commands are enabled for cluster Keypad Input + result = status(false, true, cmd->mfgSpecific); break; case ZCL_LEVEL_CONTROL_CLUSTER_ID: - // No commands are enabled for cluster Level Control - result = status(false, true, cmd->mfgSpecific); + result = emberAfLevelControlClusterServerCommandParse(cmd); break; case ZCL_LOW_POWER_CLUSTER_ID: - result = emberAfLowPowerClusterServerCommandParse(cmd); + // No commands are enabled for cluster Low Power + result = status(false, true, cmd->mfgSpecific); break; case ZCL_MEDIA_INPUT_CLUSTER_ID: - result = emberAfMediaInputClusterServerCommandParse(cmd); + // No commands are enabled for cluster Media Input + result = status(false, true, cmd->mfgSpecific); break; case ZCL_MEDIA_PLAYBACK_CLUSTER_ID: result = emberAfMediaPlaybackClusterServerCommandParse(cmd); @@ -164,14 +164,15 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) result = emberAfOnOffClusterServerCommandParse(cmd); break; case ZCL_SCENES_CLUSTER_ID: - // No commands are enabled for cluster Scenes - result = status(false, true, cmd->mfgSpecific); + result = emberAfScenesClusterServerCommandParse(cmd); break; case ZCL_TV_CHANNEL_CLUSTER_ID: - result = emberAfTvChannelClusterServerCommandParse(cmd); + // No commands are enabled for cluster TV Channel + result = status(false, true, cmd->mfgSpecific); break; case ZCL_TARGET_NAVIGATOR_CLUSTER_ID: - result = emberAfTargetNavigatorClusterServerCommandParse(cmd); + // No commands are enabled for cluster Target Navigator + result = status(false, true, cmd->mfgSpecific); break; case ZCL_TEMP_MEASUREMENT_CLUSTER_ID: // No commands are enabled for cluster Temperature Measurement @@ -240,7 +241,7 @@ EmberAfStatus emberAfAccountLoginClusterServerCommandParse(EmberAfClusterCommand } return status(wasHandled, true, cmd->mfgSpecific); } -EmberAfStatus emberAfApplicationLauncherClusterServerCommandParse(EmberAfClusterCommand * cmd) +EmberAfStatus emberAfAudioOutputClusterServerCommandParse(EmberAfClusterCommand * cmd) { bool wasHandled = false; @@ -248,20 +249,37 @@ EmberAfStatus emberAfApplicationLauncherClusterServerCommandParse(EmberAfCluster { switch (cmd->commandId) { - case ZCL_LAUNCH_APP_COMMAND_ID: { + case ZCL_RENAME_OUTPUT_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; - uint8_t * data; - /* TYPE WARNING: array array defaults to */ uint8_t * application; + uint8_t index; + uint8_t * name; + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + index = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); if (cmd->bufLen < payloadOffset + 1u) { return EMBER_ZCL_STATUS_MALFORMED_COMMAND; } - data = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); - payloadOffset = static_cast(payloadOffset + emberAfStringLength(data) + 1u); - application = cmd->buffer + payloadOffset; + name = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); - wasHandled = emberAfApplicationLauncherClusterLaunchAppCallback(nullptr, data, application); + wasHandled = emberAfAudioOutputClusterRenameOutputCallback(nullptr, index, name); + break; + } + case ZCL_SELECT_OUTPUT_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t index; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + index = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfAudioOutputClusterSelectOutputCallback(nullptr, index); break; } default: { @@ -272,7 +290,7 @@ EmberAfStatus emberAfApplicationLauncherClusterServerCommandParse(EmberAfCluster } return status(wasHandled, true, cmd->mfgSpecific); } -EmberAfStatus emberAfAudioOutputClusterServerCommandParse(EmberAfClusterCommand * cmd) +EmberAfStatus emberAfBarrierControlClusterServerCommandParse(EmberAfClusterCommand * cmd) { bool wasHandled = false; @@ -280,37 +298,21 @@ EmberAfStatus emberAfAudioOutputClusterServerCommandParse(EmberAfClusterCommand { switch (cmd->commandId) { - case ZCL_RENAME_OUTPUT_COMMAND_ID: { + case ZCL_BARRIER_CONTROL_GO_TO_PERCENT_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; - uint8_t index; - uint8_t * name; + uint8_t percentOpen; if (cmd->bufLen < payloadOffset + 1) { return EMBER_ZCL_STATUS_MALFORMED_COMMAND; } - index = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); - payloadOffset = static_cast(payloadOffset + 1); - if (cmd->bufLen < payloadOffset + 1u) - { - return EMBER_ZCL_STATUS_MALFORMED_COMMAND; - } - name = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + percentOpen = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); - wasHandled = emberAfAudioOutputClusterRenameOutputCallback(nullptr, index, name); + wasHandled = emberAfBarrierControlClusterBarrierControlGoToPercentCallback(nullptr, percentOpen); break; } - case ZCL_SELECT_OUTPUT_COMMAND_ID: { - uint16_t payloadOffset = cmd->payloadStartIndex; - uint8_t index; - - if (cmd->bufLen < payloadOffset + 1) - { - return EMBER_ZCL_STATUS_MALFORMED_COMMAND; - } - index = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); - - wasHandled = emberAfAudioOutputClusterSelectOutputCallback(nullptr, index); + case ZCL_BARRIER_CONTROL_STOP_COMMAND_ID: { + wasHandled = emberAfBarrierControlClusterBarrierControlStopCallback(nullptr); break; } default: { @@ -413,6 +415,40 @@ EmberAfStatus emberAfColorControlClusterServerCommandParse(EmberAfClusterCommand { switch (cmd->commandId) { + case ZCL_MOVE_COLOR_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + int16_t rateX; + int16_t rateY; + uint8_t optionsMask; + uint8_t optionsOverride; + + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + rateX = static_cast(emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen)); + payloadOffset = static_cast(payloadOffset + 2); + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + rateY = static_cast(emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen)); + payloadOffset = static_cast(payloadOffset + 2); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + optionsMask = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + optionsOverride = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfColorControlClusterMoveColorCallback(nullptr, rateX, rateY, optionsMask, optionsOverride); + break; + } case ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; uint8_t moveMode; @@ -530,6 +566,48 @@ EmberAfStatus emberAfColorControlClusterServerCommandParse(EmberAfClusterCommand wasHandled = emberAfColorControlClusterMoveSaturationCallback(nullptr, moveMode, rate, optionsMask, optionsOverride); break; } + case ZCL_MOVE_TO_COLOR_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint16_t colorX; + uint16_t colorY; + uint16_t transitionTime; + uint8_t optionsMask; + uint8_t optionsOverride; + + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + colorX = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 2); + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + colorY = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 2); + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + transitionTime = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 2); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + optionsMask = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + optionsOverride = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfColorControlClusterMoveToColorCallback(nullptr, colorX, colorY, transitionTime, optionsMask, + optionsOverride); + break; + } case ZCL_MOVE_TO_COLOR_TEMPERATURE_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; uint16_t colorTemperature; @@ -684,6 +762,48 @@ EmberAfStatus emberAfColorControlClusterServerCommandParse(EmberAfClusterCommand optionsOverride); break; } + case ZCL_STEP_COLOR_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + int16_t stepX; + int16_t stepY; + uint16_t transitionTime; + uint8_t optionsMask; + uint8_t optionsOverride; + + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + stepX = static_cast(emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen)); + payloadOffset = static_cast(payloadOffset + 2); + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + stepY = static_cast(emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen)); + payloadOffset = static_cast(payloadOffset + 2); + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + transitionTime = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 2); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + optionsMask = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + optionsOverride = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = + emberAfColorControlClusterStepColorCallback(nullptr, stepX, stepY, transitionTime, optionsMask, optionsOverride); + break; + } case ZCL_STEP_COLOR_TEMPERATURE_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; uint8_t stepMode; @@ -1109,6 +1229,19 @@ EmberAfStatus emberAfDoorLockClusterServerCommandParse(EmberAfClusterCommand * c wasHandled = emberAfDoorLockClusterGetYeardayScheduleCallback(nullptr, scheduleId, userId); break; } + case ZCL_LOCK_DOOR_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t * PIN; + + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + PIN = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfDoorLockClusterLockDoorCallback(nullptr, PIN); + break; + } case ZCL_SET_HOLIDAY_SCHEDULE_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; uint8_t scheduleId; @@ -1323,6 +1456,19 @@ EmberAfStatus emberAfDoorLockClusterServerCommandParse(EmberAfClusterCommand * c emberAfDoorLockClusterSetYeardayScheduleCallback(nullptr, scheduleId, userId, localStartTime, localEndTime); break; } + case ZCL_UNLOCK_DOOR_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t * PIN; + + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + PIN = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfDoorLockClusterUnlockDoorCallback(nullptr, PIN); + break; + } case ZCL_UNLOCK_WITH_TIMEOUT_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; uint16_t timeoutInSeconds; @@ -1433,7 +1579,7 @@ EmberAfStatus emberAfGeneralCommissioningClusterServerCommandParse(EmberAfCluste } return status(wasHandled, true, cmd->mfgSpecific); } -EmberAfStatus emberAfIasZoneClusterServerCommandParse(EmberAfClusterCommand * cmd) +EmberAfStatus emberAfGroupsClusterServerCommandParse(EmberAfClusterCommand * cmd) { bool wasHandled = false; @@ -1441,24 +1587,90 @@ EmberAfStatus emberAfIasZoneClusterServerCommandParse(EmberAfClusterCommand * cm { switch (cmd->commandId) { - case ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID: { + case ZCL_ADD_GROUP_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; - uint8_t enrollResponseCode; - uint8_t zoneId; + uint16_t groupId; + uint8_t * groupName; - if (cmd->bufLen < payloadOffset + 1) + if (cmd->bufLen < payloadOffset + 2) { return EMBER_ZCL_STATUS_MALFORMED_COMMAND; } - enrollResponseCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); - payloadOffset = static_cast(payloadOffset + 1); + groupId = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 2); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + groupName = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfGroupsClusterAddGroupCallback(nullptr, groupId, groupName); + break; + } + case ZCL_ADD_GROUP_IF_IDENTIFYING_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint16_t groupId; + uint8_t * groupName; + + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + groupId = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 2); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + groupName = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfGroupsClusterAddGroupIfIdentifyingCallback(nullptr, groupId, groupName); + break; + } + case ZCL_GET_GROUP_MEMBERSHIP_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t groupCount; + /* TYPE WARNING: array array defaults to */ uint8_t * groupList; + if (cmd->bufLen < payloadOffset + 1) { return EMBER_ZCL_STATUS_MALFORMED_COMMAND; } - zoneId = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + groupCount = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + groupList = cmd->buffer + payloadOffset; - wasHandled = emberAfIasZoneClusterZoneEnrollResponseCallback(nullptr, enrollResponseCode, zoneId); + wasHandled = emberAfGroupsClusterGetGroupMembershipCallback(nullptr, groupCount, groupList); + break; + } + case ZCL_REMOVE_ALL_GROUPS_COMMAND_ID: { + wasHandled = emberAfGroupsClusterRemoveAllGroupsCallback(nullptr); + break; + } + case ZCL_REMOVE_GROUP_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint16_t groupId; + + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + groupId = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfGroupsClusterRemoveGroupCallback(nullptr, groupId); + break; + } + case ZCL_VIEW_GROUP_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint16_t groupId; + + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + groupId = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfGroupsClusterViewGroupCallback(nullptr, groupId); break; } default: { @@ -1469,7 +1681,7 @@ EmberAfStatus emberAfIasZoneClusterServerCommandParse(EmberAfClusterCommand * cm } return status(wasHandled, true, cmd->mfgSpecific); } -EmberAfStatus emberAfKeypadInputClusterServerCommandParse(EmberAfClusterCommand * cmd) +EmberAfStatus emberAfIasZoneClusterServerCommandParse(EmberAfClusterCommand * cmd) { bool wasHandled = false; @@ -1477,17 +1689,24 @@ EmberAfStatus emberAfKeypadInputClusterServerCommandParse(EmberAfClusterCommand { switch (cmd->commandId) { - case ZCL_SEND_KEY_COMMAND_ID: { + case ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; - uint8_t keyCode; + uint8_t enrollResponseCode; + uint8_t zoneId; if (cmd->bufLen < payloadOffset + 1) { return EMBER_ZCL_STATUS_MALFORMED_COMMAND; } - keyCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + enrollResponseCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + zoneId = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); - wasHandled = emberAfKeypadInputClusterSendKeyCallback(nullptr, keyCode); + wasHandled = emberAfIasZoneClusterZoneEnrollResponseCallback(nullptr, enrollResponseCode, zoneId); break; } default: { @@ -1498,7 +1717,7 @@ EmberAfStatus emberAfKeypadInputClusterServerCommandParse(EmberAfClusterCommand } return status(wasHandled, true, cmd->mfgSpecific); } -EmberAfStatus emberAfLowPowerClusterServerCommandParse(EmberAfClusterCommand * cmd) +EmberAfStatus emberAfIdentifyClusterServerCommandParse(EmberAfClusterCommand * cmd) { bool wasHandled = false; @@ -1506,8 +1725,21 @@ EmberAfStatus emberAfLowPowerClusterServerCommandParse(EmberAfClusterCommand * c { switch (cmd->commandId) { - case ZCL_SLEEP_COMMAND_ID: { - wasHandled = emberAfLowPowerClusterSleepCallback(nullptr); + case ZCL_IDENTIFY_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint16_t identifyTime; + + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + identifyTime = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfIdentifyClusterIdentifyCallback(nullptr, identifyTime); + break; + } + case ZCL_IDENTIFY_QUERY_COMMAND_ID: { + wasHandled = emberAfIdentifyClusterIdentifyQueryCallback(nullptr); break; } default: { @@ -1518,7 +1750,7 @@ EmberAfStatus emberAfLowPowerClusterServerCommandParse(EmberAfClusterCommand * c } return status(wasHandled, true, cmd->mfgSpecific); } -EmberAfStatus emberAfMediaInputClusterServerCommandParse(EmberAfClusterCommand * cmd) +EmberAfStatus emberAfLevelControlClusterServerCommandParse(EmberAfClusterCommand * cmd) { bool wasHandled = false; @@ -1526,45 +1758,205 @@ EmberAfStatus emberAfMediaInputClusterServerCommandParse(EmberAfClusterCommand * { switch (cmd->commandId) { - case ZCL_HIDE_INPUT_STATUS_COMMAND_ID: { - wasHandled = emberAfMediaInputClusterHideInputStatusCallback(nullptr); + case ZCL_MOVE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t moveMode; + uint8_t rate; + uint8_t optionMask; + uint8_t optionOverride; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + moveMode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + rate = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + optionMask = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + optionOverride = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfLevelControlClusterMoveCallback(nullptr, moveMode, rate, optionMask, optionOverride); break; } - case ZCL_RENAME_INPUT_COMMAND_ID: { + case ZCL_MOVE_TO_LEVEL_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; - uint8_t index; - uint8_t * name; + uint8_t level; + uint16_t transitionTime; + uint8_t optionMask; + uint8_t optionOverride; if (cmd->bufLen < payloadOffset + 1) { return EMBER_ZCL_STATUS_MALFORMED_COMMAND; } - index = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + level = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); payloadOffset = static_cast(payloadOffset + 1); - if (cmd->bufLen < payloadOffset + 1u) + if (cmd->bufLen < payloadOffset + 2) { return EMBER_ZCL_STATUS_MALFORMED_COMMAND; } - name = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + transitionTime = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 2); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + optionMask = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + optionOverride = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); - wasHandled = emberAfMediaInputClusterRenameInputCallback(nullptr, index, name); + wasHandled = emberAfLevelControlClusterMoveToLevelCallback(nullptr, level, transitionTime, optionMask, optionOverride); break; } - case ZCL_SELECT_INPUT_COMMAND_ID: { + case ZCL_MOVE_TO_LEVEL_WITH_ON_OFF_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; - uint8_t index; + uint8_t level; + uint16_t transitionTime; if (cmd->bufLen < payloadOffset + 1) { return EMBER_ZCL_STATUS_MALFORMED_COMMAND; } - index = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + level = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + transitionTime = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfLevelControlClusterMoveToLevelWithOnOffCallback(nullptr, level, transitionTime); + break; + } + case ZCL_MOVE_WITH_ON_OFF_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t moveMode; + uint8_t rate; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + moveMode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + rate = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfLevelControlClusterMoveWithOnOffCallback(nullptr, moveMode, rate); + break; + } + case ZCL_STEP_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t stepMode; + uint8_t stepSize; + uint16_t transitionTime; + uint8_t optionMask; + uint8_t optionOverride; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + stepMode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + stepSize = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + transitionTime = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 2); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + optionMask = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + optionOverride = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = + emberAfLevelControlClusterStepCallback(nullptr, stepMode, stepSize, transitionTime, optionMask, optionOverride); + break; + } + case ZCL_STEP_WITH_ON_OFF_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t stepMode; + uint8_t stepSize; + uint16_t transitionTime; - wasHandled = emberAfMediaInputClusterSelectInputCallback(nullptr, index); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + stepMode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + stepSize = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + transitionTime = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfLevelControlClusterStepWithOnOffCallback(nullptr, stepMode, stepSize, transitionTime); break; } - case ZCL_SHOW_INPUT_STATUS_COMMAND_ID: { - wasHandled = emberAfMediaInputClusterShowInputStatusCallback(nullptr); + case ZCL_STOP_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t optionMask; + uint8_t optionOverride; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + optionMask = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + optionOverride = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfLevelControlClusterStopCallback(nullptr, optionMask, optionOverride); + break; + } + case ZCL_STOP_WITH_ON_OFF_COMMAND_ID: { + wasHandled = emberAfLevelControlClusterStopWithOnOffCallback(nullptr); break; } default: { @@ -1839,7 +2231,7 @@ EmberAfStatus emberAfOnOffClusterServerCommandParse(EmberAfClusterCommand * cmd) } return status(wasHandled, true, cmd->mfgSpecific); } -EmberAfStatus emberAfTvChannelClusterServerCommandParse(EmberAfClusterCommand * cmd) +EmberAfStatus emberAfScenesClusterServerCommandParse(EmberAfClusterCommand * cmd) { bool wasHandled = false; @@ -1847,86 +2239,155 @@ EmberAfStatus emberAfTvChannelClusterServerCommandParse(EmberAfClusterCommand * { switch (cmd->commandId) { - case ZCL_CHANGE_CHANNEL_COMMAND_ID: { + case ZCL_ADD_SCENE_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; - uint8_t * match; + uint16_t groupId; + uint8_t sceneId; + uint16_t transitionTime; + uint8_t * sceneName; + /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets; + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + groupId = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 2); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + sceneId = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + transitionTime = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 2); if (cmd->bufLen < payloadOffset + 1u) { return EMBER_ZCL_STATUS_MALFORMED_COMMAND; } - match = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + sceneName = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + emberAfStringLength(sceneName) + 1u); + extensionFieldSets = cmd->buffer + payloadOffset; - wasHandled = emberAfTvChannelClusterChangeChannelCallback(nullptr, match); + wasHandled = + emberAfScenesClusterAddSceneCallback(nullptr, groupId, sceneId, transitionTime, sceneName, extensionFieldSets); break; } - case ZCL_CHANGE_CHANNEL_BY_NUMBER_COMMAND_ID: { + case ZCL_GET_SCENE_MEMBERSHIP_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; - uint16_t majorNumber; - uint16_t minorNumber; + uint16_t groupId; if (cmd->bufLen < payloadOffset + 2) { return EMBER_ZCL_STATUS_MALFORMED_COMMAND; } - majorNumber = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + groupId = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfScenesClusterGetSceneMembershipCallback(nullptr, groupId); + break; + } + case ZCL_RECALL_SCENE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint16_t groupId; + uint8_t sceneId; + uint16_t transitionTime; + + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + groupId = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); payloadOffset = static_cast(payloadOffset + 2); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + sceneId = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); if (cmd->bufLen < payloadOffset + 2) { return EMBER_ZCL_STATUS_MALFORMED_COMMAND; } - minorNumber = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + transitionTime = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); - wasHandled = emberAfTvChannelClusterChangeChannelByNumberCallback(nullptr, majorNumber, minorNumber); + wasHandled = emberAfScenesClusterRecallSceneCallback(nullptr, groupId, sceneId, transitionTime); break; } - case ZCL_SKIP_CHANNEL_COMMAND_ID: { + case ZCL_REMOVE_ALL_SCENES_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; - uint16_t Count; + uint16_t groupId; if (cmd->bufLen < payloadOffset + 2) { return EMBER_ZCL_STATUS_MALFORMED_COMMAND; } - Count = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + groupId = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); - wasHandled = emberAfTvChannelClusterSkipChannelCallback(nullptr, Count); + wasHandled = emberAfScenesClusterRemoveAllScenesCallback(nullptr, groupId); break; } - default: { - // Unrecognized command ID, error status will apply. + case ZCL_REMOVE_SCENE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint16_t groupId; + uint8_t sceneId; + + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + groupId = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 2); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + sceneId = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfScenesClusterRemoveSceneCallback(nullptr, groupId, sceneId); break; } - } - } - return status(wasHandled, true, cmd->mfgSpecific); -} -EmberAfStatus emberAfTargetNavigatorClusterServerCommandParse(EmberAfClusterCommand * cmd) -{ - bool wasHandled = false; - - if (!cmd->mfgSpecific) - { - switch (cmd->commandId) - { - case ZCL_NAVIGATE_TARGET_COMMAND_ID: { + case ZCL_STORE_SCENE_COMMAND_ID: { uint16_t payloadOffset = cmd->payloadStartIndex; - uint8_t target; - uint8_t * data; + uint16_t groupId; + uint8_t sceneId; + if (cmd->bufLen < payloadOffset + 2) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + groupId = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 2); if (cmd->bufLen < payloadOffset + 1) { return EMBER_ZCL_STATUS_MALFORMED_COMMAND; } - target = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); - payloadOffset = static_cast(payloadOffset + 1); - if (cmd->bufLen < payloadOffset + 1u) + sceneId = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfScenesClusterStoreSceneCallback(nullptr, groupId, sceneId); + break; + } + case ZCL_VIEW_SCENE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint16_t groupId; + uint8_t sceneId; + + if (cmd->bufLen < payloadOffset + 2) { return EMBER_ZCL_STATUS_MALFORMED_COMMAND; } - data = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + groupId = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 2); + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + sceneId = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); - wasHandled = emberAfTargetNavigatorClusterNavigateTargetCallback(nullptr, target, data); + wasHandled = emberAfScenesClusterViewSceneCallback(nullptr, groupId, sceneId); break; } default: { diff --git a/examples/tv-app/tv-common/gen/callback-stub.cpp b/examples/tv-app/tv-common/gen/callback-stub.cpp index 5d89bd17988000..543f669de62562 100644 --- a/examples/tv-app/tv-common/gen/callback-stub.cpp +++ b/examples/tv-app/tv-common/gen/callback-stub.cpp @@ -527,8 +527,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/examples/tv-app/tv-common/gen/callback.h b/examples/tv-app/tv-common/gen/callback.h index cce8e153396db9..c0ca7c6d29446b 100644 --- a/examples/tv-app/tv-common/gen/callback.h +++ b/examples/tv-app/tv-common/gen/callback.h @@ -294,7 +294,7 @@ void emberAfAccountLoginClusterServerManufacturerSpecificAttributeChangedCallbac * @param message The message that was sent * @param status The status of the sent message */ -void emberAfAccountLoginClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfAccountLoginClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -364,9 +364,9 @@ void emberAfApplicationBasicClusterServerManufacturerSpecificAttributeChangedCal * @param message The message that was sent * @param status The status of the sent message */ -void emberAfApplicationBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfApplicationBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Application Basic Cluster Server Pre Attribute Changed * @@ -435,9 +435,9 @@ void emberAfApplicationLauncherClusterServerManufacturerSpecificAttributeChanged * @param message The message that was sent * @param status The status of the sent message */ -void emberAfApplicationLauncherClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfApplicationLauncherClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Application Launcher Cluster Server Pre Attribute Changed * @@ -506,7 +506,7 @@ void emberAfAudioOutputClusterServerManufacturerSpecificAttributeChangedCallback * @param message The message that was sent * @param status The status of the sent message */ -void emberAfAudioOutputClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfAudioOutputClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -576,7 +576,7 @@ void emberAfBarrierControlClusterServerManufacturerSpecificAttributeChangedCallb * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBarrierControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBarrierControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -647,7 +647,7 @@ void emberAfBindingClusterServerManufacturerSpecificAttributeChangedCallback(chi * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBindingClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBindingClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -717,7 +717,7 @@ void emberAfColorControlClusterServerManufacturerSpecificAttributeChangedCallbac * @param message The message that was sent * @param status The status of the sent message */ -void emberAfColorControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfColorControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -787,7 +787,7 @@ void emberAfContentLaunchClusterServerManufacturerSpecificAttributeChangedCallba * @param message The message that was sent * @param status The status of the sent message */ -void emberAfContentLaunchClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfContentLaunchClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -857,7 +857,7 @@ void emberAfDoorLockClusterServerManufacturerSpecificAttributeChangedCallback(ch * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDoorLockClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDoorLockClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -927,9 +927,9 @@ void emberAfGeneralCommissioningClusterServerManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Server Pre Attribute Changed * @@ -998,9 +998,9 @@ void emberAfGroupKeyManagementClusterServerManufacturerSpecificAttributeChangedC * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupKeyManagementClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGroupKeyManagementClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Group Key Management Cluster Server Pre Attribute Changed * @@ -1069,7 +1069,7 @@ void emberAfGroupsClusterServerManufacturerSpecificAttributeChangedCallback(chip * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupsClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfGroupsClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1139,7 +1139,7 @@ void emberAfIasZoneClusterServerManufacturerSpecificAttributeChangedCallback(chi * @param message The message that was sent * @param status The status of the sent message */ -void emberAfIasZoneClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfIasZoneClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1209,7 +1209,7 @@ void emberAfIdentifyClusterServerManufacturerSpecificAttributeChangedCallback(ch * @param message The message that was sent * @param status The status of the sent message */ -void emberAfIdentifyClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfIdentifyClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1279,7 +1279,7 @@ void emberAfKeypadInputClusterServerManufacturerSpecificAttributeChangedCallback * @param message The message that was sent * @param status The status of the sent message */ -void emberAfKeypadInputClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfKeypadInputClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1349,7 +1349,7 @@ void emberAfLevelControlClusterServerManufacturerSpecificAttributeChangedCallbac * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1419,7 +1419,7 @@ void emberAfLowPowerClusterServerManufacturerSpecificAttributeChangedCallback(ch * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLowPowerClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLowPowerClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1489,7 +1489,7 @@ void emberAfMediaInputClusterServerManufacturerSpecificAttributeChangedCallback( * @param message The message that was sent * @param status The status of the sent message */ -void emberAfMediaInputClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfMediaInputClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1559,7 +1559,7 @@ void emberAfMediaPlaybackClusterServerManufacturerSpecificAttributeChangedCallba * @param message The message that was sent * @param status The status of the sent message */ -void emberAfMediaPlaybackClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfMediaPlaybackClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1629,9 +1629,9 @@ void emberAfNetworkCommissioningClusterServerManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Server Pre Attribute Changed * @@ -1699,7 +1699,7 @@ void emberAfOnOffClusterServerManufacturerSpecificAttributeChangedCallback(chip: * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief On/off Cluster Server Pre Attribute Changed @@ -1768,7 +1768,7 @@ void emberAfScenesClusterServerManufacturerSpecificAttributeChangedCallback(chip * @param message The message that was sent * @param status The status of the sent message */ -void emberAfScenesClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfScenesClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1838,7 +1838,7 @@ void emberAfTvChannelClusterServerManufacturerSpecificAttributeChangedCallback(c * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTvChannelClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTvChannelClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1908,7 +1908,7 @@ void emberAfTargetNavigatorClusterServerManufacturerSpecificAttributeChangedCall * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTargetNavigatorClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTargetNavigatorClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1979,7 +1979,8 @@ void emberAfTemperatureMeasurementClusterServerManufacturerSpecificAttributeChan * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTemperatureMeasurementClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTemperatureMeasurementClusterServerMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2050,7 +2051,7 @@ void emberAfWakeOnLanClusterServerManufacturerSpecificAttributeChangedCallback(c * @param message The message that was sent * @param status The status of the sent message */ -void emberAfWakeOnLanClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfWakeOnLanClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2093,15 +2094,6 @@ bool emberAfAccountLoginClusterGetSetupPINCallback(chip::app::Command * commandO bool emberAfAccountLoginClusterLoginCallback(chip::app::Command * commandObj, uint8_t * tempAccountIdentifier, uint8_t * setupPIN); -/** - * @brief Application Launcher Cluster LaunchApp Command callback - * @param data - * @param application - */ - -bool emberAfApplicationLauncherClusterLaunchAppCallback(chip::app::Command * commandObj, uint8_t * data, - /* TYPE WARNING: array array defaults to */ uint8_t * application); - /** * @brief Audio Output Cluster RenameOutput Command callback * @param index @@ -2117,6 +2109,19 @@ bool emberAfAudioOutputClusterRenameOutputCallback(chip::app::Command * commandO bool emberAfAudioOutputClusterSelectOutputCallback(chip::app::Command * commandObj, uint8_t index); +/** + * @brief Barrier Control Cluster BarrierControlGoToPercent Command callback + * @param percentOpen + */ + +bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback(chip::app::Command * commandObj, uint8_t percentOpen); + +/** + * @brief Barrier Control Cluster BarrierControlStop Command callback + */ + +bool emberAfBarrierControlClusterBarrierControlStopCallback(chip::app::Command * commandObj); + /** * @brief Binding Cluster Bind Command callback * @param nodeId @@ -2139,6 +2144,17 @@ bool emberAfBindingClusterBindCallback(chip::app::Command * commandObj, chip::No bool emberAfBindingClusterUnbindCallback(chip::app::Command * commandObj, chip::NodeId nodeId, chip::GroupId groupId, chip::EndpointId endpointId, chip::ClusterId clusterId); +/** + * @brief Color Control Cluster MoveColor Command callback + * @param rateX + * @param rateY + * @param optionsMask + * @param optionsOverride + */ + +bool emberAfColorControlClusterMoveColorCallback(chip::app::Command * commandObj, int16_t rateX, int16_t rateY, uint8_t optionsMask, + uint8_t optionsOverride); + /** * @brief Color Control Cluster MoveColorTemperature Command callback * @param moveMode @@ -2175,6 +2191,18 @@ bool emberAfColorControlClusterMoveHueCallback(chip::app::Command * commandObj, bool emberAfColorControlClusterMoveSaturationCallback(chip::app::Command * commandObj, uint8_t moveMode, uint8_t rate, uint8_t optionsMask, uint8_t optionsOverride); +/** + * @brief Color Control Cluster MoveToColor Command callback + * @param colorX + * @param colorY + * @param transitionTime + * @param optionsMask + * @param optionsOverride + */ + +bool emberAfColorControlClusterMoveToColorCallback(chip::app::Command * commandObj, uint16_t colorX, uint16_t colorY, + uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); + /** * @brief Color Control Cluster MoveToColorTemperature Command callback * @param colorTemperature @@ -2223,6 +2251,18 @@ bool emberAfColorControlClusterMoveToHueAndSaturationCallback(chip::app::Command bool emberAfColorControlClusterMoveToSaturationCallback(chip::app::Command * commandObj, uint8_t saturation, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); +/** + * @brief Color Control Cluster StepColor Command callback + * @param stepX + * @param stepY + * @param transitionTime + * @param optionsMask + * @param optionsOverride + */ + +bool emberAfColorControlClusterStepColorCallback(chip::app::Command * commandObj, int16_t stepX, int16_t stepY, + uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride); + /** * @brief Color Control Cluster StepColorTemperature Command callback * @param stepMode @@ -2387,6 +2427,13 @@ bool emberAfDoorLockClusterGetWeekdayScheduleCallback(chip::app::Command * comma bool emberAfDoorLockClusterGetYeardayScheduleCallback(chip::app::Command * commandObj, uint8_t scheduleId, uint16_t userId); +/** + * @brief Door Lock Cluster LockDoor Command callback + * @param pin + */ + +bool emberAfDoorLockClusterLockDoorCallback(chip::app::Command * commandObj, uint8_t * PIN); + /** * @brief Door Lock Cluster SetHolidaySchedule Command callback * @param scheduleId @@ -2454,6 +2501,13 @@ bool emberAfDoorLockClusterSetWeekdayScheduleCallback(chip::app::Command * comma bool emberAfDoorLockClusterSetYeardayScheduleCallback(chip::app::Command * commandObj, uint8_t scheduleId, uint16_t userId, uint32_t localStartTime, uint32_t localEndTime); +/** + * @brief Door Lock Cluster UnlockDoor Command callback + * @param pin + */ + +bool emberAfDoorLockClusterUnlockDoorCallback(chip::app::Command * commandObj, uint8_t * PIN); + /** * @brief Door Lock Cluster UnlockWithTimeout Command callback * @param timeoutInSeconds @@ -2489,6 +2543,51 @@ bool emberAfGeneralCommissioningClusterCommissioningCompleteCallback(chip::app:: bool emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(chip::app::Command * commandObj, uint8_t location, uint8_t * countryCode, uint64_t breadcrumb, uint32_t timeoutMs); +/** + * @brief Groups Cluster AddGroup Command callback + * @param groupId + * @param groupName + */ + +bool emberAfGroupsClusterAddGroupCallback(chip::app::Command * commandObj, uint16_t groupId, uint8_t * groupName); + +/** + * @brief Groups Cluster AddGroupIfIdentifying Command callback + * @param groupId + * @param groupName + */ + +bool emberAfGroupsClusterAddGroupIfIdentifyingCallback(chip::app::Command * commandObj, uint16_t groupId, uint8_t * groupName); + +/** + * @brief Groups Cluster GetGroupMembership Command callback + * @param groupCount + * @param groupList + */ + +bool emberAfGroupsClusterGetGroupMembershipCallback(chip::app::Command * commandObj, uint8_t groupCount, + /* TYPE WARNING: array array defaults to */ uint8_t * groupList); + +/** + * @brief Groups Cluster RemoveAllGroups Command callback + */ + +bool emberAfGroupsClusterRemoveAllGroupsCallback(chip::app::Command * commandObj); + +/** + * @brief Groups Cluster RemoveGroup Command callback + * @param groupId + */ + +bool emberAfGroupsClusterRemoveGroupCallback(chip::app::Command * commandObj, uint16_t groupId); + +/** + * @brief Groups Cluster ViewGroup Command callback + * @param groupId + */ + +bool emberAfGroupsClusterViewGroupCallback(chip::app::Command * commandObj, uint16_t groupId); + /** * @brief IAS Zone Cluster ZoneEnrollResponse Command callback * @param enrollResponseCode @@ -2498,44 +2597,92 @@ bool emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(chip::app::Co bool emberAfIasZoneClusterZoneEnrollResponseCallback(chip::app::Command * commandObj, uint8_t enrollResponseCode, uint8_t zoneId); /** - * @brief Keypad Input Cluster SendKey Command callback - * @param keyCode + * @brief Identify Cluster Identify Command callback + * @param identifyTime */ -bool emberAfKeypadInputClusterSendKeyCallback(chip::app::Command * commandObj, uint8_t keyCode); +bool emberAfIdentifyClusterIdentifyCallback(chip::app::Command * commandObj, uint16_t identifyTime); /** - * @brief Low Power Cluster Sleep Command callback + * @brief Identify Cluster IdentifyQuery Command callback */ -bool emberAfLowPowerClusterSleepCallback(chip::app::Command * commandObj); +bool emberAfIdentifyClusterIdentifyQueryCallback(chip::app::Command * commandObj); /** - * @brief Media Input Cluster HideInputStatus Command callback + * @brief Level Control Cluster Move Command callback + * @param moveMode + * @param rate + * @param optionMask + * @param optionOverride */ -bool emberAfMediaInputClusterHideInputStatusCallback(chip::app::Command * commandObj); +bool emberAfLevelControlClusterMoveCallback(chip::app::Command * commandObj, uint8_t moveMode, uint8_t rate, uint8_t optionMask, + uint8_t optionOverride); /** - * @brief Media Input Cluster RenameInput Command callback - * @param index - * @param name + * @brief Level Control Cluster MoveToLevel Command callback + * @param level + * @param transitionTime + * @param optionMask + * @param optionOverride */ -bool emberAfMediaInputClusterRenameInputCallback(chip::app::Command * commandObj, uint8_t index, uint8_t * name); +bool emberAfLevelControlClusterMoveToLevelCallback(chip::app::Command * commandObj, uint8_t level, uint16_t transitionTime, + uint8_t optionMask, uint8_t optionOverride); /** - * @brief Media Input Cluster SelectInput Command callback - * @param index + * @brief Level Control Cluster MoveToLevelWithOnOff Command callback + * @param level + * @param transitionTime + */ + +bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(chip::app::Command * commandObj, uint8_t level, + uint16_t transitionTime); + +/** + * @brief Level Control Cluster MoveWithOnOff Command callback + * @param moveMode + * @param rate + */ + +bool emberAfLevelControlClusterMoveWithOnOffCallback(chip::app::Command * commandObj, uint8_t moveMode, uint8_t rate); + +/** + * @brief Level Control Cluster Step Command callback + * @param stepMode + * @param stepSize + * @param transitionTime + * @param optionMask + * @param optionOverride + */ + +bool emberAfLevelControlClusterStepCallback(chip::app::Command * commandObj, uint8_t stepMode, uint8_t stepSize, + uint16_t transitionTime, uint8_t optionMask, uint8_t optionOverride); + +/** + * @brief Level Control Cluster StepWithOnOff Command callback + * @param stepMode + * @param stepSize + * @param transitionTime + */ + +bool emberAfLevelControlClusterStepWithOnOffCallback(chip::app::Command * commandObj, uint8_t stepMode, uint8_t stepSize, + uint16_t transitionTime); + +/** + * @brief Level Control Cluster Stop Command callback + * @param optionMask + * @param optionOverride */ -bool emberAfMediaInputClusterSelectInputCallback(chip::app::Command * commandObj, uint8_t index); +bool emberAfLevelControlClusterStopCallback(chip::app::Command * commandObj, uint8_t optionMask, uint8_t optionOverride); /** - * @brief Media Input Cluster ShowInputStatus Command callback + * @brief Level Control Cluster StopWithOnOff Command callback */ -bool emberAfMediaInputClusterShowInputStatusCallback(chip::app::Command * commandObj); +bool emberAfLevelControlClusterStopWithOnOffCallback(chip::app::Command * commandObj); /** * @brief Media Playback Cluster MediaFastForward Command callback @@ -2673,35 +2820,65 @@ bool emberAfOnOffClusterOnCallback(chip::app::Command * commandObj); bool emberAfOnOffClusterToggleCallback(chip::app::Command * commandObj); /** - * @brief TV Channel Cluster ChangeChannel Command callback - * @param match + * @brief Scenes Cluster AddScene Command callback + * @param groupId + * @param sceneId + * @param transitionTime + * @param sceneName + * @param extensionFieldSets */ -bool emberAfTvChannelClusterChangeChannelCallback(chip::app::Command * commandObj, uint8_t * match); +bool emberAfScenesClusterAddSceneCallback(chip::app::Command * commandObj, uint16_t groupId, uint8_t sceneId, + uint16_t transitionTime, uint8_t * sceneName, + /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets); /** - * @brief TV Channel Cluster ChangeChannelByNumber Command callback - * @param majorNumber - * @param minorNumber + * @brief Scenes Cluster GetSceneMembership Command callback + * @param groupId */ -bool emberAfTvChannelClusterChangeChannelByNumberCallback(chip::app::Command * commandObj, uint16_t majorNumber, - uint16_t minorNumber); +bool emberAfScenesClusterGetSceneMembershipCallback(chip::app::Command * commandObj, uint16_t groupId); /** - * @brief TV Channel Cluster SkipChannel Command callback - * @param count + * @brief Scenes Cluster RecallScene Command callback + * @param groupId + * @param sceneId + * @param transitionTime */ -bool emberAfTvChannelClusterSkipChannelCallback(chip::app::Command * commandObj, uint16_t Count); +bool emberAfScenesClusterRecallSceneCallback(chip::app::Command * commandObj, uint16_t groupId, uint8_t sceneId, + uint16_t transitionTime); /** - * @brief Target Navigator Cluster NavigateTarget Command callback - * @param target - * @param data + * @brief Scenes Cluster RemoveAllScenes Command callback + * @param groupId + */ + +bool emberAfScenesClusterRemoveAllScenesCallback(chip::app::Command * commandObj, uint16_t groupId); + +/** + * @brief Scenes Cluster RemoveScene Command callback + * @param groupId + * @param sceneId + */ + +bool emberAfScenesClusterRemoveSceneCallback(chip::app::Command * commandObj, uint16_t groupId, uint8_t sceneId); + +/** + * @brief Scenes Cluster StoreScene Command callback + * @param groupId + * @param sceneId + */ + +bool emberAfScenesClusterStoreSceneCallback(chip::app::Command * commandObj, uint16_t groupId, uint8_t sceneId); + +/** + * @brief Scenes Cluster ViewScene Command callback + * @param groupId + * @param sceneId */ -bool emberAfTargetNavigatorClusterNavigateTargetCallback(chip::app::Command * commandObj, uint8_t target, uint8_t * data); +bool emberAfScenesClusterViewSceneCallback(chip::app::Command * commandObj, uint16_t groupId, uint8_t sceneId); // // Non-Cluster Related Callbacks @@ -2950,7 +3127,7 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/examples/window-app/common/gen/callback-stub.cpp b/examples/window-app/common/gen/callback-stub.cpp index ca0fc68187729b..cc666398372874 100644 --- a/examples/window-app/common/gen/callback-stub.cpp +++ b/examples/window-app/common/gen/callback-stub.cpp @@ -327,8 +327,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/examples/window-app/common/gen/callback.h b/examples/window-app/common/gen/callback.h index 0619b2326e979e..825f9126a7d246 100644 --- a/examples/window-app/common/gen/callback.h +++ b/examples/window-app/common/gen/callback.h @@ -94,7 +94,7 @@ void emberAfWindowCoveringClusterServerManufacturerSpecificAttributeChangedCallb * @param message The message that was sent * @param status The status of the sent message */ -void emberAfWindowCoveringClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfWindowCoveringClusterServerMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -418,7 +418,7 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/src/controller/python/gen/CHIPClientCallbacks.cpp b/src/controller/python/gen/CHIPClientCallbacks.cpp index 70a488cb90df99..667b0af91593ac 100644 --- a/src/controller/python/gen/CHIPClientCallbacks.cpp +++ b/src/controller/python/gen/CHIPClientCallbacks.cpp @@ -61,7 +61,7 @@ using namespace ::chip; #define GET_RESPONSE_CALLBACKS(name) \ Callback::Cancelable * onSuccessCallback = nullptr; \ Callback::Cancelable * onFailureCallback = nullptr; \ - NodeId sourceId = emberAfCurrentCommand()->source; \ + NodeId sourceId = emberAfCurrentCommand()->SourceNodeId(); \ uint8_t sequenceNumber = emberAfCurrentCommand()->seqNum; \ CHIP_ERROR err = gCallbacks.GetResponseCallback(sourceId, sequenceNumber, &onSuccessCallback, &onFailureCallback); \ \ @@ -2057,7 +2057,7 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin ChipLogProgress(Zcl, "emberAfReportAttributeCallback:"); ChipLogProgress(Zcl, " ClusterId: 0x%04x", clusterId); - NodeId sourceId = emberAfCurrentCommand()->source; + NodeId sourceId = emberAfCurrentCommand()->SourceNodeId(); ChipLogProgress(Zcl, " Source NodeId: %" PRIu64, sourceId); EndpointId endpointId = emberAfCurrentCommand()->apsFrame->sourceEndpoint; diff --git a/src/controller/python/gen/callback-stub.cpp b/src/controller/python/gen/callback-stub.cpp index 9ebbcf0a7d606f..d52bd33a654f2e 100644 --- a/src/controller/python/gen/callback-stub.cpp +++ b/src/controller/python/gen/callback-stub.cpp @@ -575,8 +575,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/src/controller/python/gen/callback.h b/src/controller/python/gen/callback.h index 17c89be4d98fc7..8f80f43c4610fa 100644 --- a/src/controller/python/gen/callback.h +++ b/src/controller/python/gen/callback.h @@ -342,7 +342,7 @@ void emberAfAccountLoginClusterClientManufacturerSpecificAttributeChangedCallbac * @param message The message that was sent * @param status The status of the sent message */ -void emberAfAccountLoginClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfAccountLoginClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -412,9 +412,9 @@ void emberAfApplicationBasicClusterClientManufacturerSpecificAttributeChangedCal * @param message The message that was sent * @param status The status of the sent message */ -void emberAfApplicationBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfApplicationBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Application Basic Cluster Client Pre Attribute Changed * @@ -483,9 +483,9 @@ void emberAfApplicationLauncherClusterClientManufacturerSpecificAttributeChanged * @param message The message that was sent * @param status The status of the sent message */ -void emberAfApplicationLauncherClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfApplicationLauncherClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Application Launcher Cluster Client Pre Attribute Changed * @@ -554,7 +554,7 @@ void emberAfAudioOutputClusterClientManufacturerSpecificAttributeChangedCallback * @param message The message that was sent * @param status The status of the sent message */ -void emberAfAudioOutputClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfAudioOutputClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -624,7 +624,7 @@ void emberAfBarrierControlClusterClientManufacturerSpecificAttributeChangedCallb * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBarrierControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBarrierControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -694,7 +694,7 @@ void emberAfBasicClusterClientManufacturerSpecificAttributeChangedCallback(chip: * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Basic Cluster Client Pre Attribute Changed @@ -763,7 +763,7 @@ void emberAfBindingClusterClientManufacturerSpecificAttributeChangedCallback(chi * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBindingClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBindingClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -833,7 +833,7 @@ void emberAfColorControlClusterClientManufacturerSpecificAttributeChangedCallbac * @param message The message that was sent * @param status The status of the sent message */ -void emberAfColorControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfColorControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -903,7 +903,7 @@ void emberAfContentLaunchClusterClientManufacturerSpecificAttributeChangedCallba * @param message The message that was sent * @param status The status of the sent message */ -void emberAfContentLaunchClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfContentLaunchClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -973,7 +973,7 @@ void emberAfDescriptorClusterClientManufacturerSpecificAttributeChangedCallback( * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDescriptorClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDescriptorClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1043,7 +1043,7 @@ void emberAfDoorLockClusterClientManufacturerSpecificAttributeChangedCallback(ch * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDoorLockClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDoorLockClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1113,9 +1113,9 @@ void emberAfGeneralCommissioningClusterClientManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Client Pre Attribute Changed * @@ -1184,9 +1184,9 @@ void emberAfGroupKeyManagementClusterClientManufacturerSpecificAttributeChangedC * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupKeyManagementClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGroupKeyManagementClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Group Key Management Cluster Client Pre Attribute Changed * @@ -1255,7 +1255,7 @@ void emberAfGroupsClusterClientManufacturerSpecificAttributeChangedCallback(chip * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupsClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfGroupsClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1325,7 +1325,7 @@ void emberAfIdentifyClusterClientManufacturerSpecificAttributeChangedCallback(ch * @param message The message that was sent * @param status The status of the sent message */ -void emberAfIdentifyClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfIdentifyClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1395,7 +1395,7 @@ void emberAfKeypadInputClusterClientManufacturerSpecificAttributeChangedCallback * @param message The message that was sent * @param status The status of the sent message */ -void emberAfKeypadInputClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfKeypadInputClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1465,7 +1465,7 @@ void emberAfLevelControlClusterClientManufacturerSpecificAttributeChangedCallbac * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLevelControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLevelControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1535,7 +1535,7 @@ void emberAfLowPowerClusterClientManufacturerSpecificAttributeChangedCallback(ch * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLowPowerClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLowPowerClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1605,7 +1605,7 @@ void emberAfMediaInputClusterClientManufacturerSpecificAttributeChangedCallback( * @param message The message that was sent * @param status The status of the sent message */ -void emberAfMediaInputClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfMediaInputClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1675,7 +1675,7 @@ void emberAfMediaPlaybackClusterClientManufacturerSpecificAttributeChangedCallba * @param message The message that was sent * @param status The status of the sent message */ -void emberAfMediaPlaybackClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfMediaPlaybackClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1745,9 +1745,9 @@ void emberAfNetworkCommissioningClusterClientManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Client Pre Attribute Changed * @@ -1815,7 +1815,7 @@ void emberAfOnOffClusterClientManufacturerSpecificAttributeChangedCallback(chip: * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOnOffClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOnOffClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief On/off Cluster Client Pre Attribute Changed @@ -1884,7 +1884,8 @@ void emberAfOperationalCredentialsClusterClientManufacturerSpecificAttributeChan * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOperationalCredentialsClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOperationalCredentialsClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1956,7 +1957,8 @@ void emberAfPumpConfigurationAndControlClusterClientManufacturerSpecificAttribut * @param message The message that was sent * @param status The status of the sent message */ -void emberAfPumpConfigurationAndControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfPumpConfigurationAndControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2027,7 +2029,7 @@ void emberAfScenesClusterClientManufacturerSpecificAttributeChangedCallback(chip * @param message The message that was sent * @param status The status of the sent message */ -void emberAfScenesClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfScenesClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2097,7 +2099,7 @@ void emberAfSwitchClusterClientManufacturerSpecificAttributeChangedCallback(chip * @param message The message that was sent * @param status The status of the sent message */ -void emberAfSwitchClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfSwitchClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2167,7 +2169,7 @@ void emberAfTvChannelClusterClientManufacturerSpecificAttributeChangedCallback(c * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTvChannelClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTvChannelClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2237,7 +2239,7 @@ void emberAfTargetNavigatorClusterClientManufacturerSpecificAttributeChangedCall * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTargetNavigatorClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTargetNavigatorClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2308,7 +2310,8 @@ void emberAfTemperatureMeasurementClusterClientManufacturerSpecificAttributeChan * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTemperatureMeasurementClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTemperatureMeasurementClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2379,7 +2382,7 @@ void emberAfThermostatClusterClientManufacturerSpecificAttributeChangedCallback( * @param message The message that was sent * @param status The status of the sent message */ -void emberAfThermostatClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfThermostatClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2449,7 +2452,7 @@ void emberAfWakeOnLanClusterClientManufacturerSpecificAttributeChangedCallback(c * @param message The message that was sent * @param status The status of the sent message */ -void emberAfWakeOnLanClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfWakeOnLanClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2519,7 +2522,7 @@ void emberAfWindowCoveringClusterClientManufacturerSpecificAttributeChangedCallb * @param message The message that was sent * @param status The status of the sent message */ -void emberAfWindowCoveringClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfWindowCoveringClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -3346,7 +3349,7 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change diff --git a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp index 3e531c9fa498fc..4cd5a842fa1bbe 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp +++ b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp @@ -61,7 +61,7 @@ using namespace ::chip; #define GET_RESPONSE_CALLBACKS(name) \ Callback::Cancelable * onSuccessCallback = nullptr; \ Callback::Cancelable * onFailureCallback = nullptr; \ - NodeId sourceId = emberAfCurrentCommand()->source; \ + NodeId sourceId = emberAfCurrentCommand()->SourceNodeId(); \ uint8_t sequenceNumber = emberAfCurrentCommand()->seqNum; \ CHIP_ERROR err = gCallbacks.GetResponseCallback(sourceId, sequenceNumber, &onSuccessCallback, &onFailureCallback); \ \ @@ -1790,7 +1790,7 @@ bool emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * message, uin ChipLogProgress(Zcl, "emberAfReportAttributeCallback:"); ChipLogProgress(Zcl, " ClusterId: 0x%04x", clusterId); - NodeId sourceId = emberAfCurrentCommand()->source; + NodeId sourceId = emberAfCurrentCommand()->SourceNodeId(); ChipLogProgress(Zcl, " Source NodeId: %" PRIu64, sourceId); EndpointId endpointId = emberAfCurrentCommand()->apsFrame->sourceEndpoint; diff --git a/src/darwin/Framework/CHIP/gen/callback-stub.cpp b/src/darwin/Framework/CHIP/gen/callback-stub.cpp index 692e2845326d6d..4e2a280253e842 100644 --- a/src/darwin/Framework/CHIP/gen/callback-stub.cpp +++ b/src/darwin/Framework/CHIP/gen/callback-stub.cpp @@ -487,8 +487,8 @@ bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * * @param status Ver.: always */ bool __attribute__((weak)) -emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, uint16_t msgLen, - uint8_t * message, EmberStatus status) +emberAfMessageSentCallback(EmberOutgoingMessageType type, MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status) { return false; } diff --git a/src/darwin/Framework/CHIP/gen/callback.h b/src/darwin/Framework/CHIP/gen/callback.h index 427396801eb7a0..33f23a8a8b98ed 100644 --- a/src/darwin/Framework/CHIP/gen/callback.h +++ b/src/darwin/Framework/CHIP/gen/callback.h @@ -254,9 +254,9 @@ void emberAfApplicationBasicClusterClientManufacturerSpecificAttributeChangedCal * @param message The message that was sent * @param status The status of the sent message */ -void emberAfApplicationBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfApplicationBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Application Basic Cluster Client Pre Attribute Changed * @@ -325,7 +325,7 @@ void emberAfBarrierControlClusterClientManufacturerSpecificAttributeChangedCallb * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBarrierControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBarrierControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -395,7 +395,7 @@ void emberAfBasicClusterClientManufacturerSpecificAttributeChangedCallback(chip: * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBasicClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Basic Cluster Client Pre Attribute Changed @@ -464,7 +464,7 @@ void emberAfBindingClusterClientManufacturerSpecificAttributeChangedCallback(chi * @param message The message that was sent * @param status The status of the sent message */ -void emberAfBindingClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfBindingClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -534,7 +534,7 @@ void emberAfColorControlClusterClientManufacturerSpecificAttributeChangedCallbac * @param message The message that was sent * @param status The status of the sent message */ -void emberAfColorControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfColorControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -604,7 +604,7 @@ void emberAfDescriptorClusterClientManufacturerSpecificAttributeChangedCallback( * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDescriptorClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDescriptorClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -674,7 +674,7 @@ void emberAfDoorLockClusterClientManufacturerSpecificAttributeChangedCallback(ch * @param message The message that was sent * @param status The status of the sent message */ -void emberAfDoorLockClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfDoorLockClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -744,9 +744,9 @@ void emberAfGeneralCommissioningClusterClientManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGeneralCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGeneralCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief General Commissioning Cluster Client Pre Attribute Changed * @@ -815,9 +815,9 @@ void emberAfGroupKeyManagementClusterClientManufacturerSpecificAttributeChangedC * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupKeyManagementClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfGroupKeyManagementClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Group Key Management Cluster Client Pre Attribute Changed * @@ -886,7 +886,7 @@ void emberAfGroupsClusterClientManufacturerSpecificAttributeChangedCallback(chip * @param message The message that was sent * @param status The status of the sent message */ -void emberAfGroupsClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfGroupsClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -956,7 +956,7 @@ void emberAfIdentifyClusterClientManufacturerSpecificAttributeChangedCallback(ch * @param message The message that was sent * @param status The status of the sent message */ -void emberAfIdentifyClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfIdentifyClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1026,7 +1026,7 @@ void emberAfLevelControlClusterClientManufacturerSpecificAttributeChangedCallbac * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLevelControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLevelControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1096,7 +1096,7 @@ void emberAfLowPowerClusterClientManufacturerSpecificAttributeChangedCallback(ch * @param message The message that was sent * @param status The status of the sent message */ -void emberAfLowPowerClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfLowPowerClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1166,9 +1166,9 @@ void emberAfNetworkCommissioningClusterClientManufacturerSpecificAttributeChange * @param message The message that was sent * @param status The status of the sent message */ -void emberAfNetworkCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, - EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, - EmberStatus status); +void emberAfNetworkCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, + uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Network Commissioning Cluster Client Pre Attribute Changed * @@ -1236,7 +1236,7 @@ void emberAfOnOffClusterClientManufacturerSpecificAttributeChangedCallback(chip: * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOnOffClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOnOffClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief On/off Cluster Client Pre Attribute Changed @@ -1305,7 +1305,8 @@ void emberAfOperationalCredentialsClusterClientManufacturerSpecificAttributeChan * @param message The message that was sent * @param status The status of the sent message */ -void emberAfOperationalCredentialsClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfOperationalCredentialsClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1377,7 +1378,8 @@ void emberAfPumpConfigurationAndControlClusterClientManufacturerSpecificAttribut * @param message The message that was sent * @param status The status of the sent message */ -void emberAfPumpConfigurationAndControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfPumpConfigurationAndControlClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1448,7 +1450,7 @@ void emberAfScenesClusterClientManufacturerSpecificAttributeChangedCallback(chip * @param message The message that was sent * @param status The status of the sent message */ -void emberAfScenesClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfScenesClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1518,7 +1520,7 @@ void emberAfSwitchClusterClientManufacturerSpecificAttributeChangedCallback(chip * @param message The message that was sent * @param status The status of the sent message */ -void emberAfSwitchClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfSwitchClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1588,7 +1590,8 @@ void emberAfTemperatureMeasurementClusterClientManufacturerSpecificAttributeChan * @param message The message that was sent * @param status The status of the sent message */ -void emberAfTemperatureMeasurementClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfTemperatureMeasurementClusterClientMessageSentCallback(EmberOutgoingMessageType type, + chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -1659,7 +1662,7 @@ void emberAfThermostatClusterClientManufacturerSpecificAttributeChangedCallback( * @param message The message that was sent * @param status The status of the sent message */ -void emberAfThermostatClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, +void emberAfThermostatClusterClientMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); @@ -2350,7 +2353,7 @@ bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberSt * @param message Ver.: always * @param status Ver.: always */ -bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame, +bool emberAfMessageSentCallback(EmberOutgoingMessageType type, chip::MessageSendDestination destination, EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status); /** @brief Pre Attribute Change