From 1c4f37d32855a0bcfb73224c79833f8b29b1aa53 Mon Sep 17 00:00:00 2001 From: Kamil Kasperczyk <66371704+kkasperczyk-no@users.noreply.github.com> Date: Thu, 28 Apr 2022 03:21:18 +0200 Subject: [PATCH] Added support for Thread Synchronized Sleepy End Devices (#17803) Thread 1.2 allows to use Synchronized Sleepy End Devices that doesn't need to poll parent for data like traditional SED, but wakes up in scheduled time slots to listen for messages without transmitting requests to parent. * Refactored naming for sleepy end devices, as everywhere the polling mechanism is assumed. Basically renamed polling intervals to intervals and fast/slow polling mode to active/idle mode. * Added CHIP_DEVICE_CONFIG_THREAD_SSED that allows to enable Thread SSED support. * Added new Thread kThreadDeviceType_SynchronizedSleepyEndDevice device type * Added calculating communication intervals for Thread SSED based on CSL period instead of poll period. --- .../Kconfig.multiprotocol_rpmsg.defaults | 4 + config/zephyr/Kconfig | 6 ++ .../main/include/CHIPProjectConfig.h | 2 +- .../main/include/CHIPProjectConfig.h | 2 +- .../main/include/CHIPProjectConfig.h | 2 +- .../k32w/k32w0/include/CHIPProjectConfig.h | 4 +- src/app/server/CommissioningWindowManager.cpp | 4 +- src/app/server/Dnssd.cpp | 2 +- src/include/platform/CHIPDeviceConfig.h | 26 +++-- src/include/platform/CHIPDeviceEvent.h | 6 +- src/include/platform/ConnectivityManager.h | 61 ++++++------ src/include/platform/ThreadStackManager.h | 30 +++--- .../GenericConnectivityManagerImpl_NoThread.h | 16 +-- .../GenericConnectivityManagerImpl_Thread.h | 20 ++-- src/messaging/ExchangeContext.cpp | 22 ++--- src/messaging/ExchangeContext.h | 16 +-- src/messaging/ReliableMessageContext.h | 20 ++-- .../ReliableMessageProtocolConfig.cpp | 10 +- src/platform/Linux/ThreadStackManagerImpl.cpp | 16 +-- src/platform/Linux/ThreadStackManagerImpl.h | 6 +- ...nericThreadStackManagerImpl_OpenThread.cpp | 97 ++++++++++++------- ...GenericThreadStackManagerImpl_OpenThread.h | 14 +-- .../nrfconnect/CHIPDevicePlatformConfig.h | 1 + 23 files changed, 219 insertions(+), 168 deletions(-) diff --git a/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.defaults b/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.defaults index ae993ca7ef63fc..18d3e7889ae1a2 100644 --- a/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.defaults +++ b/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.defaults @@ -97,3 +97,7 @@ config NRF_802154_SER_RADIO config NRF_RTC_TIMER_USER_CHAN_COUNT int default 2 + +config NRF_802154_ENCRYPTION + bool + default y diff --git a/config/zephyr/Kconfig b/config/zephyr/Kconfig index 748047ca5a85d7..b47aa808439ea2 100644 --- a/config/zephyr/Kconfig +++ b/config/zephyr/Kconfig @@ -139,6 +139,12 @@ config CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT help Enables Thread Sleepy End Device support in Matter. +config CHIP_THREAD_SSED + bool "Enable Thread Synchronized Sleepy End Device support" + depends on OPENTHREAD_CSL_RECEIVER && CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT + help + Enables Thread Synchronized Sleepy End Device support in Matter. + config CHIP_OTA_REQUESTOR bool "Enable OTA requestor" help diff --git a/examples/all-clusters-app/nrfconnect/main/include/CHIPProjectConfig.h b/examples/all-clusters-app/nrfconnect/main/include/CHIPProjectConfig.h index 625dd7ae7b361a..59863c6a38949e 100644 --- a/examples/all-clusters-app/nrfconnect/main/include/CHIPProjectConfig.h +++ b/examples/all-clusters-app/nrfconnect/main/include/CHIPProjectConfig.h @@ -30,6 +30,6 @@ #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 -#define CHIP_DEVICE_CONFIG_SED_SLOW_POLLING_INTERVAL 2000_ms32 +#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 2000_ms32 #define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 diff --git a/examples/light-switch-app/nrfconnect/main/include/CHIPProjectConfig.h b/examples/light-switch-app/nrfconnect/main/include/CHIPProjectConfig.h index 862c63c8b5c02e..3360f4cb60d62e 100644 --- a/examples/light-switch-app/nrfconnect/main/include/CHIPProjectConfig.h +++ b/examples/light-switch-app/nrfconnect/main/include/CHIPProjectConfig.h @@ -30,5 +30,5 @@ /* Use a default pairing code if one hasn't been provisioned in flash. */ #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 -#define CHIP_DEVICE_CONFIG_SED_SLOW_POLLING_INTERVAL 2000_ms32 +#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 2000_ms32 #define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 diff --git a/examples/lock-app/nrfconnect/main/include/CHIPProjectConfig.h b/examples/lock-app/nrfconnect/main/include/CHIPProjectConfig.h index 4dfcd9bb79779b..1eb34c2c8eb0bb 100644 --- a/examples/lock-app/nrfconnect/main/include/CHIPProjectConfig.h +++ b/examples/lock-app/nrfconnect/main/include/CHIPProjectConfig.h @@ -31,6 +31,6 @@ #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 -#define CHIP_DEVICE_CONFIG_SED_SLOW_POLLING_INTERVAL 2000_ms32 +#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 2000_ms32 #define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 diff --git a/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h b/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h index 839dd07cc42a06..e353245107691c 100644 --- a/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h +++ b/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h @@ -139,8 +139,8 @@ #define CHIP_CONFIG_MAX_FABRICS 4 // 3 fabrics + 1 for rotation slack #define CHIP_DEVICE_CONFIG_ENABLE_SED 1 -#define CHIP_DEVICE_CONFIG_SED_SLOW_POLLING_INTERVAL 1000_ms32 -#define CHIP_DEVICE_CONFIG_SED_FAST_POLLING_INTERVAL 100_ms32 +#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 1000_ms32 +#define CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL 100_ms32 /** * CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE diff --git a/src/app/server/CommissioningWindowManager.cpp b/src/app/server/CommissioningWindowManager.cpp index 455337c5de8d9a..f9e1c639ef598e 100644 --- a/src/app/server/CommissioningWindowManager.cpp +++ b/src/app/server/CommissioningWindowManager.cpp @@ -339,7 +339,7 @@ CHIP_ERROR CommissioningWindowManager::StartAdvertisement() #if CHIP_DEVICE_CONFIG_ENABLE_SED if (!mIsBLE && mWindowStatus == AdministratorCommissioning::CommissioningWindowStatus::kWindowNotOpen) { - DeviceLayer::ConnectivityMgr().RequestSEDFastPollingMode(true); + DeviceLayer::ConnectivityMgr().RequestSEDActiveMode(true); } #endif @@ -381,7 +381,7 @@ CHIP_ERROR CommissioningWindowManager::StopAdvertisement(bool aShuttingDown) #if CHIP_DEVICE_CONFIG_ENABLE_SED if (!mIsBLE && mWindowStatus != AdministratorCommissioning::CommissioningWindowStatus::kWindowNotOpen) { - DeviceLayer::ConnectivityMgr().RequestSEDFastPollingMode(false); + DeviceLayer::ConnectivityMgr().RequestSEDActiveMode(false); } #endif diff --git a/src/app/server/Dnssd.cpp b/src/app/server/Dnssd.cpp index 3f8bf616cf5700..96e409030c45d8 100644 --- a/src/app/server/Dnssd.cpp +++ b/src/app/server/Dnssd.cpp @@ -47,7 +47,7 @@ void OnPlatformEvent(const DeviceLayer::ChipDeviceEvent * event) { if (event->Type == DeviceLayer::DeviceEventType::kDnssdPlatformInitialized #if CHIP_DEVICE_CONFIG_ENABLE_SED - || event->Type == DeviceLayer::DeviceEventType::kSEDPollingIntervalChange + || event->Type == DeviceLayer::DeviceEventType::kSEDIntervalChange #endif ) { diff --git a/src/include/platform/CHIPDeviceConfig.h b/src/include/platform/CHIPDeviceConfig.h index 4b45de6424aa42..105cf23e25af52 100644 --- a/src/include/platform/CHIPDeviceConfig.h +++ b/src/include/platform/CHIPDeviceConfig.h @@ -126,23 +126,23 @@ #endif /** - * CHIP_DEVICE_CONFIG_SED_SLOW_POLLING_INTERVAL + * CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL * - * The default amount of time in milliseconds that the sleepy end device will use as a slow-polling interval. + * The default amount of time in milliseconds that the sleepy end device will use as an idle interval. * This interval is used by the device to periodically wake up and poll the data in the idle mode. */ -#ifndef CHIP_DEVICE_CONFIG_SED_SLOW_POLLING_INTERVAL -#define CHIP_DEVICE_CONFIG_SED_SLOW_POLLING_INTERVAL 5000_ms32 +#ifndef CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL +#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 5000_ms32 #endif /** - * CHIP_DEVICE_CONFIG_SED_FAST_POLLING_INTERVAL + * CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL * - * The default amount of time in milliseconds that the sleepy end device will use as a fast-polling interval. + * The default amount of time in milliseconds that the sleepy end device will use as an active interval. * This interval is used by the device to periodically wake up and poll the data in the active mode. */ -#ifndef CHIP_DEVICE_CONFIG_SED_FAST_POLLING_INTERVAL -#define CHIP_DEVICE_CONFIG_SED_FAST_POLLING_INTERVAL 200_ms32 +#ifndef CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL +#define CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL 200_ms32 #endif // -------------------- Device Identification Configuration -------------------- @@ -691,6 +691,16 @@ #define CHIP_DEVICE_CONFIG_THREAD_FTD 1 #endif +/** + * CHIP_DEVICE_CONFIG_THREAD_SSED + * + * Enable support for Thread Synchronized Sleepy End Device behavior. + * + */ +#ifndef CHIP_DEVICE_CONFIG_THREAD_SSED +#define CHIP_DEVICE_CONFIG_THREAD_SSED 0 +#endif + /** * CHIP_DEVICE_CONFIG_THREAD_TASK_NAME * diff --git a/src/include/platform/CHIPDeviceEvent.h b/src/include/platform/CHIPDeviceEvent.h index f5988a7a4ffc4d..2ff9526b58ce28 100644 --- a/src/include/platform/CHIPDeviceEvent.h +++ b/src/include/platform/CHIPDeviceEvent.h @@ -161,11 +161,11 @@ enum PublicEventTypes kTimeSyncChange, /** - * SED Polling Interval Change + * SED Interval Change * - * Signals a change to the sleepy end device polling interval. + * Signals a change to the sleepy end device interval. */ - kSEDPollingIntervalChange, + kSEDIntervalChange, /** * Security Session Established diff --git a/src/include/platform/ConnectivityManager.h b/src/include/platform/ConnectivityManager.h index 32824e2fd6462e..105f70a74ee506 100644 --- a/src/include/platform/ConnectivityManager.h +++ b/src/include/platform/ConnectivityManager.h @@ -133,11 +133,12 @@ class ConnectivityManager enum ThreadDeviceType { - kThreadDeviceType_NotSupported = 0, - kThreadDeviceType_Router = 1, - kThreadDeviceType_FullEndDevice = 2, - kThreadDeviceType_MinimalEndDevice = 3, - kThreadDeviceType_SleepyEndDevice = 4, + kThreadDeviceType_NotSupported = 0, + kThreadDeviceType_Router = 1, + kThreadDeviceType_FullEndDevice = 2, + kThreadDeviceType_MinimalEndDevice = 3, + kThreadDeviceType_SleepyEndDevice = 4, + kThreadDeviceType_SynchronizedSleepyEndDevice = 5, }; enum BLEAdvertisingMode @@ -146,13 +147,13 @@ class ConnectivityManager kSlowAdvertising = 1, }; - enum class SEDPollingMode + enum class SEDIntervalMode { Idle = 0, Active = 1, }; - struct SEDPollingConfig; + struct SEDIntervalsConfig; void SetDelegate(ConnectivityManagerDelegate * delegate) { mDelegate = delegate; } ConnectivityManagerDelegate * GetDelegate() const { return mDelegate; } @@ -195,24 +196,24 @@ class ConnectivityManager // Sleepy end device methods #if CHIP_DEVICE_CONFIG_ENABLE_SED - CHIP_ERROR GetSEDPollingConfig(SEDPollingConfig & pollingConfig); + CHIP_ERROR GetSEDIntervalsConfig(SEDIntervalsConfig & intervalsConfig); /** - * Sets Sleepy End Device polling configuration and posts kSEDPollingIntervalChange event to inform other software + * Sets Sleepy End Device intervals configuration and posts kSEDIntervalChange event to inform other software * modules about the change. * - * @param[in] pollingConfig polling intervals configuration to be set + * @param[in] intervalsConfig intervals configuration to be set */ - CHIP_ERROR SetSEDPollingConfig(const SEDPollingConfig & pollingConfig); + CHIP_ERROR SetSEDIntervalsConfig(const SEDIntervalsConfig & intervalsConfig); /** - * Requests setting Sleepy End Device fast polling interval on or off. - * Every method call with onOff parameter set to true or false results in incrementing or decrementing the fast polling - * consumers counter. Fast polling mode is set if the consumers counter is bigger than 0. + * Requests setting Sleepy End Device active interval on or off. + * Every method call with onOff parameter set to true or false results in incrementing or decrementing the active mode + * consumers counter. Active mode is set if the consumers counter is bigger than 0. * - * @param[in] onOff true if fast polling should be enabled and false otherwise. + * @param[in] onOff true if active mode should be enabled and false otherwise. */ - CHIP_ERROR RequestSEDFastPollingMode(bool onOff); + CHIP_ERROR RequestSEDActiveMode(bool onOff); #endif // CHIPoBLE service methods @@ -271,17 +272,17 @@ class ConnectivityManager }; /** - * Information describing the desired polling behavior of a sleepy end device (SED). + * Information describing the desired intervals for a sleepy end device (SED). */ -struct ConnectivityManager::SEDPollingConfig +struct ConnectivityManager::SEDIntervalsConfig { - /** Interval at which the device polls its parent when there are active chip exchanges in progress. Only meaningful when the - * device is acting as a sleepy end node. */ - System::Clock::Milliseconds32 FastPollingIntervalMS; + /** Interval at which the device is able to communicate with its parent when there are active chip exchanges in progress. Only + * meaningful when the device is acting as a sleepy end node. */ + System::Clock::Milliseconds32 ActiveIntervalMS; - /** Interval at which the device polls its parent when there are NO active chip exchanges in progress. Only meaningful when the - * device is acting as a sleepy end node. */ - System::Clock::Milliseconds32 SlowPollingIntervalMS; + /** Interval at which the device is able to communicate with its parent when there are NO active chip exchanges in progress. + * Only meaningful when the device is acting as a sleepy end node. */ + System::Clock::Milliseconds32 IdleIntervalMS; }; /** @@ -442,19 +443,19 @@ inline CHIP_ERROR ConnectivityManager::SetThreadDeviceType(ThreadDeviceType devi } #if CHIP_DEVICE_CONFIG_ENABLE_SED -inline CHIP_ERROR ConnectivityManager::GetSEDPollingConfig(SEDPollingConfig & pollingConfig) +inline CHIP_ERROR ConnectivityManager::GetSEDIntervalsConfig(SEDIntervalsConfig & intervalsConfig) { - return static_cast(this)->_GetSEDPollingConfig(pollingConfig); + return static_cast(this)->_GetSEDIntervalsConfig(intervalsConfig); } -inline CHIP_ERROR ConnectivityManager::SetSEDPollingConfig(const SEDPollingConfig & pollingConfig) +inline CHIP_ERROR ConnectivityManager::SetSEDIntervalsConfig(const SEDIntervalsConfig & intervalsConfig) { - return static_cast(this)->_SetSEDPollingConfig(pollingConfig); + return static_cast(this)->_SetSEDIntervalsConfig(intervalsConfig); } -inline CHIP_ERROR ConnectivityManager::RequestSEDFastPollingMode(bool onOff) +inline CHIP_ERROR ConnectivityManager::RequestSEDActiveMode(bool onOff) { - return static_cast(this)->_RequestSEDFastPollingMode(onOff); + return static_cast(this)->_RequestSEDActiveMode(onOff); } #endif diff --git a/src/include/platform/ThreadStackManager.h b/src/include/platform/ThreadStackManager.h index f236835f832d1e..5ce7ec1dd09ea6 100644 --- a/src/include/platform/ThreadStackManager.h +++ b/src/include/platform/ThreadStackManager.h @@ -163,24 +163,24 @@ class ThreadStackManager CHIP_ERROR SetThreadDeviceType(ConnectivityManager::ThreadDeviceType threadRole); #if CHIP_DEVICE_CONFIG_ENABLE_SED - CHIP_ERROR GetSEDPollingConfig(ConnectivityManager::SEDPollingConfig & pollingConfig); + CHIP_ERROR GetSEDIntervalsConfig(ConnectivityManager::SEDIntervalsConfig & intervalsConfig); /** - * Sets Sleepy End Device polling configuration and posts kSEDPollingIntervalChange event to inform other software + * Sets Sleepy End Device intervals configuration and posts kSEDIntervalChange event to inform other software * modules about the change. * - * @param[in] pollingConfig polling intervals configuration to be set + * @param[in] intervalsConfig intervals configuration to be set */ - CHIP_ERROR SetSEDPollingConfig(const ConnectivityManager::SEDPollingConfig & pollingConfig); + CHIP_ERROR SetSEDIntervalsConfig(const ConnectivityManager::SEDIntervalsConfig & intervalsConfig); /** - * Requests setting Sleepy End Device fast polling interval on or off. - * Every method call with onOff parameter set to true or false results in incrementing or decrementing the fast polling - * consumers counter. Fast polling mode is set if the consumers counter is bigger than 0. + * Requests setting Sleepy End Device active interval on or off. + * Every method call with onOff parameter set to true or false results in incrementing or decrementing the active mode + * consumers counter. Active mode is set if the consumers counter is bigger than 0. * - * @param[in] onOff true if fast polling should be enabled and false otherwise. + * @param[in] onOff true if active mode should be enabled and false otherwise. */ - CHIP_ERROR RequestSEDFastPollingMode(bool onOff); + CHIP_ERROR RequestSEDActiveMode(bool onOff); #endif bool HaveMeshConnectivity(); @@ -390,19 +390,19 @@ inline CHIP_ERROR ThreadStackManager::SetThreadDeviceType(ConnectivityManager::T } #if CHIP_DEVICE_CONFIG_ENABLE_SED -inline CHIP_ERROR ThreadStackManager::GetSEDPollingConfig(ConnectivityManager::SEDPollingConfig & pollingConfig) +inline CHIP_ERROR ThreadStackManager::GetSEDIntervalsConfig(ConnectivityManager::SEDIntervalsConfig & intervalsConfig) { - return static_cast(this)->_GetSEDPollingConfig(pollingConfig); + return static_cast(this)->_GetSEDIntervalsConfig(intervalsConfig); } -inline CHIP_ERROR ThreadStackManager::SetSEDPollingConfig(const ConnectivityManager::SEDPollingConfig & pollingConfig) +inline CHIP_ERROR ThreadStackManager::SetSEDIntervalsConfig(const ConnectivityManager::SEDIntervalsConfig & intervalsConfig) { - return static_cast(this)->_SetSEDPollingConfig(pollingConfig); + return static_cast(this)->_SetSEDIntervalsConfig(intervalsConfig); } -inline CHIP_ERROR ThreadStackManager::RequestSEDFastPollingMode(bool onOff) +inline CHIP_ERROR ThreadStackManager::RequestSEDActiveMode(bool onOff) { - return static_cast(this)->_RequestSEDFastPollingMode(onOff); + return static_cast(this)->_RequestSEDActiveMode(onOff); } #endif diff --git a/src/include/platform/internal/GenericConnectivityManagerImpl_NoThread.h b/src/include/platform/internal/GenericConnectivityManagerImpl_NoThread.h index e25dcb4ff8aea4..e4bb6cf9f31e80 100644 --- a/src/include/platform/internal/GenericConnectivityManagerImpl_NoThread.h +++ b/src/include/platform/internal/GenericConnectivityManagerImpl_NoThread.h @@ -50,9 +50,9 @@ class GenericConnectivityManagerImpl_NoThread bool _IsThreadApplicationControlled(void); ConnectivityManager::ThreadDeviceType _GetThreadDeviceType(void); CHIP_ERROR _SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType); - CHIP_ERROR _GetSEDPollingConfig(ConnectivityManager::SEDPollingConfig & pollingConfig); - CHIP_ERROR _SetSEDPollingConfig(const ConnectivityManager::SEDPollingConfig & pollingConfig); - CHIP_ERROR _RequestSEDFastPollingMode(bool onOff); + CHIP_ERROR _GetSEDIntervalsConfig(ConnectivityManager::SEDIntervalsConfig & intervalsConfig); + CHIP_ERROR _SetSEDIntervalsConfig(const ConnectivityManager::SEDIntervalsConfig & intervalsConfig); + CHIP_ERROR _RequestSEDActiveMode(bool onOff); bool _IsThreadAttached(void); bool _IsThreadProvisioned(void); void _ErasePersistentInfo(void); @@ -116,21 +116,21 @@ GenericConnectivityManagerImpl_NoThread::_SetThreadDeviceType(Connect } template -inline CHIP_ERROR -GenericConnectivityManagerImpl_NoThread::_GetSEDPollingConfig(ConnectivityManager::SEDPollingConfig & pollingConfig) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoThread::_GetSEDIntervalsConfig( + ConnectivityManager::SEDIntervalsConfig & intervalsConfig) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } template -inline CHIP_ERROR GenericConnectivityManagerImpl_NoThread::_SetSEDPollingConfig( - const ConnectivityManager::SEDPollingConfig & pollingConfig) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoThread::_SetSEDIntervalsConfig( + const ConnectivityManager::SEDIntervalsConfig & intervalsConfig) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } template -inline CHIP_ERROR GenericConnectivityManagerImpl_NoThread::_RequestSEDFastPollingMode(bool onOff) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoThread::_RequestSEDActiveMode(bool onOff) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } diff --git a/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.h b/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.h index 2c34aa81b921f8..84cf4f04da31aa 100644 --- a/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.h +++ b/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.h @@ -64,9 +64,9 @@ class GenericConnectivityManagerImpl_Thread ConnectivityManager::ThreadDeviceType _GetThreadDeviceType(); CHIP_ERROR _SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType); #if CHIP_DEVICE_CONFIG_ENABLE_SED - CHIP_ERROR _GetSEDPollingConfig(ConnectivityManager::SEDPollingConfig & pollingConfig); - CHIP_ERROR _SetSEDPollingConfig(const ConnectivityManager::SEDPollingConfig & pollingConfig); - CHIP_ERROR _RequestSEDFastPollingMode(bool onOff); + CHIP_ERROR _GetSEDIntervalsConfig(ConnectivityManager::SEDIntervalsConfig & intervalsConfig); + CHIP_ERROR _SetSEDIntervalsConfig(const ConnectivityManager::SEDIntervalsConfig & intervalsConfig); + CHIP_ERROR _RequestSEDActiveMode(bool onOff); #endif bool _IsThreadAttached(); bool _IsThreadProvisioned(); @@ -144,22 +144,22 @@ GenericConnectivityManagerImpl_Thread::_SetThreadDeviceType(Connectiv #if CHIP_DEVICE_CONFIG_ENABLE_SED template inline CHIP_ERROR -GenericConnectivityManagerImpl_Thread::_GetSEDPollingConfig(ConnectivityManager::SEDPollingConfig & pollingConfig) +GenericConnectivityManagerImpl_Thread::_GetSEDIntervalsConfig(ConnectivityManager::SEDIntervalsConfig & intervalsConfig) { - return ThreadStackMgrImpl().GetSEDPollingConfig(pollingConfig); + return ThreadStackMgrImpl().GetSEDIntervalsConfig(intervalsConfig); } template -inline CHIP_ERROR -GenericConnectivityManagerImpl_Thread::_SetSEDPollingConfig(const ConnectivityManager::SEDPollingConfig & pollingConfig) +inline CHIP_ERROR GenericConnectivityManagerImpl_Thread::_SetSEDIntervalsConfig( + const ConnectivityManager::SEDIntervalsConfig & intervalsConfig) { - return ThreadStackMgrImpl().SetSEDPollingConfig(pollingConfig); + return ThreadStackMgrImpl().SetSEDIntervalsConfig(intervalsConfig); } template -inline CHIP_ERROR GenericConnectivityManagerImpl_Thread::_RequestSEDFastPollingMode(bool onOff) +inline CHIP_ERROR GenericConnectivityManagerImpl_Thread::_RequestSEDActiveMode(bool onOff) { - return ThreadStackMgrImpl().RequestSEDFastPollingMode(onOff); + return ThreadStackMgrImpl().RequestSEDActiveMode(onOff); } #endif diff --git a/src/messaging/ExchangeContext.cpp b/src/messaging/ExchangeContext.cpp index c75c687ea5e5e2..28592c19457d06 100644 --- a/src/messaging/ExchangeContext.cpp +++ b/src/messaging/ExchangeContext.cpp @@ -85,13 +85,13 @@ void ExchangeContext::SetResponseTimeout(Timeout timeout) } #if CONFIG_DEVICE_LAYER && CHIP_DEVICE_CONFIG_ENABLE_SED -void ExchangeContext::UpdateSEDPollingMode() +void ExchangeContext::UpdateSEDIntervalMode() { if (!HasSessionHandle()) { // After the session has been deleted, no further communication can occur on the exchange, - // so withdraw a SED fast-polling mode request. - UpdateSEDPollingMode(false); + // so withdraw a SED active mode request. + UpdateSEDIntervalMode(false); return; } @@ -110,15 +110,15 @@ void ExchangeContext::UpdateSEDPollingMode() } VerifyOrReturn(address.GetTransportType() != Transport::Type::kBle); - UpdateSEDPollingMode(IsResponseExpected() || IsSendExpected() || IsMessageNotAcked()); + UpdateSEDIntervalMode(IsResponseExpected() || IsSendExpected() || IsMessageNotAcked()); } -void ExchangeContext::UpdateSEDPollingMode(bool fastPollingMode) +void ExchangeContext::UpdateSEDIntervalMode(bool activeMode) { - if (fastPollingMode != IsRequestingFastPollingMode()) + if (activeMode != IsRequestingActiveMode()) { - SetRequestingFastPollingMode(fastPollingMode); - DeviceLayer::ConnectivityMgr().RequestSEDFastPollingMode(fastPollingMode); + SetRequestingActiveMode(activeMode); + DeviceLayer::ConnectivityMgr().RequestSEDActiveMode(activeMode); } } #endif @@ -301,8 +301,8 @@ ExchangeContext::~ExchangeContext() VerifyOrDie(!IsAckPending()); #if CONFIG_DEVICE_LAYER && CHIP_DEVICE_CONFIG_ENABLE_SED - // Make sure that the exchange withdraws the request for Sleepy End Device fast-polling mode. - UpdateSEDPollingMode(false); + // Make sure that the exchange withdraws the request for Sleepy End Device active mode. + UpdateSEDIntervalMode(false); #endif // Ideally, in this scenario, the retransmit table should @@ -482,7 +482,7 @@ CHIP_ERROR ExchangeContext::HandleMessage(uint32_t messageCounter, const Payload void ExchangeContext::MessageHandled() { #if CONFIG_DEVICE_LAYER && CHIP_DEVICE_CONFIG_ENABLE_SED - UpdateSEDPollingMode(); + UpdateSEDIntervalMode(); #endif if (mFlags.Has(Flags::kFlagClosed) || IsResponseExpected() || IsSendExpected()) diff --git a/src/messaging/ExchangeContext.h b/src/messaging/ExchangeContext.h index 94a75200f3500b..ec4b4916070038 100644 --- a/src/messaging/ExchangeContext.h +++ b/src/messaging/ExchangeContext.h @@ -240,23 +240,23 @@ class DLL_EXPORT ExchangeContext : public ReliableMessageContext, void MessageHandled(); /** - * Updates Sleepy End Device polling mode in the following way: + * Updates Sleepy End Device intervals mode in the following way: * - does nothing for exchanges over Bluetooth LE - * - requests fast-polling (active) mode if there are more messages, + * - requests active mode if there are more messages, * including MRP acknowledgements, expected to be sent or received on * this exchange. - * - withdraws the request for fast-polling (active) mode, otherwise. + * - withdraws the request for active mode, otherwise. */ - void UpdateSEDPollingMode(); + void UpdateSEDIntervalMode(); /** - * Requests or withdraws the request for Sleepy End Device fast-polling mode + * Requests or withdraws the request for Sleepy End Device active mode * based on the argument value. * - * Note that the device switches to the slow-polling (idle) mode if no - * exchange nor other component requests the fast-polling mode. + * Note that the device switches to the idle mode if no + * exchange nor other component requests the active mode. */ - void UpdateSEDPollingMode(bool fastPollingMode); + void UpdateSEDIntervalMode(bool activeMode); }; } // namespace Messaging diff --git a/src/messaging/ReliableMessageContext.h b/src/messaging/ReliableMessageContext.h index f82e94201d8a64..804b358ea294cb 100644 --- a/src/messaging/ReliableMessageContext.h +++ b/src/messaging/ReliableMessageContext.h @@ -135,11 +135,11 @@ class ReliableMessageContext /// Set whether there is a message hasn't been acknowledged. void SetMessageNotAcked(bool messageNotAcked); - /// Set if this exchange is requesting Sleepy End Device fast-polling mode - void SetRequestingFastPollingMode(bool fastPollingMode); + /// Set if this exchange is requesting Sleepy End Device active mode + void SetRequestingActiveMode(bool activeMode); - /// Determine whether this exchange is requesting Sleepy End Device fast-polling mode - bool IsRequestingFastPollingMode() const; + /// Determine whether this exchange is requesting Sleepy End Device active mode + bool IsRequestingActiveMode() const; /** * Get the reliable message manager that corresponds to this reliable @@ -180,8 +180,8 @@ class ReliableMessageContext /// When set, we have had Close() or Abort() called on us already. kFlagClosed = (1u << 8), - /// When set, signifies that the exchange is requesting Sleepy End Device fast-polling mode. - kFlagFastPollingMode = (1u << 9), + /// When set, signifies that the exchange is requesting Sleepy End Device active mode. + kFlagActiveMode = (1u << 9), }; BitFlags mFlags; // Internal state flags @@ -238,9 +238,9 @@ inline bool ReliableMessageContext::HasPiggybackAckPending() const return mFlags.Has(Flags::kFlagAckMessageCounterIsValid); } -inline bool ReliableMessageContext::IsRequestingFastPollingMode() const +inline bool ReliableMessageContext::IsRequestingActiveMode() const { - return mFlags.Has(Flags::kFlagFastPollingMode); + return mFlags.Has(Flags::kFlagActiveMode); } inline void ReliableMessageContext::SetAutoRequestAck(bool autoReqAck) @@ -263,9 +263,9 @@ inline void ReliableMessageContext::SetMessageNotAcked(bool messageNotAcked) mFlags.Set(Flags::kFlagMessageNotAcked, messageNotAcked); } -inline void ReliableMessageContext::SetRequestingFastPollingMode(bool fastPollingMode) +inline void ReliableMessageContext::SetRequestingActiveMode(bool activeMode) { - mFlags.Set(Flags::kFlagFastPollingMode, fastPollingMode); + mFlags.Set(Flags::kFlagActiveMode, activeMode); } } // namespace Messaging diff --git a/src/messaging/ReliableMessageProtocolConfig.cpp b/src/messaging/ReliableMessageProtocolConfig.cpp index 3404ad97623957..6132a240cbaed3 100644 --- a/src/messaging/ReliableMessageProtocolConfig.cpp +++ b/src/messaging/ReliableMessageProtocolConfig.cpp @@ -37,14 +37,14 @@ ReliableMessageProtocolConfig GetLocalMRPConfig() CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL); #if CHIP_DEVICE_CONFIG_ENABLE_SED - DeviceLayer::ConnectivityManager::SEDPollingConfig sedPollingConfig; + DeviceLayer::ConnectivityManager::SEDIntervalsConfig sedIntervalsConfig; - if (DeviceLayer::ConnectivityMgr().GetSEDPollingConfig(sedPollingConfig) == CHIP_NO_ERROR) + if (DeviceLayer::ConnectivityMgr().GetSEDIntervalsConfig(sedIntervalsConfig) == CHIP_NO_ERROR) { - // Increase default MRP retry intervals by SED polling intervals. That is, intervals for + // Increase default MRP retry intervals by SED intervals. That is, intervals for // which the device can be at sleep and not be able to receive any messages). - config.mIdleRetransTimeout += sedPollingConfig.SlowPollingIntervalMS; - config.mActiveRetransTimeout += sedPollingConfig.FastPollingIntervalMS; + config.mIdleRetransTimeout += sedIntervalsConfig.IdleIntervalMS; + config.mActiveRetransTimeout += sedIntervalsConfig.ActiveIntervalMS; } #endif diff --git a/src/platform/Linux/ThreadStackManagerImpl.cpp b/src/platform/Linux/ThreadStackManagerImpl.cpp index 1b547bf02198a5..b02e14d9d37930 100644 --- a/src/platform/Linux/ThreadStackManagerImpl.cpp +++ b/src/platform/Linux/ThreadStackManagerImpl.cpp @@ -480,27 +480,27 @@ CHIP_ERROR ThreadStackManagerImpl::_SetThreadDeviceType(ConnectivityManager::Thr } #if CHIP_DEVICE_CONFIG_ENABLE_SED -CHIP_ERROR ThreadStackManagerImpl::_GetSEDPollingConfig(ConnectivityManager::SEDPollingConfig & pollingConfig) +CHIP_ERROR ThreadStackManagerImpl::_GetSEDIntervalsConfig(ConnectivityManager::SEDIntervalsConfig & intervalsConfig) { - (void) pollingConfig; + (void) intervalsConfig; - ChipLogError(DeviceLayer, "Polling config is not supported on linux"); + ChipLogError(DeviceLayer, "SED intervals config is not supported on linux"); return CHIP_ERROR_NOT_IMPLEMENTED; } -CHIP_ERROR ThreadStackManagerImpl::_SetSEDPollingConfig(const ConnectivityManager::SEDPollingConfig & pollingConfig) +CHIP_ERROR ThreadStackManagerImpl::_SetSEDIntervalsConfig(const ConnectivityManager::SEDIntervalsConfig & intervalsConfig) { - (void) pollingConfig; + (void) intervalsConfig; - ChipLogError(DeviceLayer, "Polling config is not supported on linux"); + ChipLogError(DeviceLayer, "SED intervals config is not supported on linux"); return CHIP_ERROR_NOT_IMPLEMENTED; } -CHIP_ERROR ThreadStackManagerImpl::_RequestSEDFastPollingMode(bool onOff) +CHIP_ERROR ThreadStackManagerImpl::_RequestSEDActiveMode(bool onOff) { (void) onOff; - ChipLogError(DeviceLayer, "Polling config is not supported on linux"); + ChipLogError(DeviceLayer, "SED intervals config is not supported on linux"); return CHIP_ERROR_NOT_IMPLEMENTED; } #endif diff --git a/src/platform/Linux/ThreadStackManagerImpl.h b/src/platform/Linux/ThreadStackManagerImpl.h index f112c065a65de5..cb86c1e9e695c8 100644 --- a/src/platform/Linux/ThreadStackManagerImpl.h +++ b/src/platform/Linux/ThreadStackManagerImpl.h @@ -87,9 +87,9 @@ class ThreadStackManagerImpl : public ThreadStackManager CHIP_ERROR _SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType); #if CHIP_DEVICE_CONFIG_ENABLE_SED - CHIP_ERROR _GetSEDPollingConfig(ConnectivityManager::SEDPollingConfig & pollingConfig); - CHIP_ERROR _SetSEDPollingConfig(const ConnectivityManager::SEDPollingConfig & pollingConfig); - CHIP_ERROR _RequestSEDFastPollingMode(bool onOff); + CHIP_ERROR _GetSEDIntervalsConfig(ConnectivityManager::SEDIntervalsConfig & intervalsConfig); + CHIP_ERROR _SetSEDIntervalsConfig(const ConnectivityManager::SEDIntervalsConfig & intervalsConfig); + CHIP_ERROR _RequestSEDActiveMode(bool onOff); #endif bool _HaveMeshConnectivity(); diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp index a43809ff08fba7..5d786ca9815ce2 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp @@ -467,6 +467,11 @@ ConnectivityManager::ThreadDeviceType GenericThreadStackManagerImpl_OpenThread::_SetThreadDeviceType(Connec #endif case ConnectivityManager::kThreadDeviceType_MinimalEndDevice: case ConnectivityManager::kThreadDeviceType_SleepyEndDevice: +#if CHIP_DEVICE_CONFIG_THREAD_SSED + case ConnectivityManager::kThreadDeviceType_SynchronizedSleepyEndDevice: +#endif break; default: ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); @@ -512,6 +520,11 @@ GenericThreadStackManagerImpl_OpenThread::_SetThreadDeviceType(Connec case ConnectivityManager::kThreadDeviceType_SleepyEndDevice: deviceTypeStr = "SLEEPY END DEVICE"; break; +#if CHIP_DEVICE_CONFIG_THREAD_SSED + case ConnectivityManager::kThreadDeviceType_SynchronizedSleepyEndDevice: + deviceTypeStr = "SYNCHRONIZED SLEEPY END DEVICE"; + break; +#endif default: deviceTypeStr = "(unknown)"; break; @@ -540,6 +553,7 @@ GenericThreadStackManagerImpl_OpenThread::_SetThreadDeviceType(Connec linkMode.mRxOnWhenIdle = true; break; case ConnectivityManager::kThreadDeviceType_SleepyEndDevice: + case ConnectivityManager::kThreadDeviceType_SynchronizedSleepyEndDevice: linkMode.mDeviceType = false; linkMode.mRxOnWhenIdle = false; break; @@ -1634,14 +1648,14 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::DoInit(otInstanc mOTInst = otInst; #if CHIP_DEVICE_CONFIG_ENABLE_SED - ConnectivityManager::SEDPollingConfig sedPollingConfig; + ConnectivityManager::SEDIntervalsConfig sedIntervalsConfig; using namespace System::Clock::Literals; - sedPollingConfig.FastPollingIntervalMS = CHIP_DEVICE_CONFIG_SED_FAST_POLLING_INTERVAL; - sedPollingConfig.SlowPollingIntervalMS = CHIP_DEVICE_CONFIG_SED_SLOW_POLLING_INTERVAL; - err = _SetSEDPollingConfig(sedPollingConfig); + sedIntervalsConfig.ActiveIntervalMS = CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL; + sedIntervalsConfig.IdleIntervalMS = CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL; + err = _SetSEDIntervalsConfig(sedIntervalsConfig); if (err != CHIP_NO_ERROR) { - ChipLogError(DeviceLayer, "Sleepy end device polling config set failed: %s", ErrorStr(err)); + ChipLogError(DeviceLayer, "Failed to set sleepy end device intervals: %s", ErrorStr(err)); } SuccessOrExit(err); #endif @@ -1680,6 +1694,7 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::DoInit(otInstanc initNetworkCommissioningThreadDriver(); exit: + ChipLogProgress(DeviceLayer, "OpenThread started: %s", otThreadErrorToString(otErr)); return err; } @@ -1699,31 +1714,31 @@ bool GenericThreadStackManagerImpl_OpenThread::IsThreadInterfaceUpNoL #if CHIP_DEVICE_CONFIG_ENABLE_SED template -CHIP_ERROR -GenericThreadStackManagerImpl_OpenThread::_GetSEDPollingConfig(ConnectivityManager::SEDPollingConfig & pollingConfig) +CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_GetSEDIntervalsConfig( + ConnectivityManager::SEDIntervalsConfig & intervalsConfig) { - pollingConfig = mPollingConfig; + intervalsConfig = mIntervalsConfig; return CHIP_NO_ERROR; } template -CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_SetSEDPollingConfig( - const ConnectivityManager::SEDPollingConfig & pollingConfig) +CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_SetSEDIntervalsConfig( + const ConnectivityManager::SEDIntervalsConfig & intervalsConfig) { using namespace System::Clock::Literals; - if ((pollingConfig.SlowPollingIntervalMS < pollingConfig.FastPollingIntervalMS) || - (pollingConfig.SlowPollingIntervalMS == 0_ms32) || (pollingConfig.FastPollingIntervalMS == 0_ms32)) + if ((intervalsConfig.IdleIntervalMS < intervalsConfig.ActiveIntervalMS) || (intervalsConfig.IdleIntervalMS == 0_ms32) || + (intervalsConfig.ActiveIntervalMS == 0_ms32)) { return CHIP_ERROR_INVALID_ARGUMENT; } - mPollingConfig = pollingConfig; + mIntervalsConfig = intervalsConfig; - CHIP_ERROR err = SetSEDPollingMode(mPollingMode); + CHIP_ERROR err = SetSEDIntervalMode(mIntervalsMode); if (err == CHIP_NO_ERROR) { ChipDeviceEvent event; - event.Type = DeviceEventType::kSEDPollingIntervalChange; + event.Type = DeviceEventType::kSEDIntervalChange; err = chip::DeviceLayer::PlatformMgr().PostEvent(&event); } @@ -1731,65 +1746,79 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_SetSEDPollingCo } template -CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::SetSEDPollingMode(ConnectivityManager::SEDPollingMode pollingType) +CHIP_ERROR +GenericThreadStackManagerImpl_OpenThread::SetSEDIntervalMode(ConnectivityManager::SEDIntervalMode intervalType) { CHIP_ERROR err = CHIP_NO_ERROR; System::Clock::Milliseconds32 interval; - if (pollingType == ConnectivityManager::SEDPollingMode::Idle) + if (intervalType == ConnectivityManager::SEDIntervalMode::Idle) { - interval = mPollingConfig.SlowPollingIntervalMS; + interval = mIntervalsConfig.IdleIntervalMS; } - else if (pollingType == ConnectivityManager::SEDPollingMode::Active) + else if (intervalType == ConnectivityManager::SEDIntervalMode::Active) { - interval = mPollingConfig.FastPollingIntervalMS; + interval = mIntervalsConfig.ActiveIntervalMS; } else { return CHIP_ERROR_INVALID_ARGUMENT; } - mPollingMode = pollingType; + mIntervalsMode = intervalType; Impl()->LockThreadStack(); - uint32_t curPollingIntervalMS = otLinkGetPollPeriod(mOTInst); +// For Thread devices, the intervals are defined as: +// * poll period for SED devices that poll the parent for data +// * CSL period for SSED devices that listen for messages in scheduled time slots. +#if CHIP_DEVICE_CONFIG_THREAD_SSED + // Get CSL period in units of 10 symbols, convert it to microseconds and divide by 1000 to get milliseconds. + uint32_t curIntervalMS = otLinkCslGetPeriod(mOTInst) * OT_US_PER_TEN_SYMBOLS / 1000; +#else + uint32_t curIntervalMS = otLinkGetPollPeriod(mOTInst); +#endif - if (interval.count() != curPollingIntervalMS) + if (interval.count() != curIntervalMS) { +#if CHIP_DEVICE_CONFIG_THREAD_SSED + // Set CSL period in units of 10 symbols, convert it to microseconds and divide by 1000 to get milliseconds. + otError otErr = otLinkCslSetPeriod(mOTInst, interval.count() * 1000 / OT_US_PER_TEN_SYMBOLS); +#else otError otErr = otLinkSetPollPeriod(mOTInst, interval.count()); - err = MapOpenThreadError(otErr); +#endif + err = MapOpenThreadError(otErr); } Impl()->UnlockThreadStack(); - if (interval.count() != curPollingIntervalMS) + if (interval.count() != curIntervalMS) { - ChipLogProgress(DeviceLayer, "OpenThread polling interval set to %" PRId32 "ms", interval.count()); + ChipLogProgress(DeviceLayer, "OpenThread SED interval set to %" PRId32 "ms", interval.count()); } return err; } template -CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_RequestSEDFastPollingMode(bool onOff) +CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_RequestSEDActiveMode(bool onOff) { CHIP_ERROR err = CHIP_NO_ERROR; - ConnectivityManager::SEDPollingMode mode; + ConnectivityManager::SEDIntervalMode mode; if (onOff) { - mFastPollingConsumers++; + mActiveModeConsumers++; } else { - if (mFastPollingConsumers > 0) - mFastPollingConsumers--; + if (mActiveModeConsumers > 0) + mActiveModeConsumers--; } - mode = mFastPollingConsumers > 0 ? ConnectivityManager::SEDPollingMode::Active : ConnectivityManager::SEDPollingMode::Idle; + mode = mActiveModeConsumers > 0 ? ConnectivityManager::SEDIntervalMode::Active : ConnectivityManager::SEDIntervalMode::Idle; - if (mPollingMode != mode) - err = SetSEDPollingMode(mode); + if (mIntervalsMode != mode) + err = SetSEDIntervalMode(mode); return err; } diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h index e3395ec147145c..397658b146ee5f 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h @@ -101,9 +101,9 @@ class GenericThreadStackManagerImpl_OpenThread void _UpdateNetworkStatus(); #if CHIP_DEVICE_CONFIG_ENABLE_SED - CHIP_ERROR _GetSEDPollingConfig(ConnectivityManager::SEDPollingConfig & pollingConfig); - CHIP_ERROR _SetSEDPollingConfig(const ConnectivityManager::SEDPollingConfig & pollingConfig); - CHIP_ERROR _RequestSEDFastPollingMode(bool onOff); + CHIP_ERROR _GetSEDIntervalsConfig(ConnectivityManager::SEDIntervalsConfig & intervalsConfig); + CHIP_ERROR _SetSEDIntervalsConfig(const ConnectivityManager::SEDIntervalsConfig & intervalsConfig); + CHIP_ERROR _RequestSEDActiveMode(bool onOff); #endif bool _HaveMeshConnectivity(void); @@ -157,9 +157,9 @@ class GenericThreadStackManagerImpl_OpenThread NetworkCommissioning::Internal::BaseDriver::NetworkStatusChangeCallback * mpStatusChangeCallback = nullptr; #if CHIP_DEVICE_CONFIG_ENABLE_SED - ConnectivityManager::SEDPollingConfig mPollingConfig; - ConnectivityManager::SEDPollingMode mPollingMode = ConnectivityManager::SEDPollingMode::Idle; - uint32_t mFastPollingConsumers = 0; + ConnectivityManager::SEDIntervalsConfig mIntervalsConfig; + ConnectivityManager::SEDIntervalMode mIntervalsMode = ConnectivityManager::SEDIntervalMode::Idle; + uint32_t mActiveModeConsumers = 0; #endif #if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT @@ -271,7 +271,7 @@ class GenericThreadStackManagerImpl_OpenThread void OnJoinerComplete(otError aError); #if CHIP_DEVICE_CONFIG_ENABLE_SED - CHIP_ERROR SetSEDPollingMode(ConnectivityManager::SEDPollingMode pollingType); + CHIP_ERROR SetSEDIntervalMode(ConnectivityManager::SEDIntervalMode intervalType); #endif inline ImplClass * Impl() { return static_cast(this); } diff --git a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h index 52479283b23825..0861f7ebc79527 100644 --- a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h +++ b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h @@ -116,6 +116,7 @@ #ifdef CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT #define CHIP_DEVICE_CONFIG_ENABLE_SED 1 +#define CHIP_DEVICE_CONFIG_THREAD_SSED CONFIG_CHIP_THREAD_SSED #endif // CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT #ifdef CONFIG_CHIP_COMMISSIONABLE_DEVICE_TYPE