From 2aafb491364123ec98faf4d7e5d570c35b1de9d1 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 28 Jun 2022 03:28:01 -0400 Subject: [PATCH] Remove incorrect GenericConnectivityManagerImpl_NoThread::_WriteThreadNetworkDiagnosticAttributeToTlv code. (#20014) We should not be doing anything other than returning error here: consumers should not enable Thread network diagnostics while not even compiling in Thread support in the connectivity manager. And this avoids the codesize hit for platforms that in fact do not support Thread. --- .../GenericConnectivityManagerImpl_NoThread.h | 164 +----------------- 1 file changed, 1 insertion(+), 163 deletions(-) diff --git a/src/include/platform/internal/GenericConnectivityManagerImpl_NoThread.h b/src/include/platform/internal/GenericConnectivityManagerImpl_NoThread.h index 6e7f51c92874cc..61b157e25d5563 100644 --- a/src/include/platform/internal/GenericConnectivityManagerImpl_NoThread.h +++ b/src/include/platform/internal/GenericConnectivityManagerImpl_NoThread.h @@ -143,169 +143,7 @@ template inline CHIP_ERROR GenericConnectivityManagerImpl_NoThread::_WriteThreadNetworkDiagnosticAttributeToTlv( AttributeId attributeId, app::AttributeValueEncoder & encoder) { - CHIP_ERROR err = CHIP_NO_ERROR; - - switch (attributeId) - { - case app::Clusters::ThreadNetworkDiagnostics::Attributes::NeighborTableList::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RouteTableList::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::ActiveNetworkFaultsList::Id: - err = encoder.EncodeEmptyList(); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::Channel::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RoutingRole::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::NetworkName::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::PanId::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::ExtendedPanId::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::MeshLocalPrefix::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::PartitionId::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::Weighting::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::DataVersion::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::StableDataVersion::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::LeaderRouterId::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::ActiveTimestamp::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::PendingTimestamp::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::Delay::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::ChannelMask::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::SecurityPolicy::Id: - case app::Clusters::ThreadNetworkDiagnostics::Attributes::OperationalDatasetComponents::Id: - err = encoder.EncodeNull(); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::OverrunCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::DetachedRoleCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::ChildRoleCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RouterRoleCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::LeaderRoleCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::AttachAttemptCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::PartitionIdChangeCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::BetterPartitionAttachAttemptCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::ParentChangeCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxTotalCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxUnicastCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBroadcastCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxAckRequestedCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxAckedCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxNoAckRequestedCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDataCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDataPollCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBeaconCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBeaconRequestCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxOtherCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxRetryCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDirectMaxRetryExpiryCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxIndirectMaxRetryExpiryCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrCcaCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrAbortCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrBusyChannelCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxTotalCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxUnicastCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBroadcastCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDataCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDataPollCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBeaconCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBeaconRequestCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxOtherCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxAddressFilteredCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDestAddrFilteredCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDuplicatedCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrNoFrameCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrUnknownNeighborCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrInvalidSrcAddrCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrSecCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrFcsCount::Id: - err = encoder.Encode(static_cast(0)); - break; - case app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrOtherCount::Id: - err = encoder.Encode(static_cast(0)); - break; - default: - err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; - break; - } - - return err; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } } // namespace Internal