Skip to content

Commit

Permalink
Update cluster callback signatures to the new signature.
Browse files Browse the repository at this point in the history
This commit was generated by running:

  find src/app/clusters examples/tv-app/linux/include/content-launcher examples/window-app/common/src -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef; } s/bool emberAf([a-zA-Z0-9]*)Cluster([a-zA-Z0-9]*)Callback\((?:chip::)?EndpointId (aEndpoint|endpoint|aEndpointId),\s*(?:chip::)?((?:app::)?CommandHandler \*(?: commandObj| command| apCommandObj|))([^)]*)\)/bool emberAf\1Cluster\2Callback(\4, const app::ConcreteCommandPath & commandPath, EndpointId \3\5, Commands::\2::DecodableType & fields)/g;'

and then restyling the modified files.
  • Loading branch information
bzbarsky-apple committed Oct 2, 2021
1 parent 3195ad8 commit 47de348
Show file tree
Hide file tree
Showing 37 changed files with 493 additions and 269 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ static void sendResponse(const char * responseName, ContentLaunchResponse launch
}
}

bool emberAfContentLauncherClusterLaunchContentCallback(chip::EndpointId endpoint, chip::app::CommandHandler * command,
bool autoplay, unsigned char * data)
bool emberAfContentLauncherClusterLaunchContentCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath,
EndpointId endpoint, bool autoplay, unsigned char * data,
Commands::LaunchContent::DecodableType & fields)
{

string dataString(reinterpret_cast<char *>(data));
Expand All @@ -114,8 +115,9 @@ bool emberAfContentLauncherClusterLaunchContentCallback(chip::EndpointId endpoin
return true;
}

bool emberAfContentLauncherClusterLaunchURLCallback(chip::EndpointId endpoint, chip::app::CommandHandler * command,
unsigned char * contentUrl, unsigned char * displayString)
bool emberAfContentLauncherClusterLaunchURLCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath,
EndpointId endpoint, unsigned char * contentUrl, unsigned char * displayString,
Commands::LaunchURL::DecodableType & fields)
{
string contentUrlString(reinterpret_cast<char *>(contentUrl));
string displayStringString(reinterpret_cast<char *>(displayString));
Expand Down
3 changes: 2 additions & 1 deletion examples/window-app/common/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ void emberAfPostAttributeChangeCallback(chip::EndpointId endpoint, chip::Cluster
/**
* @brief Cluster StopMotion Command callback (from client)
*/
bool emberAfWindowCoveringClusterStopMotionCallback(chip::EndpointId endpoint, chip::app::CommandHandler * commandObj)
bool emberAfWindowCoveringClusterStopMotionCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
EndpointId endpoint, Commands::StopMotion::DecodableType & fields)
{
ChipLogProgress(Zcl, "StopMotion command received");
WindowApp::Instance().PostEvent(WindowApp::Event(WindowApp::EventId::StopMotion, endpoint));
Expand Down
10 changes: 6 additions & 4 deletions src/app/clusters/account-login-server/account-login-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ void sendResponse(app::CommandHandler * command, const char * responseSetupPin)
}
}

bool emberAfAccountLoginClusterGetSetupPINCallback(EndpointId endpoint, app::CommandHandler * command,
uint8_t * tempAccountIdentifier)
bool emberAfAccountLoginClusterGetSetupPINCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath,
EndpointId endpoint, uint8_t * tempAccountIdentifier,
Commands::GetSetupPIN::DecodableType & fields)
{
// TODO: char is not null terminated, verify this code once #7963 gets merged.
std::string tempAccountIdentifierString(reinterpret_cast<char *>(tempAccountIdentifier));
Expand All @@ -59,8 +60,9 @@ bool emberAfAccountLoginClusterGetSetupPINCallback(EndpointId endpoint, app::Com
return true;
}

bool emberAfAccountLoginClusterLoginCallback(EndpointId endpoint, app::CommandHandler * command, uint8_t * tempAccountIdentifier,
uint8_t * tempSetupPin)
bool emberAfAccountLoginClusterLoginCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath,
EndpointId endpoint, uint8_t * tempAccountIdentifier, uint8_t * tempSetupPin,
Commands::Login::DecodableType & fields)
{
// TODO: char is not null terminated, verify this code once #7963 gets merged.
std::string tempAccountIdentifierString(reinterpret_cast<char *>(tempAccountIdentifier));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ using namespace chip;
// Specifications section 5.4.2.3. Announcement Duration
constexpr uint32_t kMaxCommissionioningTimeoutSeconds = 15 * 60;

bool emberAfAdministratorCommissioningClusterOpenCommissioningWindowCallback(EndpointId endpoint, app::CommandHandler * commandObj,
uint16_t commissioningTimeout, ByteSpan pakeVerifier,
uint16_t discriminator, uint32_t iterations,
ByteSpan salt, uint16_t passcodeID)
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 & fields)
{
EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS;
PASEVerifier verifier;
Expand Down Expand Up @@ -70,9 +70,9 @@ bool emberAfAdministratorCommissioningClusterOpenCommissioningWindowCallback(End
return true;
}

bool emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallback(EndpointId endpoint,
app::CommandHandler * commandObj,
uint16_t commissioningTimeout)
bool emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallback(
app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, EndpointId endpoint,
uint16_t commissioningTimeout, Commands::OpenBasicCommissioningWindow::DecodableType & fields)
{
EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS;
ChipLogProgress(Zcl, "Received command to open basic commissioning window");
Expand All @@ -93,7 +93,10 @@ bool emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallbac
return true;
}

bool emberAfAdministratorCommissioningClusterRevokeCommissioningCallback(EndpointId endpoint, app::CommandHandler * commandObj)
bool emberAfAdministratorCommissioningClusterRevokeCommissioningCallback(app::CommandHandler * commandObj,
const app::ConcreteCommandPath & commandPath,
EndpointId endpoint,
Commands::RevokeCommissioning::DecodableType & fields)
{
ChipLogProgress(Zcl, "Received command to close commissioning window");
Server::GetInstance().GetCommissioningWindowManager().CloseCommissioningWindow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ using namespace chip;

bool applicationBasicClusterChangeApplicationStatus(EmberAfApplicationBasicStatus status, EndpointId endpoint);

bool emberAfApplicationBasicClusterChangeStatusCallback(EndpointId endpoint, app::CommandHandler * commandObj,
uint8_t newApplicationStatus)
bool emberAfApplicationBasicClusterChangeStatusCallback(app::CommandHandler * commandObj,
const app::ConcreteCommandPath & commandPath, EndpointId endpoint,
uint8_t newApplicationStatus,
Commands::ChangeStatus::DecodableType & fields)
{
bool success = applicationBasicClusterChangeApplicationStatus(static_cast<EmberAfApplicationBasicStatus>(newApplicationStatus),
emberAfCurrentEndpoint());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ using namespace chip;

ApplicationLauncherResponse applicationLauncherClusterLaunchApp(ApplicationLauncherApp application, std::string data);

bool emberAfApplicationLauncherClusterLaunchAppCallback(EndpointId endpoint, app::CommandHandler * commandObj, uint8_t *, uint8_t *)
bool emberAfApplicationLauncherClusterLaunchAppCallback(app::CommandHandler * commandObj,
const app::ConcreteCommandPath & commandPath, EndpointId endpoint,
uint8_t *, uint8_t *, Commands::LaunchApp::DecodableType & fields)
{
EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS;
emberAfSendImmediateDefaultResponse(status);
Expand Down Expand Up @@ -67,8 +69,10 @@ ApplicationLauncherApp getApplicationFromCommand(uint16_t catalogVendorId, uint8
return application;
}

bool emberAfApplicationLauncherClusterLaunchAppCallback(EndpointId endpoint, app::CommandHandler * command, uint8_t * requestData,
uint16_t requestApplicationCatalogVendorId, uint8_t * requestApplicationId)
bool emberAfApplicationLauncherClusterLaunchAppCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath,
EndpointId endpoint, uint8_t * requestData,
uint16_t requestApplicationCatalogVendorId, uint8_t * requestApplicationId,
Commands::LaunchApp::DecodableType & fields)
{
ApplicationLauncherApp application = getApplicationFromCommand(requestApplicationCatalogVendorId, requestApplicationId);
// TODO: Char is not null terminated, verify this code once #7963 gets merged.
Expand Down
9 changes: 6 additions & 3 deletions src/app/clusters/audio-output-server/audio-output-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,19 @@ using namespace chip;
bool audioOutputClusterSelectOutput(uint8_t index);
bool audioOutputClusterRenameOutput(uint8_t index, uint8_t * name);

bool emberAfAudioOutputClusterRenameOutputCallback(EndpointId endpoint, app::CommandHandler * command, 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 & fields)
{
bool success = audioOutputClusterRenameOutput(index, name);
EmberAfStatus status = success ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE;
emberAfSendImmediateDefaultResponse(status);
return true;
}

bool emberAfAudioOutputClusterSelectOutputCallback(EndpointId endpoint, app::CommandHandler * command, uint8_t index)
bool emberAfAudioOutputClusterSelectOutputCallback(app::CommandHandler * command, const app::ConcreteCommandPath & commandPath,
EndpointId endpoint, uint8_t index,
Commands::SelectOutput::DecodableType & fields)
{
bool success = audioOutputClusterSelectOutput(index);
EmberAfStatus status = success ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,10 @@ static void sendDefaultResponse(EmberAfStatus status)
}
}

bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback(EndpointId aEndpoint, app::CommandHandler * commandObj,
uint8_t percentOpen)
bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback(app::CommandHandler * commandObj,
const app::ConcreteCommandPath & commandPath,
EndpointId aEndpoint, uint8_t percentOpen,
Commands::BarrierControlGoToPercent::DecodableType & fields)
{
EndpointId endpoint = emberAfCurrentCommand()->apsFrame->destinationEndpoint;
EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS;
Expand Down Expand Up @@ -339,7 +341,9 @@ bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback(EndpointId aE
return true;
}

bool emberAfBarrierControlClusterBarrierControlStopCallback(EndpointId aEndpoint, app::CommandHandler * commandObj)
bool emberAfBarrierControlClusterBarrierControlStopCallback(app::CommandHandler * commandObj,
const app::ConcreteCommandPath & commandPath, EndpointId aEndpoint,
Commands::BarrierControlStop::DecodableType & fields)
{
EndpointId endpoint = emberAfCurrentCommand()->apsFrame->destinationEndpoint;
emberAfDeactivateServerTick(endpoint, BarrierControl::Id);
Expand Down
10 changes: 6 additions & 4 deletions src/app/clusters/bindings/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ EmberStatus getUnusedBindingIndex(uint8_t * bindingIndex)
return EMBER_NOT_FOUND;
}

bool emberAfBindingClusterBindCallback(EndpointId endpoint, app::CommandHandler * commandObj, NodeId nodeId, GroupId groupId,
EndpointId endpointId, ClusterId clusterId)
bool emberAfBindingClusterBindCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
EndpointId endpoint, NodeId nodeId, GroupId groupId, EndpointId endpointId,
ClusterId clusterId, Commands::Bind::DecodableType & fields)
{
ChipLogDetail(Zcl, "RX: BindCallback");

Expand Down Expand Up @@ -118,8 +119,9 @@ bool emberAfBindingClusterBindCallback(EndpointId endpoint, app::CommandHandler
return true;
}

bool emberAfBindingClusterUnbindCallback(EndpointId endpoint, app::CommandHandler * commandObj, NodeId nodeId, GroupId groupId,
EndpointId endpointId, ClusterId clusterId)
bool emberAfBindingClusterUnbindCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
EndpointId endpoint, NodeId nodeId, GroupId groupId, EndpointId endpointId,
ClusterId clusterId, Commands::Unbind::DecodableType & fields)
{
ChipLogDetail(Zcl, "RX: UnbindCallback");

Expand Down
Loading

0 comments on commit 47de348

Please sign in to comment.