From e9833d937cd1b101c06b2c49e9ed92eafbf95a69 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Thu, 24 Aug 2023 03:20:33 -0700 Subject: [PATCH] =?UTF-8?q?Revert=20"[Telink]=20Move=20SetRouterPromotion(?= =?UTF-8?q?false)=20at=20the=20end=20of=20OpenCom=E2=80=A6=20(#28848)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Revert "[Telink] Move SetRouterPromotion(false) at the end of OpenCommissioningWindow (#25517)" This reverts commit 37c3db969e100b50d284906e940317d1b48926f5. * Revert "[Telink] Block device role changing into Router if commissioning window opened and device not yet Router (#25395)" This reverts commit c1261582574ea53ecb6a261cc63e9b2aab8916a9. --- src/app/server/CommissioningWindowManager.cpp | 24 ------------------- src/app/server/CommissioningWindowManager.h | 4 ---- src/include/platform/ThreadStackManager.h | 6 ----- src/platform/Linux/ThreadStackManagerImpl.cpp | 5 ---- src/platform/Linux/ThreadStackManagerImpl.h | 2 -- ...GenericThreadStackManagerImpl_OpenThread.h | 1 - ...nericThreadStackManagerImpl_OpenThread.hpp | 13 ---------- src/platform/Tizen/ThreadStackManagerImpl.cpp | 5 ---- src/platform/Tizen/ThreadStackManagerImpl.h | 2 -- 9 files changed, 62 deletions(-) diff --git a/src/app/server/CommissioningWindowManager.cpp b/src/app/server/CommissioningWindowManager.cpp index a8c6fe1cea462c..cbc7c44e7fb6f8 100644 --- a/src/app/server/CommissioningWindowManager.cpp +++ b/src/app/server/CommissioningWindowManager.cpp @@ -25,10 +25,6 @@ #include #include -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD && CHIP_DEVICE_CONFIG_THREAD_FTD -using namespace chip::DeviceLayer; -#endif - using namespace chip::app::Clusters; using namespace chip::System::Clock; @@ -112,15 +108,6 @@ void CommissioningWindowManager::ResetState() UpdateWindowStatus(CommissioningWindowStatusEnum::kWindowNotOpen); -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD && CHIP_DEVICE_CONFIG_THREAD_FTD - // Recover Router device role. - if (mRecoverRouterDeviceRole) - { - ThreadStackMgr().SetRouterPromotion(true); - mRecoverRouterDeviceRole = false; - } -#endif - UpdateOpenerFabricIndex(NullNullable); UpdateOpenerVendorId(NullNullable); @@ -249,17 +236,6 @@ CHIP_ERROR CommissioningWindowManager::OpenCommissioningWindow(Seconds16 commiss mCommissioningTimeoutTimerArmed = true; -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD && CHIP_DEVICE_CONFIG_THREAD_FTD - // Block device role changing into Router if commissioning window opened and device not yet Router. - // AdvertiseAndListenForPASE fails doesn't matter, because if it does the callers of OpenCommissioningWindow - // will end up calling ResetState, which will reset the boolean. - if (ConnectivityManagerImpl().GetThreadDeviceType() == ConnectivityManager::kThreadDeviceType_Router) - { - ThreadStackMgr().SetRouterPromotion(false); - mRecoverRouterDeviceRole = true; - } -#endif - return AdvertiseAndListenForPASE(); } diff --git a/src/app/server/CommissioningWindowManager.h b/src/app/server/CommissioningWindowManager.h index 1fabd26bd6827d..fae3c075f5b518 100644 --- a/src/app/server/CommissioningWindowManager.h +++ b/src/app/server/CommissioningWindowManager.h @@ -215,10 +215,6 @@ class CommissioningWindowManager : public Messaging::UnsolicitedMessageHandler, bool mSEDActiveModeEnabled = false; #endif -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD && CHIP_DEVICE_CONFIG_THREAD_FTD - bool mRecoverRouterDeviceRole = false; -#endif - // For tests only, so that we can test the commissioning window timeout // without having to wait 3 minutes. Optional mMinCommissioningTimeoutOverride; diff --git a/src/include/platform/ThreadStackManager.h b/src/include/platform/ThreadStackManager.h index 3f72378e285653..589d138ba77773 100755 --- a/src/include/platform/ThreadStackManager.h +++ b/src/include/platform/ThreadStackManager.h @@ -105,7 +105,6 @@ class ThreadStackManager CHIP_ERROR GetPrimary802154MACAddress(uint8_t * buf); CHIP_ERROR GetExternalIPv6Address(chip::Inet::IPAddress & addr); CHIP_ERROR GetPollPeriod(uint32_t & buf); - void SetRouterPromotion(bool val); CHIP_ERROR JoinerStart(); CHIP_ERROR SetThreadProvision(ByteSpan aDataset); @@ -453,11 +452,6 @@ inline CHIP_ERROR ThreadStackManager::GetPollPeriod(uint32_t & buf) return static_cast(this)->_GetPollPeriod(buf); } -inline void ThreadStackManager::SetRouterPromotion(bool val) -{ - static_cast(this)->_SetRouterPromotion(val); -} - inline CHIP_ERROR ThreadStackManager::JoinerStart() { return static_cast(this)->_JoinerStart(); diff --git a/src/platform/Linux/ThreadStackManagerImpl.cpp b/src/platform/Linux/ThreadStackManagerImpl.cpp index dfaee5297f6f11..f1ee3a7dac7c5e 100755 --- a/src/platform/Linux/ThreadStackManagerImpl.cpp +++ b/src/platform/Linux/ThreadStackManagerImpl.cpp @@ -614,11 +614,6 @@ CHIP_ERROR ThreadStackManagerImpl::_JoinerStart() return CHIP_ERROR_NOT_IMPLEMENTED; } -void ThreadStackManagerImpl::_SetRouterPromotion(bool val) -{ - // Set Router Promotion is not supported on linux -} - CHIP_ERROR ThreadStackManagerImpl::GLibMatterContextCallScan(ThreadStackManagerImpl * self) { VerifyOrDie(g_main_context_get_thread_default() != nullptr); diff --git a/src/platform/Linux/ThreadStackManagerImpl.h b/src/platform/Linux/ThreadStackManagerImpl.h index 22bbc7f5191924..b91d210f7c5028 100755 --- a/src/platform/Linux/ThreadStackManagerImpl.h +++ b/src/platform/Linux/ThreadStackManagerImpl.h @@ -118,8 +118,6 @@ class ThreadStackManagerImpl : public ThreadStackManager CHIP_ERROR _JoinerStart(); - void _SetRouterPromotion(bool val); - void _ResetThreadNetworkDiagnosticsCounts(); CHIP_ERROR _WriteThreadNetworkDiagnosticAttributeToTlv(AttributeId attributeId, app::AttributeValueEncoder & encoder); diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h index 603161900b788f..b28058b5946d72 100755 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h @@ -120,7 +120,6 @@ class GenericThreadStackManagerImpl_OpenThread void _ResetThreadNetworkDiagnosticsCounts(void); CHIP_ERROR _WriteThreadNetworkDiagnosticAttributeToTlv(AttributeId attributeId, app::AttributeValueEncoder & encoder); CHIP_ERROR _GetPollPeriod(uint32_t & buf); - void _SetRouterPromotion(bool val); void _OnWoBLEAdvertisingStart(void); void _OnWoBLEAdvertisingStop(void); diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp index da821aefc6c0e7..4d2f461e61dd7f 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp @@ -1677,19 +1677,6 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_GetPollPeriod(u return CHIP_NO_ERROR; } -template -void GenericThreadStackManagerImpl_OpenThread::_SetRouterPromotion(bool val) -{ -#if CHIP_DEVICE_CONFIG_THREAD_FTD - Impl()->LockThreadStack(); - if (otThreadGetDeviceRole(DeviceLayer::ThreadStackMgrImpl().OTInstance()) != OT_DEVICE_ROLE_ROUTER) - { - otThreadSetRouterEligible(DeviceLayer::ThreadStackMgrImpl().OTInstance(), val); - } - Impl()->UnlockThreadStack(); -#endif -} - template CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::DoInit(otInstance * otInst) { diff --git a/src/platform/Tizen/ThreadStackManagerImpl.cpp b/src/platform/Tizen/ThreadStackManagerImpl.cpp index 7813fb0c083ee0..10d0a56b1ebae3 100644 --- a/src/platform/Tizen/ThreadStackManagerImpl.cpp +++ b/src/platform/Tizen/ThreadStackManagerImpl.cpp @@ -491,11 +491,6 @@ CHIP_ERROR ThreadStackManagerImpl::_JoinerStart() return CHIP_ERROR_NOT_IMPLEMENTED; } -void ThreadStackManagerImpl::_SetRouterPromotion(bool val) -{ - // Set Router Promotion is not supported on Tizen -} - CHIP_ERROR ThreadStackManagerImpl::_StartThreadScan(NetworkCommissioning::ThreadDriver::ScanCallback * callback) { ChipLogError(DeviceLayer, "Not implemented"); diff --git a/src/platform/Tizen/ThreadStackManagerImpl.h b/src/platform/Tizen/ThreadStackManagerImpl.h index 018e8a5358f199..efa2c84e93252a 100644 --- a/src/platform/Tizen/ThreadStackManagerImpl.h +++ b/src/platform/Tizen/ThreadStackManagerImpl.h @@ -100,8 +100,6 @@ class ThreadStackManagerImpl : public ThreadStackManager CHIP_ERROR _JoinerStart(); - void _SetRouterPromotion(bool val); - void _ResetThreadNetworkDiagnosticsCounts(); CHIP_ERROR _WriteThreadNetworkDiagnosticAttributeToTlv(AttributeId attributeId, app::AttributeValueEncoder & encoder);