@@ -36,14 +36,15 @@ CHIP_ERROR WifiSleepManager::Init()
36
36
37
37
void WifiSleepManager::HandleCommissioningComplete ()
38
38
{
39
- TransitionToLowPowerMode ();
39
+ VerifyAndTransitionToLowPowerMode ();
40
40
}
41
41
42
42
void WifiSleepManager::HandleInternetConnectivityChange ()
43
43
{
44
+ // TODO: Centralize the buisness logic in the VerifyAndTransitionToLowPowerMode
44
45
if (!isCommissioningInProgress)
45
46
{
46
- TransitionToLowPowerMode ();
47
+ VerifyAndTransitionToLowPowerMode ();
47
48
}
48
49
}
49
50
@@ -69,8 +70,6 @@ CHIP_ERROR WifiSleepManager::RequestHighPerformance()
69
70
#if SLI_SI917 // 917 SoC & NCP
70
71
VerifyOrReturnError (wfx_power_save (RSI_ACTIVE, HIGH_PERFORMANCE, 0 ) == SL_STATUS_OK, CHIP_ERROR_INTERNAL,
71
72
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" ));
74
73
#endif // SLI_SI917
75
74
}
76
75
@@ -85,17 +84,15 @@ CHIP_ERROR WifiSleepManager::RemoveHighPerformanceRequest()
85
84
86
85
mHighPerformanceRequestCounter --;
87
86
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 ());
92
89
93
90
return CHIP_NO_ERROR;
94
91
}
95
92
96
- CHIP_ERROR WifiSleepManager::TransitionToLowPowerMode ()
93
+ CHIP_ERROR WifiSleepManager::VerifyAndTransitionToLowPowerMode ()
97
94
{
98
- VerifyOrReturnError (mHighPerformanceRequestCounter == 0 , CHIP_NO_ERROR,
95
+ VerifyOrReturnValue (mHighPerformanceRequestCounter == 0 , CHIP_NO_ERROR,
99
96
ChipLogDetail (DeviceLayer, " High Performance Requested - Device cannot go to a lower power mode." ));
100
97
101
98
#if SLI_SI917 // 917 SoC & NCP
0 commit comments