Skip to content

Commit

Permalink
regen files
Browse files Browse the repository at this point in the history
  • Loading branch information
shana-apple committed May 5, 2021
1 parent a2bea4a commit 3dce0d2
Show file tree
Hide file tree
Showing 44 changed files with 360 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7023,6 +7023,12 @@ void DispatchServerCommand(app::Command * apCommandObj, CommandId aCommandId, En
{
switch (aCommandId)
{
case ZCL_REMOVE_ALL_FABRICS_COMMAND_ID: {

// TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
emberAfOperationalCredentialsClusterRemoveAllFabricsCallback(apCommandObj);
break;
}
case ZCL_REMOVE_FABRIC_COMMAND_ID: {
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2310,6 +2310,10 @@ EmberAfStatus emberAfOperationalCredentialsClusterServerCommandParse(EmberAfClus
{
switch (cmd->commandId)
{
case ZCL_REMOVE_ALL_FABRICS_COMMAND_ID: {
wasHandled = emberAfOperationalCredentialsClusterRemoveAllFabricsCallback(nullptr);
break;
}
case ZCL_REMOVE_FABRIC_COMMAND_ID: {
uint16_t payloadOffset = cmd->payloadStartIndex;
chip::FabricId FabricId;
Expand Down
6 changes: 6 additions & 0 deletions examples/all-clusters-app/all-clusters-common/gen/callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -2718,6 +2718,12 @@ bool emberAfOnOffClusterOnCallback(chip::app::Command * commandObj);

bool emberAfOnOffClusterToggleCallback(chip::app::Command * commandObj);

/**
* @brief Operational Credentials Cluster RemoveAllFabrics Command callback
*/

bool emberAfOperationalCredentialsClusterRemoveAllFabricsCallback(chip::app::Command * commandObj);

/**
* @brief Operational Credentials Cluster RemoveFabric Command callback
* @param fabricId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2217,6 +2217,15 @@
\
ZCL_SET_FABRIC_RESPONSE_COMMAND_ID, "u", FabricId);

/** @brief Command description for RemoveAllFabrics
*
* Command: RemoveAllFabrics
*/
#define emberAfFillCommandOperational \
CredentialsClusterRemoveAllFabrics() emberAfFillExternalBuffer(mask, \
\
ZCL_REMOVE_ALL_FABRICS_COMMAND_ID, "", );

/** @brief Command description for UpdateFabricLabel
*
* Command: UpdateFabricLabel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@
// Commands for cluster: Operational Credentials
#define ZCL_SET_FABRIC_COMMAND_ID (0x00)
#define ZCL_SET_FABRIC_RESPONSE_COMMAND_ID (0x01)
#define ZCL_REMOVE_ALL_FABRICS_COMMAND_ID (0x02)
#define ZCL_UPDATE_FABRIC_LABEL_COMMAND_ID (0x09)
#define ZCL_REMOVE_FABRIC_COMMAND_ID (0x0A)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@

// Array of EmberAfCommandMetadata structs.
#define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask
#define EMBER_AF_GENERATED_COMMAND_COUNT (140)
#define EMBER_AF_GENERATED_COMMAND_COUNT (141)
#define GENERATED_COMMANDS \
{ \
\
Expand Down Expand Up @@ -1304,6 +1304,7 @@
/* Endpoint: 0, Cluster: Operational Credentials (server) */ \
{ 0x003E, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* SetFabric */ \
{ 0x003E, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* SetFabricResponse */ \
{ 0x003E, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveAllFabrics */ \
{ 0x003E, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* UpdateFabricLabel */ \
{ 0x003E, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveFabric */ \
\
Expand Down
9 changes: 9 additions & 0 deletions examples/bridge-app/bridge-common/gen/client-command-macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -2217,6 +2217,15 @@
\
ZCL_SET_FABRIC_RESPONSE_COMMAND_ID, "u", FabricId);

/** @brief Command description for RemoveAllFabrics
*
* Command: RemoveAllFabrics
*/
#define emberAfFillCommandOperational \
CredentialsClusterRemoveAllFabrics() emberAfFillExternalBuffer(mask, \
\
ZCL_REMOVE_ALL_FABRICS_COMMAND_ID, "", );

/** @brief Command description for UpdateFabricLabel
*
* Command: UpdateFabricLabel
Expand Down
1 change: 1 addition & 0 deletions examples/bridge-app/bridge-common/gen/command-id.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@
// Commands for cluster: Operational Credentials
#define ZCL_SET_FABRIC_COMMAND_ID (0x00)
#define ZCL_SET_FABRIC_RESPONSE_COMMAND_ID (0x01)
#define ZCL_REMOVE_ALL_FABRICS_COMMAND_ID (0x02)
#define ZCL_UPDATE_FABRIC_LABEL_COMMAND_ID (0x09)
#define ZCL_REMOVE_FABRIC_COMMAND_ID (0x0A)

Expand Down
37 changes: 34 additions & 3 deletions examples/chip-tool/commands/clusters/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -10498,6 +10498,7 @@ class ReadOnOffClusterRevision : public ModelCommand
| Cluster OperationalCredentials | 0x003E |
|------------------------------------------------------------------------------|
| Commands: | |
| * RemoveAllFabrics | 0x02 |
| * RemoveFabric | 0x0A |
| * SetFabric | 0x00 |
| * UpdateFabricLabel | 0x09 |
Expand All @@ -10507,6 +10508,35 @@ class ReadOnOffClusterRevision : public ModelCommand
| * ClusterRevision | 0xFFFD |
\*----------------------------------------------------------------------------*/

/*
* Command RemoveAllFabrics
*/
class OperationalCredentialsRemoveAllFabrics : public ModelCommand
{
public:
OperationalCredentialsRemoveAllFabrics() : ModelCommand("remove-all-fabrics") { ModelCommand::AddArguments(); }
~OperationalCredentialsRemoveAllFabrics()
{
delete onSuccessCallback;
delete onFailureCallback;
}

CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
{
ChipLogProgress(chipTool, "Sending cluster (0x003E) command (0x02) on endpoint %" PRIu16, endpointId);

chip::Controller::OperationalCredentialsCluster cluster;
cluster.Associate(device, endpointId);
return cluster.RemoveAllFabrics(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
}

private:
chip::Callback::Callback<DefaultSuccessCallback> * onSuccessCallback =
new chip::Callback::Callback<DefaultSuccessCallback>(OnDefaultSuccessResponse, this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};

/*
* Command RemoveFabric
*/
Expand Down Expand Up @@ -14923,9 +14953,10 @@ void registerClusterOperationalCredentials(Commands & commands)
const char * clusterName = "OperationalCredentials";

commands_list clusterCommands = {
make_unique<OperationalCredentialsRemoveFabric>(), make_unique<OperationalCredentialsSetFabric>(),
make_unique<OperationalCredentialsUpdateFabricLabel>(), make_unique<DiscoverOperationalCredentialsAttributes>(),
make_unique<ReadOperationalCredentialsFabricsList>(), make_unique<ReadOperationalCredentialsClusterRevision>(),
make_unique<OperationalCredentialsRemoveAllFabrics>(), make_unique<OperationalCredentialsRemoveFabric>(),
make_unique<OperationalCredentialsSetFabric>(), make_unique<OperationalCredentialsUpdateFabricLabel>(),
make_unique<DiscoverOperationalCredentialsAttributes>(), make_unique<ReadOperationalCredentialsFabricsList>(),
make_unique<ReadOperationalCredentialsClusterRevision>(),
};

commands.Register(clusterName, clusterCommands);
Expand Down
26 changes: 26 additions & 0 deletions examples/chip-tool/gen/CHIPClusters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4511,6 +4511,32 @@ CHIP_ERROR OnOffCluster::ReadAttributeClusterRevision(Callback::Cancelable * onS
}

// OperationalCredentials Cluster Commands
CHIP_ERROR OperationalCredentialsCluster::RemoveAllFabrics(Callback::Cancelable * onSuccessCallback,
Callback::Cancelable * onFailureCallback)
{
#if CHIP_ENABLE_INTERACTION_MODEL
VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
(void) onSuccessCallback;
(void) onFailureCallback;

app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kRemoveAllFabricsCommandId,
(chip::app::CommandPathFlags::kEndpointIdValid) };
app::Command * ZCLcommand = mDevice->GetCommandSender();

ReturnErrorOnFailure(ZCLcommand->PrepareCommand(&cmdParams));

// Command takes no arguments.

ReturnErrorOnFailure(ZCLcommand->FinishCommand());

return mDevice->SendCommands();
#else
uint8_t seqNum = mDevice->GetNextSequenceNumber();
System::PacketBufferHandle encodedCommand = encodeOperationalCredentialsClusterRemoveAllFabricsCommand(seqNum, mEndpoint);
return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
#endif
}

CHIP_ERROR OperationalCredentialsCluster::RemoveFabric(Callback::Cancelable * onSuccessCallback,
Callback::Cancelable * onFailureCallback, chip::FabricId fabricId,
chip::NodeId nodeId, uint16_t vendorId)
Expand Down
2 changes: 2 additions & 0 deletions examples/chip-tool/gen/CHIPClusters.h
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,7 @@ class DLL_EXPORT OperationalCredentialsCluster : public ClusterBase
~OperationalCredentialsCluster() {}

// Cluster Commands
CHIP_ERROR RemoveAllFabrics(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR RemoveFabric(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::FabricId fabricId, chip::NodeId nodeId, uint16_t vendorId);
CHIP_ERROR SetFabric(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t vendorId);
Expand All @@ -829,6 +830,7 @@ class DLL_EXPORT OperationalCredentialsCluster : public ClusterBase
CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);

private:
static constexpr CommandId kRemoveAllFabricsCommandId = 0x02;
static constexpr CommandId kRemoveFabricCommandId = 0x0A;
static constexpr CommandId kSetFabricCommandId = 0x00;
static constexpr CommandId kUpdateFabricLabelCommandId = 0x09;
Expand Down
1 change: 1 addition & 0 deletions examples/chip-tool/gen/CHIPClustersObjc.h
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
@interface CHIPOperationalCredentials : CHIPCluster

- (void)removeAllFabrics:(ResponseHandler)responseHandler;
- (void)removeFabric:(uint64_t)fabricId
nodeId:(uint64_t)nodeId
vendorId:(uint16_t)vendorId
Expand Down
26 changes: 26 additions & 0 deletions examples/chip-tool/gen/CHIPClustersObjc.mm
Original file line number Diff line number Diff line change
Expand Up @@ -10180,6 +10180,32 @@ @implementation CHIPOperationalCredentials
return &_cppCluster;
}

- (void)removeAllFabrics:(ResponseHandler)responseHandler
{
CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(responseHandler, [self callbackQueue]);
if (!onSuccess) {
responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}

CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]);
if (!onFailure) {
delete onSuccess;
responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
return;
}

__block CHIP_ERROR err;
dispatch_sync([self chipWorkQueue], ^{
err = self.cppCluster.RemoveAllFabrics(onSuccess->Cancel(), onFailure->Cancel());
});

if (err != CHIP_NO_ERROR) {
delete onSuccess;
delete onFailure;
responseHandler([CHIPError errorForCHIPErrorCode:err], nil);
}
}
- (void)removeFabric:(uint64_t)fabricId
nodeId:(uint64_t)nodeId
vendorId:(uint16_t)vendorId
Expand Down
9 changes: 9 additions & 0 deletions examples/chip-tool/gen/client-command-macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -2217,6 +2217,15 @@
\
ZCL_SET_FABRIC_RESPONSE_COMMAND_ID, "u", FabricId);

/** @brief Command description for RemoveAllFabrics
*
* Command: RemoveAllFabrics
*/
#define emberAfFillCommandOperational \
CredentialsClusterRemoveAllFabrics() emberAfFillExternalBuffer(mask, \
\
ZCL_REMOVE_ALL_FABRICS_COMMAND_ID, "", );

/** @brief Command description for UpdateFabricLabel
*
* Command: UpdateFabricLabel
Expand Down
1 change: 1 addition & 0 deletions examples/chip-tool/gen/command-id.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@
// Commands for cluster: Operational Credentials
#define ZCL_SET_FABRIC_COMMAND_ID (0x00)
#define ZCL_SET_FABRIC_RESPONSE_COMMAND_ID (0x01)
#define ZCL_REMOVE_ALL_FABRICS_COMMAND_ID (0x02)
#define ZCL_UPDATE_FABRIC_LABEL_COMMAND_ID (0x09)
#define ZCL_REMOVE_FABRIC_COMMAND_ID (0x0A)

Expand Down
3 changes: 2 additions & 1 deletion examples/chip-tool/gen/endpoint_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@

// Array of EmberAfCommandMetadata structs.
#define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask
#define EMBER_AF_GENERATED_COMMAND_COUNT (191)
#define EMBER_AF_GENERATED_COMMAND_COUNT (192)
#define GENERATED_COMMANDS \
{ \
\
Expand Down Expand Up @@ -408,6 +408,7 @@
/* Endpoint: 1, Cluster: Operational Credentials (client) */ \
{ 0x003E, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* SetFabric */ \
{ 0x003E, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* SetFabricResponse */ \
{ 0x003E, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveAllFabrics */ \
{ 0x003E, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* UpdateFabricLabel */ \
{ 0x003E, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveFabric */ \
\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2217,6 +2217,15 @@
\
ZCL_SET_FABRIC_RESPONSE_COMMAND_ID, "u", FabricId);

/** @brief Command description for RemoveAllFabrics
*
* Command: RemoveAllFabrics
*/
#define emberAfFillCommandOperational \
CredentialsClusterRemoveAllFabrics() emberAfFillExternalBuffer(mask, \
\
ZCL_REMOVE_ALL_FABRICS_COMMAND_ID, "", );

/** @brief Command description for UpdateFabricLabel
*
* Command: UpdateFabricLabel
Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/lighting-common/gen/command-id.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@
// Commands for cluster: Operational Credentials
#define ZCL_SET_FABRIC_COMMAND_ID (0x00)
#define ZCL_SET_FABRIC_RESPONSE_COMMAND_ID (0x01)
#define ZCL_REMOVE_ALL_FABRICS_COMMAND_ID (0x02)
#define ZCL_UPDATE_FABRIC_LABEL_COMMAND_ID (0x09)
#define ZCL_REMOVE_FABRIC_COMMAND_ID (0x0A)

Expand Down
9 changes: 9 additions & 0 deletions examples/lock-app/lock-common/gen/client-command-macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -2217,6 +2217,15 @@
\
ZCL_SET_FABRIC_RESPONSE_COMMAND_ID, "u", FabricId);

/** @brief Command description for RemoveAllFabrics
*
* Command: RemoveAllFabrics
*/
#define emberAfFillCommandOperational \
CredentialsClusterRemoveAllFabrics() emberAfFillExternalBuffer(mask, \
\
ZCL_REMOVE_ALL_FABRICS_COMMAND_ID, "", );

/** @brief Command description for UpdateFabricLabel
*
* Command: UpdateFabricLabel
Expand Down
1 change: 1 addition & 0 deletions examples/lock-app/lock-common/gen/command-id.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@
// Commands for cluster: Operational Credentials
#define ZCL_SET_FABRIC_COMMAND_ID (0x00)
#define ZCL_SET_FABRIC_RESPONSE_COMMAND_ID (0x01)
#define ZCL_REMOVE_ALL_FABRICS_COMMAND_ID (0x02)
#define ZCL_UPDATE_FABRIC_LABEL_COMMAND_ID (0x09)
#define ZCL_REMOVE_FABRIC_COMMAND_ID (0x0A)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2217,6 +2217,15 @@
\
ZCL_SET_FABRIC_RESPONSE_COMMAND_ID, "u", FabricId);

/** @brief Command description for RemoveAllFabrics
*
* Command: RemoveAllFabrics
*/
#define emberAfFillCommandOperational \
CredentialsClusterRemoveAllFabrics() emberAfFillExternalBuffer(mask, \
\
ZCL_REMOVE_ALL_FABRICS_COMMAND_ID, "", );

/** @brief Command description for UpdateFabricLabel
*
* Command: UpdateFabricLabel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@
// Commands for cluster: Operational Credentials
#define ZCL_SET_FABRIC_COMMAND_ID (0x00)
#define ZCL_SET_FABRIC_RESPONSE_COMMAND_ID (0x01)
#define ZCL_REMOVE_ALL_FABRICS_COMMAND_ID (0x02)
#define ZCL_UPDATE_FABRIC_LABEL_COMMAND_ID (0x09)
#define ZCL_REMOVE_FABRIC_COMMAND_ID (0x0A)

Expand Down
Loading

0 comments on commit 3dce0d2

Please sign in to comment.