Skip to content

Commit

Permalink
[im] Add command obj to all cluster callbacks (#5994)
Browse files Browse the repository at this point in the history
* [im] Add command object to ZCL callbacks

* apCommandIbj -> commandObj

* Fix new added clusters

* Run Codegen

* Fix dirty merge
  • Loading branch information
erjiaqing authored Apr 21, 2021
1 parent 7d19916 commit 60b896d
Show file tree
Hide file tree
Showing 82 changed files with 1,971 additions and 1,943 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

252 changes: 139 additions & 113 deletions examples/all-clusters-app/all-clusters-common/gen/callback.h

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "esp_log.h"
#include "gen/attribute-id.h"
#include "gen/cluster-id.h"
#include <app/Command.h>
#include <app/server/Mdns.h>
#include <app/util/basic-types.h>
#include <app/util/util.h>
Expand Down Expand Up @@ -174,7 +175,7 @@ void DeviceCallbacks::OnIdentifyPostAttributeChangeCallback(EndpointId endpointI
return;
}

bool emberAfBasicClusterMfgSpecificPingCallback(void)
bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::Command * commandObj)
{
emberAfSendDefaultResponse(emberAfCurrentCommand(), EMBER_ZCL_STATUS_SUCCESS);
return true;
Expand Down
3 changes: 2 additions & 1 deletion examples/all-clusters-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "af.h"
#include "gen/attribute-id.h"
#include "gen/cluster-id.h"
#include <app/Command.h>
#include <app/chip-zcl-zpro-codec.h>
#include <app/server/Mdns.h>
#include <app/util/af-types.h>
Expand All @@ -45,7 +46,7 @@ void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId
uint16_t manufacturerCode, uint8_t type, uint8_t size, uint8_t * value)
{}

bool emberAfBasicClusterMfgSpecificPingCallback(void)
bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::Command * commandObj)
{
emberAfSendDefaultResponse(emberAfCurrentCommand(), EMBER_ZCL_STATUS_SUCCESS);
return true;
Expand Down
42 changes: 22 additions & 20 deletions examples/bridge-app/bridge-common/gen/IMClusterCommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfLevelControlClusterMoveCallback(moveMode, rate, optionMask, optionOverride);
emberAfLevelControlClusterMoveCallback(apCommandObj, moveMode, rate, optionMask, optionOverride);
}
else
{
Expand Down Expand Up @@ -264,7 +264,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfLevelControlClusterMoveToLevelCallback(level, transitionTime, optionMask, optionOverride);
emberAfLevelControlClusterMoveToLevelCallback(apCommandObj, level, transitionTime, optionMask, optionOverride);
}
else
{
Expand Down Expand Up @@ -347,7 +347,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfLevelControlClusterMoveToLevelWithOnOffCallback(level, transitionTime);
emberAfLevelControlClusterMoveToLevelWithOnOffCallback(apCommandObj, level, transitionTime);
}
else
{
Expand Down Expand Up @@ -430,7 +430,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfLevelControlClusterMoveWithOnOffCallback(moveMode, rate);
emberAfLevelControlClusterMoveWithOnOffCallback(apCommandObj, moveMode, rate);
}
else
{
Expand Down Expand Up @@ -561,7 +561,8 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount)
{
// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfLevelControlClusterStepCallback(stepMode, stepSize, transitionTime, optionMask, optionOverride);
emberAfLevelControlClusterStepCallback(apCommandObj, stepMode, stepSize, transitionTime, optionMask,
optionOverride);
}
else
{
Expand Down Expand Up @@ -660,7 +661,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfLevelControlClusterStepWithOnOffCallback(stepMode, stepSize, transitionTime);
emberAfLevelControlClusterStepWithOnOffCallback(apCommandObj, stepMode, stepSize, transitionTime);
}
else
{
Expand Down Expand Up @@ -743,7 +744,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfLevelControlClusterStopCallback(optionMask, optionOverride);
emberAfLevelControlClusterStopCallback(apCommandObj, optionMask, optionOverride);
}
else
{
Expand All @@ -758,7 +759,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
case ZCL_STOP_WITH_ON_OFF_COMMAND_ID: {

// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfLevelControlClusterStopWithOnOffCallback();
emberAfLevelControlClusterStopWithOnOffCallback(apCommandObj);
break;
}
default: {
Expand Down Expand Up @@ -872,7 +873,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfNetworkCommissioningClusterAddThreadNetworkCallback(operationalDataset, breadcrumb, timeoutMs);
emberAfNetworkCommissioningClusterAddThreadNetworkCallback(apCommandObj, operationalDataset, breadcrumb, timeoutMs);
}
else
{
Expand Down Expand Up @@ -995,7 +996,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfNetworkCommissioningClusterAddWiFiNetworkCallback(ssid, credentials, breadcrumb, timeoutMs);
emberAfNetworkCommissioningClusterAddWiFiNetworkCallback(apCommandObj, ssid, credentials, breadcrumb, timeoutMs);
}
else
{
Expand Down Expand Up @@ -1098,7 +1099,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfNetworkCommissioningClusterDisableNetworkCallback(networkID, breadcrumb, timeoutMs);
emberAfNetworkCommissioningClusterDisableNetworkCallback(apCommandObj, networkID, breadcrumb, timeoutMs);
}
else
{
Expand Down Expand Up @@ -1201,7 +1202,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfNetworkCommissioningClusterEnableNetworkCallback(networkID, breadcrumb, timeoutMs);
emberAfNetworkCommissioningClusterEnableNetworkCallback(apCommandObj, networkID, breadcrumb, timeoutMs);
}
else
{
Expand Down Expand Up @@ -1268,7 +1269,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfNetworkCommissioningClusterGetLastNetworkCommissioningResultCallback(timeoutMs);
emberAfNetworkCommissioningClusterGetLastNetworkCommissioningResultCallback(apCommandObj, timeoutMs);
}
else
{
Expand Down Expand Up @@ -1371,7 +1372,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfNetworkCommissioningClusterRemoveNetworkCallback(NetworkID, Breadcrumb, TimeoutMs);
emberAfNetworkCommissioningClusterRemoveNetworkCallback(apCommandObj, NetworkID, Breadcrumb, TimeoutMs);
}
else
{
Expand Down Expand Up @@ -1474,7 +1475,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfNetworkCommissioningClusterScanNetworksCallback(ssid, breadcrumb, timeoutMs);
emberAfNetworkCommissioningClusterScanNetworksCallback(apCommandObj, ssid, breadcrumb, timeoutMs);
}
else
{
Expand Down Expand Up @@ -1577,7 +1578,8 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfNetworkCommissioningClusterUpdateThreadNetworkCallback(operationalDataset, breadcrumb, timeoutMs);
emberAfNetworkCommissioningClusterUpdateThreadNetworkCallback(apCommandObj, operationalDataset, breadcrumb,
timeoutMs);
}
else
{
Expand Down Expand Up @@ -1700,7 +1702,7 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfNetworkCommissioningClusterUpdateWiFiNetworkCallback(ssid, credentials, breadcrumb, timeoutMs);
emberAfNetworkCommissioningClusterUpdateWiFiNetworkCallback(apCommandObj, ssid, credentials, breadcrumb, timeoutMs);
}
else
{
Expand Down Expand Up @@ -1735,19 +1737,19 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
case ZCL_OFF_COMMAND_ID: {

// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfOnOffClusterOffCallback();
emberAfOnOffClusterOffCallback(apCommandObj);
break;
}
case ZCL_ON_COMMAND_ID: {

// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfOnOffClusterOnCallback();
emberAfOnOffClusterOnCallback(apCommandObj);
break;
}
case ZCL_TOGGLE_COMMAND_ID: {

// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfOnOffClusterToggleCallback();
emberAfOnOffClusterToggleCallback(apCommandObj);
break;
}
default: {
Expand Down
Loading

0 comments on commit 60b896d

Please sign in to comment.