From 90548e61650f075442fc87610dec62ad609f6805 Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Fri, 22 Mar 2024 13:32:03 +0100 Subject: [PATCH] Remove unused ThreadMode setting --- src/include/platform/ConnectivityManager.h | 26 ------------- .../GenericConnectivityManagerImpl_NoThread.h | 21 ----------- .../GenericConnectivityManagerImpl_Thread.h | 10 ----- .../GenericConnectivityManagerImpl_Thread.ipp | 37 ------------------- 4 files changed, 94 deletions(-) diff --git a/src/include/platform/ConnectivityManager.h b/src/include/platform/ConnectivityManager.h index ed881f78cc2c3c..30002484c33a3d 100644 --- a/src/include/platform/ConnectivityManager.h +++ b/src/include/platform/ConnectivityManager.h @@ -102,14 +102,6 @@ class ConnectivityManager kWiFiAPMode_OnDemand_NoStationProvision = 5, }; - enum ThreadMode - { - kThreadMode_NotSupported = 0, - kThreadMode_ApplicationControlled = 1, - kThreadMode_Disabled = 2, - kThreadMode_Enabled = 3, - }; - enum WiFiStationState { kWiFiStationState_NotConnected, @@ -192,10 +184,7 @@ class ConnectivityManager void SetWiFiAPIdleTimeout(System::Clock::Timeout val); // Thread Methods - ThreadMode GetThreadMode(); - CHIP_ERROR SetThreadMode(ThreadMode val); bool IsThreadEnabled(); - bool IsThreadApplicationControlled(); ThreadDeviceType GetThreadDeviceType(); CHIP_ERROR SetThreadDeviceType(ThreadDeviceType deviceType); bool IsThreadAttached(); @@ -417,26 +406,11 @@ inline CHIP_ERROR ConnectivityManager::GetAndLogWiFiStatsCounters() return static_cast(this)->_GetAndLogWiFiStatsCounters(); } -inline ConnectivityManager::ThreadMode ConnectivityManager::GetThreadMode() -{ - return static_cast(this)->_GetThreadMode(); -} - -inline CHIP_ERROR ConnectivityManager::SetThreadMode(ThreadMode val) -{ - return static_cast(this)->_SetThreadMode(val); -} - inline bool ConnectivityManager::IsThreadEnabled() { return static_cast(this)->_IsThreadEnabled(); } -inline bool ConnectivityManager::IsThreadApplicationControlled() -{ - return static_cast(this)->_IsThreadApplicationControlled(); -} - inline ConnectivityManager::ThreadDeviceType ConnectivityManager::GetThreadDeviceType() { return static_cast(this)->_GetThreadDeviceType(); diff --git a/src/include/platform/internal/GenericConnectivityManagerImpl_NoThread.h b/src/include/platform/internal/GenericConnectivityManagerImpl_NoThread.h index c84f2160a1457b..865feb9b55845b 100755 --- a/src/include/platform/internal/GenericConnectivityManagerImpl_NoThread.h +++ b/src/include/platform/internal/GenericConnectivityManagerImpl_NoThread.h @@ -44,10 +44,7 @@ class GenericConnectivityManagerImpl_NoThread protected: // ===== Methods that implement the ConnectivityManager abstract interface. - ConnectivityManager::ThreadMode _GetThreadMode(void); - CHIP_ERROR _SetThreadMode(ConnectivityManager::ThreadMode val); bool _IsThreadEnabled(void); - bool _IsThreadApplicationControlled(void); ConnectivityManager::ThreadDeviceType _GetThreadDeviceType(void); CHIP_ERROR _SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType); bool _IsThreadAttached(void); @@ -57,30 +54,12 @@ class GenericConnectivityManagerImpl_NoThread ImplClass * Impl() { return static_cast(this); } }; -template -inline ConnectivityManager::ThreadMode GenericConnectivityManagerImpl_NoThread::_GetThreadMode(void) -{ - return ConnectivityManager::kThreadMode_NotSupported; -} - -template -inline CHIP_ERROR GenericConnectivityManagerImpl_NoThread::_SetThreadMode(ConnectivityManager::ThreadMode val) -{ - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; -} - template inline bool GenericConnectivityManagerImpl_NoThread::_IsThreadEnabled(void) { return false; } -template -inline bool GenericConnectivityManagerImpl_NoThread::_IsThreadApplicationControlled(void) -{ - return false; -} - template inline bool GenericConnectivityManagerImpl_NoThread::_IsThreadAttached(void) { diff --git a/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.h b/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.h index 3e0e6c1a18a171..f20412fda3aa3e 100755 --- a/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.h +++ b/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.h @@ -58,10 +58,7 @@ class GenericConnectivityManagerImpl_Thread void _Init(); void _OnPlatformEvent(const ChipDeviceEvent * event); - ConnectivityManager::ThreadMode _GetThreadMode(); - CHIP_ERROR _SetThreadMode(ConnectivityManager::ThreadMode val); bool _IsThreadEnabled(); - bool _IsThreadApplicationControlled(); ConnectivityManager::ThreadDeviceType _GetThreadDeviceType(); CHIP_ERROR _SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType); #if CHIP_CONFIG_ENABLE_ICD_SERVER @@ -82,7 +79,6 @@ class GenericConnectivityManagerImpl_Thread enum class Flags : uint8_t { kHaveServiceConnectivity = 0x01, - kIsApplicationControlled = 0x02 }; BitFlags mFlags; @@ -102,12 +98,6 @@ inline bool GenericConnectivityManagerImpl_Thread::_IsThreadEnabled() return ThreadStackMgrImpl().IsThreadEnabled(); } -template -inline bool GenericConnectivityManagerImpl_Thread::_IsThreadApplicationControlled() -{ - return mFlags.Has(Flags::kIsApplicationControlled); -} - template inline bool GenericConnectivityManagerImpl_Thread::_IsThreadAttached() { diff --git a/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.ipp b/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.ipp index 6df48f5f0a590f..403ddd643b7193 100644 --- a/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.ipp +++ b/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.ipp @@ -56,43 +56,6 @@ void GenericConnectivityManagerImpl_Thread::_OnPlatformEvent(const Ch } } -template -ConnectivityManager::ThreadMode GenericConnectivityManagerImpl_Thread::_GetThreadMode() -{ - if (mFlags.Has(Flags::kIsApplicationControlled)) - { - return ConnectivityManager::kThreadMode_ApplicationControlled; - } - - return ThreadStackMgrImpl().IsThreadEnabled() ? ConnectivityManager::kThreadMode_Enabled - : ConnectivityManager::kThreadMode_Disabled; -} - -template -CHIP_ERROR GenericConnectivityManagerImpl_Thread::_SetThreadMode(ConnectivityManager::ThreadMode val) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - VerifyOrExit(val == ConnectivityManager::kThreadMode_Enabled || val == ConnectivityManager::kThreadMode_Disabled || - val == ConnectivityManager::kThreadMode_ApplicationControlled, - err = CHIP_ERROR_INVALID_ARGUMENT); - - if (val == ConnectivityManager::kThreadMode_ApplicationControlled) - { - mFlags.Set(Flags::kIsApplicationControlled); - } - else - { - mFlags.Clear(Flags::kIsApplicationControlled); - - err = ThreadStackMgrImpl().SetThreadEnabled(val == ConnectivityManager::kThreadMode_Enabled); - SuccessOrExit(err); - } - -exit: - return err; -} - template void GenericConnectivityManagerImpl_Thread::UpdateServiceConnectivity() {