Skip to content

Commit

Permalink
Update gen/ folders
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien-apple committed May 17, 2021
1 parent 55cf22f commit f65cad4
Show file tree
Hide file tree
Showing 11 changed files with 621 additions and 91 deletions.
196 changes: 114 additions & 82 deletions examples/chip-tool/chip-tool.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,88 @@
}
]
},
{
"name": "General Diagnostics",
"code": 51,
"mfgCode": null,
"define": "GENERAL_DIAGNOSTICS_CLUSTER",
"side": "client",
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "client",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "General Diagnostics",
"code": 51,
"mfgCode": null,
"define": "GENERAL_DIAGNOSTICS_CLUSTER",
"side": "server",
"enabled": 0,
"commands": [],
"attributes": [
{
"name": "NetworkInterfaces",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "RebootCount",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0000",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "Thread Network Diagnostics",
"code": 53,
Expand Down Expand Up @@ -2462,88 +2544,6 @@
}
]
},
{
"name": "General Diagnostics",
"code": 51,
"mfgCode": null,
"define": "GENERAL_DIAGNOSTICS_CLUSTER",
"side": "client",
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "client",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "General Diagnostics",
"code": 51,
"mfgCode": null,
"define": "GENERAL_DIAGNOSTICS_CLUSTER",
"side": "server",
"enabled": 0,
"commands": [],
"attributes": [
{
"name": "NetworkInterfaces",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "RebootCount",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0000",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "Switch",
"code": 59,
Expand Down Expand Up @@ -2657,6 +2657,22 @@
"incoming": 1,
"outgoing": 1
},
{
"name": "OpCSRRequest",
"code": 4,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "AddOpCert",
"code": 6,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "UpdateFabricLabel",
"code": 9,
Expand Down Expand Up @@ -2715,6 +2731,22 @@
"source": "server",
"incoming": 1,
"outgoing": 1
},
{
"name": "OpCSRResponse",
"code": 5,
"mfgCode": null,
"source": "server",
"incoming": 1,
"outgoing": 1
},
{
"name": "OpCertResponse",
"code": 8,
"mfgCode": null,
"source": "server",
"incoming": 1,
"outgoing": 1
}
],
"attributes": [
Expand Down
114 changes: 110 additions & 4 deletions examples/chip-tool/commands/clusters/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,25 @@ static void OnNetworkCommissioningClusterUpdateWiFiNetworkResponse(void * contex
command->SetCommandExitStatus(true);
}

static void OnOperationalCredentialsClusterOpCSRResponse(void * context, chip::ByteSpan CSR, chip::ByteSpan CSRNonce,
chip::ByteSpan VendorReserved1, chip::ByteSpan VendorReserved2,
chip::ByteSpan VendorReserved3, chip::ByteSpan Signature)
{
ChipLogProgress(chipTool, "OperationalCredentialsClusterOpCSRResponse");

ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
command->SetCommandExitStatus(true);
}

static void OnOperationalCredentialsClusterOpCertResponse(void * context, uint8_t StatusCode, uint64_t FabricIndex,
uint8_t * DebugText)
{
ChipLogProgress(chipTool, "OperationalCredentialsClusterOpCertResponse");

ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
command->SetCommandExitStatus(true);
}

static void OnOperationalCredentialsClusterSetFabricResponse(void * context, chip::FabricId FabricId)
{
ChipLogProgress(chipTool, "OperationalCredentialsClusterSetFabricResponse");
Expand Down Expand Up @@ -10692,6 +10711,8 @@ class ReadOnOffClusterRevision : public ModelCommand
| Cluster OperationalCredentials | 0x003E |
|------------------------------------------------------------------------------|
| Commands: | |
| * AddOpCert | 0x06 |
| * OpCSRRequest | 0x04 |
| * RemoveAllFabrics | 0x0B |
| * RemoveFabric | 0x0A |
| * SetFabric | 0x00 |
Expand All @@ -10702,6 +10723,88 @@ class ReadOnOffClusterRevision : public ModelCommand
| * ClusterRevision | 0xFFFD |
\*----------------------------------------------------------------------------*/

/*
* Command AddOpCert
*/
class OperationalCredentialsAddOpCert : public ModelCommand
{
public:
OperationalCredentialsAddOpCert() : ModelCommand("add-op-cert")
{
AddArgument("noc", &mNoc);
AddArgument("iCACertificate", &mICACertificate);
AddArgument("iPKValue", &mIPKValue);
AddArgument("caseAdminNode", 0, UINT64_MAX, &mCaseAdminNode);
AddArgument("adminVendorId", 0, UINT16_MAX, &mAdminVendorId);
ModelCommand::AddArguments();
}
~OperationalCredentialsAddOpCert()
{
delete onSuccessCallback;
delete onFailureCallback;
}

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

chip::Controller::OperationalCredentialsCluster cluster;
cluster.Associate(device, endpointId);
return cluster.AddOpCert(
onSuccessCallback->Cancel(), onFailureCallback->Cancel(), chip::ByteSpan(chip::Uint8::from_char(mNoc), strlen(mNoc)),
chip::ByteSpan(chip::Uint8::from_char(mICACertificate), strlen(mICACertificate)),
chip::ByteSpan(chip::Uint8::from_char(mIPKValue), strlen(mIPKValue)), mCaseAdminNode, mAdminVendorId);
}

private:
chip::Callback::Callback<OperationalCredentialsClusterOpCertResponseCallback> * onSuccessCallback =
new chip::Callback::Callback<OperationalCredentialsClusterOpCertResponseCallback>(
OnOperationalCredentialsClusterOpCertResponse, this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
char * mNoc;
char * mICACertificate;
char * mIPKValue;
chip::NodeId mCaseAdminNode;
uint16_t mAdminVendorId;
};

/*
* Command OpCSRRequest
*/
class OperationalCredentialsOpCSRRequest : public ModelCommand
{
public:
OperationalCredentialsOpCSRRequest() : ModelCommand("op-csrrequest")
{
AddArgument("cSRNonce", &mCSRNonce);
ModelCommand::AddArguments();
}
~OperationalCredentialsOpCSRRequest()
{
delete onSuccessCallback;
delete onFailureCallback;
}

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

chip::Controller::OperationalCredentialsCluster cluster;
cluster.Associate(device, endpointId);
return cluster.OpCSRRequest(onSuccessCallback->Cancel(), onFailureCallback->Cancel(),
chip::ByteSpan(chip::Uint8::from_char(mCSRNonce), strlen(mCSRNonce)));
}

private:
chip::Callback::Callback<OperationalCredentialsClusterOpCSRResponseCallback> * onSuccessCallback =
new chip::Callback::Callback<OperationalCredentialsClusterOpCSRResponseCallback>(
OnOperationalCredentialsClusterOpCSRResponse, this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
char * mCSRNonce;
};

/*
* Command RemoveAllFabrics
*/
Expand Down Expand Up @@ -10760,8 +10863,9 @@ class OperationalCredentialsRemoveFabric : public ModelCommand
}

private:
chip::Callback::Callback<DefaultSuccessCallback> * onSuccessCallback =
new chip::Callback::Callback<DefaultSuccessCallback>(OnDefaultSuccessResponse, this);
chip::Callback::Callback<OperationalCredentialsClusterOpCertResponseCallback> * onSuccessCallback =
new chip::Callback::Callback<OperationalCredentialsClusterOpCertResponseCallback>(
OnOperationalCredentialsClusterOpCertResponse, this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
chip::FabricId mFabricId;
Expand Down Expand Up @@ -10832,8 +10936,9 @@ class OperationalCredentialsUpdateFabricLabel : public ModelCommand
}

private:
chip::Callback::Callback<DefaultSuccessCallback> * onSuccessCallback =
new chip::Callback::Callback<DefaultSuccessCallback>(OnDefaultSuccessResponse, this);
chip::Callback::Callback<OperationalCredentialsClusterOpCertResponseCallback> * onSuccessCallback =
new chip::Callback::Callback<OperationalCredentialsClusterOpCertResponseCallback>(
OnOperationalCredentialsClusterOpCertResponse, this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
char * mLabel;
Expand Down Expand Up @@ -15232,6 +15337,7 @@ void registerClusterOperationalCredentials(Commands & commands)
const char * clusterName = "OperationalCredentials";

commands_list clusterCommands = {
make_unique<OperationalCredentialsAddOpCert>(), make_unique<OperationalCredentialsOpCSRRequest>(),
make_unique<OperationalCredentialsRemoveAllFabrics>(), make_unique<OperationalCredentialsRemoveFabric>(),
make_unique<OperationalCredentialsSetFabric>(), make_unique<OperationalCredentialsUpdateFabricLabel>(),
make_unique<DiscoverOperationalCredentialsAttributes>(), make_unique<ReadOperationalCredentialsFabricsList>(),
Expand Down
Loading

0 comments on commit f65cad4

Please sign in to comment.