[v1.3]backport: components/esp_matter:add optional attributes for general diagnostic cluster

This commit is contained in:
Li Ya Shuai
2025-03-28 02:24:04 +08:00
committed by Shu Chen
parent 0a3bb390ea
commit 8268d66eb5
2 changed files with 35 additions and 0 deletions
@@ -468,6 +468,36 @@ attribute_t *create_up_time(cluster_t *cluster, uint64_t value)
ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint64(value));
}
attribute_t *create_total_operational_hours(cluster_t *cluster, uint32_t value)
{
return esp_matter::attribute::create(cluster, GeneralDiagnostics::Attributes::TotalOperationalHours::Id,
ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint32(value));
}
attribute_t *create_boot_reason(cluster_t *cluster, uint8_t value)
{
return esp_matter::attribute::create(cluster, GeneralDiagnostics::Attributes::BootReason::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value));
}
attribute_t *create_active_hardware_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
{
return esp_matter::attribute::create(cluster, GeneralDiagnostics::Attributes::ActiveHardwareFaults::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count));
}
attribute_t *create_active_radio_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
{
return esp_matter::attribute::create(cluster, GeneralDiagnostics::Attributes::ActiveRadioFaults::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count));
}
attribute_t *create_active_network_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
{
return esp_matter::attribute::create(cluster, GeneralDiagnostics::Attributes::ActiveNetworkFaults::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count));
}
attribute_t *create_test_event_triggers_enabled(cluster_t *cluster, bool value)
{
return esp_matter::attribute::create(cluster, GeneralDiagnostics::Attributes::TestEventTriggersEnabled::Id,
@@ -141,6 +141,11 @@ namespace attribute {
attribute_t *create_network_interfaces(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
attribute_t *create_reboot_count(cluster_t *cluster, uint16_t value);
attribute_t *create_up_time(cluster_t *cluster, uint64_t value);
attribute_t *create_total_operational_hours(cluster_t *cluster, uint32_t value);
attribute_t *create_boot_reason(cluster_t *cluster, uint8_t value);
attribute_t *create_active_hardware_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
attribute_t *create_active_radio_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
attribute_t *create_active_network_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
attribute_t *create_test_event_triggers_enabled(cluster_t *cluster, bool value);
} /* attribute */
} /* general_diagnostics */