diff --git a/examples/platform/silabs/efr32/wf200/host_if.cpp b/examples/platform/silabs/efr32/wf200/host_if.cpp index 1d0f061e77d1bc..94aad7334bd6e4 100644 --- a/examples/platform/silabs/efr32/wf200/host_if.cpp +++ b/examples/platform/silabs/efr32/wf200/host_if.cpp @@ -602,15 +602,6 @@ static void wfx_events_task(void * p_arg) retryJoin = 0; retryInterval = WLAN_MIN_RETRY_TIMER_MS; wfx_lwip_set_sta_link_up(); -#ifdef SLEEP_ENABLED - if (!(wfx_get_wifi_state() & SL_WFX_AP_INTERFACE_UP)) - { - // Enable the power save - SILABS_LOG("WF200 going to DTIM based sleep"); - sl_wfx_set_power_mode(WFM_PM_MODE_DTIM, WFM_PM_POLL_FAST_PS, BEACON_1); - sl_wfx_enable_device_power_save(); - } -#endif // SLEEP_ENABLED } if (flags & SL_WFX_DISCONNECT) @@ -896,6 +887,18 @@ int32_t wfx_reset_counts() return -1; } +/************************************************************************ + * @brief + * reset the count + * @return returns -1 + **************************************************************************/ +void wfx_power_save() { + // Enable the power save + SILABS_LOG("WF200 going to DTIM based sleep"); + sl_wfx_set_power_mode(WFM_PM_MODE_DTIM, WFM_PM_POLL_FAST_PS, BEACON_1); + sl_wfx_enable_device_power_save(); +} + /************************************************************************* * @brief * I think that this is getting called before FreeRTOS threads are ready diff --git a/src/platform/silabs/BLEManagerImpl.h b/src/platform/silabs/BLEManagerImpl.h index 330aad5a1c4be6..da6ce3bb4e3002 100644 --- a/src/platform/silabs/BLEManagerImpl.h +++ b/src/platform/silabs/BLEManagerImpl.h @@ -72,7 +72,6 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla void HandleTxConfirmationEvent(BLE_CONNECTION_OBJECT conId); void HandleTXCharCCCDWrite(rsi_ble_event_write_t * evt); void HandleSoftTimerEvent(void); - CHIP_ERROR StartAdvertising(void); #else void HandleConnectEvent(volatile sl_bt_msg_t * evt); void HandleConnectionCloseEvent(volatile sl_bt_msg_t * evt); @@ -81,8 +80,9 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla void HandleTxConfirmationEvent(BLE_CONNECTION_OBJECT conId); void HandleTXCharCCCDWrite(volatile sl_bt_msg_t * evt); void HandleSoftTimerEvent(volatile sl_bt_msg_t * evt); - CHIP_ERROR StartAdvertising(void); #endif // RSI_BLE_ENABLE + CHIP_ERROR StartAdvertising(void); + CHIP_ERROR StopAdvertising(void); #if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING #ifdef RSI_BLE_ENABLE @@ -187,7 +187,6 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla CHIP_ERROR MapBLEError(int bleErr); void DriveBLEState(void); CHIP_ERROR ConfigureAdvertisingData(void); - CHIP_ERROR StopAdvertising(void); #if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING CHIP_ERROR EncodeAdditionalDataTlv(); #endif diff --git a/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp b/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp index d115187e90934b..3ddccdc1c82406 100644 --- a/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp +++ b/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp @@ -380,7 +380,9 @@ void ConnectivityManagerImpl::OnStationConnected() event.Type = DeviceEventType::kWiFiConnectivityChange; event.WiFiConnectivityChange.Result = kConnectivity_Established; (void) PlatformMgr().PostEvent(&event); + // Setting the rs911x in the power save mode #if CHIP_DEVICE_CONFIG_ENABLE_SED + chip::DeviceLayer::Internal::BLEManagerImpl().StopAdvertising(); wfx_power_save(); #endif /* CHIP_DEVICE_CONFIG_ENABLE_SED */ UpdateInternetConnectivityState(); diff --git a/src/platform/silabs/efr32/rs911x/BLEManagerImpl.cpp b/src/platform/silabs/efr32/rs911x/BLEManagerImpl.cpp index e0e3e87635c190..319a30e16b596b 100644 --- a/src/platform/silabs/efr32/rs911x/BLEManagerImpl.cpp +++ b/src/platform/silabs/efr32/rs911x/BLEManagerImpl.cpp @@ -661,12 +661,12 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void) return CHIP_NO_ERROR; // err; } -// TODO:: Implementation need to be done. CHIP_ERROR BLEManagerImpl::StopAdvertising(void) { CHIP_ERROR err = CHIP_NO_ERROR; int32_t status = 0; - if (mFlags.Has(Flags::kAdvertising)) + // TODO: change this condition + if (1) { mFlags.Clear(Flags::kAdvertising).Clear(Flags::kRestartAdvertising); mFlags.Set(Flags::kFastAdvertisingEnabled, true);