Skip to content

Commit

Permalink
[icd] Removed ICD related methods (former SED) from NoThreadImpl
Browse files Browse the repository at this point in the history
There are several methods related to ICD (former SED) used for
setting expected communication intervals. Currently they are
implemented only for Thread devices and for Wi-Fi the
implementation returns unsupported feature through NoThreadImpl.
Including this sleep intervals could be useful for some low power
Wi-Fi modes too.

Changes:
* Removed methods implementation from NoThread impl. Now after
enabling CHIP_DEVICE_CONFIG_ENABLE_SED (I believe it should be
renamed to ICD in the future), the implementation will have to
be provided by the proper platform.
* Implemented methods for nrfconnect Wi-Fi platform.
  • Loading branch information
kkasperczyk-no committed Jan 16, 2023
1 parent 28cb6cc commit 2044552
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 23 deletions.
7 changes: 7 additions & 0 deletions examples/light-switch-app/nrfconnect/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ config CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT

endif # NET_L2_OPENTHREAD

if CHIP_WIFI

config NRF_WIFI_LOW_POWER
default y

endif # CHIP_WIFI

rsource "../../../config/nrfconnect/chip-module/Kconfig.features"
rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults"
source "Kconfig.zephyr"
7 changes: 7 additions & 0 deletions examples/lock-app/nrfconnect/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ config CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT

endif # NET_L2_OPENTHREAD

if CHIP_WIFI

config NRF_WIFI_LOW_POWER
default y

endif # CHIP_WIFI

rsource "../../../config/nrfconnect/chip-module/Kconfig.features"
rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults"
source "Kconfig.zephyr"
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ class GenericConnectivityManagerImpl_NoThread
bool _IsThreadApplicationControlled(void);
ConnectivityManager::ThreadDeviceType _GetThreadDeviceType(void);
CHIP_ERROR _SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType);
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);
Expand Down Expand Up @@ -115,26 +112,6 @@ GenericConnectivityManagerImpl_NoThread<ImplClass>::_SetThreadDeviceType(Connect
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

template <class ImplClass>
inline CHIP_ERROR GenericConnectivityManagerImpl_NoThread<ImplClass>::_GetSEDIntervalsConfig(
ConnectivityManager::SEDIntervalsConfig & intervalsConfig)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

template <class ImplClass>
inline CHIP_ERROR GenericConnectivityManagerImpl_NoThread<ImplClass>::_SetSEDIntervalsConfig(
const ConnectivityManager::SEDIntervalsConfig & intervalsConfig)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

template <class ImplClass>
inline CHIP_ERROR GenericConnectivityManagerImpl_NoThread<ImplClass>::_RequestSEDActiveMode(bool onOff)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

template <class ImplClass>
inline void GenericConnectivityManagerImpl_NoThread<ImplClass>::_ResetThreadNetworkDiagnosticsCounts()
{}
Expand Down
4 changes: 4 additions & 0 deletions src/platform/nrfconnect/CHIPDevicePlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@
#define CHIP_DEVICE_CONFIG_THREAD_SSED CONFIG_CHIP_THREAD_SSED
#endif // CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT

#ifdef CONFIG_NRF_WIFI_LOW_POWER
#define CHIP_DEVICE_CONFIG_ENABLE_SED 1
#endif // CONFIG_NRF_WIFI_LOW_POWER

#ifndef CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL
#ifdef CONFIG_CHIP_SED_IDLE_INTERVAL
#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL chip::System::Clock::Milliseconds32(CONFIG_CHIP_SED_IDLE_INTERVAL)
Expand Down
20 changes: 20 additions & 0 deletions src/platform/nrfconnect/wifi/ConnectivityManagerImplWiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,26 @@ void ConnectivityManagerImplWiFi::OnStationDisconnected()
}
}

#if CHIP_DEVICE_CONFIG_ENABLE_SED
CHIP_ERROR ConnectivityManagerImplWiFi::_GetSEDIntervalsConfig(ConnectivityManager::SEDIntervalsConfig & SEDIntervalsConfig)
{
// For now Wi-Fi uses legacy power save mode that has fixed inactivity interval
SEDIntervalsConfig.ActiveIntervalMS =
chip::System::Clock::Milliseconds32(WiFiManager::kDefaultDTIMInterval * WiFiManager::kBeaconIntervalMs);
SEDIntervalsConfig.IdleIntervalMS =
chip::System::Clock::Milliseconds32(WiFiManager::kDefaultDTIMInterval * WiFiManager::kBeaconIntervalMs);
return CHIP_NO_ERROR;
}
CHIP_ERROR ConnectivityManagerImplWiFi::_SetSEDIntervalsConfig(const ConnectivityManager::SEDIntervalsConfig & intervalsConfig)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}
CHIP_ERROR ConnectivityManagerImplWiFi::_RequestSEDActiveMode(bool onOff)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}
#endif

ConnectivityManager::WiFiAPMode ConnectivityManagerImplWiFi::_GetWiFiAPMode(void)
{
/* AP mode is unsupported */
Expand Down
6 changes: 6 additions & 0 deletions src/platform/nrfconnect/wifi/ConnectivityManagerImplWiFi.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ class ConnectivityManagerImplWiFi
void OnStationConnected();
void OnStationDisconnected();

#if CHIP_DEVICE_CONFIG_ENABLE_SED
CHIP_ERROR _GetSEDIntervalsConfig(ConnectivityManager::SEDIntervalsConfig & intervalsConfig);
CHIP_ERROR _SetSEDIntervalsConfig(const ConnectivityManager::SEDIntervalsConfig & intervalsConfig);
CHIP_ERROR _RequestSEDActiveMode(bool onOff);
#endif

// Wi-Fi access point - not supported
ConnectivityManager::WiFiAPMode _GetWiFiAPMode(void);
CHIP_ERROR _SetWiFiAPMode(ConnectivityManager::WiFiAPMode val);
Expand Down
5 changes: 5 additions & 0 deletions src/platform/nrfconnect/wifi/WiFiManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ class WiFiManager
uint32_t mOverruns{};
};

#if CHIP_DEVICE_CONFIG_ENABLE_SED
static constexpr uint8_t kDefaultDTIMInterval = 3;
static constexpr uint8_t kBeaconIntervalMs = 100;
#endif

CHIP_ERROR Init();
CHIP_ERROR Scan(const ByteSpan & ssid, ScanCallback callback);
CHIP_ERROR Connect(const ByteSpan & ssid, const ByteSpan & credentials, const ConnectionHandling & handling);
Expand Down

0 comments on commit 2044552

Please sign in to comment.