From eb3b25eb4fe4f5b5bcc4c7888be5dc485924c3cc Mon Sep 17 00:00:00 2001 From: WanqQixiang Date: Mon, 31 Mar 2025 16:07:43 +0800 Subject: [PATCH] esp_matter: add missing attributes and features for Thread network diagnostics and software diagnostics clusters Closes CON-1619 Closes CON-1621 --- .../esp_matter/esp_matter_attribute.cpp | 300 +++++++++++++++++- components/esp_matter/esp_matter_attribute.h | 53 +++- components/esp_matter/esp_matter_cluster.cpp | 4 +- components/esp_matter/esp_matter_cluster.h | 4 +- components/esp_matter/esp_matter_command.cpp | 4 +- components/esp_matter/esp_matter_command.h | 4 +- components/esp_matter/esp_matter_event.cpp | 4 +- components/esp_matter/esp_matter_event.h | 4 +- components/esp_matter/esp_matter_feature.cpp | 82 ++++- components/esp_matter/esp_matter_feature.h | 38 ++- .../private/esp_matter_cluster_revisions.h | 4 +- 11 files changed, 479 insertions(+), 22 deletions(-) diff --git a/components/esp_matter/esp_matter_attribute.cpp b/components/esp_matter/esp_matter_attribute.cpp index 253e807cc..bca89d171 100644 --- a/components/esp_matter/esp_matter_attribute.cpp +++ b/components/esp_matter/esp_matter_attribute.cpp @@ -554,6 +554,24 @@ attribute_t *create_current_heap_high_watermark(cluster_t *cluster, uint64_t val ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint64(value)); } +attribute_t *create_thread_metrics(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, SoftwareDiagnostics::Attributes::ThreadMetrics::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_heap_free(cluster_t *cluster, uint64_t value) +{ + return esp_matter::attribute::create(cluster, SoftwareDiagnostics::Attributes::CurrentHeapFree::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint64(value)); +} + +attribute_t *create_current_heap_used(cluster_t *cluster, uint64_t value) +{ + return esp_matter::attribute::create(cluster, SoftwareDiagnostics::Attributes::CurrentHeapUsed::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint64(value)); +} + } /* attribute */ } /* software_diagnostics */ @@ -718,7 +736,7 @@ attribute_t *create_operating_mode(cluster_t *cluster, uint8_t value) } /* attribute */ } /* icd_management */ -namespace wifi_network_diagnotics { +namespace wifi_network_diagnostics { namespace attribute { attribute_t *create_bssid(cluster_t *cluster, uint8_t *value, uint16_t length) @@ -800,7 +818,7 @@ attribute_t *create_overrun_count(cluster_t *cluster, nullable value) } } /* attribute */ -} /* wifi_network_diagnotics */ +} /* wifi_network_diagnostics */ namespace thread_network_diagnostics { namespace attribute { @@ -928,6 +946,284 @@ attribute_t *create_rloc16(cluster_t *cluster, nullable value) return NULL; } +attribute_t *create_overrun_count(cluster_t *cluster, uint64_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::OverrunCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint64(value)); +} + +attribute_t *create_detached_role_count(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::DetachedRoleCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_chlid_role_count(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::ChildRoleCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_router_role_count(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RouterRoleCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} +attribute_t *create_leader_role_count(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::LeaderRoleCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_attach_attempt_count(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::AttachAttemptCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_partition_id_change_count(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::PartitionIdChangeCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_better_partition_attach_attempt_count(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::BetterPartitionAttachAttemptCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_parent_change_count(cluster_t *cluster, uint16_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::ParentChangeCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); +} + +attribute_t *create_tx_total_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxTotalCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_unicast_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxUnicastCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_broadcast_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxBroadcastCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_ack_requested_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxAckRequestedCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_acked_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxAckedCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_no_ack_requested_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxNoAckRequestedCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_data_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxDataCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_data_poll_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxDataPollCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_beacon_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxBeaconCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_beacon_request_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxBeaconRequestCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_other_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxOtherCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_retry_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxRetryCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_direct_max_retry_expiry_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxDirectMaxRetryExpiryCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_indirect_max_retry_expiry_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxIndirectMaxRetryExpiryCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_err_cca_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxErrCcaCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_err_abort_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxErrAbortCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_tx_err_busy_channel_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxErrBusyChannelCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_total_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxTotalCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_unicast_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxUnicastCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_broadcast_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxBroadcastCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_data_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxDataCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_data_poll_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxDataPollCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_beacon_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxBeaconCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_beacon_request_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxBeaconRequestCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_other_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxOtherCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_address_filtered_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxAddressFilteredCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_dest_addr_filtered_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxDestAddrFilteredCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_duplicated_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxDuplicatedCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_err_no_frame_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxErrNoFrameCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_err_unknown_neighbor_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxErrUnknownNeighborCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_err_invalid_src_addr_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxErrInvalidSrcAddrCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_err_sec_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxErrSecCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_err_fcs_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxErrFcsCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_rx_err_other_count(cluster_t *cluster, uint32_t value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RxErrOtherCount::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); +} + +attribute_t *create_active_timestamp(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::ActiveTimestamp::Id, + ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, + esp_matter_nullable_uint64(value)); +} + +attribute_t *create_pending_timestamp(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::PendingTimestamp::Id, + ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, + esp_matter_nullable_uint64(value)); +} + +attribute_t *create_delay(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::Delay::Id, + ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, + esp_matter_nullable_uint32(value)); +} + } /* attribute */ } /* thread_network_diagnostics */ diff --git a/components/esp_matter/esp_matter_attribute.h b/components/esp_matter/esp_matter_attribute.h index 0db68b325..874590dfe 100644 --- a/components/esp_matter/esp_matter_attribute.h +++ b/components/esp_matter/esp_matter_attribute.h @@ -164,6 +164,9 @@ attribute_t *create_test_event_triggers_enabled(cluster_t *cluster, bool value); namespace software_diagnostics { namespace attribute { attribute_t *create_current_heap_high_watermark(cluster_t *cluster, uint64_t value); +attribute_t *create_thread_metrics(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); +attribute_t *create_current_heap_free(cluster_t *cluster, uint64_t value); +attribute_t *create_current_heap_used(cluster_t *cluster, uint64_t value); } /* attribute */ } /* software_diagnostics */ @@ -211,7 +214,7 @@ attribute_t *create_operating_mode(cluster_t *cluster, uint8_t value); } /* attribute */ } /* icd_management */ -namespace wifi_network_diagnotics { +namespace wifi_network_diagnostics { namespace attribute { attribute_t *create_bssid(cluster_t *cluster, uint8_t *value, uint16_t length); attribute_t *create_security_type(cluster_t *cluster, nullable value); @@ -231,7 +234,7 @@ attribute_t *create_packet_unicast_tx_count(cluster_t *cluster, nullable value); attribute_t *create_overrun_count(cluster_t *cluster, nullable value); } /* attribute */ -} /* wifi_network_diagnotics */ +} /* wifi_network_diagnostics */ namespace thread_network_diagnostics { namespace attribute { @@ -254,6 +257,52 @@ attribute_t *create_operational_dataset_components(cluster_t *cluster, uint8_t * attribute_t *create_active_network_faults(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); attribute_t *create_ext_address(cluster_t *cluster, nullable value); attribute_t *create_rloc16(cluster_t *cluster, nullable value); +attribute_t *create_overrun_count(cluster_t *cluster, uint64_t value); +attribute_t *create_detached_role_count(cluster_t *cluster, uint16_t value); +attribute_t *create_chlid_role_count(cluster_t *cluster, uint16_t value); +attribute_t *create_router_role_count(cluster_t *cluster, uint16_t value); +attribute_t *create_leader_role_count(cluster_t *cluster, uint16_t value); +attribute_t *create_attach_attempt_count(cluster_t *cluster, uint16_t value); +attribute_t *create_partition_id_change_count(cluster_t *cluster, uint16_t value); +attribute_t *create_better_partition_attach_attempt_count(cluster_t *cluster, uint16_t value); +attribute_t *create_parent_change_count(cluster_t *cluster, uint16_t value); +attribute_t *create_tx_total_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_unicast_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_broadcast_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_ack_requested_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_acked_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_no_ack_requested_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_data_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_data_poll_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_beacon_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_beacon_request_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_other_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_retry_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_direct_max_retry_expiry_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_indirect_max_retry_expiry_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_err_cca_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_err_abort_count(cluster_t *cluster, uint32_t value); +attribute_t *create_tx_err_busy_channel_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_total_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_unicast_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_broadcast_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_data_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_data_poll_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_beacon_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_beacon_request_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_other_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_address_filtered_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_dest_addr_filtered_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_duplicated_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_no_frame_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_unknown_neighbor_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_invalid_src_addr_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_sec_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_fcs_count(cluster_t *cluster, uint32_t value); +attribute_t *create_rx_err_other_count(cluster_t *cluster, uint32_t value); +attribute_t *create_active_timestamp(cluster_t *cluster, nullable value); +attribute_t *create_pending_timestamp(cluster_t *cluster, nullable value); +attribute_t *create_delay(cluster_t *cluster, nullable value); } /* attribute */ } /* thread_network_diagnostics */ diff --git a/components/esp_matter/esp_matter_cluster.cpp b/components/esp_matter/esp_matter_cluster.cpp index 8647d1a11..8ac7391c5 100644 --- a/components/esp_matter/esp_matter_cluster.cpp +++ b/components/esp_matter/esp_matter_cluster.cpp @@ -573,7 +573,7 @@ cluster_t *create(endpoint_t *endpoint, uint8_t flags) } } /* group_key_management */ -namespace wifi_network_diagnotics { +namespace wifi_network_diagnostics { const function_generic_t *function_list = NULL; const int function_flags = CLUSTER_FLAG_NONE; @@ -602,7 +602,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) return cluster; } -} /* wifi_network_diagnotics */ +} /* wifi_network_diagnostics */ namespace thread_network_diagnostics { const function_generic_t *function_list = NULL; diff --git a/components/esp_matter/esp_matter_cluster.h b/components/esp_matter/esp_matter_cluster.h index 51bb7d5b3..2307ac1a9 100644 --- a/components/esp_matter/esp_matter_cluster.h +++ b/components/esp_matter/esp_matter_cluster.h @@ -166,10 +166,10 @@ using config_t = common::config_t; cluster_t *create(endpoint_t *endpoint, uint8_t flags); } /* group_key_management */ -namespace wifi_network_diagnotics { +namespace wifi_network_diagnostics { using config_t = common::config_t; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); -} /* wifi_network_diagnotics */ +} /* wifi_network_diagnostics */ namespace thread_network_diagnostics { using config_t = common::config_t; diff --git a/components/esp_matter/esp_matter_command.cpp b/components/esp_matter/esp_matter_command.cpp index de40ff22a..0b2054aa0 100644 --- a/components/esp_matter/esp_matter_command.cpp +++ b/components/esp_matter/esp_matter_command.cpp @@ -1683,7 +1683,7 @@ command_t *create_reset_counts(cluster_t *cluster) } /* command */ } /* thread_network_diagnostics */ -namespace wifi_network_diagnotics { +namespace wifi_network_diagnostics { namespace command { command_t *create_reset_counts(cluster_t *cluster) @@ -1693,7 +1693,7 @@ command_t *create_reset_counts(cluster_t *cluster) } } /* command */ -} /* wifi_network_diagnotics */ +} /* wifi_network_diagnostics */ namespace ethernet_network_diagnostics { namespace command { diff --git a/components/esp_matter/esp_matter_command.h b/components/esp_matter/esp_matter_command.h index 036c3d8d3..efaf0277a 100644 --- a/components/esp_matter/esp_matter_command.h +++ b/components/esp_matter/esp_matter_command.h @@ -75,11 +75,11 @@ command_t *create_reset_counts(cluster_t *cluster); } /* command */ } /* thread_network_diagnostics */ -namespace wifi_network_diagnotics { +namespace wifi_network_diagnostics { namespace command { command_t *create_reset_counts(cluster_t *cluster); } /* command */ -} /* wifi_network_diagnotics */ +} /* wifi_network_diagnostics */ namespace ethernet_network_diagnostics { namespace command { diff --git a/components/esp_matter/esp_matter_event.cpp b/components/esp_matter/esp_matter_event.cpp index 811755703..4cc7d2cb2 100644 --- a/components/esp_matter/esp_matter_event.cpp +++ b/components/esp_matter/esp_matter_event.cpp @@ -150,7 +150,7 @@ event_t *create_boot_reason(cluster_t *cluster) } // namespace event } // namespace general_diagnostics -namespace wifi_network_diagnotics { +namespace wifi_network_diagnostics { namespace event { event_t *create_disconnection(cluster_t *cluster) { @@ -168,7 +168,7 @@ event_t *create_connection_status(cluster_t *cluster) } } // namespace event -} // namespace wifi_network_diagnotics +} // namespace wifi_network_diagnostics namespace thread_network_diagnostics { namespace event { diff --git a/components/esp_matter/esp_matter_event.h b/components/esp_matter/esp_matter_event.h index c566f3861..6713c10cd 100644 --- a/components/esp_matter/esp_matter_event.h +++ b/components/esp_matter/esp_matter_event.h @@ -73,13 +73,13 @@ event_t *create_boot_reason(cluster_t *cluster); } // namespace event } // namespace general_diagnostics -namespace wifi_network_diagnotics { +namespace wifi_network_diagnostics { namespace event { event_t *create_disconnection(cluster_t *cluster); event_t *create_association_failure(cluster_t *cluster); event_t *create_connection_status(cluster_t *cluster); } // namespace event -} // namespace wifi_network_diagnotics +} // namespace wifi_network_diagnostics namespace thread_network_diagnostics { namespace event { diff --git a/components/esp_matter/esp_matter_feature.cpp b/components/esp_matter/esp_matter_feature.cpp index d3774f3bb..250cc23b7 100644 --- a/components/esp_matter/esp_matter_feature.cpp +++ b/components/esp_matter/esp_matter_feature.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "esp_matter_attribute.h" +#include "esp_matter_command.h" #include #include #include @@ -920,7 +922,7 @@ esp_err_t add(cluster_t *cluster, config_t *config) } /* feature */ } /* window_covering */ -namespace wifi_network_diagnotics { +namespace wifi_network_diagnostics { namespace feature { namespace packets_counts { @@ -976,7 +978,83 @@ esp_err_t add(cluster_t *cluster) } /* error_counts */ } /* feature */ -} /* wifi_network_diagnotics */ +} /* wifi_network_diagnostics */ + +namespace thread_network_diagnostics { +namespace feature { + +namespace packets_counts { + +uint32_t get_id() +{ + return chip::to_underlying(ThreadNetworkDiagnostics::Feature::kPacketCounts); +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); + update_feature_map(cluster, get_id()); + return ESP_OK; +} + +} /* packets_counts */ + +namespace error_counts { + +uint32_t get_id() +{ + return chip::to_underlying(ThreadNetworkDiagnostics::Feature::kErrorCounts); +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); + update_feature_map(cluster, get_id()); + + /* Attribute managed internally */ + attribute::create_overrun_count(cluster, 0); + + /* Command */ + command::create_reset_counts(cluster); + return ESP_OK; +} + +} /* error_counts */ + +namespace mle_counts { + +uint32_t get_id() +{ + return chip::to_underlying(ThreadNetworkDiagnostics::Feature::kMLECounts); +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); + update_feature_map(cluster, get_id()); + return ESP_OK; +} + +} /* mle_counts */ + +namespace mac_counts { + +uint32_t get_id() +{ + return chip::to_underlying(ThreadNetworkDiagnostics::Feature::kMACCounts); +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); + update_feature_map(cluster, get_id()); + return ESP_OK; +} + +} /* mac_counts */ + +} /* feature */ +} /* thread_network_diagnostics */ namespace ethernet_network_diagnostics { namespace feature { diff --git a/components/esp_matter/esp_matter_feature.h b/components/esp_matter/esp_matter_feature.h index 4aa397b89..96f7b40b0 100644 --- a/components/esp_matter/esp_matter_feature.h +++ b/components/esp_matter/esp_matter_feature.h @@ -468,7 +468,7 @@ esp_err_t add(cluster_t *cluster, config_t *config); } /* feature */ } /* window_covering */ -namespace wifi_network_diagnotics { +namespace wifi_network_diagnostics { namespace feature { namespace packets_counts { @@ -486,7 +486,41 @@ esp_err_t add(cluster_t *cluster); } /* error_counts */ } /* feature */ -} /* wifi_network_diagnotics */ +} /* wifi_network_diagnostics */ + +namespace thread_network_diagnostics { +namespace feature { + +namespace packets_counts { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* packets_counts */ + +namespace error_counts { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* error_counts */ + +namespace mle_counts { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* mle_counts */ + +namespace mac_counts { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* mac_counts */ + +} /* feature */ +} /* thread_network_diagnostics */ namespace ethernet_network_diagnostics { namespace feature { diff --git a/components/esp_matter/private/esp_matter_cluster_revisions.h b/components/esp_matter/private/esp_matter_cluster_revisions.h index c76e4679c..41cc37fca 100644 --- a/components/esp_matter/private/esp_matter_cluster_revisions.h +++ b/components/esp_matter/private/esp_matter_cluster_revisions.h @@ -79,9 +79,9 @@ namespace group_key_management { constexpr uint16_t cluster_revision = 2; } // namespace group_key_management -namespace wifi_network_diagnotics { +namespace wifi_network_diagnostics { constexpr uint16_t cluster_revision = 1; -} // namespace wifi_network_diagnotics +} // namespace wifi_network_diagnostics namespace thread_network_diagnostics { constexpr uint16_t cluster_revision = 3;