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

Better align naming in General Diagnostics cluster XML with the spec. #24292

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
24 changes: 12 additions & 12 deletions examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@ void AllClustersAppCommandHandler::OnGeneralFaultEventHandler(uint32_t eventId)

#if CHIP_CONFIG_TEST
// On Linux Simulation, set following hardware faults statically.
ReturnOnFailure(previous.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_RADIO));
ReturnOnFailure(previous.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_POWER_SOURCE));
ReturnOnFailure(previous.add(EMBER_ZCL_HARDWARE_FAULT_RADIO));
ReturnOnFailure(previous.add(EMBER_ZCL_HARDWARE_FAULT_POWER_SOURCE));

ReturnOnFailure(current.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_RADIO));
ReturnOnFailure(current.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_SENSOR));
ReturnOnFailure(current.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_POWER_SOURCE));
ReturnOnFailure(current.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_USER_INTERFACE_FAULT));
ReturnOnFailure(current.add(EMBER_ZCL_HARDWARE_FAULT_RADIO));
ReturnOnFailure(current.add(EMBER_ZCL_HARDWARE_FAULT_SENSOR));
ReturnOnFailure(current.add(EMBER_ZCL_HARDWARE_FAULT_POWER_SOURCE));
ReturnOnFailure(current.add(EMBER_ZCL_HARDWARE_FAULT_USER_INTERFACE_FAULT));
#endif
Clusters::GeneralDiagnosticsServer::Instance().OnHardwareFaultsDetect(previous, current);
}
Expand All @@ -200,13 +200,13 @@ void AllClustersAppCommandHandler::OnGeneralFaultEventHandler(uint32_t eventId)

#if CHIP_CONFIG_TEST
// On Linux Simulation, set following radio faults statically.
ReturnOnFailure(previous.add(EMBER_ZCL_RADIO_FAULT_TYPE_WI_FI_FAULT));
ReturnOnFailure(previous.add(EMBER_ZCL_RADIO_FAULT_TYPE_THREAD_FAULT));
ReturnOnFailure(previous.add(EMBER_ZCL_RADIO_FAULT_WI_FI_FAULT));
ReturnOnFailure(previous.add(EMBER_ZCL_RADIO_FAULT_THREAD_FAULT));

ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_TYPE_WI_FI_FAULT));
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_TYPE_CELLULAR_FAULT));
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_TYPE_THREAD_FAULT));
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_TYPE_NFC_FAULT));
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_WI_FI_FAULT));
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_CELLULAR_FAULT));
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_THREAD_FAULT));
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_NFC_FAULT));
#endif
Clusters::GeneralDiagnosticsServer::Instance().OnRadioFaultsDetect(previous, current);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,27 @@ CHIP_ERROR GenericFaultTestEventTriggerDelegate::HandleEventTrigger(uint64_t eve
// Fault injection
GeneralFaults<kMaxHardwareFaults> hwFaultsPrevious;
GeneralFaults<kMaxHardwareFaults> hwFaultsCurrent;
ReturnErrorOnFailure(hwFaultsPrevious.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_RADIO));
ReturnErrorOnFailure(hwFaultsPrevious.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_POWER_SOURCE));
ReturnErrorOnFailure(hwFaultsPrevious.add(EMBER_ZCL_HARDWARE_FAULT_RADIO));
ReturnErrorOnFailure(hwFaultsPrevious.add(EMBER_ZCL_HARDWARE_FAULT_POWER_SOURCE));

ReturnErrorOnFailure(hwFaultsCurrent.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_RADIO));
ReturnErrorOnFailure(hwFaultsCurrent.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_SENSOR));
ReturnErrorOnFailure(hwFaultsCurrent.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_POWER_SOURCE));
ReturnErrorOnFailure(hwFaultsCurrent.add(EMBER_ZCL_HARDWARE_FAULT_TYPE_USER_INTERFACE_FAULT));
ReturnErrorOnFailure(hwFaultsCurrent.add(EMBER_ZCL_HARDWARE_FAULT_RADIO));
ReturnErrorOnFailure(hwFaultsCurrent.add(EMBER_ZCL_HARDWARE_FAULT_SENSOR));
ReturnErrorOnFailure(hwFaultsCurrent.add(EMBER_ZCL_HARDWARE_FAULT_POWER_SOURCE));
ReturnErrorOnFailure(hwFaultsCurrent.add(EMBER_ZCL_HARDWARE_FAULT_USER_INTERFACE_FAULT));

app::Clusters::GeneralDiagnosticsServer::Instance().OnHardwareFaultsDetect(hwFaultsPrevious, hwFaultsCurrent);

// Radio faults injection
GeneralFaults<kMaxRadioFaults> radioFaultsPrevious;
GeneralFaults<kMaxRadioFaults> radioFaultsCurrent;

ReturnErrorOnFailure(radioFaultsPrevious.add(EMBER_ZCL_RADIO_FAULT_TYPE_WI_FI_FAULT));
ReturnErrorOnFailure(radioFaultsPrevious.add(EMBER_ZCL_RADIO_FAULT_TYPE_THREAD_FAULT));
ReturnErrorOnFailure(radioFaultsPrevious.add(EMBER_ZCL_RADIO_FAULT_WI_FI_FAULT));
ReturnErrorOnFailure(radioFaultsPrevious.add(EMBER_ZCL_RADIO_FAULT_THREAD_FAULT));

ReturnErrorOnFailure(radioFaultsCurrent.add(EMBER_ZCL_RADIO_FAULT_TYPE_WI_FI_FAULT));
ReturnErrorOnFailure(radioFaultsCurrent.add(EMBER_ZCL_RADIO_FAULT_TYPE_CELLULAR_FAULT));
ReturnErrorOnFailure(radioFaultsCurrent.add(EMBER_ZCL_RADIO_FAULT_TYPE_THREAD_FAULT));
ReturnErrorOnFailure(radioFaultsCurrent.add(EMBER_ZCL_RADIO_FAULT_TYPE_NFC_FAULT));
ReturnErrorOnFailure(radioFaultsCurrent.add(EMBER_ZCL_RADIO_FAULT_WI_FI_FAULT));
ReturnErrorOnFailure(radioFaultsCurrent.add(EMBER_ZCL_RADIO_FAULT_CELLULAR_FAULT));
ReturnErrorOnFailure(radioFaultsCurrent.add(EMBER_ZCL_RADIO_FAULT_THREAD_FAULT));
ReturnErrorOnFailure(radioFaultsCurrent.add(EMBER_ZCL_RADIO_FAULT_NFC_FAULT));

app::Clusters::GeneralDiagnosticsServer::Instance().OnRadioFaultsDetect(radioFaultsPrevious, radioFaultsCurrent);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ CHIP_ERROR GeneralDiagosticsAttrAccess::Read(const ConcreteReadAttributePath & a
case TotalOperationalHours::Id: {
return ReadIfSupported(&DiagnosticDataProvider::GetTotalOperationalHours, aEncoder);
}
case BootReasons::Id: {
case BootReason::Id: {
return ReadIfSupported(&DiagnosticDataProvider::GetBootReason, aEncoder);
}
case TestEventTriggersEnabled::Id: {
Expand Down Expand Up @@ -242,11 +242,11 @@ GeneralDiagnosticsServer & GeneralDiagnosticsServer::Instance()
}

// Gets called when the device has been rebooted.
void GeneralDiagnosticsServer::OnDeviceReboot(BootReasonType bootReason)
void GeneralDiagnosticsServer::OnDeviceReboot(BootReasonEnum bootReason)
{
ChipLogDetail(Zcl, "GeneralDiagnostics: OnDeviceReboot");

ReportAttributeOnAllEndpoints(GeneralDiagnostics::Attributes::BootReasons::Id);
ReportAttributeOnAllEndpoints(GeneralDiagnostics::Attributes::BootReason::Id);

// GeneralDiagnostics cluster should exist only for endpoint 0.
if (emberAfContainsServer(0, GeneralDiagnostics::Id))
Expand Down Expand Up @@ -276,10 +276,9 @@ void GeneralDiagnosticsServer::OnHardwareFaultsDetect(const GeneralFaults<kMaxHa

// Record HardwareFault event
EventNumber eventNumber;
DataModel::List<const HardwareFaultType> currentList(reinterpret_cast<const HardwareFaultType *>(current.data()),
current.size());
DataModel::List<const HardwareFaultType> previousList(reinterpret_cast<const HardwareFaultType *>(previous.data()),
previous.size());
DataModel::List<const HardwareFault> currentList(reinterpret_cast<const HardwareFault *>(current.data()), current.size());
DataModel::List<const HardwareFault> previousList(reinterpret_cast<const HardwareFault *>(previous.data()),
previous.size());
Events::HardwareFaultChange::Type event{ currentList, previousList };

if (CHIP_NO_ERROR != LogEvent(event, endpointId, eventNumber))
Expand All @@ -303,9 +302,8 @@ void GeneralDiagnosticsServer::OnRadioFaultsDetect(const GeneralFaults<kMaxRadio

// Record RadioFault event
EventNumber eventNumber;
DataModel::List<const RadioFaultType> currentList(reinterpret_cast<const RadioFaultType *>(current.data()), current.size());
DataModel::List<const RadioFaultType> previousList(reinterpret_cast<const RadioFaultType *>(previous.data()),
previous.size());
DataModel::List<const RadioFault> currentList(reinterpret_cast<const RadioFault *>(current.data()), current.size());
DataModel::List<const RadioFault> previousList(reinterpret_cast<const RadioFault *>(previous.data()), previous.size());
Events::RadioFaultChange::Type event{ currentList, previousList };

if (CHIP_NO_ERROR != LogEvent(event, endpointId, eventNumber))
Expand Down Expand Up @@ -383,7 +381,7 @@ bool emberAfGeneralDiagnosticsClusterTestEventTriggerCallback(CommandHandler * c

void MatterGeneralDiagnosticsPluginServerInitCallback()
{
BootReasonType bootReason;
BootReasonEnum bootReason;

registerAttributeAccessOverride(&gAttrAccess);
ConnectivityMgr().SetDelegate(&gDiagnosticDelegate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class GeneralDiagnosticsServer
* @brief
* Called after the current device is rebooted.
*/
void OnDeviceReboot(GeneralDiagnostics::BootReasonType bootReason);
void OnDeviceReboot(GeneralDiagnostics::BootReasonEnum bootReason);

/**
* @brief
Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/mode-select-server/mode-select-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ using namespace chip::app::Clusters;
using namespace chip::app::Clusters::ModeSelect;
using namespace chip::Protocols;

using BootReasonType = GeneralDiagnostics::BootReasonType;
using BootReasonType = GeneralDiagnostics::BootReasonEnum;

static InteractionModel::Status verifyModeValue(const EndpointId endpointId, const uint8_t newMode);

Expand Down
4 changes: 2 additions & 2 deletions src/app/common/templates/weak-enum-list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- ContentLaunchStatus
- ContentLaunchStreamingType
- EnhancedColorMode
- HardwareFaultType
- HardwareFault
- HueDirection
- HueMoveMode
- HueStepMode
Expand All @@ -26,7 +26,7 @@
- OnOffDyingLightEffectVariant
- OnOffEffectIdentifier
- PHYRate
- RadioFaultType
- RadioFault
- RoutingRole
- SaturationMoveMode
- SaturationStepMode
Expand Down
2 changes: 1 addition & 1 deletion src/app/tests/suites/certification/Test_TC_DGGEN_2_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ tests:
- label: "TH reads BootReason attribute value from DUT."
PICS: DGGEN.S.A0004
command: "readAttribute"
attribute: "BootReasons"
attribute: "BootReason"
response:
constraints:
minValue: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.
-->
<configurator>
<domain name="CHIP"/>
<enum name="HardwareFaultType" type="ENUM8">
<enum name="HardwareFault" type="ENUM8">
<cluster code="0x0033"/>
<item name="Unspecified" value="0x00"/>
<item name="Radio" value="0x01"/>
Expand All @@ -30,7 +30,7 @@ limitations under the License.
<item name="NonVolatileMemoryError" value="0x09"/>
<item name="TamperDetected" value="0x0A"/>
</enum>
<enum name="RadioFaultType" type="ENUM8">
<enum name="RadioFault" type="ENUM8">
<cluster code="0x0033"/>
<item name="Unspecified" value="0x00"/>
<item name="WiFiFault" value="0x01"/>
Expand All @@ -47,7 +47,7 @@ limitations under the License.
<item name="NetworkJammed" value="0x02"/>
<item name="ConnectionFailed" value="0x03"/>
</enum>
<enum name="BootReasonType" type="ENUM8">
<enum name="BootReasonEnum" type="ENUM8">
<cluster code="0x0033"/>
<item name="Unspecified" value="0x00"/>
<item name="PowerOnReboot" value="0x01"/>
Expand All @@ -65,7 +65,7 @@ limitations under the License.
<item name="Cellular" value="0x03"/>
<item name="Thread" value="0x04"/>
</enum>
<struct name="NetworkInterfaceType">
<struct name="NetworkInterface">
<cluster code="0x0033"/>
<item name="Name" type="CHAR_STRING" length="32"/>
<item name="IsOperational" type="BOOLEAN"/>
Expand All @@ -83,14 +83,14 @@ limitations under the License.
<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="0x00" define="NETWORK_INTERFACES" type="ARRAY" entryType="NetworkInterface" 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="UP_TIME" 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" writable="false" optional="true">ActiveHardwareFaults</attribute>
<attribute side="server" code="0x06" define="ACTIVE_RADIO_FAULTS" type="ARRAY" entryType="ENUM8" writable="false" optional="true">ActiveRadioFaults</attribute>
<attribute side="server" code="0x07" define="ACTIVE_NETWORK_FAULTS" type="ARRAY" entryType="ENUM8" writable="false" optional="true">ActiveNetworkFaults</attribute>
<attribute side="server" code="0x04" define="BOOT_REASONS" type="BootReasonEnum" writable="false" optional="true">BootReason</attribute>
<attribute side="server" code="0x05" define="ACTIVE_HARDWARE_FAULTS" type="ARRAY" entryType="HardwareFault" writable="false" optional="true">ActiveHardwareFaults</attribute>
<attribute side="server" code="0x06" define="ACTIVE_RADIO_FAULTS" type="ARRAY" entryType="RadioFault" writable="false" optional="true">ActiveRadioFaults</attribute>
<attribute side="server" code="0x07" define="ACTIVE_NETWORK_FAULTS" type="ARRAY" entryType="NetworkFaultType" writable="false" optional="true">ActiveNetworkFaults</attribute>
<attribute side="server" code="0x08" define="TEST_EVENT_TRIGGERS_ENABLED" type="BOOLEAN" writable="false" optional="false">TestEventTriggersEnabled</attribute>

<command source="client" code="0x00" name="TestEventTrigger" optional="false">
Expand All @@ -102,13 +102,13 @@ limitations under the License.

<event side="server" code="0x00" name="HardwareFaultChange" priority="critical" optional="true">
<description>Indicate a change in the set of hardware faults currently detected by the Node.</description>
<field id="0" name="Current" type="HardwareFaultType" array="true"/>
<field id="1" name="Previous" type="HardwareFaultType" array="true"/>
<field id="0" name="Current" type="HardwareFault" array="true"/>
<field id="1" name="Previous" type="HardwareFault" array="true"/>
</event>
<event side="server" code="0x01" name="RadioFaultChange" priority="critical" optional="true">
<description>Indicate a change in the set of radio faults currently detected by the Node.</description>
<field id="0" name="Current" type="RadioFaultType" array="true"/>
<field id="1" name="Previous" type="RadioFaultType" array="true"/>
<field id="0" name="Current" type="RadioFault" array="true"/>
<field id="1" name="Previous" type="RadioFault" array="true"/>
</event>
<event side="server" code="0x02" name="NetworkFaultChange" priority="critical" optional="true">
<description>Indicate a change in the set of network faults currently detected by the Node.</description>
Expand All @@ -117,7 +117,7 @@ limitations under the License.
</event>
<event side="server" code="0x03" name="BootReason" priority="critical" optional="false">
<description>Indicate the reason that caused the device to start-up.</description>
<field id="0" name="BootReason" type="BootReasonType"/>
<field id="0" name="BootReason" type="BootReasonEnum"/>
andy31415 marked this conversation as resolved.
Show resolved Hide resolved
</event>
</cluster>
</configurator>
2 changes: 1 addition & 1 deletion src/app/zap-templates/zcl/zcl-with-test-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"RebootCount",
"UpTime",
"TotalOperationalHours",
"BootReasons"
"BootReason"
],
"Group Key Management": [
"ClusterRevision",
Expand Down
2 changes: 1 addition & 1 deletion src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
"RebootCount",
"UpTime",
"TotalOperationalHours",
"BootReasons"
"BootReason"
],
"Group Key Management": [
"ClusterRevision",
Expand Down
Loading