|
25 | 25 | #include <platform/CommissionableDataProvider.h>
|
26 | 26 | #include <platform/DeviceControlServer.h>
|
27 | 27 |
|
| 28 | +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD && CHIP_DEVICE_CONFIG_THREAD_FTD |
| 29 | +using namespace chip::DeviceLayer; |
| 30 | +#endif |
| 31 | + |
28 | 32 | using namespace chip::app::Clusters;
|
29 | 33 | using namespace chip::System::Clock;
|
30 | 34 |
|
@@ -108,6 +112,15 @@ void CommissioningWindowManager::ResetState()
|
108 | 112 |
|
109 | 113 | UpdateWindowStatus(CommissioningWindowStatusEnum::kWindowNotOpen);
|
110 | 114 |
|
| 115 | +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD && CHIP_DEVICE_CONFIG_THREAD_FTD |
| 116 | + // Recover Router device role. |
| 117 | + if (mRecoverRouterDeviceRole) |
| 118 | + { |
| 119 | + ThreadStackMgr().SetRouterPromotion(true); |
| 120 | + mRecoverRouterDeviceRole = false; |
| 121 | + } |
| 122 | +#endif |
| 123 | + |
111 | 124 | UpdateOpenerFabricIndex(NullNullable);
|
112 | 125 | UpdateOpenerVendorId(NullNullable);
|
113 | 126 |
|
@@ -457,6 +470,15 @@ CHIP_ERROR CommissioningWindowManager::StartAdvertisement()
|
457 | 470 | // reset all advertising, switching to our new commissioning mode.
|
458 | 471 | app::DnssdServer::Instance().StartServer();
|
459 | 472 |
|
| 473 | +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD && CHIP_DEVICE_CONFIG_THREAD_FTD |
| 474 | + // Block device role changing into Router if commissioning window opened and device not yet Router. |
| 475 | + if (ConnectivityManagerImpl().GetThreadDeviceType() == ConnectivityManager::kThreadDeviceType_Router) |
| 476 | + { |
| 477 | + ThreadStackMgr().SetRouterPromotion(false); |
| 478 | + mRecoverRouterDeviceRole = true; |
| 479 | + } |
| 480 | +#endif |
| 481 | + |
460 | 482 | return CHIP_NO_ERROR;
|
461 | 483 | }
|
462 | 484 |
|
|
0 commit comments