Skip to content

Commit

Permalink
Revert "[Telink] Move SetRouterPromotion(false) at the end of OpenCom… (
Browse files Browse the repository at this point in the history
#28848)

* Revert "[Telink] Move SetRouterPromotion(false) at the end of OpenCommissioningWindow (#25517)"

This reverts commit 37c3db9.

* Revert "[Telink] Block device role changing into Router if commissioning window opened and device not yet Router (#25395)"

This reverts commit c126158.
  • Loading branch information
woody-apple authored and pull[bot] committed Oct 16, 2023
1 parent aeaf4f2 commit 1112362
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 62 deletions.
24 changes: 0 additions & 24 deletions src/app/server/CommissioningWindowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
#include <platform/CommissionableDataProvider.h>
#include <platform/DeviceControlServer.h>

#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;

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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();
}

Expand Down
4 changes: 0 additions & 4 deletions src/app/server/CommissioningWindowManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<System::Clock::Seconds16> mMinCommissioningTimeoutOverride;
Expand Down
6 changes: 0 additions & 6 deletions src/include/platform/ThreadStackManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -453,11 +452,6 @@ inline CHIP_ERROR ThreadStackManager::GetPollPeriod(uint32_t & buf)
return static_cast<ImplClass *>(this)->_GetPollPeriod(buf);
}

inline void ThreadStackManager::SetRouterPromotion(bool val)
{
static_cast<ImplClass *>(this)->_SetRouterPromotion(val);
}

inline CHIP_ERROR ThreadStackManager::JoinerStart()
{
return static_cast<ImplClass *>(this)->_JoinerStart();
Expand Down
5 changes: 0 additions & 5 deletions src/platform/Linux/ThreadStackManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions src/platform/Linux/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1677,19 +1677,6 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_GetPollPeriod(u
return CHIP_NO_ERROR;
}

template <class ImplClass>
void GenericThreadStackManagerImpl_OpenThread<ImplClass>::_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 <class ImplClass>
CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::DoInit(otInstance * otInst)
{
Expand Down
5 changes: 0 additions & 5 deletions src/platform/Tizen/ThreadStackManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 0 additions & 2 deletions src/platform/Tizen/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1112362

Please sign in to comment.