diff --git a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp index 676b4bae4cacf5..1f492788245d2a 100644 --- a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp +++ b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp @@ -106,9 +106,11 @@ static void sendResponse(const char * responseName, ContentLaunchResponse launch } bool emberAfContentLauncherClusterLaunchContentCallback( - chip::app::CommandHandler * command, const chip::app::ConcreteCommandPath & commandPath, chip::EndpointId endpoint, - bool autoplay, unsigned char * data, chip::app::Clusters::ContentLauncher::Commands::LaunchContent::DecodableType & commandData) + chip::app::CommandHandler * command, const chip::app::ConcreteCommandPath & commandPath, + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::DecodableType & commandData) { + auto & autoplay = commandData.autoplay; + auto & data = commandData.data; string dataString(reinterpret_cast(data)); list parameterList; @@ -118,10 +120,12 @@ bool emberAfContentLauncherClusterLaunchContentCallback( } bool emberAfContentLauncherClusterLaunchURLCallback( - chip::app::CommandHandler * command, const chip::app::ConcreteCommandPath & commandPath, chip::EndpointId endpoint, - unsigned char * contentUrl, unsigned char * displayString, + chip::app::CommandHandler * command, const chip::app::ConcreteCommandPath & commandPath, chip::app::Clusters::ContentLauncher::Commands::LaunchURL::DecodableType & commandData) { + auto & contentUrl = commandData.contentUrl; + auto & displayString = commandData.displayString; + string contentUrlString(reinterpret_cast(contentUrl)); string displayStringString(reinterpret_cast(displayString)); ContentLaunchBrandingInformation brandingInformation; diff --git a/examples/window-app/common/src/ZclCallbacks.cpp b/examples/window-app/common/src/ZclCallbacks.cpp index f5578d59bc37a9..8facbf6d0e5247 100644 --- a/examples/window-app/common/src/ZclCallbacks.cpp +++ b/examples/window-app/common/src/ZclCallbacks.cpp @@ -97,7 +97,7 @@ void emberAfPostAttributeChangeCallback(chip::EndpointId endpoint, chip::Cluster * @brief Cluster StopMotion Command callback (from client) */ bool emberAfWindowCoveringClusterStopMotionCallback(chip::app::CommandHandler * commandObj, - const chip::app::ConcreteCommandPath & commandPath, chip::EndpointId endpoint, + const chip::app::ConcreteCommandPath & commandPath, Commands::StopMotion::DecodableType & commandData) { ChipLogProgress(Zcl, "StopMotion command received"); diff --git a/src/app/clusters/account-login-server/account-login-server.cpp b/src/app/clusters/account-login-server/account-login-server.cpp index 0a4efad968e603..21d8259c7a731e 100644 --- a/src/app/clusters/account-login-server/account-login-server.cpp +++ b/src/app/clusters/account-login-server/account-login-server.cpp @@ -53,9 +53,10 @@ void sendResponse(app::CommandHandler * command, const char * responseSetupPin) } bool emberAfAccountLoginClusterGetSetupPINCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t * tempAccountIdentifier, Commands::GetSetupPIN::DecodableType & commandData) { + auto & tempAccountIdentifier = commandData.tempAccountIdentifier; + // TODO: char is not null terminated, verify this code once #7963 gets merged. std::string tempAccountIdentifierString(reinterpret_cast(tempAccountIdentifier)); std::string responseSetupPin = accountLoginClusterGetSetupPin(tempAccountIdentifierString, emberAfCurrentEndpoint()); @@ -64,9 +65,11 @@ bool emberAfAccountLoginClusterGetSetupPINCallback(app::CommandHandler * command } bool emberAfAccountLoginClusterLoginCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t * tempAccountIdentifier, uint8_t * tempSetupPin, Commands::Login::DecodableType & commandData) { + auto & tempAccountIdentifier = commandData.tempAccountIdentifier; + auto & tempSetupPin = commandData.tempSetupPin; + // TODO: char is not null terminated, verify this code once #7963 gets merged. std::string tempAccountIdentifierString(reinterpret_cast(tempAccountIdentifier)); std::string tempSetupPinString(reinterpret_cast(tempSetupPin)); diff --git a/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp b/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp index 5c63bcc78401c3..a39d67cc674ca1 100644 --- a/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp +++ b/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp @@ -36,10 +36,16 @@ using namespace chip::app::Clusters::AdministratorCommissioning; constexpr uint32_t kMaxCommissionioningTimeoutSeconds = 15 * 60; bool emberAfAdministratorCommissioningClusterOpenCommissioningWindowCallback( - app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint16_t commissioningTimeout, ByteSpan pakeVerifier, uint16_t discriminator, uint32_t iterations, ByteSpan salt, - uint16_t passcodeID, Commands::OpenCommissioningWindow::DecodableType & commandData) + app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, + Commands::OpenCommissioningWindow::DecodableType & commandData) { + auto & commissioningTimeout = commandData.commissioningTimeout; + auto & pakeVerifier = commandData.pakeVerifier; + auto & discriminator = commandData.discriminator; + auto & iterations = commandData.iterations; + auto & salt = commandData.salt; + auto & passcodeID = commandData.passcodeID; + EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; PASEVerifier verifier; const uint8_t * verifierData = pakeVerifier.data(); @@ -74,9 +80,11 @@ bool emberAfAdministratorCommissioningClusterOpenCommissioningWindowCallback( } bool emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallback( - app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint16_t commissioningTimeout, Commands::OpenBasicCommissioningWindow::DecodableType & commandData) + app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, + Commands::OpenBasicCommissioningWindow::DecodableType & commandData) { + auto & commissioningTimeout = commandData.commissioningTimeout; + EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; ChipLogProgress(Zcl, "Received command to open basic commissioning window"); VerifyOrExit(!Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen(), @@ -98,7 +106,6 @@ bool emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallbac bool emberAfAdministratorCommissioningClusterRevokeCommissioningCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::RevokeCommissioning::DecodableType & commandData) { ChipLogProgress(Zcl, "Received command to close commissioning window"); diff --git a/src/app/clusters/application-basic-server/application-basic-server.cpp b/src/app/clusters/application-basic-server/application-basic-server.cpp index 9ddb015f757586..428cbb8274cda2 100644 --- a/src/app/clusters/application-basic-server/application-basic-server.cpp +++ b/src/app/clusters/application-basic-server/application-basic-server.cpp @@ -35,10 +35,11 @@ using namespace chip::app::Clusters::ApplicationBasic; bool applicationBasicClusterChangeApplicationStatus(EmberAfApplicationBasicStatus status, EndpointId endpoint); bool emberAfApplicationBasicClusterChangeStatusCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t newApplicationStatus, + const app::ConcreteCommandPath & commandPath, Commands::ChangeStatus::DecodableType & commandData) { + auto & newApplicationStatus = commandData.newApplicationStatus; + bool success = applicationBasicClusterChangeApplicationStatus(static_cast(newApplicationStatus), emberAfCurrentEndpoint()); EmberAfStatus status = success ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE; diff --git a/src/app/clusters/application-launcher-server/application-launcher-server.cpp b/src/app/clusters/application-launcher-server/application-launcher-server.cpp index a9cd0ed157a1f6..63498f1c2a1e13 100644 --- a/src/app/clusters/application-launcher-server/application-launcher-server.cpp +++ b/src/app/clusters/application-launcher-server/application-launcher-server.cpp @@ -73,10 +73,12 @@ ::ApplicationLauncherApp getApplicationFromCommand(uint16_t catalogVendorId, uin } bool emberAfApplicationLauncherClusterLaunchAppCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t * requestData, - uint16_t requestApplicationCatalogVendorId, uint8_t * requestApplicationId, Commands::LaunchApp::DecodableType & commandData) { + auto & requestData = commandData.requestData; + auto & requestApplicationCatalogVendorId = commandData.requestApplicationCatalogVendorId; + auto & requestApplicationId = commandData.requestApplicationId; + ::ApplicationLauncherApp application = getApplicationFromCommand(requestApplicationCatalogVendorId, requestApplicationId); // TODO: Char is not null terminated, verify this code once #7963 gets merged. std::string reqestDataString(reinterpret_cast(requestData)); diff --git a/src/app/clusters/audio-output-server/audio-output-server.cpp b/src/app/clusters/audio-output-server/audio-output-server.cpp index 6286a0c80f6bb1..68078b12c8996f 100644 --- a/src/app/clusters/audio-output-server/audio-output-server.cpp +++ b/src/app/clusters/audio-output-server/audio-output-server.cpp @@ -34,9 +34,11 @@ bool audioOutputClusterSelectOutput(uint8_t index); bool audioOutputClusterRenameOutput(uint8_t index, uint8_t * name); bool emberAfAudioOutputClusterRenameOutputCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t index, uint8_t * name, Commands::RenameOutput::DecodableType & commandData) { + auto & index = commandData.index; + auto & name = commandData.name; + bool success = audioOutputClusterRenameOutput(index, name); EmberAfStatus status = success ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE; emberAfSendImmediateDefaultResponse(status); @@ -44,9 +46,10 @@ bool emberAfAudioOutputClusterRenameOutputCallback(app::CommandHandler * command } bool emberAfAudioOutputClusterSelectOutputCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t index, Commands::SelectOutput::DecodableType & commandData) { + auto & index = commandData.index; + bool success = audioOutputClusterSelectOutput(index); EmberAfStatus status = success ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE; emberAfSendImmediateDefaultResponse(status); diff --git a/src/app/clusters/barrier-control-server/barrier-control-server.cpp b/src/app/clusters/barrier-control-server/barrier-control-server.cpp index 1aac71ed8dd2e8..5e83168b7a8dea 100644 --- a/src/app/clusters/barrier-control-server/barrier-control-server.cpp +++ b/src/app/clusters/barrier-control-server/barrier-control-server.cpp @@ -301,9 +301,10 @@ static void sendDefaultResponse(EmberAfStatus status) bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId aEndpoint, uint8_t percentOpen, Commands::BarrierControlGoToPercent::DecodableType & commandData) { + auto & percentOpen = commandData.percentOpen; + EndpointId endpoint = emberAfCurrentCommand()->apsFrame->destinationEndpoint; EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; @@ -345,7 +346,7 @@ bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback(app::CommandH } bool emberAfBarrierControlClusterBarrierControlStopCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId aEndpoint, + const app::ConcreteCommandPath & commandPath, Commands::BarrierControlStop::DecodableType & commandData) { EndpointId endpoint = emberAfCurrentCommand()->apsFrame->destinationEndpoint; diff --git a/src/app/clusters/bindings/bindings.cpp b/src/app/clusters/bindings/bindings.cpp index 6686f0b80d5cd4..96266b9f4ae796 100644 --- a/src/app/clusters/bindings/bindings.cpp +++ b/src/app/clusters/bindings/bindings.cpp @@ -92,9 +92,13 @@ EmberStatus getUnusedBindingIndex(uint8_t * bindingIndex) } bool emberAfBindingClusterBindCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, NodeId nodeId, GroupId groupId, EndpointId endpointId, - ClusterId clusterId, Commands::Bind::DecodableType & commandData) + Commands::Bind::DecodableType & commandData) { + auto & nodeId = commandData.nodeId; + auto & groupId = commandData.groupId; + auto & endpointId = commandData.endpointId; + auto & clusterId = commandData.clusterId; + ChipLogDetail(Zcl, "RX: BindCallback"); EmberBindingTableEntry bindingEntry; @@ -123,9 +127,13 @@ bool emberAfBindingClusterBindCallback(app::CommandHandler * commandObj, const a } bool emberAfBindingClusterUnbindCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, NodeId nodeId, GroupId groupId, EndpointId endpointId, - ClusterId clusterId, Commands::Unbind::DecodableType & commandData) + Commands::Unbind::DecodableType & commandData) { + auto & nodeId = commandData.nodeId; + auto & groupId = commandData.groupId; + auto & endpointId = commandData.endpointId; + auto & clusterId = commandData.clusterId; + ChipLogDetail(Zcl, "RX: UnbindCallback"); EmberBindingTableEntry bindingEntry; diff --git a/src/app/clusters/color-control-server/color-control-server.cpp b/src/app/clusters/color-control-server/color-control-server.cpp index d828aab5a22579..17c62f60f3d9b9 100644 --- a/src/app/clusters/color-control-server/color-control-server.cpp +++ b/src/app/clusters/color-control-server/color-control-server.cpp @@ -2288,109 +2288,158 @@ void emberAfPluginColorControlServerStopTransition(void) #ifdef EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_HSV bool emberAfColorControlClusterMoveHueCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t moveMode, uint8_t rate, uint8_t optionsMask, - uint8_t optionsOverride, Commands::MoveHue::DecodableType & commandData) + Commands::MoveHue::DecodableType & commandData) { + auto & moveMode = commandData.moveMode; + auto & rate = commandData.rate; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().moveHueCommand(moveMode, static_cast(rate), optionsMask, optionsOverride, false); } bool emberAfColorControlClusterMoveSaturationCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId aEndpoint, - uint8_t moveMode, uint8_t rate, uint8_t optionsMask, uint8_t optionsOverride, + const app::ConcreteCommandPath & commandPath, Commands::MoveSaturation::DecodableType & commandData) { + auto & moveMode = commandData.moveMode; + auto & rate = commandData.rate; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().moveSaturationCommand(moveMode, rate, optionsMask, optionsOverride); } bool emberAfColorControlClusterMoveToHueCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t hue, uint8_t hueMoveMode, uint16_t transitionTime, - uint8_t optionsMask, uint8_t optionsOverride, Commands::MoveToHue::DecodableType & commandData) { + auto & hue = commandData.hue; + auto & hueMoveMode = commandData.hueMoveMode; + auto & transitionTime = commandData.transitionTime; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().moveToHueCommand(static_cast(hue), hueMoveMode, transitionTime, optionsMask, optionsOverride, false); } bool emberAfColorControlClusterMoveToSaturationCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId aEndpoint, - uint8_t saturation, uint16_t transitionTime, uint8_t optionsMask, - uint8_t optionsOverride, + const app::ConcreteCommandPath & commandPath, Commands::MoveToSaturation::DecodableType & commandData) { + auto & saturation = commandData.saturation; + auto & transitionTime = commandData.transitionTime; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().moveToSaturationCommand(saturation, transitionTime, optionsMask, optionsOverride); } bool emberAfColorControlClusterMoveToHueAndSaturationCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t hue, uint8_t saturation, uint16_t transitionTime, - uint8_t optionsMask, uint8_t optionsOverride, + const app::ConcreteCommandPath & commandPath, Commands::MoveToHueAndSaturation::DecodableType & commandData) { + auto & hue = commandData.hue; + auto & saturation = commandData.saturation; + auto & transitionTime = commandData.transitionTime; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().moveToHueAndSaturationCommand(static_cast(hue), saturation, transitionTime, optionsMask, optionsOverride, false); } bool emberAfColorControlClusterStepHueCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t stepMode, uint8_t stepSize, uint8_t transitionTime, - uint8_t optionsMask, uint8_t optionsOverride, Commands::StepHue::DecodableType & commandData) { + auto & stepMode = commandData.stepMode; + auto & stepSize = commandData.stepSize; + auto & transitionTime = commandData.transitionTime; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().stepHueCommand( stepMode, static_cast(stepSize), static_cast(transitionTime), optionsMask, optionsOverride, false); } bool emberAfColorControlClusterStepSaturationCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId aEndpoint, - uint8_t stepMode, uint8_t stepSize, uint8_t transitionTime, - uint8_t optionsMask, uint8_t optionsOverride, + const app::ConcreteCommandPath & commandPath, Commands::StepSaturation::DecodableType & commandData) { + auto & stepMode = commandData.stepMode; + auto & stepSize = commandData.stepSize; + auto & transitionTime = commandData.transitionTime; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().stepSaturationCommand(stepMode, stepSize, transitionTime, optionsMask, optionsOverride); } bool emberAfColorControlClusterEnhancedMoveHueCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t moveMode, uint16_t rate, uint8_t optionsMask, - uint8_t optionsOverride, + const app::ConcreteCommandPath & commandPath, Commands::EnhancedMoveHue::DecodableType & commandData) { + auto & moveMode = commandData.moveMode; + auto & rate = commandData.rate; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().moveHueCommand(moveMode, rate, optionsMask, optionsOverride, true); } bool emberAfColorControlClusterEnhancedMoveToHueCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint16_t enhancedHue, uint8_t direction, uint16_t transitionTime, - uint8_t optionsMask, uint8_t optionsOverride, + const app::ConcreteCommandPath & commandPath, Commands::EnhancedMoveToHue::DecodableType & commandData) { + auto & enhancedHue = commandData.enhancedHue; + auto & direction = commandData.direction; + auto & transitionTime = commandData.transitionTime; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().moveToHueCommand(enhancedHue, direction, transitionTime, optionsMask, optionsOverride, true); } bool emberAfColorControlClusterEnhancedMoveToHueAndSaturationCallback( - app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, EndpointId endpoint, uint16_t enhancedHue, - uint8_t saturation, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride, + app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, Commands::EnhancedMoveToHueAndSaturation::DecodableType & commandData) { + auto & enhancedHue = commandData.enhancedHue; + auto & saturation = commandData.saturation; + auto & transitionTime = commandData.transitionTime; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().moveToHueAndSaturationCommand(enhancedHue, saturation, transitionTime, optionsMask, optionsOverride, true); } bool emberAfColorControlClusterEnhancedStepHueCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t stepMode, uint16_t stepSize, uint16_t transitionTime, - uint8_t optionsMask, uint8_t optionsOverride, + const app::ConcreteCommandPath & commandPath, Commands::EnhancedStepHue::DecodableType & commandData) { + auto & stepMode = commandData.stepMode; + auto & stepSize = commandData.stepSize; + auto & transitionTime = commandData.transitionTime; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().stepHueCommand(stepMode, stepSize, transitionTime, optionsMask, optionsOverride, true); } bool emberAfColorControlClusterColorLoopSetCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId aEndpoint, uint8_t updateFlags, uint8_t action, uint8_t direction, - uint16_t time, uint16_t startHue, uint8_t optionsMask, uint8_t optionsOverride, Commands::ColorLoopSet::DecodableType & commandData) { + auto & updateFlags = commandData.updateFlags; + auto & action = commandData.action; + auto & direction = commandData.direction; + auto & time = commandData.time; + auto & startHue = commandData.startHue; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().colorLoopCommand(updateFlags, action, direction, time, startHue, optionsMask, optionsOverride); } @@ -2400,25 +2449,37 @@ bool emberAfColorControlClusterColorLoopSetCallback(app::CommandHandler * comman #ifdef EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_XY bool emberAfColorControlClusterMoveToColorCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId aEndpoint, uint16_t colorX, uint16_t colorY, uint16_t transitionTime, - uint8_t optionsMask, uint8_t optionsOverride, Commands::MoveToColor::DecodableType & commandData) { + auto & colorX = commandData.colorX; + auto & colorY = commandData.colorY; + auto & transitionTime = commandData.transitionTime; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().moveToColorCommand(colorX, colorY, transitionTime, optionsMask, optionsOverride); } bool emberAfColorControlClusterMoveColorCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId aEndpoint, int16_t rateX, int16_t rateY, uint8_t optionsMask, - uint8_t optionsOverride, Commands::MoveColor::DecodableType & commandData) + Commands::MoveColor::DecodableType & commandData) { + auto & rateX = commandData.rateX; + auto & rateY = commandData.rateY; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().moveColorCommand(rateX, rateY, optionsMask, optionsOverride); } bool emberAfColorControlClusterStepColorCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId aEndpoint, int16_t stepX, int16_t stepY, uint16_t transitionTime, - uint8_t optionsMask, uint8_t optionsOverride, Commands::StepColor::DecodableType & commandData) { + auto & stepX = commandData.stepX; + auto & stepY = commandData.stepY; + auto & transitionTime = commandData.transitionTime; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().stepColorCommand(stepX, stepY, transitionTime, optionsMask, optionsOverride); } @@ -2427,32 +2488,44 @@ bool emberAfColorControlClusterStepColorCallback(app::CommandHandler * commandOb #ifdef EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP bool emberAfColorControlClusterMoveToColorTemperatureCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId aEndpoint, - uint16_t colorTemperature, uint16_t transitionTime, - uint8_t optionsMask, uint8_t optionsOverride, + const app::ConcreteCommandPath & commandPath, Commands::MoveToColorTemperature::DecodableType & commandData) { + auto & colorTemperature = commandData.colorTemperature; + auto & transitionTime = commandData.transitionTime; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().moveToColorTempCommand(colorTemperature, transitionTime, optionsMask, optionsOverride); } bool emberAfColorControlClusterMoveColorTemperatureCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId aEndpoint, - uint8_t moveMode, uint16_t rate, uint16_t colorTemperatureMinimum, - uint16_t colorTemperatureMaximum, uint8_t optionsMask, - uint8_t optionsOverride, + const app::ConcreteCommandPath & commandPath, Commands::MoveColorTemperature::DecodableType & commandData) { + auto & moveMode = commandData.moveMode; + auto & rate = commandData.rate; + auto & colorTemperatureMinimum = commandData.colorTemperatureMinimum; + auto & colorTemperatureMaximum = commandData.colorTemperatureMaximum; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().moveColorTempCommand(moveMode, rate, colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride); } bool emberAfColorControlClusterStepColorTemperatureCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId aEndpoint, - uint8_t stepMode, uint16_t stepSize, uint16_t transitionTime, - uint16_t colorTemperatureMinimum, uint16_t colorTemperatureMaximum, - uint8_t optionsMask, uint8_t optionsOverride, + const app::ConcreteCommandPath & commandPath, Commands::StepColorTemperature::DecodableType & commandData) { + auto & stepMode = commandData.stepMode; + auto & stepSize = commandData.stepSize; + auto & transitionTime = commandData.transitionTime; + auto & colorTemperatureMinimum = commandData.colorTemperatureMinimum; + auto & colorTemperatureMaximum = commandData.colorTemperatureMaximum; + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().stepColorTempCommand(stepMode, stepSize, transitionTime, colorTemperatureMinimum, colorTemperatureMaximum, optionsMask, optionsOverride); } @@ -2465,9 +2538,11 @@ void emberAfPluginLevelControlCoupledColorTempChangeCallback(EndpointId endpoint #endif // EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP bool emberAfColorControlClusterStopMoveStepCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId aEndpoint, uint8_t optionsMask, uint8_t optionsOverride, Commands::StopMoveStep::DecodableType & commandData) { + auto & optionsMask = commandData.optionsMask; + auto & optionsOverride = commandData.optionsOverride; + return ColorControlServer::Instance().stopMoveStepCommand(optionsMask, optionsOverride); } diff --git a/src/app/clusters/diagnostic-logs-server/diagnostic-logs-server.cpp b/src/app/clusters/diagnostic-logs-server/diagnostic-logs-server.cpp index c7c33b7954313f..5ce468ff8fed80 100644 --- a/src/app/clusters/diagnostic-logs-server/diagnostic-logs-server.cpp +++ b/src/app/clusters/diagnostic-logs-server/diagnostic-logs-server.cpp @@ -24,11 +24,13 @@ using namespace chip; using namespace chip::app::Clusters::DiagnosticLogs; bool emberAfDiagnosticLogsClusterRetrieveLogsRequestCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t intent, uint8_t requestedProtocol, - ByteSpan transferFileDesignator, + const app::ConcreteCommandPath & commandPath, Commands::RetrieveLogsRequest::DecodableType & commandData) { + auto & intent = commandData.intent; + auto & requestedProtocol = commandData.requestedProtocol; + auto & transferFileDesignator = commandData.transferFileDesignator; + EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; emberAfSendImmediateDefaultResponse(status); return true; diff --git a/src/app/clusters/door-lock-server/door-lock-server-logging.cpp b/src/app/clusters/door-lock-server/door-lock-server-logging.cpp index 25a3845bce755a..b66a760592e511 100644 --- a/src/app/clusters/door-lock-server/door-lock-server-logging.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server-logging.cpp @@ -121,9 +121,10 @@ bool emberAfPluginDoorLockServerGetLogEntry(uint16_t * entryId, EmberAfPluginDoo } bool emberAfDoorLockClusterGetLogRecordCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint16_t entryId, Commands::GetLogRecord::DecodableType & commandData) { + auto & entryId = commandData.entryId; + EmberStatus status; EmberAfPluginDoorLockServerLogEntry entry; CHIP_ERROR err = CHIP_NO_ERROR; diff --git a/src/app/clusters/door-lock-server/door-lock-server-schedule.cpp b/src/app/clusters/door-lock-server/door-lock-server-schedule.cpp index 172b3651f95a1e..600545ef14a428 100644 --- a/src/app/clusters/door-lock-server/door-lock-server-schedule.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server-schedule.cpp @@ -124,11 +124,17 @@ void emAfPluginDoorLockServerInitSchedule(void) } bool emberAfDoorLockClusterSetWeekdayScheduleCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t scheduleId, uint16_t userId, uint8_t daysMask, uint8_t startHour, - uint8_t startMinute, uint8_t stopHour, uint8_t stopMinute, + const app::ConcreteCommandPath & commandPath, Commands::SetWeekdaySchedule::DecodableType & commandData) { + auto & scheduleId = commandData.scheduleId; + auto & userId = commandData.userId; + auto & daysMask = commandData.daysMask; + auto & startHour = commandData.startHour; + auto & startMinute = commandData.startMinute; + auto & stopHour = commandData.stopHour; + auto & stopMinute = commandData.stopMinute; + uint8_t status = 0x00; uint8_t userPin = 0x00; uint16_t rfProgrammingEventMask = 0xffff; // event sent by default @@ -184,10 +190,12 @@ bool emberAfDoorLockClusterSetWeekdayScheduleCallback(app::CommandHandler * comm } bool emberAfDoorLockClusterGetWeekdayScheduleCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t scheduleId, uint16_t userId, + const app::ConcreteCommandPath & commandPath, Commands::GetWeekdaySchedule::DecodableType & commandData) { + auto & scheduleId = commandData.scheduleId; + auto & userId = commandData.userId; + EmberAfStatus zclStatus = ((scheduleId > EMBER_AF_PLUGIN_DOOR_LOCK_SERVER_WEEKDAY_SCHEDULE_TABLE_SIZE) ? EMBER_ZCL_STATUS_INVALID_FIELD : EMBER_ZCL_STATUS_SUCCESS); @@ -226,10 +234,12 @@ bool emberAfDoorLockClusterGetWeekdayScheduleCallback(app::CommandHandler * comm } bool emberAfDoorLockClusterClearWeekdayScheduleCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t scheduleId, uint16_t userId, + const app::ConcreteCommandPath & commandPath, Commands::ClearWeekdaySchedule::DecodableType & commandData) { + auto & scheduleId = commandData.scheduleId; + auto & userId = commandData.userId; + EmberAfStatus zclStatus = ((scheduleId > EMBER_AF_PLUGIN_DOOR_LOCK_SERVER_WEEKDAY_SCHEDULE_TABLE_SIZE) ? EMBER_ZCL_STATUS_INVALID_FIELD : EMBER_ZCL_STATUS_SUCCESS); @@ -259,11 +269,14 @@ bool emberAfDoorLockClusterClearWeekdayScheduleCallback(app::CommandHandler * co } bool emberAfDoorLockClusterSetYeardayScheduleCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t scheduleId, uint16_t userId, uint32_t localStartTime, - uint32_t localEndTime, + const app::ConcreteCommandPath & commandPath, Commands::SetYeardaySchedule::DecodableType & commandData) { + auto & scheduleId = commandData.scheduleId; + auto & userId = commandData.userId; + auto & localStartTime = commandData.localStartTime; + auto & localEndTime = commandData.localEndTime; + uint8_t status; CHIP_ERROR err = CHIP_NO_ERROR; if (scheduleId >= EMBER_AF_PLUGIN_DOOR_LOCK_SERVER_YEARDAY_SCHEDULE_TABLE_SIZE) @@ -298,10 +311,12 @@ bool emberAfDoorLockClusterSetYeardayScheduleCallback(app::CommandHandler * comm } bool emberAfDoorLockClusterGetYeardayScheduleCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t scheduleId, uint16_t userId, + const app::ConcreteCommandPath & commandPath, Commands::GetYeardaySchedule::DecodableType & commandData) { + auto & scheduleId = commandData.scheduleId; + auto & userId = commandData.userId; + EmberAfPluginDoorLockServerYeardayScheduleEntry * entry = &yeardayScheduleTable[0]; EmberAfStatus zclStatus; CHIP_ERROR err = CHIP_NO_ERROR; @@ -346,10 +361,12 @@ bool emberAfDoorLockClusterGetYeardayScheduleCallback(app::CommandHandler * comm } bool emberAfDoorLockClusterClearYeardayScheduleCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t scheduleId, uint16_t userId, + const app::ConcreteCommandPath & commandPath, Commands::ClearYeardaySchedule::DecodableType & commandData) { + auto & scheduleId = commandData.scheduleId; + auto & userId = commandData.userId; + uint8_t status; CHIP_ERROR err = CHIP_NO_ERROR; if (scheduleId >= EMBER_AF_PLUGIN_DOOR_LOCK_SERVER_YEARDAY_SCHEDULE_TABLE_SIZE) @@ -382,11 +399,14 @@ bool emberAfDoorLockClusterClearYeardayScheduleCallback(app::CommandHandler * co } bool emberAfDoorLockClusterSetHolidayScheduleCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t holidayScheduleId, uint32_t localStartTime, uint32_t localEndTime, - uint8_t operatingModeDuringHoliday, + const app::ConcreteCommandPath & commandPath, Commands::SetHolidaySchedule::DecodableType & commandData) { + auto & holidayScheduleId = commandData.holidayScheduleId; + auto & localStartTime = commandData.localStartTime; + auto & localEndTime = commandData.localEndTime; + auto & operatingModeDuringHoliday = commandData.operatingModeDuringHoliday; + uint8_t status; CHIP_ERROR err = CHIP_NO_ERROR; if (holidayScheduleId >= EMBER_AF_PLUGIN_DOOR_LOCK_SERVER_HOLIDAY_SCHEDULE_TABLE_SIZE) @@ -423,10 +443,11 @@ bool emberAfDoorLockClusterSetHolidayScheduleCallback(app::CommandHandler * comm } bool emberAfDoorLockClusterGetHolidayScheduleCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t holidayScheduleId, + const app::ConcreteCommandPath & commandPath, Commands::GetHolidaySchedule::DecodableType & commandData) { + auto & holidayScheduleId = commandData.holidayScheduleId; + EmberAfPluginDoorLockServerHolidayScheduleEntry * entry = &holidayScheduleTable[0]; EmberAfStatus zclStatus; CHIP_ERROR err = CHIP_NO_ERROR; @@ -470,10 +491,11 @@ bool emberAfDoorLockClusterGetHolidayScheduleCallback(app::CommandHandler * comm } bool emberAfDoorLockClusterClearHolidayScheduleCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t holidayScheduleId, + const app::ConcreteCommandPath & commandPath, Commands::ClearHolidaySchedule::DecodableType & commandData) { + auto & holidayScheduleId = commandData.holidayScheduleId; + uint8_t status; CHIP_ERROR err = CHIP_NO_ERROR; if (holidayScheduleId >= EMBER_AF_PLUGIN_DOOR_LOCK_SERVER_YEARDAY_SCHEDULE_TABLE_SIZE) diff --git a/src/app/clusters/door-lock-server/door-lock-server-user.cpp b/src/app/clusters/door-lock-server/door-lock-server-user.cpp index c499fc195f7bb6..258eee1de9ef62 100644 --- a/src/app/clusters/door-lock-server/door-lock-server-user.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server-user.cpp @@ -225,9 +225,10 @@ static uint8_t clearUserPinOrRfid(uint16_t userId, EmberAfPluginDoorLockServerUs } bool emberAfDoorLockClusterGetUserTypeCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint16_t userId, Commands::GetUserType::DecodableType & commandData) { + auto & userId = commandData.userId; + CHIP_ERROR err = CHIP_NO_ERROR; if (emAfPluginDoorLockServerCheckForSufficientSpace(userId, EMBER_AF_PLUGIN_DOOR_LOCK_SERVER_PIN_USER_TABLE_SIZE)) { @@ -253,9 +254,11 @@ bool emberAfDoorLockClusterGetUserTypeCallback(app::CommandHandler * commandObj, } bool emberAfDoorLockClusterSetUserTypeCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint16_t userId, uint8_t userType, Commands::SetUserType::DecodableType & commandData) { + auto & userId = commandData.userId; + auto & userType = commandData.userType; + CHIP_ERROR err = CHIP_NO_ERROR; // TODO: Need to validate userType. https://github.com/project-chip/connectedhomeip/issues/3580 uint8_t status = (emAfPluginDoorLockServerSetPinUserType(userId, static_cast(userType)) @@ -296,9 +299,13 @@ bool emAfPluginDoorLockServerSetPinUserType(uint16_t userId, EmberAfDoorLockUser // PIN handling bool emberAfDoorLockClusterSetPinCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint16_t userId, uint8_t userStatus, uint8_t userType, ByteSpan pin, Commands::SetPin::DecodableType & commandData) { + auto & userId = commandData.userId; + auto & userStatus = commandData.userStatus; + auto & userType = commandData.userType; + auto & pin = commandData.pin; + CHIP_ERROR err = CHIP_NO_ERROR; // send response uint8_t status = setUser(userId, userStatus, userType, pin, pinUserTable, EMBER_AF_PLUGIN_DOOR_LOCK_SERVER_PIN_USER_TABLE_SIZE); @@ -350,8 +357,10 @@ static bool getSendPinOverTheAir(void) } bool emberAfDoorLockClusterGetPinCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint16_t userId, Commands::GetPin::DecodableType & commandData) + Commands::GetPin::DecodableType & commandData) { + auto & userId = commandData.userId; + EmberAfPluginDoorLockServerUser user; EmberStatus status = EMBER_SUCCESS; CHIP_ERROR err = CHIP_NO_ERROR; @@ -395,8 +404,10 @@ bool emberAfDoorLockClusterGetPinCallback(app::CommandHandler * commandObj, cons } bool emberAfDoorLockClusterClearPinCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint16_t userId, Commands::ClearPin::DecodableType & commandData) + Commands::ClearPin::DecodableType & commandData) { + auto & userId = commandData.userId; + CHIP_ERROR err = CHIP_NO_ERROR; uint8_t status = clearUserPinOrRfid(userId, pinUserTable, EMBER_AF_PLUGIN_DOOR_LOCK_SERVER_PIN_USER_TABLE_SIZE); // get bitmask so we can check if we should send event notification @@ -438,7 +449,7 @@ bool emberAfDoorLockClusterClearPinCallback(app::CommandHandler * commandObj, co } bool emberAfDoorLockClusterClearAllPinsCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::ClearAllPins::DecodableType & commandData) + Commands::ClearAllPins::DecodableType & commandData) { uint8_t i; CHIP_ERROR err = CHIP_NO_ERROR; @@ -469,9 +480,13 @@ bool emberAfDoorLockClusterClearAllPinsCallback(app::CommandHandler * commandObj // RFID handling bool emberAfDoorLockClusterSetRfidCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint16_t userId, uint8_t userStatus, uint8_t userType, - ByteSpan rfid, Commands::SetRfid::DecodableType & commandData) + Commands::SetRfid::DecodableType & commandData) { + auto & userId = commandData.userId; + auto & userStatus = commandData.userStatus; + auto & userType = commandData.userType; + auto & rfid = commandData.rfid; + CHIP_ERROR err = CHIP_NO_ERROR; uint8_t status = setUser(userId, userStatus, userType, rfid, rfidUserTable, EMBER_AF_PLUGIN_DOOR_LOCK_SERVER_RFID_USER_TABLE_SIZE); @@ -494,8 +509,10 @@ bool emberAfDoorLockClusterSetRfidCallback(app::CommandHandler * commandObj, con } bool emberAfDoorLockClusterGetRfidCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint16_t userId, Commands::GetRfid::DecodableType & commandData) + Commands::GetRfid::DecodableType & commandData) { + auto & userId = commandData.userId; + EmberAfPluginDoorLockServerUser user; EmberStatus status = EMBER_SUCCESS; CHIP_ERROR err = CHIP_NO_ERROR; @@ -532,8 +549,10 @@ bool emberAfDoorLockClusterGetRfidCallback(app::CommandHandler * commandObj, con } bool emberAfDoorLockClusterClearRfidCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint16_t userId, Commands::ClearRfid::DecodableType & commandData) + Commands::ClearRfid::DecodableType & commandData) { + auto & userId = commandData.userId; + CHIP_ERROR err = CHIP_NO_ERROR; uint8_t status = clearUserPinOrRfid(userId, rfidUserTable, EMBER_AF_PLUGIN_DOOR_LOCK_SERVER_RFID_USER_TABLE_SIZE); @@ -555,7 +574,7 @@ bool emberAfDoorLockClusterClearRfidCallback(app::CommandHandler * commandObj, c } bool emberAfDoorLockClusterClearAllRfidsCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::ClearAllRfids::DecodableType & commandData) + Commands::ClearAllRfids::DecodableType & commandData) { CHIP_ERROR err = CHIP_NO_ERROR; for (uint8_t i = 0; i < EMBER_AF_PLUGIN_DOOR_LOCK_SERVER_RFID_USER_TABLE_SIZE; i++) @@ -636,8 +655,10 @@ static bool verifyPin(ByteSpan & pin, uint8_t * userId) } bool emberAfDoorLockClusterLockDoorCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, ByteSpan PIN, Commands::LockDoor::DecodableType & commandData) + Commands::LockDoor::DecodableType & commandData) { + auto & PIN = commandData.PIN; + uint8_t userId = 0; bool pinVerified = verifyPin(PIN, &userId); bool doorLocked = false; @@ -703,8 +724,10 @@ bool emberAfDoorLockClusterLockDoorCallback(app::CommandHandler * commandObj, co } bool emberAfDoorLockClusterUnlockDoorCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, ByteSpan pin, Commands::UnlockDoor::DecodableType & commandData) + Commands::UnlockDoor::DecodableType & commandData) { + auto & pin = commandData.pin; + uint8_t userId = 0; bool pinVerified = verifyPin(pin, &userId); bool doorUnlocked = false; @@ -894,9 +917,11 @@ void emberAfDoorLockClusterServerAttributeChangedCallback(EndpointId endpoint, A } bool emberAfDoorLockClusterUnlockWithTimeoutCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint16_t timeoutS, ByteSpan pin, Commands::UnlockWithTimeout::DecodableType & commandData) { + auto & timeoutS = commandData.timeoutS; + auto & pin = commandData.pin; + uint8_t userId; uint8_t status; CHIP_ERROR err = CHIP_NO_ERROR; diff --git a/src/app/clusters/ethernet_network_diagnostics_server/ethernet_network_diagnostics_server.cpp b/src/app/clusters/ethernet_network_diagnostics_server/ethernet_network_diagnostics_server.cpp index b6c59835266b18..bba93283eadd18 100644 --- a/src/app/clusters/ethernet_network_diagnostics_server/ethernet_network_diagnostics_server.cpp +++ b/src/app/clusters/ethernet_network_diagnostics_server/ethernet_network_diagnostics_server.cpp @@ -116,7 +116,7 @@ CHIP_ERROR EthernetDiagosticsAttrAccess::Read(ClusterInfo & aClusterInfo, Attrib } // anonymous namespace bool emberAfEthernetNetworkDiagnosticsClusterResetCountsCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, + const app::ConcreteCommandPath & commandPath, Commands::ResetCounts::DecodableType & commandData) { EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; diff --git a/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp b/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp index 5d2cfeeebc766b..c6e9337a9da71e 100644 --- a/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp +++ b/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp @@ -33,10 +33,13 @@ using namespace chip; using namespace chip::app::Clusters::GeneralCommissioning; bool emberAfGeneralCommissioningClusterArmFailSafeCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint16_t expiryLengthSeconds, uint64_t breadcrumb, uint32_t timeoutMs, + const app::ConcreteCommandPath & commandPath, Commands::ArmFailSafe::DecodableType & commandData) { + auto & expiryLengthSeconds = commandData.expiryLengthSeconds; + auto & breadcrumb = commandData.breadcrumb; + auto & timeoutMs = commandData.timeoutMs; + CHIP_ERROR err = DeviceLayer::Internal::DeviceControlServer::DeviceControlSvr().ArmFailSafe(expiryLengthSeconds); emberAfSendImmediateDefaultResponse(err == CHIP_NO_ERROR ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE); @@ -45,7 +48,6 @@ bool emberAfGeneralCommissioningClusterArmFailSafeCallback(app::CommandHandler * bool emberAfGeneralCommissioningClusterCommissioningCompleteCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::CommissioningComplete::DecodableType & commandData) { CHIP_ERROR err = DeviceLayer::Internal::DeviceControlServer::DeviceControlSvr().CommissioningComplete(); @@ -56,10 +58,13 @@ bool emberAfGeneralCommissioningClusterCommissioningCompleteCallback(app::Comman bool emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t location, uint8_t * countryCode, - uint64_t breadcrumb, uint32_t timeoutMs, Commands::SetRegulatoryConfig::DecodableType & commandData) { + auto & location = commandData.location; + auto & countryCode = commandData.countryCode; + auto & breadcrumb = commandData.breadcrumb; + auto & timeoutMs = commandData.timeoutMs; + CHIP_ERROR err = DeviceLayer::Internal::DeviceControlServer::DeviceControlSvr().SetRegulatoryConfig( location, reinterpret_cast(countryCode), breadcrumb); diff --git a/src/app/clusters/groups-server/groups-server.cpp b/src/app/clusters/groups-server/groups-server.cpp index c7c0e592f884d4..3255d3831e2f60 100644 --- a/src/app/clusters/groups-server/groups-server.cpp +++ b/src/app/clusters/groups-server/groups-server.cpp @@ -155,9 +155,11 @@ static EmberAfStatus removeEntryFromGroupTable(EndpointId endpoint, GroupId grou } bool emberAfGroupsClusterAddGroupCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, GroupId groupId, uint8_t * groupName, Commands::AddGroup::DecodableType & commandData) { + auto & groupId = commandData.groupId; + auto & groupName = commandData.groupName; + EmberAfStatus status; CHIP_ERROR err = CHIP_NO_ERROR; @@ -193,8 +195,10 @@ bool emberAfGroupsClusterAddGroupCallback(app::CommandHandler * commandObj, cons } bool emberAfGroupsClusterViewGroupCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, GroupId groupId, Commands::ViewGroup::DecodableType & commandData) + Commands::ViewGroup::DecodableType & commandData) { + auto & groupId = commandData.groupId; + EmberAfStatus status = EMBER_ZCL_STATUS_NOT_FOUND; CHIP_ERROR err = CHIP_NO_ERROR; uint8_t groupName[ZCL_GROUPS_CLUSTER_MAXIMUM_NAME_LENGTH + 1] = { 0 }; @@ -236,9 +240,11 @@ bool emberAfGroupsClusterViewGroupCallback(app::CommandHandler * commandObj, con } bool emberAfGroupsClusterGetGroupMembershipCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t groupCount, uint8_t * groupList, Commands::GetGroupMembership::DecodableType & commandData) { + auto & groupCount = commandData.groupCount; + auto & groupList = commandData.groupList; + EmberStatus status = EMBER_ZCL_STATUS_FAILURE; uint8_t i, j; uint8_t count = 0; @@ -335,9 +341,10 @@ bool emberAfGroupsClusterGetGroupMembershipCallback(app::CommandHandler * comman } bool emberAfGroupsClusterRemoveGroupCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, GroupId groupId, Commands::RemoveGroup::DecodableType & commandData) { + auto & groupId = commandData.groupId; + EmberAfStatus status; CHIP_ERROR err = CHIP_NO_ERROR; @@ -375,7 +382,7 @@ bool emberAfGroupsClusterRemoveGroupCallback(app::CommandHandler * commandObj, c } bool emberAfGroupsClusterRemoveAllGroupsCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId aEndpoint, Commands::RemoveAllGroups::DecodableType & commandData) + Commands::RemoveAllGroups::DecodableType & commandData) { EmberStatus sendStatus = EMBER_SUCCESS; uint8_t i; @@ -424,10 +431,12 @@ bool emberAfGroupsClusterRemoveAllGroupsCallback(app::CommandHandler * commandOb } bool emberAfGroupsClusterAddGroupIfIdentifyingCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - GroupId groupId, uint8_t * groupName, + const app::ConcreteCommandPath & commandPath, Commands::AddGroupIfIdentifying::DecodableType & commandData) { + auto & groupId = commandData.groupId; + auto & groupName = commandData.groupName; + EmberAfStatus status; EmberStatus sendStatus = EMBER_SUCCESS; diff --git a/src/app/clusters/ias-zone-server/ias-zone-server.cpp b/src/app/clusters/ias-zone-server/ias-zone-server.cpp index 1e2411b36adc95..294ae2c4aaec75 100644 --- a/src/app/clusters/ias-zone-server/ias-zone-server.cpp +++ b/src/app/clusters/ias-zone-server/ias-zone-server.cpp @@ -352,9 +352,11 @@ static void updateEnrollState(EndpointId endpoint, bool enrolled) } bool emberAfIasZoneClusterZoneEnrollResponseCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId aEndpoint, uint8_t enrollResponseCode, uint8_t zoneId, Commands::ZoneEnrollResponse::DecodableType & commandData) { + auto & enrollResponseCode = commandData.enrollResponseCode; + auto & zoneId = commandData.zoneId; + EndpointId endpoint; uint8_t epZoneId; EmberAfStatus status; diff --git a/src/app/clusters/identify-server/identify-server.cpp b/src/app/clusters/identify-server/identify-server.cpp index a812d458a0676f..3d68c6b329bae9 100644 --- a/src/app/clusters/identify-server/identify-server.cpp +++ b/src/app/clusters/identify-server/identify-server.cpp @@ -209,16 +209,17 @@ void emberAfIdentifyClusterServerAttributeChangedCallback(EndpointId endpoint, A } bool emberAfIdentifyClusterIdentifyCallback(CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint16_t identifyTime, Commands::Identify::DecodableType & commandData) { + auto & identifyTime = commandData.identifyTime; + // cmd Identify return EMBER_SUCCESS == emberAfSendImmediateDefaultResponse(Clusters::Identify::Attributes::IdentifyTime::Set(endpoint, identifyTime)); } bool emberAfIdentifyClusterIdentifyQueryCallback(CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::IdentifyQuery::DecodableType & commandData) + Commands::IdentifyQuery::DecodableType & commandData) { // cmd IdentifyQuery uint16_t identifyTime = 0; @@ -272,9 +273,11 @@ bool emberAfIdentifyClusterIdentifyQueryCallback(CommandHandler * commandObj, co } bool emberAfIdentifyClusterTriggerEffectCallback(CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t effectIdentifier, uint8_t effectVariant, Commands::TriggerEffect::DecodableType & commandData) { + auto & effectIdentifier = commandData.effectIdentifier; + auto & effectVariant = commandData.effectVariant; + // cmd TriggerEffect Identify * identify = inst(endpoint); uint16_t identifyTime = 0; diff --git a/src/app/clusters/keypad-input-server/keypad-input-server.cpp b/src/app/clusters/keypad-input-server/keypad-input-server.cpp index f02e5d93c8ef2e..0cda5dd3533762 100644 --- a/src/app/clusters/keypad-input-server/keypad-input-server.cpp +++ b/src/app/clusters/keypad-input-server/keypad-input-server.cpp @@ -55,8 +55,10 @@ static void sendResponse(app::CommandHandler * command, EmberAfKeypadInputStatus } bool emberAfKeypadInputClusterSendKeyCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t keyCode, Commands::SendKey::DecodableType & commandData) + Commands::SendKey::DecodableType & commandData) { + auto & keyCode = commandData.keyCode; + EmberAfKeypadInputStatus status = keypadInputClusterSendKey(static_cast(keyCode)); sendResponse(command, status); return true; diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp index 9574366c0d82f3..b24768442192e2 100644 --- a/src/app/clusters/level-control/level-control.cpp +++ b/src/app/clusters/level-control/level-control.cpp @@ -410,9 +410,13 @@ static bool shouldExecuteIfOff(EndpointId endpoint, CommandId commandId, uint8_t } bool emberAfLevelControlClusterMoveToLevelCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t level, uint16_t transitionTime, uint8_t optionMask, - uint8_t optionOverride, Commands::MoveToLevel::DecodableType & commandData) + Commands::MoveToLevel::DecodableType & commandData) { + auto & level = commandData.level; + auto & transitionTime = commandData.transitionTime; + auto & optionMask = commandData.optionMask; + auto & optionOverride = commandData.optionOverride; + emberAfLevelControlClusterPrintln("%pMOVE_TO_LEVEL %x %2x %x %x", "RX level-control:", level, transitionTime, optionMask, optionOverride); moveToLevelHandler(ZCL_MOVE_TO_LEVEL_COMMAND_ID, level, transitionTime, optionMask, optionOverride, @@ -421,10 +425,12 @@ bool emberAfLevelControlClusterMoveToLevelCallback(app::CommandHandler * command } bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t level, uint16_t transitionTime, + const app::ConcreteCommandPath & commandPath, Commands::MoveToLevelWithOnOff::DecodableType & commandData) { + auto & level = commandData.level; + auto & transitionTime = commandData.transitionTime; + emberAfLevelControlClusterPrintln("%pMOVE_TO_LEVEL_WITH_ON_OFF %x %2x", "RX level-control:", level, transitionTime); moveToLevelHandler(ZCL_MOVE_TO_LEVEL_WITH_ON_OFF_COMMAND_ID, level, transitionTime, 0xFF, 0xFF, INVALID_STORED_LEVEL); // Don't revert to the stored level @@ -432,52 +438,68 @@ bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(app::CommandHandler } bool emberAfLevelControlClusterMoveCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t moveMode, uint8_t rate, uint8_t optionMask, - uint8_t optionOverride, Commands::Move::DecodableType & commandData) + Commands::Move::DecodableType & commandData) { + auto & moveMode = commandData.moveMode; + auto & rate = commandData.rate; + auto & optionMask = commandData.optionMask; + auto & optionOverride = commandData.optionOverride; + emberAfLevelControlClusterPrintln("%pMOVE %x %x", "RX level-control:", moveMode, rate); moveHandler(ZCL_MOVE_COMMAND_ID, moveMode, rate, optionMask, optionOverride); return true; } bool emberAfLevelControlClusterMoveWithOnOffCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t moveMode, uint8_t rate, Commands::MoveWithOnOff::DecodableType & commandData) { + auto & moveMode = commandData.moveMode; + auto & rate = commandData.rate; + emberAfLevelControlClusterPrintln("%pMOVE_WITH_ON_OFF %x %x", "RX level-control:", moveMode, rate); moveHandler(ZCL_MOVE_WITH_ON_OFF_COMMAND_ID, moveMode, rate, 0xFF, 0xFF); return true; } bool emberAfLevelControlClusterStepCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime, - uint8_t optionMask, uint8_t optionOverride, Commands::Step::DecodableType & commandData) + Commands::Step::DecodableType & commandData) { + auto & stepMode = commandData.stepMode; + auto & stepSize = commandData.stepSize; + auto & transitionTime = commandData.transitionTime; + auto & optionMask = commandData.optionMask; + auto & optionOverride = commandData.optionOverride; + emberAfLevelControlClusterPrintln("%pSTEP %x %x %2x", "RX level-control:", stepMode, stepSize, transitionTime); stepHandler(ZCL_STEP_COMMAND_ID, stepMode, stepSize, transitionTime, optionMask, optionOverride); return true; } bool emberAfLevelControlClusterStepWithOnOffCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t stepMode, uint8_t stepSize, - uint16_t transitionTime, Commands::StepWithOnOff::DecodableType & commandData) + Commands::StepWithOnOff::DecodableType & commandData) { + auto & stepMode = commandData.stepMode; + auto & stepSize = commandData.stepSize; + auto & transitionTime = commandData.transitionTime; + emberAfLevelControlClusterPrintln("%pSTEP_WITH_ON_OFF %x %x %2x", "RX level-control:", stepMode, stepSize, transitionTime); stepHandler(ZCL_STEP_WITH_ON_OFF_COMMAND_ID, stepMode, stepSize, transitionTime, 0xFF, 0xFF); return true; } bool emberAfLevelControlClusterStopCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t optionMask, uint8_t optionOverride, Commands::Stop::DecodableType & commandData) { + auto & optionMask = commandData.optionMask; + auto & optionOverride = commandData.optionOverride; + emberAfLevelControlClusterPrintln("%pSTOP", "RX level-control:"); stopHandler(ZCL_STOP_COMMAND_ID, optionMask, optionOverride); return true; } bool emberAfLevelControlClusterStopWithOnOffCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::StopWithOnOff::DecodableType & commandData) + Commands::StopWithOnOff::DecodableType & commandData) { emberAfLevelControlClusterPrintln("%pSTOP_WITH_ON_OFF", "RX level-control:"); stopHandler(ZCL_STOP_WITH_ON_OFF_COMMAND_ID, 0xFF, 0xFF); diff --git a/src/app/clusters/low-power-server/low-power-server.cpp b/src/app/clusters/low-power-server/low-power-server.cpp index 405eaefaef0974..68e9a247a7410e 100644 --- a/src/app/clusters/low-power-server/low-power-server.cpp +++ b/src/app/clusters/low-power-server/low-power-server.cpp @@ -33,7 +33,7 @@ using namespace chip::app::Clusters::LowPower; bool lowPowerClusterSleep(); bool emberAfLowPowerClusterSleepCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::Sleep::DecodableType & commandData) + Commands::Sleep::DecodableType & commandData) { bool success = lowPowerClusterSleep(); EmberAfStatus status = success ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE; diff --git a/src/app/clusters/media-input-server/media-input-server.cpp b/src/app/clusters/media-input-server/media-input-server.cpp index f9850b573add00..b3d07aa9dc7f4b 100644 --- a/src/app/clusters/media-input-server/media-input-server.cpp +++ b/src/app/clusters/media-input-server/media-input-server.cpp @@ -50,9 +50,10 @@ static void storeCurrentInput(EndpointId endpoint, uint8_t currentInput) } bool emberAfMediaInputClusterSelectInputCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t input, Commands::SelectInput::DecodableType & commandData) { + auto & input = commandData.input; + bool success = mediaInputClusterSelectInput(input); EmberAfStatus status = success ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE; if (success) @@ -64,7 +65,7 @@ bool emberAfMediaInputClusterSelectInputCallback(app::CommandHandler * command, } bool emberAfMediaInputClusterShowInputStatusCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::ShowInputStatus::DecodableType & commandData) + Commands::ShowInputStatus::DecodableType & commandData) { bool success = mediaInputClusterShowInputStatus(); EmberAfStatus status = success ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE; @@ -73,7 +74,7 @@ bool emberAfMediaInputClusterShowInputStatusCallback(app::CommandHandler * comma } bool emberAfMediaInputClusterHideInputStatusCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::HideInputStatus::DecodableType & commandData) + Commands::HideInputStatus::DecodableType & commandData) { bool success = mediaInputClusterHideInputStatus(); EmberAfStatus status = success ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE; @@ -82,9 +83,11 @@ bool emberAfMediaInputClusterHideInputStatusCallback(app::CommandHandler * comma } bool emberAfMediaInputClusterRenameInputCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t input, uint8_t * name, Commands::RenameInput::DecodableType & commandData) { + auto & input = commandData.input; + auto & name = commandData.name; + // TODO: char is not null terminated, verify this code once #7963 gets merged. std::string nameString(reinterpret_cast(name)); bool success = mediaInputClusterRenameInput(input, nameString); diff --git a/src/app/clusters/media-playback-server/media-playback-server.cpp b/src/app/clusters/media-playback-server/media-playback-server.cpp index 3a87bd948c7cc7..43d805db3556ac 100644 --- a/src/app/clusters/media-playback-server/media-playback-server.cpp +++ b/src/app/clusters/media-playback-server/media-playback-server.cpp @@ -98,7 +98,7 @@ static void sendResponse(app::CommandHandler * command, const char * responseNam } bool emberAfMediaPlaybackClusterMediaPlayCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::MediaPlay::DecodableType & commandData) + Commands::MediaPlay::DecodableType & commandData) { EmberAfMediaPlaybackStatus status = mediaPlaybackClusterSendMediaPlaybackRequest(MEDIA_PLAYBACK_REQUEST_PLAY, 0); storeNewPlaybackState(emberAfCurrentEndpoint(), EMBER_ZCL_MEDIA_PLAYBACK_STATE_PLAYING); @@ -107,7 +107,7 @@ bool emberAfMediaPlaybackClusterMediaPlayCallback(app::CommandHandler * command, } bool emberAfMediaPlaybackClusterMediaPauseCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::MediaPause::DecodableType & commandData) + Commands::MediaPause::DecodableType & commandData) { EmberAfMediaPlaybackStatus status = mediaPlaybackClusterSendMediaPlaybackRequest(MEDIA_PLAYBACK_REQUEST_PAUSE, 0); storeNewPlaybackState(emberAfCurrentEndpoint(), EMBER_ZCL_MEDIA_PLAYBACK_STATE_PAUSED); @@ -116,7 +116,7 @@ bool emberAfMediaPlaybackClusterMediaPauseCallback(app::CommandHandler * command } bool emberAfMediaPlaybackClusterMediaStopCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::MediaStop::DecodableType & commandData) + Commands::MediaStop::DecodableType & commandData) { EmberAfMediaPlaybackStatus status = mediaPlaybackClusterSendMediaPlaybackRequest(MEDIA_PLAYBACK_REQUEST_STOP, 0); storeNewPlaybackState(emberAfCurrentEndpoint(), EMBER_ZCL_MEDIA_PLAYBACK_STATE_NOT_PLAYING); @@ -125,7 +125,7 @@ bool emberAfMediaPlaybackClusterMediaStopCallback(app::CommandHandler * command, } bool emberAfMediaPlaybackClusterMediaFastForwardCallback(app::CommandHandler * command, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, + const app::ConcreteCommandPath & commandPath, Commands::MediaFastForward::DecodableType & commandData) { EmberAfMediaPlaybackStatus status = mediaPlaybackClusterSendMediaPlaybackRequest(MEDIA_PLAYBACK_REQUEST_FAST_FORWARD, 0); @@ -134,7 +134,7 @@ bool emberAfMediaPlaybackClusterMediaFastForwardCallback(app::CommandHandler * c } bool emberAfMediaPlaybackClusterMediaPreviousCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::MediaPrevious::DecodableType & commandData) + Commands::MediaPrevious::DecodableType & commandData) { EmberAfMediaPlaybackStatus status = mediaPlaybackClusterSendMediaPlaybackRequest(MEDIA_PLAYBACK_REQUEST_PREVIOUS, 0); sendResponse(command, "MediaPrevious", ZCL_MEDIA_PREVIOUS_RESPONSE_COMMAND_ID, status); @@ -142,7 +142,7 @@ bool emberAfMediaPlaybackClusterMediaPreviousCallback(app::CommandHandler * comm } bool emberAfMediaPlaybackClusterMediaRewindCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::MediaRewind::DecodableType & commandData) + Commands::MediaRewind::DecodableType & commandData) { EmberAfMediaPlaybackStatus status = mediaPlaybackClusterSendMediaPlaybackRequest(MEDIA_PLAYBACK_REQUEST_REWIND, 0); sendResponse(command, "MediaRewind", ZCL_MEDIA_REWIND_RESPONSE_COMMAND_ID, status); @@ -150,10 +150,11 @@ bool emberAfMediaPlaybackClusterMediaRewindCallback(app::CommandHandler * comman } bool emberAfMediaPlaybackClusterMediaSkipBackwardCallback(app::CommandHandler * command, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint64_t deltaPositionMilliseconds, + const app::ConcreteCommandPath & commandPath, Commands::MediaSkipBackward::DecodableType & commandData) { + auto & deltaPositionMilliseconds = commandData.deltaPositionMilliseconds; + EmberAfMediaPlaybackStatus status = mediaPlaybackClusterSendMediaPlaybackRequest(MEDIA_PLAYBACK_REQUEST_SKIP_BACKWARD, deltaPositionMilliseconds); sendResponse(command, "MediaSkipBackward", ZCL_MEDIA_SKIP_BACKWARD_RESPONSE_COMMAND_ID, status); @@ -161,10 +162,11 @@ bool emberAfMediaPlaybackClusterMediaSkipBackwardCallback(app::CommandHandler * } bool emberAfMediaPlaybackClusterMediaSkipForwardCallback(app::CommandHandler * command, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint64_t deltaPositionMilliseconds, + const app::ConcreteCommandPath & commandPath, Commands::MediaSkipForward::DecodableType & commandData) { + auto & deltaPositionMilliseconds = commandData.deltaPositionMilliseconds; + EmberAfMediaPlaybackStatus status = mediaPlaybackClusterSendMediaPlaybackRequest(MEDIA_PLAYBACK_REQUEST_SKIP_FORWARD, deltaPositionMilliseconds); sendResponse(command, "MediaSkipForward", ZCL_MEDIA_SKIP_FORWARD_RESPONSE_COMMAND_ID, status); @@ -172,9 +174,10 @@ bool emberAfMediaPlaybackClusterMediaSkipForwardCallback(app::CommandHandler * c } bool emberAfMediaPlaybackClusterMediaSeekCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint64_t positionMilliseconds, Commands::MediaSeek::DecodableType & commandData) { + auto & positionMilliseconds = commandData.positionMilliseconds; + EmberAfMediaPlaybackStatus status = mediaPlaybackClusterSendMediaPlaybackRequest(MEDIA_PLAYBACK_REQUEST_SEEK, positionMilliseconds); sendResponse(command, "MediaSeek", ZCL_MEDIA_SEEK_RESPONSE_COMMAND_ID, status); @@ -182,14 +185,14 @@ bool emberAfMediaPlaybackClusterMediaSeekCallback(app::CommandHandler * command, } bool emberAfMediaPlaybackClusterMediaNextCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::MediaNext::DecodableType & commandData) + Commands::MediaNext::DecodableType & commandData) { EmberAfMediaPlaybackStatus status = mediaPlaybackClusterSendMediaPlaybackRequest(MEDIA_PLAYBACK_REQUEST_NEXT, 0); sendResponse(command, "MediaNext", ZCL_MEDIA_NEXT_RESPONSE_COMMAND_ID, status); return true; } bool emberAfMediaPlaybackClusterMediaStartOverCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::MediaStartOver::DecodableType & commandData) + Commands::MediaStartOver::DecodableType & commandData) { EmberAfMediaPlaybackStatus status = mediaPlaybackClusterSendMediaPlaybackRequest(MEDIA_PLAYBACK_REQUEST_START_OVER, 0); sendResponse(command, "MediaStartOver", ZCL_MEDIA_START_OVER_RESPONSE_COMMAND_ID, status); diff --git a/src/app/clusters/network-commissioning/network-commissioning-ember.cpp b/src/app/clusters/network-commissioning/network-commissioning-ember.cpp index 8141672447050d..64047a0a3af662 100644 --- a/src/app/clusters/network-commissioning/network-commissioning-ember.cpp +++ b/src/app/clusters/network-commissioning/network-commissioning-ember.cpp @@ -36,11 +36,13 @@ using namespace chip; using namespace chip::app::Clusters::NetworkCommissioning; bool emberAfNetworkCommissioningClusterAddThreadNetworkCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - ByteSpan operationalDataset, uint64_t breadcrumb, - uint32_t timeoutMs, + const app::ConcreteCommandPath & commandPath, Commands::AddThreadNetwork::DecodableType & commandData) { + auto & operationalDataset = commandData.operationalDataset; + auto & breadcrumb = commandData.breadcrumb; + auto & timeoutMs = commandData.timeoutMs; + EmberAfNetworkCommissioningError err = app::Clusters::NetworkCommissioning::OnAddThreadNetworkCommandCallbackInternal( nullptr, emberAfCurrentEndpoint(), operationalDataset, breadcrumb, timeoutMs); emberAfSendImmediateDefaultResponse(err == EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_SUCCESS ? EMBER_ZCL_STATUS_SUCCESS @@ -49,11 +51,14 @@ bool emberAfNetworkCommissioningClusterAddThreadNetworkCallback(app::CommandHand } bool emberAfNetworkCommissioningClusterAddWiFiNetworkCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - ByteSpan ssid, ByteSpan credentials, uint64_t breadcrumb, - uint32_t timeoutMs, + const app::ConcreteCommandPath & commandPath, Commands::AddWiFiNetwork::DecodableType & commandData) { + auto & ssid = commandData.ssid; + auto & credentials = commandData.credentials; + auto & breadcrumb = commandData.breadcrumb; + auto & timeoutMs = commandData.timeoutMs; + EmberAfNetworkCommissioningError err = app::Clusters::NetworkCommissioning::OnAddWiFiNetworkCommandCallbackInternal( nullptr, emberAfCurrentEndpoint(), ssid, credentials, breadcrumb, timeoutMs); emberAfSendImmediateDefaultResponse(err == EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_SUCCESS ? EMBER_ZCL_STATUS_SUCCESS @@ -62,10 +67,13 @@ bool emberAfNetworkCommissioningClusterAddWiFiNetworkCallback(app::CommandHandle } bool emberAfNetworkCommissioningClusterEnableNetworkCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - ByteSpan networkID, uint64_t breadcrumb, uint32_t timeoutMs, + const app::ConcreteCommandPath & commandPath, Commands::EnableNetwork::DecodableType & commandData) { + auto & networkID = commandData.networkID; + auto & breadcrumb = commandData.breadcrumb; + auto & timeoutMs = commandData.timeoutMs; + EmberAfNetworkCommissioningError err = app::Clusters::NetworkCommissioning::OnEnableNetworkCommandCallbackInternal( nullptr, emberAfCurrentEndpoint(), networkID, breadcrumb, timeoutMs); emberAfSendImmediateDefaultResponse(err == EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_SUCCESS ? EMBER_ZCL_STATUS_SUCCESS @@ -77,49 +85,65 @@ bool emberAfNetworkCommissioningClusterEnableNetworkCallback(app::CommandHandler // These commands are not implemented thus not handled yet, return false so ember will return a error. bool emberAfNetworkCommissioningClusterDisableNetworkCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - ByteSpan networkID, uint64_t breadcrumb, uint32_t timeoutMs, + const app::ConcreteCommandPath & commandPath, Commands::DisableNetwork::DecodableType & commandData) { + auto & networkID = commandData.networkID; + auto & breadcrumb = commandData.breadcrumb; + auto & timeoutMs = commandData.timeoutMs; + return false; } bool emberAfNetworkCommissioningClusterGetLastNetworkCommissioningResultCallback( - app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, EndpointId endpoint, uint32_t timeoutMs, + app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, Commands::GetLastNetworkCommissioningResult::DecodableType & commandData) { + auto & timeoutMs = commandData.timeoutMs; + return false; } bool emberAfNetworkCommissioningClusterRemoveNetworkCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - ByteSpan NetworkID, uint64_t Breadcrumb, uint32_t TimeoutMs, + const app::ConcreteCommandPath & commandPath, Commands::RemoveNetwork::DecodableType & commandData) { + auto & NetworkID = commandData.NetworkID; + auto & Breadcrumb = commandData.Breadcrumb; + auto & TimeoutMs = commandData.TimeoutMs; + return false; } bool emberAfNetworkCommissioningClusterScanNetworksCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - ByteSpan ssid, uint64_t breadcrumb, uint32_t timeoutMs, + const app::ConcreteCommandPath & commandPath, Commands::ScanNetworks::DecodableType & commandData) { + auto & ssid = commandData.ssid; + auto & breadcrumb = commandData.breadcrumb; + auto & timeoutMs = commandData.timeoutMs; + return false; } bool emberAfNetworkCommissioningClusterUpdateThreadNetworkCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, ByteSpan operationalDataset, - uint64_t breadcrumb, uint32_t timeoutMs, Commands::UpdateThreadNetwork::DecodableType & commandData) { + auto & operationalDataset = commandData.operationalDataset; + auto & breadcrumb = commandData.breadcrumb; + auto & timeoutMs = commandData.timeoutMs; + return false; } bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - ByteSpan ssid, ByteSpan credentials, uint64_t breadcrumb, - uint32_t timeoutMs, + const app::ConcreteCommandPath & commandPath, Commands::UpdateWiFiNetwork::DecodableType & commandData) { + auto & ssid = commandData.ssid; + auto & credentials = commandData.credentials; + auto & breadcrumb = commandData.breadcrumb; + auto & timeoutMs = commandData.timeoutMs; + return false; } diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp index 6d56d1f310d0f0..722cd13edb8091 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -169,7 +169,7 @@ EmberAfStatus emberAfOnOffClusterSetValueCallback(EndpointId endpoint, uint8_t c } bool emberAfOnOffClusterOffCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::Off::DecodableType & commandData) + Commands::Off::DecodableType & commandData) { EmberAfStatus status = emberAfOnOffClusterSetValueCallback(emberAfCurrentEndpoint(), ZCL_OFF_COMMAND_ID, false); #ifdef EMBER_AF_PLUGIN_ZLL_ON_OFF_SERVER @@ -183,7 +183,7 @@ bool emberAfOnOffClusterOffCallback(app::CommandHandler * commandObj, const app: } bool emberAfOnOffClusterOnCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::On::DecodableType & commandData) + Commands::On::DecodableType & commandData) { EmberAfStatus status = emberAfOnOffClusterSetValueCallback(emberAfCurrentEndpoint(), ZCL_ON_COMMAND_ID, false); #ifdef EMBER_AF_PLUGIN_ZLL_ON_OFF_SERVER @@ -197,7 +197,7 @@ bool emberAfOnOffClusterOnCallback(app::CommandHandler * commandObj, const app:: } bool emberAfOnOffClusterToggleCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::Toggle::DecodableType & commandData) + Commands::Toggle::DecodableType & commandData) { EmberAfStatus status = emberAfOnOffClusterSetValueCallback(emberAfCurrentEndpoint(), ZCL_TOGGLE_COMMAND_ID, false); #ifdef EMBER_AF_PLUGIN_ZLL_ON_OFF_SERVER diff --git a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp index 8071567952d28d..14e274e4ad0b73 100644 --- a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp +++ b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp @@ -271,10 +271,11 @@ FabricCleanupExchangeDelegate gFabricCleanupExchangeDelegate; } // namespace bool emberAfOperationalCredentialsClusterRemoveFabricCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - FabricIndex fabricBeingRemoved, + const app::ConcreteCommandPath & commandPath, Commands::RemoveFabric::DecodableType & commandData) { + auto & fabricBeingRemoved = commandData.fabricBeingRemoved; + emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: RemoveFabric"); // TODO: Generate emberAfFabricClusterPrintln EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; @@ -308,9 +309,10 @@ bool emberAfOperationalCredentialsClusterRemoveFabricCallback(app::CommandHandle bool emberAfOperationalCredentialsClusterUpdateFabricLabelCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t * Label, Commands::UpdateFabricLabel::DecodableType & commandData) { + auto & Label = commandData.Label; + emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: UpdateFabricLabel"); EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; @@ -391,11 +393,15 @@ EmberAfNodeOperationalCertStatus ConvertToNOCResponseStatus(CHIP_ERROR err) } // namespace bool emberAfOperationalCredentialsClusterAddNOCCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - ByteSpan NOCValue, ByteSpan ICACValue, ByteSpan IPKValue, - NodeId adminNodeId, uint16_t adminVendorId, + const app::ConcreteCommandPath & commandPath, Commands::AddNOC::DecodableType & commandData) { + auto & NOCValue = commandData.NOCValue; + auto & ICACValue = commandData.ICACValue; + auto & IPKValue = commandData.IPKValue; + auto & adminNodeId = commandData.adminNodeId; + auto & adminVendorId = commandData.adminVendorId; + EmberAfNodeOperationalCertStatus nocResponse = EMBER_ZCL_NODE_OPERATIONAL_CERT_STATUS_SUCCESS; CHIP_ERROR err = CHIP_NO_ERROR; @@ -434,10 +440,12 @@ bool emberAfOperationalCredentialsClusterAddNOCCallback(app::CommandHandler * co } bool emberAfOperationalCredentialsClusterUpdateNOCCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - ByteSpan NOCValue, ByteSpan ICACValue, + const app::ConcreteCommandPath & commandPath, Commands::UpdateNOC::DecodableType & commandData) { + auto & NOCValue = commandData.NOCValue; + auto & ICACValue = commandData.ICACValue; + EmberAfNodeOperationalCertStatus nocResponse = EMBER_ZCL_NODE_OPERATIONAL_CERT_STATUS_SUCCESS; CHIP_ERROR err = CHIP_NO_ERROR; @@ -476,9 +484,11 @@ bool emberAfOperationalCredentialsClusterUpdateNOCCallback(app::CommandHandler * } bool emberAfOperationalCredentialsClusterCertificateChainRequestCallback( - app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, EndpointId endpoint, uint8_t certificateType, + app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, Commands::CertificateChainRequest::DecodableType & commandData) { + auto & certificateType = commandData.certificateType; + CHIP_ERROR err = CHIP_NO_ERROR; emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: commissioner has requested Device Attestation Credentials"); @@ -534,9 +544,10 @@ bool emberAfOperationalCredentialsClusterCertificateChainRequestCallback( bool emberAfOperationalCredentialsClusterAttestationRequestCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, ByteSpan attestationNonce, Commands::AttestationRequest::DecodableType & commandData) { + auto & attestationNonce = commandData.attestationNonce; + CHIP_ERROR err = CHIP_NO_ERROR; TLV::TLVWriter * writer = nullptr; Platform::ScopedMemoryBuffer attestationElements; @@ -619,10 +630,11 @@ bool emberAfOperationalCredentialsClusterAttestationRequestCallback(app::Command } bool emberAfOperationalCredentialsClusterOpCSRRequestCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - ByteSpan CSRNonce, + const app::ConcreteCommandPath & commandPath, Commands::OpCSRRequest::DecodableType & commandData) { + auto & CSRNonce = commandData.CSRNonce; + CHIP_ERROR err = CHIP_NO_ERROR; Platform::ScopedMemoryBuffer csr; @@ -689,9 +701,11 @@ bool emberAfOperationalCredentialsClusterOpCSRRequestCallback(app::CommandHandle } bool emberAfOperationalCredentialsClusterAddTrustedRootCertificateCallback( - app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, EndpointId endpoint, ByteSpan RootCertificate, + app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, Commands::AddTrustedRootCertificate::DecodableType & commandData) { + auto & RootCertificate = commandData.RootCertificate; + EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; emberAfPrintln(EMBER_AF_PRINT_DEBUG, "OpCreds: commissioner has added a trusted root Cert"); @@ -710,9 +724,11 @@ bool emberAfOperationalCredentialsClusterAddTrustedRootCertificateCallback( } bool emberAfOperationalCredentialsClusterRemoveTrustedRootCertificateCallback( - app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - ByteSpan TrustedRootIdentifier, Commands::RemoveTrustedRootCertificate::DecodableType & commandData) + app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, + Commands::RemoveTrustedRootCertificate::DecodableType & commandData) { + auto & TrustedRootIdentifier = commandData.TrustedRootIdentifier; + EmberAfStatus status = EMBER_ZCL_STATUS_FAILURE; emberAfSendImmediateDefaultResponse(status); return true; diff --git a/src/app/clusters/ota-provider/ota-provider.cpp b/src/app/clusters/ota-provider/ota-provider.cpp index fc7087722db5fa..e7cd57c06a06f4 100644 --- a/src/app/clusters/ota-provider/ota-provider.cpp +++ b/src/app/clusters/ota-provider/ota-provider.cpp @@ -73,10 +73,11 @@ bool SendStatusIfDelegateNull(EndpointId endpoint) bool emberAfOtaSoftwareUpdateProviderClusterApplyUpdateRequestCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, ByteSpan updateToken, - uint32_t newVersion, Commands::ApplyUpdateRequest::DecodableType & commandData) { + auto & updateToken = commandData.updateToken; + auto & newVersion = commandData.newVersion; + EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; OTAProviderDelegate * delegate = GetDelegate(endpoint); @@ -113,10 +114,11 @@ bool emberAfOtaSoftwareUpdateProviderClusterApplyUpdateRequestCallback(app::Comm bool emberAfOtaSoftwareUpdateProviderClusterNotifyUpdateAppliedCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, chip::ByteSpan updateToken, - uint32_t softwareVersion, Commands::NotifyUpdateApplied::DecodableType & commandData) { + auto & updateToken = commandData.updateToken; + auto & softwareVersion = commandData.softwareVersion; + EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; OTAProviderDelegate * delegate = GetDelegate(endpoint); diff --git a/src/app/clusters/scenes/scenes.cpp b/src/app/clusters/scenes/scenes.cpp index a098de84aebf42..8bd04251555208 100644 --- a/src/app/clusters/scenes/scenes.cpp +++ b/src/app/clusters/scenes/scenes.cpp @@ -220,25 +220,33 @@ void emAfPluginScenesServerPrintInfo(void) } bool emberAfScenesClusterAddSceneCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, GroupId groupId, uint8_t sceneId, uint16_t transitionTime, - uint8_t * sceneName, uint8_t * extensionFieldSets, Commands::AddScene::DecodableType & commandData) { + auto & groupId = commandData.groupId; + auto & sceneId = commandData.sceneId; + auto & transitionTime = commandData.transitionTime; + auto & sceneName = commandData.sceneName; + auto & extensionFieldSets = commandData.extensionFieldSets; + return emberAfPluginScenesServerParseAddScene(commandObj, emberAfCurrentCommand(), groupId, sceneId, transitionTime, sceneName, extensionFieldSets); } bool emberAfScenesClusterViewSceneCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, GroupId groupId, uint8_t sceneId, Commands::ViewScene::DecodableType & commandData) { + auto & groupId = commandData.groupId; + auto & sceneId = commandData.sceneId; + return emberAfPluginScenesServerParseViewScene(commandObj, emberAfCurrentCommand(), groupId, sceneId); } bool emberAfScenesClusterRemoveSceneCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, GroupId groupId, uint8_t sceneId, Commands::RemoveScene::DecodableType & commandData) { + auto & groupId = commandData.groupId; + auto & sceneId = commandData.sceneId; + EmberAfStatus status = EMBER_ZCL_STATUS_NOT_FOUND; CHIP_ERROR err = CHIP_NO_ERROR; @@ -292,9 +300,10 @@ bool emberAfScenesClusterRemoveSceneCallback(app::CommandHandler * commandObj, c } bool emberAfScenesClusterRemoveAllScenesCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, GroupId groupId, Commands::RemoveAllScenes::DecodableType & commandData) { + auto & groupId = commandData.groupId; + EmberAfStatus status = EMBER_ZCL_STATUS_INVALID_FIELD; CHIP_ERROR err = CHIP_NO_ERROR; @@ -343,9 +352,11 @@ bool emberAfScenesClusterRemoveAllScenesCallback(app::CommandHandler * commandOb } bool emberAfScenesClusterStoreSceneCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, GroupId groupId, uint8_t sceneId, Commands::StoreScene::DecodableType & commandData) { + auto & groupId = commandData.groupId; + auto & sceneId = commandData.sceneId; + EmberAfStatus status; CHIP_ERROR err = CHIP_NO_ERROR; emberAfScenesClusterPrintln("RX: StoreScene 0x%2x, 0x%x", groupId, sceneId); @@ -376,9 +387,12 @@ bool emberAfScenesClusterStoreSceneCallback(app::CommandHandler * commandObj, co } bool emberAfScenesClusterRecallSceneCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, GroupId groupId, uint8_t sceneId, uint16_t transitionTime, Commands::RecallScene::DecodableType & commandData) { + auto & groupId = commandData.groupId; + auto & sceneId = commandData.sceneId; + auto & transitionTime = commandData.transitionTime; + // NOTE: TransitionTime field in the RecallScene command is currently // ignored. Per Zigbee Alliance ZCL 7 (07-5123-07): // @@ -411,9 +425,10 @@ bool emberAfScenesClusterRecallSceneCallback(app::CommandHandler * commandObj, c } bool emberAfScenesClusterGetSceneMembershipCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, GroupId groupId, Commands::GetSceneMembership::DecodableType & commandData) { + auto & groupId = commandData.groupId; + CHIP_ERROR err = CHIP_NO_ERROR; EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; uint8_t sceneCount = 0; diff --git a/src/app/clusters/software_diagnostics_server/software_diagnostics_server.cpp b/src/app/clusters/software_diagnostics_server/software_diagnostics_server.cpp index 749b78dba0b477..78fc6f0dda128d 100644 --- a/src/app/clusters/software_diagnostics_server/software_diagnostics_server.cpp +++ b/src/app/clusters/software_diagnostics_server/software_diagnostics_server.cpp @@ -96,7 +96,7 @@ CHIP_ERROR SoftwareDiagosticsAttrAccess::ReadIfSupported(CHIP_ERROR (PlatformMan } // anonymous namespace bool emberAfSoftwareDiagnosticsClusterResetWatermarksCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, + const app::ConcreteCommandPath & commandPath, Commands::ResetWatermarks::DecodableType & commandData) { uint64_t currentHeapUsed; diff --git a/src/app/clusters/target-navigator-server/target-navigator-server.cpp b/src/app/clusters/target-navigator-server/target-navigator-server.cpp index b0dc1883a5ec8e..c5d4ffed8e07c4 100644 --- a/src/app/clusters/target-navigator-server/target-navigator-server.cpp +++ b/src/app/clusters/target-navigator-server/target-navigator-server.cpp @@ -56,10 +56,12 @@ void sendResponse(app::CommandHandler * command, TargetNavigatorResponse respons } bool emberAfTargetNavigatorClusterNavigateTargetCallback(app::CommandHandler * command, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t target, uint8_t * data, + const app::ConcreteCommandPath & commandPath, Commands::NavigateTarget::DecodableType & commandData) { + auto & target = commandData.target; + auto & data = commandData.data; + // TODO: char is not null terminated, verify this code once #7963 gets merged. std::string dataString(reinterpret_cast(data)); TargetNavigatorResponse response = targetNavigatorClusterNavigateTarget(target, dataString); diff --git a/src/app/clusters/test-cluster-server/test-cluster-server.cpp b/src/app/clusters/test-cluster-server/test-cluster-server.cpp index 2144da3175d0af..0d6d9844b36682 100644 --- a/src/app/clusters/test-cluster-server/test-cluster-server.cpp +++ b/src/app/clusters/test-cluster-server/test-cluster-server.cpp @@ -150,7 +150,7 @@ void emberAfPluginTestClusterServerInitCallback(void) } } -bool emberAfTestClusterClusterTestCallback(app::CommandHandler *, const app::ConcreteCommandPath & commandPath, EndpointId endpoint, +bool emberAfTestClusterClusterTestCallback(app::CommandHandler *, const app::ConcreteCommandPath & commandPath, Commands::Test::DecodableType & commandData) { emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); @@ -181,22 +181,24 @@ bool sendNumericResponse(EndpointId endpoint, app::CommandHandler * apCommandObj } bool emberAfTestClusterClusterTestSpecificCallback(app::CommandHandler * apCommandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::TestSpecific::DecodableType & commandData) + Commands::TestSpecific::DecodableType & commandData) { return sendNumericResponse(endpoint, apCommandObj, Commands::TestSpecificResponse::Id, 7); } bool emberAfTestClusterClusterTestNotHandledCallback(app::CommandHandler *, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::TestNotHandled::DecodableType & commandData) + Commands::TestNotHandled::DecodableType & commandData) { return false; } bool emberAfTestClusterClusterTestAddArgumentsCallback(app::CommandHandler * apCommandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t arg1, uint8_t arg2, + const app::ConcreteCommandPath & commandPath, Commands::TestAddArguments::DecodableType & commandData) { + auto & arg1 = commandData.arg1; + auto & arg2 = commandData.arg2; + if (arg1 > UINT8_MAX - arg2) { return emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_ARGUMENT); diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index 497d588bbb74d4..6af40d86ba5204 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -257,14 +257,14 @@ EmberAfStatus emberAfThermostatClusterServerPreAttributeChangedCallback(chip::En } bool emberAfThermostatClusterClearWeeklyScheduleCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId aEndpointId, + const app::ConcreteCommandPath & commandPath, Commands::ClearWeeklySchedule::DecodableType & commandData) { // TODO return false; } bool emberAfThermostatClusterGetRelayStatusLogCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId aEndpointId, + const app::ConcreteCommandPath & commandPath, Commands::GetRelayStatusLog::DecodableType & commandData) { // TODO @@ -272,20 +272,25 @@ bool emberAfThermostatClusterGetRelayStatusLogCallback(app::CommandHandler * com } bool emberAfThermostatClusterGetWeeklyScheduleCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId aEndpointId, - uint8_t daysToReturn, uint8_t modeToReturn, + const app::ConcreteCommandPath & commandPath, Commands::GetWeeklySchedule::DecodableType & commandData) { + auto & daysToReturn = commandData.daysToReturn; + auto & modeToReturn = commandData.modeToReturn; + // TODO return false; } bool emberAfThermostatClusterSetWeeklyScheduleCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId aEndpointId, - uint8_t numberOfTransitionsForSequence, uint8_t daysOfWeekForSequence, - uint8_t modeForSequence, uint8_t * payload, + const app::ConcreteCommandPath & commandPath, Commands::SetWeeklySchedule::DecodableType & commandData) { + auto & numberOfTransitionsForSequence = commandData.numberOfTransitionsForSequence; + auto & daysOfWeekForSequence = commandData.daysOfWeekForSequence; + auto & modeForSequence = commandData.modeForSequence; + auto & payload = commandData.payload; + // TODO return false; } @@ -434,10 +439,12 @@ int16_t EnforceCoolingSetpointLimits(int16_t CoolingSetpoint, EndpointId endpoin return CoolingSetpoint; } bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId aEndpointId, - uint8_t mode, int8_t amount, + const app::ConcreteCommandPath & commandPath, Commands::SetpointRaiseLower::DecodableType & commandData) { + auto & mode = commandData.mode; + auto & amount = commandData.amount; + int16_t HeatingSetpoint = kDefaultHeatingSetpoint, CoolingSetpoint = kDefaultCoolingSetpoint; // Set to defaults to be safe EmberAfStatus status = EMBER_ZCL_STATUS_FAILURE; EmberAfStatus ReadStatus = EMBER_ZCL_STATUS_FAILURE; diff --git a/src/app/clusters/thread_network_diagnostics_server/thread_network_diagnostics_server.cpp b/src/app/clusters/thread_network_diagnostics_server/thread_network_diagnostics_server.cpp index ab8f40bb5cec3e..cf7376ed7dc131 100644 --- a/src/app/clusters/thread_network_diagnostics_server/thread_network_diagnostics_server.cpp +++ b/src/app/clusters/thread_network_diagnostics_server/thread_network_diagnostics_server.cpp @@ -80,7 +80,7 @@ CHIP_ERROR ThreadDiagosticsAttrAccess::Read(ClusterInfo & aClusterInfo, Attribut } // anonymous namespace bool emberAfThreadNetworkDiagnosticsClusterResetCountsCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, + const app::ConcreteCommandPath & commandPath, Commands::ResetCounts::DecodableType & commandData) { EmberAfStatus status = ThreadNetworkDiagnostics::Attributes::OverrunCount::Set(endpoint, 0); diff --git a/src/app/clusters/tv-channel-server/tv-channel-server.cpp b/src/app/clusters/tv-channel-server/tv-channel-server.cpp index ebee8b104f8655..3f5762bddce6db 100644 --- a/src/app/clusters/tv-channel-server/tv-channel-server.cpp +++ b/src/app/clusters/tv-channel-server/tv-channel-server.cpp @@ -74,9 +74,10 @@ void sendResponse(app::CommandHandler * command, ::TvChannelInfo channelInfo) } bool emberAfTvChannelClusterChangeChannelCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint8_t * match, Commands::ChangeChannel::DecodableType & commandData) { + auto & match = commandData.match; + // TODO: char is not null terminated, verify this code once #7963 gets merged. std::string matchString(reinterpret_cast(match)); // TODO: Enable this once struct as param is supported @@ -87,10 +88,12 @@ bool emberAfTvChannelClusterChangeChannelCallback(app::CommandHandler * command, } bool emberAfTvChannelClusterChangeChannelByNumberCallback(app::CommandHandler * command, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint16_t majorNumber, uint16_t minorNumber, + const app::ConcreteCommandPath & commandPath, Commands::ChangeChannelByNumber::DecodableType & commandData) { + auto & majorNumber = commandData.majorNumber; + auto & minorNumber = commandData.minorNumber; + bool success = tvChannelClusterChangeChannelByNumber(majorNumber, minorNumber); EmberAfStatus status = success ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE; emberAfSendImmediateDefaultResponse(status); @@ -98,9 +101,10 @@ bool emberAfTvChannelClusterChangeChannelByNumberCallback(app::CommandHandler * } bool emberAfTvChannelClusterSkipChannelCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, uint16_t count, Commands::SkipChannel::DecodableType & commandData) { + auto & count = commandData.count; + bool success = tvChannelClusterSkipChannel(count); EmberAfStatus status = success ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE; emberAfSendImmediateDefaultResponse(status); diff --git a/src/app/clusters/wifi_network_diagnostics_server/wifi_network_diagnostics_server.cpp b/src/app/clusters/wifi_network_diagnostics_server/wifi_network_diagnostics_server.cpp index 670ab4fed09c49..0c830ae82e7076 100644 --- a/src/app/clusters/wifi_network_diagnostics_server/wifi_network_diagnostics_server.cpp +++ b/src/app/clusters/wifi_network_diagnostics_server/wifi_network_diagnostics_server.cpp @@ -125,7 +125,7 @@ CHIP_ERROR WiFiDiagosticsAttrAccess::Read(ClusterInfo & aClusterInfo, AttributeV } // anonymous namespace bool emberAfWiFiNetworkDiagnosticsClusterResetCountsCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, + const app::ConcreteCommandPath & commandPath, Commands::ResetCounts::DecodableType & commandData) { EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; diff --git a/src/app/clusters/window-covering-server/window-covering-server.cpp b/src/app/clusters/window-covering-server/window-covering-server.cpp index 0e6b0650c7a253..4726a80bead718 100644 --- a/src/app/clusters/window-covering-server/window-covering-server.cpp +++ b/src/app/clusters/window-covering-server/window-covering-server.cpp @@ -382,7 +382,7 @@ void emberAfWindowCoveringClusterInitCallback(chip::EndpointId endpoint) * @brief Cluster UpOrOpen Command callback (from client) */ bool emberAfWindowCoveringClusterUpOrOpenCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::UpOrOpen::DecodableType & commandData) + Commands::UpOrOpen::DecodableType & commandData) { emberAfWindowCoveringClusterPrint("UpOrOpen command received"); if (HasFeature(endpoint, Features::Lift)) @@ -401,7 +401,7 @@ bool emberAfWindowCoveringClusterUpOrOpenCallback(app::CommandHandler * commandO * @brief Cluster DownOrClose Command callback (from client) */ bool emberAfWindowCoveringClusterDownOrCloseCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - EndpointId endpoint, Commands::DownOrClose::DecodableType & commandData) + Commands::DownOrClose::DecodableType & commandData) { emberAfWindowCoveringClusterPrint("DownOrClose command received"); if (HasFeature(endpoint, Features::Lift)) @@ -433,9 +433,11 @@ emberAfWindowCoveringClusterStopMotionCallback(app::CommandHandler * commandObj, * @brief Cluster GoToLiftValue Command callback (from client) */ bool emberAfWindowCoveringClusterGoToLiftValueCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint16_t liftValue, Commands::GoToLiftValue::DecodableType & commandData) + const app::ConcreteCommandPath & commandPath, + Commands::GoToLiftValue::DecodableType & commandData) { + auto & liftValue = commandData.liftValue; + bool hasLift = HasFeature(endpoint, Features::Lift); bool isPositionAware = HasFeature(endpoint, Features::PositionAware); @@ -457,10 +459,12 @@ bool emberAfWindowCoveringClusterGoToLiftValueCallback(app::CommandHandler * com * @brief Cluster GoToLiftPercentage Command callback (from client) */ bool emberAfWindowCoveringClusterGoToLiftPercentageCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t liftPercentageValue, uint16_t liftPercent100thsValue, + const app::ConcreteCommandPath & commandPath, Commands::GoToLiftPercentage::DecodableType & commandData) { + auto & liftPercentageValue = commandData.liftPercentageValue; + auto & liftPercent100thsValue = commandData.liftPercent100thsValue; + bool hasLift = HasFeature(endpoint, Features::Lift); bool isPositionAware = HasFeature(endpoint, Features::PositionAware); @@ -483,9 +487,11 @@ bool emberAfWindowCoveringClusterGoToLiftPercentageCallback(app::CommandHandler * @brief Cluster GoToTiltValue Command callback (from client) */ bool emberAfWindowCoveringClusterGoToTiltValueCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint16_t tiltValue, Commands::GoToTiltValue::DecodableType & commandData) + const app::ConcreteCommandPath & commandPath, + Commands::GoToTiltValue::DecodableType & commandData) { + auto & tiltValue = commandData.tiltValue; + bool hasTilt = HasFeature(endpoint, Features::Tilt); bool isPositionAware = HasFeature(endpoint, Features::PositionAware); @@ -507,10 +513,12 @@ bool emberAfWindowCoveringClusterGoToTiltValueCallback(app::CommandHandler * com * @brief Cluster GoToTiltPercentage Command callback (from client) */ bool emberAfWindowCoveringClusterGoToTiltPercentageCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, EndpointId endpoint, - uint8_t tiltPercentageValue, uint16_t tiltPercent100thsValue, + const app::ConcreteCommandPath & commandPath, Commands::GoToTiltPercentage::DecodableType & commandData) { + auto & tiltPercentageValue = commandData.tiltPercentageValue; + auto & tiltPercent100thsValue = commandData.tiltPercent100thsValue; + bool hasTilt = HasFeature(endpoint, Features::Tilt); bool isPositionAware = HasFeature(endpoint, Features::PositionAware);