Skip to content

Commit 542af61

Browse files
clean up and address review comments
1 parent 913eb12 commit 542af61

File tree

6 files changed

+17
-50
lines changed

6 files changed

+17
-50
lines changed

examples/platform/silabs/BaseApplication.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -902,10 +902,12 @@ void BaseApplication::OnPlatformEvent(const ChipDeviceEvent * event, intptr_t)
902902
if ((event->ThreadConnectivityChange.Result == kConnectivity_Established) ||
903903
(event->InternetConnectivityChange.IPv6 == kConnectivity_Established))
904904
{
905-
#if SL_WIFI && CHIP_CONFIG_ENABLE_ICD_SERVER
905+
#if SL_WIFI
906906
chip::app::DnssdServer::Instance().StartServer();
907+
#if CHIP_CONFIG_ENABLE_ICD_SERVER
907908
WifiSleepManager::GetInstance().HandleInternetConnectivityChange();
908-
#endif // SL_WIFI && CHIP_CONFIG_ENABLE_ICD_SERVER
909+
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
910+
#endif // SL_WIFI
909911

910912
#if SILABS_OTA_ENABLED
911913
ChipLogProgress(AppServer, "Scheduling OTA Requestor initialization");

examples/platform/silabs/MatterConfig.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@
4949
#include <platform/silabs/wifi/wiseconnect-abstraction/WiseconnectInterfaceAbstraction.h>
5050
#endif // SLI_SI91X_MCU_INTERFACE
5151

52-
// TODO: Add suport for the WF200 in the WifiSleepManager
53-
#if defined(RS911X_WIFI) || SLI_SI91X_MCU_INTERFACE
54-
#endif // defined(RS911X_WIFI) || SLI_SI91X_MCU_INTERFACE
55-
5652
#include <crypto/CHIPCryptoPAL.h>
5753
// If building with the EFR32-provided crypto backend, we can use the
5854
// opaque keystore

src/platform/silabs/wifi/SiWx/WifiInterface.cpp

+1-23
Original file line numberDiff line numberDiff line change
@@ -865,15 +865,7 @@ void wfx_dhcp_got_ipv4(uint32_t ip)
865865
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
866866

867867
#if CHIP_CONFIG_ENABLE_ICD_SERVER
868-
/**
869-
* @brief
870-
*
871-
* @param sl_si91x_ble_state
872-
* @param sl_si91x_wifi_state
873-
* @param listenInterval
874-
* @param enableBroadcastFilter
875-
* @return sl_status_t
876-
*/
868+
877869
sl_status_t wfx_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state,
878870
uint32_t listenInterval)
879871
{
@@ -893,18 +885,4 @@ sl_status_t wfx_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_
893885

894886
return status;
895887
}
896-
897-
sl_status_t ConfigureBroadcastFilter(bool enableBroadcastFilter)
898-
{
899-
sl_status_t status = SL_STATUS_OK;
900-
901-
uint16_t beaconDropThreshold = (enableBroadcastFilter) ? kTimeToFullBeaconReception : 0;
902-
uint8_t filterBcastInTim = (enableBroadcastFilter) ? 1 : 0;
903-
904-
status = sl_wifi_filter_broadcast(5000, 1, 1 /* valid till next update*/);
905-
VerifyOrReturnError(status == SL_STATUS_OK, status,
906-
ChipLogError(DeviceLayer, "sl_wifi_filter_broadcast failed: 0x%lx", static_cast<uint32_t>(status)));
907-
908-
return status;
909-
}
910888
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER

src/platform/silabs/wifi/WifiInterfaceAbstraction.h

-9
Original file line numberDiff line numberDiff line change
@@ -260,15 +260,6 @@ sl_status_t wfx_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_
260260
sl_status_t wfx_power_save();
261261
#endif /* (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) */
262262
#endif /* RS911X_WIFI */
263-
264-
/**
265-
* @brief Configures the broadcast filter.
266-
*
267-
* @param[in] enableBroadcastFilter Boolean to enable or disable the broadcast filter.
268-
* @return sl_status_t Returns the status of the operation.
269-
*/
270-
sl_status_t ConfigureBroadcastFilter(bool enableBroadcastFilter);
271-
272263
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
273264

274265
void sl_matter_wifi_task(void * arg);

src/platform/silabs/wifi/icd/WifiSleepManager.cpp

+7-10
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ CHIP_ERROR WifiSleepManager::Init()
3636

3737
void WifiSleepManager::HandleCommissioningComplete()
3838
{
39-
TransitionToLowPowerMode();
39+
VerifyAndTransitionToLowPowerMode();
4040
}
4141

4242
void WifiSleepManager::HandleInternetConnectivityChange()
4343
{
44+
// TODO: Centralize the buisness logic in the VerifyAndTransitionToLowPowerMode
4445
if (!isCommissioningInProgress)
4546
{
46-
TransitionToLowPowerMode();
47+
VerifyAndTransitionToLowPowerMode();
4748
}
4849
}
4950

@@ -69,8 +70,6 @@ CHIP_ERROR WifiSleepManager::RequestHighPerformance()
6970
#if SLI_SI917 // 917 SoC & NCP
7071
VerifyOrReturnError(wfx_power_save(RSI_ACTIVE, HIGH_PERFORMANCE, 0) == SL_STATUS_OK, CHIP_ERROR_INTERNAL,
7172
ChipLogError(DeviceLayer, "Failed to set Wi-FI configuration to HighPerformance"));
72-
VerifyOrReturnError(ConfigureBroadcastFilter(false) == SL_STATUS_OK, CHIP_ERROR_INTERNAL,
73-
ChipLogError(DeviceLayer, "Failed to disable broadcast filter"));
7473
#endif // SLI_SI917
7574
}
7675

@@ -85,17 +84,15 @@ CHIP_ERROR WifiSleepManager::RemoveHighPerformanceRequest()
8584

8685
mHighPerformanceRequestCounter--;
8786

88-
if (mHighPerformanceRequestCounter == 0)
89-
{
90-
ReturnErrorOnFailure(TransitionToLowPowerMode());
91-
}
87+
// We don't do the mHighPerformanceRequestCounter check here; the check is in TransitionToLowPowerMode function
88+
ReturnErrorOnFailure(VerifyAndTransitionToLowPowerMode());
9289

9390
return CHIP_NO_ERROR;
9491
}
9592

96-
CHIP_ERROR WifiSleepManager::TransitionToLowPowerMode()
93+
CHIP_ERROR WifiSleepManager::VerifyAndTransitionToLowPowerMode()
9794
{
98-
VerifyOrReturnError(mHighPerformanceRequestCounter == 0, CHIP_NO_ERROR,
95+
VerifyOrReturnValue(mHighPerformanceRequestCounter == 0, CHIP_NO_ERROR,
9996
ChipLogDetail(DeviceLayer, "High Performance Requested - Device cannot go to a lower power mode."));
10097

10198
#if SLI_SI917 // 917 SoC & NCP

src/platform/silabs/wifi/icd/WifiSleepManager.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,15 @@ class WifiSleepManager
7474
~WifiSleepManager() = default;
7575

7676
/**
77-
* @brief Transition the device to the Lowest Power State.
77+
* @brief Function validates what is the lowest power mode the device can got to and transitions the device to a low pwoer
78+
* state.
79+
* - Unprovisionned and no commissioning in progress: Deep Sleep
80+
* - Otherwise, DTIM based low power mode
7881
*
7982
* @return CHIP_ERROR CHIP_NO_ERROR if the device was transitionned to low power
8083
* CHIP_ERROR_INTERNAL if an error occured
8184
*/
82-
CHIP_ERROR TransitionToLowPowerMode();
85+
CHIP_ERROR VerifyAndTransitionToLowPowerMode();
8386

8487
static WifiSleepManager mInstance;
8588
bool isCommissioningInProgress = false;

0 commit comments

Comments
 (0)