@@ -61,18 +61,26 @@ class WifiSleepManager
61
61
62
62
inline void HandleCommissioningSessionStarted ()
63
63
{
64
- mIsCommissioningInProgress = true ;
65
-
66
- // TODO: Remove High Performance Req during commissioning when sleep issues are resolved
67
- WifiSleepManager::GetInstance ().RequestHighPerformance ();
64
+ bool wasCommissioningInProgress = mIsCommissioningInProgress ;
65
+ mIsCommissioningInProgress = true ;
66
+
67
+ if (!wasCommissioningInProgress)
68
+ {
69
+ // TODO: Remove High Performance Req during commissioning when sleep issues are resolved
70
+ WifiSleepManager::GetInstance ().RequestHighPerformanceWithTransition ();
71
+ }
68
72
}
69
73
70
74
inline void HandleCommissioningSessionStopped ()
71
75
{
72
- mIsCommissioningInProgress = false ;
73
-
74
- // TODO: Remove High Performance Req during commissioning when sleep issues are resolved
75
- WifiSleepManager::GetInstance ().RemoveHighPerformanceRequest ();
76
+ bool wasCommissioningInProgress = mIsCommissioningInProgress ;
77
+ mIsCommissioningInProgress = false ;
78
+
79
+ if (wasCommissioningInProgress)
80
+ {
81
+ // TODO: Remove High Performance Req during commissioning when sleep issues are resolved
82
+ WifiSleepManager::GetInstance ().RemoveHighPerformanceRequest ();
83
+ }
76
84
}
77
85
78
86
/* *
@@ -86,7 +94,22 @@ class WifiSleepManager
86
94
* @return CHIP_ERROR CHIP_NO_ERROR if the chip was set to high performance or already in high performance
87
95
* CHIP_ERROR_INTERNAL, if the high performance configuration failed
88
96
*/
89
- CHIP_ERROR RequestHighPerformance ();
97
+ CHIP_ERROR RequestHighPerformanceWithTransition () { return RequestHighPerformance (true ); }
98
+
99
+ /* *
100
+ * @brief Public API to increase the HighPerformance request counter without transitioning the Wi-Fi chip to High Performance.
101
+ * The transition to a different power mode will be done the next the VerifyAndTransitionToLowPowerMode is called.
102
+ *
103
+ * This API does not call the VerifyAndTransitionToLowPowerMode function.
104
+ * To trigger the update directly adding a high performance request, call RequestHighPerformanceWithTransition.
105
+ *
106
+ * This API can be called before the Init function. By doing so, the device will transition to High Performance during
107
+ * the Init sequence
108
+ *
109
+ * @return CHIP_ERROR CHIP_NO_ERROR if the chip was set to high performance or already in high performance
110
+ * CHIP_ERROR_INTERNAL, if the high performance configuration failed
111
+ */
112
+ CHIP_ERROR RequestHighPerformanceWithoutTransition () { return RequestHighPerformance (false ); }
90
113
91
114
/* *
92
115
* @brief Public API to remove request to keep the Wi-Fi chip in High Performance.
@@ -161,6 +184,17 @@ class WifiSleepManager
161
184
*/
162
185
CHIP_ERROR ConfigureDTIMBasedSleep ();
163
186
187
+ /* *
188
+ * @brief Increments the HighPerformance request counter and triggers the transition to High Performance if requested.
189
+ *
190
+ * @param triggerTransition true, triggers the transition to High Performance
191
+ * false, only increments the HighPerformance request counter
192
+ *
193
+ * @return CHIP_ERROR CHIP_NO_ERROR if the req removal and sleep transition succeed
194
+ * CHIP_ERROR_INTERNAL, if the req removal or the transition to sleep failed
195
+ */
196
+ CHIP_ERROR RequestHighPerformance (bool triggerTransition);
197
+
164
198
static WifiSleepManager mInstance ;
165
199
166
200
PowerSaveInterface * mPowerSaveInterface = nullptr ;
0 commit comments