Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial version of the General Diagnostics Cluster #6690

Merged
merged 3 commits into from
May 13, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo
{{chipType}} * entry = reinterpret_cast<{{chipType}} *>(write ? src : dest);
{{#chip_attribute_list_entryTypes}}
{{#if (isString type)}}
chip::ByteSpan * {{name}}Span = &entry->{{name}}; // {{type}}
chip::ByteSpan * {{name}}Span = reinterpret_cast<chip::ByteSpan *>(&entry->{{name}}); // {{type}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we reinterpret-cast here? why is the entry name not of the correct type?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what #6801 was about.

if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, {{size}}, {{name}}Span) : ReadByteSpan(src + entryOffset, {{size}}, {{name}}Span)))
{
ChipLogError(Zcl, "Index %l is invalid. Not enough remaining space", index);
Expand Down
25 changes: 20 additions & 5 deletions src/app/zap-templates/zcl/custom-types.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ limitations under the License.
<enum name="GroupKeySecurityPolicy" type="ENUM8">
<item name="Standard" value="0x00"/>
<item name="LowLatency" value="0x01"/>
</enum>
</enum>
<enum name="InterfaceType" type="ENUM8">
<item name="Unspecified" value="0x00"/>
<item name="WiFi" value="0x01"/>
<item name="Ethernet" value="0x02"/>
<item name="Cellular" value="0x03"/>
<item name="Thread" value="0x04"/>
</enum>
<struct name="GroupState">
<item name="VendorId" type="INT16U"/>
<item name="VendorGroupId" type="INT16U"/>
Expand All @@ -39,10 +46,10 @@ limitations under the License.
<item name="GroupKeyEpochStartTime" type="INT64U"/>
<item name="GroupKeySecurityPolicy" type="GroupKeySecurityPolicy"/>
</struct>
<struct name="DeviceType">
<item name="type" type="DEVICE_TYPE_ID"/>
<item name="revision" type="INT16U"/>
</struct>
<struct name="DeviceType">
<item name="type" type="DEVICE_TYPE_ID"/>
<item name="revision" type="INT16U"/>
</struct>
<struct name="FabricDescriptor">
<item name="FabricId" type="FABRIC_ID"/>
<item name="VendorId" type="INT16U"/> // Change INT16U to new type VendorID #2395
Expand All @@ -53,4 +60,12 @@ limitations under the License.
<item name="fabricIndex" type="INT64U"/>
<item name="operationalCert" type="OCTET_STRING" length="32"/>
</struct>
<struct name="NetworkInterfaceType">
<item name="Name" type="CHAR_STRING" length="32"/>
<item name="FabricConnected" type="BOOLEAN"/>
<item name="OffPremiseServicesReachableIPv4" type="BOOLEAN"/>
<item name="OffPremiseServicesReachableIPv6" type="BOOLEAN"/>
<item name="HardwareAddress" type="IEEE_ADDRESS"/>
<item name="Type" type="ENUM8"/>
</struct>
</configurator>
71 changes: 71 additions & 0 deletions src/app/zap-templates/zcl/general-diagnostics-cluster.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2021 Project CHIP Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<configurator>
<domain name="CHIP"/>
<enum name="HardwareFaultType" type="ENUM8">
<item name="Unspecified" value="0x00"/>
<item name="Radio" value="0x01"/>
<item name="Sensor" value="0x02"/>
<item name="ResettableOverTemp" value="0x03"/>
<item name="NonResettableOverTemp" value="0x04"/>
<item name="PowerSource" value="0x05"/>
<item name="VisualDisplayFault" value="0x06"/>
<item name="AudioOutputFault" value="0x07"/>
<item name="UserInterfaceFault" value="0x08"/>
<item name="NonVolatileMemoryError" value="0x09"/>
<item name="TamperDetected" value="0x0A"/>
</enum>
<enum name="RadioFaultType" type="ENUM8">
<item name="Unspecified" value="0x00"/>
<item name="WiFiFault" value="0x01"/>
<item name="CellularFault" value="0x02"/>
<item name="ThreadFault" value="0x03"/>
<item name="NFCFault" value="0x04"/>
<item name="BLEFault" value="0x05"/>
<item name="EthernetFault" value="0x06"/>
</enum>
<enum name="NetworkFaultType" type="ENUM8">
<item name="Unspecified" value="0x00"/>
<item name="HardwareFailure" value="0x01"/>
<item name="NetworkJammed" value="0x02"/>
<item name="ConnectionFailed" value="0x03"/>
</enum>
<enum name="BootReasonType" type="ENUM8">
<item name="Unspecified" value="0x00"/>
<item name="PowerOnReboot" value="0x01"/>
<item name="BrownOutReset" value="0x02"/>
<item name="SoftwareWatchdogReset" value="0x03"/>
<item name="HardwareWatchdogReset" value="0x04"/>
<item name="SoftwareUpdateCompleted" value="0x05"/>
<item name="SoftwareReset" value="0x06"/>
</enum>
<cluster>
<domain>General</domain>
<name>General Diagnostics</name>
<code>0x0033</code>
<define>GENERAL_DIAGNOSTICS_CLUSTER</define>
<description>The General Diagnostics Cluster, along with other diagnostics clusters, provide a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems.</description>
<attribute side="server" code="0x00" define="NETWORK_INTERFACES" type="ARRAY" entryType="NetworkInterfaceType" length="254" writable="false" optional="false">NetworkInterfaces</attribute>
<attribute side="server" code="0x01" define="REBOOT_COUNT" type="INT16U" min="0x0000" max="0xFFFF" writable="false" default="0x0000" optional="false">RebootCount</attribute>
<attribute side="server" code="0x02" define="UPTIME" type="INT64U" min="0x0000000000000000" max="0xFFFFFFFFFFFFFFFF" writable="false" default="0x0000000000000000" optional="true">UpTime</attribute>
<attribute side="server" code="0x03" define="TOTAL_OPERATIONAL_HOURS" type="INT32U" min="0x00000000" max="0xFFFFFFFF" writable="false" default="0x00000000" optional="true">TotalOperationalHours</attribute>
<attribute side="server" code="0x04" define="BOOT_REASONS" type="ENUM8" writable="false" optional="true">BootReasons</attribute>
<attribute side="server" code="0x05" define="ACTIVE_HARDWARE_FAULTS" type="ARRAY" entryType="ENUM8" length="254" writable="false" optional="true">ActiveHardwareFaults</attribute>
<attribute side="server" code="0x06" define="ACTIVE_RADIO_FAULTS" type="ARRAY" entryType="ENUM8" length="254" writable="false" optional="true">ActiveRadioFaults</attribute>
<attribute side="server" code="0x07" define="ACTIVE_NETWORK_FAULTS" type="ARRAY" entryType="ENUM8" length="254" writable="false" optional="true">ActiveNetworkFaults</attribute>
</cluster>
</configurator>
1 change: 1 addition & 0 deletions src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"operational-credentials-cluster.xml",
"trusted-root-certificates-cluster.xml",
"general-commissioning-cluster.xml",
"general-diagnostics-cluster.xml",
"group-key-mgmt-cluster.xml",
"ha.xml",
"ha-devices.xml",
Expand Down
2 changes: 2 additions & 0 deletions src/app/zap_cluster_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'DEVICE_TEMP_CLUSTER': [],
'DOOR_LOCK_CLUSTER': ['door-lock-server'],
'GENERAL_COMMISSIONING_CLUSTER': ['general-commissioning-server'],
'GENERAL_DIAGNOSTICS_CLUSTER': [],
'GROUPS_CLUSTER': ['groups-server'],
'GROUP_KEY_MANAGEMENT_CLUSTER': [],
'IAS_ZONE_CLUSTER': ['ias-zone-server'],
Expand Down Expand Up @@ -73,6 +74,7 @@
'DESCRIPTOR_CLUSTER': [],
'DOOR_LOCK_CLUSTER': [],
'GENERAL_COMMISSIONING_CLUSTER': [],
'GENERAL_DIAGNOSTICS_CLUSTER': [],
'GROUPS_CLUSTER': [],
'GROUP_KEY_MANAGEMENT_CLUSTER': [],
'IAS_ZONE_CLUSTER': ['ias-zone-client'],
Expand Down