Skip to content

Commit

Permalink
Regenerate generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple committed May 14, 2021
1 parent 5a461d1 commit 65c68f9
Show file tree
Hide file tree
Showing 58 changed files with 1,477 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ typedef struct _NeighborInfo
// Struct for NetworkInterfaceType
typedef struct _NetworkInterfaceType
{
uint8_t * Name;
chip::ByteSpan Name;
uint8_t FabricConnected;
uint8_t OffPremiseServicesReachableIPv4;
uint8_t OffPremiseServicesReachableIPv6;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo
entryOffset = static_cast<uint16_t>(entryOffset + ((index - 1) * entryLength));
// Struct _NetworkInterfaceType
_NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest);
chip::ByteSpan * NameSpan = reinterpret_cast<chip::ByteSpan *>(&entry->Name); // CHAR_STRING
chip::ByteSpan * NameSpan = &entry->Name; // OCTET_STRING
if (CHIP_NO_ERROR !=
(write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan)))
{
Expand Down Expand Up @@ -219,8 +219,8 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo
copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write,
&entryOffset, sizeof(entry->VendorId)); // INT16U
copyListMember(write ? dest : (uint8_t *) &entry->GroupKeyIndex, write ? (uint8_t *) &entry->GroupKeyIndex : src, write,
&entryOffset, sizeof(entry->GroupKeyIndex)); // INT16U
chip::ByteSpan * GroupKeyRootSpan = reinterpret_cast<chip::ByteSpan *>(&entry->GroupKeyRoot); // OCTET_STRING
&entryOffset, sizeof(entry->GroupKeyIndex)); // INT16U
chip::ByteSpan * GroupKeyRootSpan = &entry->GroupKeyRoot; // OCTET_STRING
if (CHIP_NO_ERROR !=
(write ? WriteByteSpan(dest + entryOffset, 18, GroupKeyRootSpan)
: ReadByteSpan(src + entryOffset, 18, GroupKeyRootSpan)))
Expand Down Expand Up @@ -318,8 +318,8 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo
// Struct _TestListStructOctet
_TestListStructOctet * entry = reinterpret_cast<_TestListStructOctet *>(write ? src : dest);
copyListMember(write ? dest : (uint8_t *) &entry->fabricIndex, write ? (uint8_t *) &entry->fabricIndex : src, write,
&entryOffset, sizeof(entry->fabricIndex)); // INT64U
chip::ByteSpan * operationalCertSpan = reinterpret_cast<chip::ByteSpan *>(&entry->operationalCert); // OCTET_STRING
&entryOffset, sizeof(entry->fabricIndex)); // INT64U
chip::ByteSpan * operationalCertSpan = &entry->operationalCert; // OCTET_STRING
if (CHIP_NO_ERROR !=
(write ? WriteByteSpan(dest + entryOffset, 34, operationalCertSpan)
: ReadByteSpan(src + entryOffset, 34, operationalCertSpan)))
Expand Down
2 changes: 1 addition & 1 deletion examples/bridge-app/bridge-common/gen/af-structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ typedef struct _NeighborInfo
// Struct for NetworkInterfaceType
typedef struct _NetworkInterfaceType
{
uint8_t * Name;
chip::ByteSpan Name;
uint8_t FabricConnected;
uint8_t OffPremiseServicesReachableIPv4;
uint8_t OffPremiseServicesReachableIPv6;
Expand Down
2 changes: 1 addition & 1 deletion examples/bridge-app/bridge-common/gen/attribute-size.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo
entryOffset = static_cast<uint16_t>(entryOffset + ((index - 1) * entryLength));
// Struct _NetworkInterfaceType
_NetworkInterfaceType * entry = reinterpret_cast<_NetworkInterfaceType *>(write ? src : dest);
chip::ByteSpan * NameSpan = reinterpret_cast<chip::ByteSpan *>(&entry->Name); // CHAR_STRING
chip::ByteSpan * NameSpan = &entry->Name; // OCTET_STRING
if (CHIP_NO_ERROR !=
(write ? WriteByteSpan(dest + entryOffset, 34, NameSpan) : ReadByteSpan(src + entryOffset, 34, NameSpan)))
{
Expand Down
180 changes: 180 additions & 0 deletions examples/chip-tool/commands/clusters/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,26 @@ static void OnDescriptorPartsListListAttributeResponse(void * context, uint16_t
command->SetCommandExitStatus(true);
}

static void OnGeneralDiagnosticsNetworkInterfacesListAttributeResponse(void * context, uint16_t count,
_NetworkInterfaceType * entries)
{
ChipLogProgress(chipTool, "OnGeneralDiagnosticsNetworkInterfacesListAttributeResponse: %lu entries", count);

for (uint16_t i = 0; i < count; i++)
{
ChipLogProgress(chipTool, "NetworkInterfaceType[%lu]:", i);
ChipLogProgress(chipTool, " Name: %s", entries[i].Name);
ChipLogProgress(chipTool, " FabricConnected: %" PRIu8 "", entries[i].FabricConnected);
ChipLogProgress(chipTool, " OffPremiseServicesReachableIPv4: %" PRIu8 "", entries[i].OffPremiseServicesReachableIPv4);
ChipLogProgress(chipTool, " OffPremiseServicesReachableIPv6: %" PRIu8 "", entries[i].OffPremiseServicesReachableIPv6);
ChipLogProgress(chipTool, " HardwareAddress: %" PRIu64 "", entries[i].HardwareAddress);
ChipLogProgress(chipTool, " Type: %" PRIu8 "", entries[i].Type);
}

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

static void OnGroupKeyManagementGroupsListAttributeResponse(void * context, uint16_t count, _GroupState * entries)
{
ChipLogProgress(chipTool, "OnGroupKeyManagementGroupsListAttributeResponse: %lu entries", count);
Expand Down Expand Up @@ -820,6 +840,7 @@ static void OnTestClusterListStructOctetStringListAttributeResponse(void * conte
| Descriptor | 0x001D |
| DoorLock | 0x0101 |
| GeneralCommissioning | 0x0030 |
| GeneralDiagnostics | 0x0033 |
| GroupKeyManagement | 0xF004 |
| Groups | 0x0004 |
| Identify | 0x0003 |
Expand Down Expand Up @@ -854,6 +875,7 @@ constexpr chip::ClusterId kContentLaunchClusterId = 0x050A;
constexpr chip::ClusterId kDescriptorClusterId = 0x001D;
constexpr chip::ClusterId kDoorLockClusterId = 0x0101;
constexpr chip::ClusterId kGeneralCommissioningClusterId = 0x0030;
constexpr chip::ClusterId kGeneralDiagnosticsClusterId = 0x0033;
constexpr chip::ClusterId kGroupKeyManagementClusterId = 0xF004;
constexpr chip::ClusterId kGroupsClusterId = 0x0004;
constexpr chip::ClusterId kIdentifyClusterId = 0x0003;
Expand Down Expand Up @@ -7815,6 +7837,150 @@ class ReadGeneralCommissioningClusterRevision : public ModelCommand
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};

/*----------------------------------------------------------------------------*\
| Cluster GeneralDiagnostics | 0x0033 |
|------------------------------------------------------------------------------|
| Commands: | |
|------------------------------------------------------------------------------|
| Attributes: | |
| * NetworkInterfaces | 0x0000 |
| * RebootCount | 0x0001 |
| * ClusterRevision | 0xFFFD |
\*----------------------------------------------------------------------------*/

/*
* Discover Attributes
*/
class DiscoverGeneralDiagnosticsAttributes : public ModelCommand
{
public:
DiscoverGeneralDiagnosticsAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }

~DiscoverGeneralDiagnosticsAttributes()
{
delete onSuccessCallback;
delete onFailureCallback;
}

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

chip::Controller::GeneralDiagnosticsCluster cluster;
cluster.Associate(device, endpointId);
return cluster.DiscoverAttributes(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);
};

/*
* Attribute NetworkInterfaces
*/
class ReadGeneralDiagnosticsNetworkInterfaces : public ModelCommand
{
public:
ReadGeneralDiagnosticsNetworkInterfaces() : ModelCommand("read")
{
AddArgument("attr-name", "network-interfaces");
ModelCommand::AddArguments();
}

~ReadGeneralDiagnosticsNetworkInterfaces()
{
delete onSuccessCallback;
delete onFailureCallback;
}

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

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

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

/*
* Attribute RebootCount
*/
class ReadGeneralDiagnosticsRebootCount : public ModelCommand
{
public:
ReadGeneralDiagnosticsRebootCount() : ModelCommand("read")
{
AddArgument("attr-name", "reboot-count");
ModelCommand::AddArguments();
}

~ReadGeneralDiagnosticsRebootCount()
{
delete onSuccessCallback;
delete onFailureCallback;
}

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

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

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

/*
* Attribute ClusterRevision
*/
class ReadGeneralDiagnosticsClusterRevision : public ModelCommand
{
public:
ReadGeneralDiagnosticsClusterRevision() : ModelCommand("read")
{
AddArgument("attr-name", "cluster-revision");
ModelCommand::AddArguments();
}

~ReadGeneralDiagnosticsClusterRevision()
{
delete onSuccessCallback;
delete onFailureCallback;
}

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

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

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

/*----------------------------------------------------------------------------*\
| Cluster GroupKeyManagement | 0xF004 |
|------------------------------------------------------------------------------|
Expand Down Expand Up @@ -14895,6 +15061,19 @@ void registerClusterGeneralCommissioning(Commands & commands)

commands.Register(clusterName, clusterCommands);
}
void registerClusterGeneralDiagnostics(Commands & commands)
{
const char * clusterName = "GeneralDiagnostics";

commands_list clusterCommands = {
make_unique<DiscoverGeneralDiagnosticsAttributes>(),
make_unique<ReadGeneralDiagnosticsNetworkInterfaces>(),
make_unique<ReadGeneralDiagnosticsRebootCount>(),
make_unique<ReadGeneralDiagnosticsClusterRevision>(),
};

commands.Register(clusterName, clusterCommands);
}
void registerClusterGroupKeyManagement(Commands & commands)
{
const char * clusterName = "GroupKeyManagement";
Expand Down Expand Up @@ -15247,6 +15426,7 @@ void registerClusters(Commands & commands)
registerClusterDescriptor(commands);
registerClusterDoorLock(commands);
registerClusterGeneralCommissioning(commands);
registerClusterGeneralDiagnostics(commands);
registerClusterGroupKeyManagement(commands);
registerClusterGroups(commands);
registerClusterIdentify(commands);
Expand Down
36 changes: 36 additions & 0 deletions examples/chip-tool/gen/CHIPClientCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,42 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
}
}
break;
case 0x0033:
switch (attributeId)
{
case 0x0000: // NetworkInterfaceType
{
_NetworkInterfaceType data[count];
for (size_t i = 0; i < count; i++)
{
CHECK_STATUS(ReadByteSpan(message, 34, &data[i].Name));
messageLen -= 34;
message += 34;
CHECK_MESSAGE_LENGTH(1);
data[i].FabricConnected = emberAfGetInt8u(message, 0, 1);
message += 1;
CHECK_MESSAGE_LENGTH(1);
data[i].OffPremiseServicesReachableIPv4 = emberAfGetInt8u(message, 0, 1);
message += 1;
CHECK_MESSAGE_LENGTH(1);
data[i].OffPremiseServicesReachableIPv6 = emberAfGetInt8u(message, 0, 1);
message += 1;
CHECK_MESSAGE_LENGTH(8);
data[i].HardwareAddress = emberAfGetInt64u(message, 0, 8);
message += 8;
CHECK_MESSAGE_LENGTH(1);
data[i].Type = emberAfGetInt8u(message, 0, 1);
message += 1;
}

Callback::Callback<GeneralDiagnosticsNetworkInterfacesListAttributeCallback> * cb =
Callback::Callback<GeneralDiagnosticsNetworkInterfacesListAttributeCallback>::FromCancelable(
onSuccessCallback);
cb->mCall(cb->mContext, count, data);
break;
}
}
break;
case 0xF004:
switch (attributeId)
{
Expand Down
2 changes: 2 additions & 0 deletions examples/chip-tool/gen/CHIPClientCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ typedef void (*DescriptorDeviceListListAttributeCallback)(void * context, uint16
typedef void (*DescriptorServerListListAttributeCallback)(void * context, uint16_t count, chip::ClusterId * entries);
typedef void (*DescriptorClientListListAttributeCallback)(void * context, uint16_t count, chip::ClusterId * entries);
typedef void (*DescriptorPartsListListAttributeCallback)(void * context, uint16_t count, chip::EndpointId * entries);
typedef void (*GeneralDiagnosticsNetworkInterfacesListAttributeCallback)(void * context, uint16_t count,
_NetworkInterfaceType * entries);
typedef void (*GroupKeyManagementGroupsListAttributeCallback)(void * context, uint16_t count, _GroupState * entries);
typedef void (*GroupKeyManagementGroupKeysListAttributeCallback)(void * context, uint16_t count, _GroupKey * entries);
typedef void (*OperationalCredentialsFabricsListListAttributeCallback)(void * context, uint16_t count, _FabricDescriptor * entries);
Expand Down
33 changes: 33 additions & 0 deletions examples/chip-tool/gen/CHIPClusters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2617,6 +2617,39 @@ CHIP_ERROR GeneralCommissioningCluster::ReadAttributeClusterRevision(Callback::C
return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
}

// GeneralDiagnostics Cluster Commands
// GeneralDiagnostics Cluster Attributes
CHIP_ERROR GeneralDiagnosticsCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback,
Callback::Cancelable * onFailureCallback)
{
uint8_t seqNum = mDevice->GetNextSequenceNumber();
System::PacketBufferHandle encodedCommand = encodeGeneralDiagnosticsClusterDiscoverAttributes(seqNum, mEndpoint);
return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
}
CHIP_ERROR GeneralDiagnosticsCluster::ReadAttributeNetworkInterfaces(Callback::Cancelable * onSuccessCallback,
Callback::Cancelable * onFailureCallback)
{
uint8_t seqNum = mDevice->GetNextSequenceNumber();
System::PacketBufferHandle encodedCommand = encodeGeneralDiagnosticsClusterReadNetworkInterfacesAttribute(seqNum, mEndpoint);
return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
}

CHIP_ERROR GeneralDiagnosticsCluster::ReadAttributeRebootCount(Callback::Cancelable * onSuccessCallback,
Callback::Cancelable * onFailureCallback)
{
uint8_t seqNum = mDevice->GetNextSequenceNumber();
System::PacketBufferHandle encodedCommand = encodeGeneralDiagnosticsClusterReadRebootCountAttribute(seqNum, mEndpoint);
return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
}

CHIP_ERROR GeneralDiagnosticsCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback,
Callback::Cancelable * onFailureCallback)
{
uint8_t seqNum = mDevice->GetNextSequenceNumber();
System::PacketBufferHandle encodedCommand = encodeGeneralDiagnosticsClusterReadClusterRevisionAttribute(seqNum, mEndpoint);
return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
}

// GroupKeyManagement Cluster Commands
// GroupKeyManagement Cluster Attributes
CHIP_ERROR GroupKeyManagementCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback,
Expand Down
Loading

0 comments on commit 65c68f9

Please sign in to comment.