@@ -43,6 +43,36 @@ class WifiSleepManager
43
43
kConnectivityChange = 2 ,
44
44
};
45
45
46
+ /* *
47
+ * @brief Class implements the callbacks that the application can implement
48
+ * to alter the WifiSleepManager behaviors.
49
+ */
50
+ class ApplicationCallback
51
+ {
52
+ public:
53
+ virtual ~ApplicationCallback () = default ;
54
+
55
+ /* *
56
+ * @brief Function informs the WifiSleepManager in which Low Power mode the device can go to.
57
+ * The two supported sleep modes are DTIM based sleep and LI based sleep.
58
+ *
59
+ * When the function is called, the WifiSleepManager is about to go to sleep and using this function to make decision
60
+ * as too wether it can go LI based sleep, lowest power mode, or DTIM based sleep.
61
+ *
62
+ * DTIM based sleep requires the Wi-Fi devices to be synced with the DTIM beacon.
63
+ * In this mode, the broadcast filter is disabled and the device will process multicast and
64
+ * broadcast messages.
65
+ *
66
+ * LI based sleep allows the Wi-Fi devices to sleep for configurable amounts of time without needing to be synced
67
+ * with the DTIM beacon. The sleep time is configurable trough the ICD Manager feature-set.
68
+ * In the LI based sleep, the broadcast filter is enabled.
69
+ *
70
+ * @return true The Wi-Fi Sleep Manager can go to LI based sleep
71
+ * @return false The Wi-Fi Sleep Manager cannot go to LI based sleep or an error occured in the processing.
72
+ */
73
+ virtual bool CanGoToLIBasedSleep () = 0;
74
+ };
75
+
46
76
/* *
47
77
* @brief Init function that configure the SleepManager APIs based on the type of ICD.
48
78
* Function validates that the SleepManager configuration were correctly set as well.
@@ -70,6 +100,14 @@ class WifiSleepManager
70
100
WifiSleepManager::GetInstance ().RemoveHighPerformanceRequest ();
71
101
}
72
102
103
+ /* *
104
+ * @brief Set the Application Callback
105
+ *
106
+ * @param callbacks pointer to the application callbacks.
107
+ * The callback can be set to nullptr if the application wants to remove its callback
108
+ */
109
+ void SetApplicationCallback (ApplicationCallback * callback) { mCallback = callback; }
110
+
73
111
/* *
74
112
* @brief Public API to request the Wi-Fi chip to transition to High Performance.
75
113
* Function increases the HighPerformance request counter to prevent the chip from going to sleep
@@ -105,6 +143,7 @@ class WifiSleepManager
105
143
* 1. If there are high performance requests, configure high performance mode.
106
144
* 2. If commissioning is in progress, configure DTIM based sleep.
107
145
* 3. If no commissioning is in progress and the device is unprovisioned, configure deep sleep.
146
+ * 4. If the application callback allows, configure LI based sleep; otherwise, configure DTIM based sleep.
108
147
*
109
148
* @param event PowerEvent triggering the Verify and transition to low power mode processing
110
149
*
@@ -130,6 +169,8 @@ class WifiSleepManager
130
169
131
170
bool mIsCommissioningInProgress = false ;
132
171
uint8_t mHighPerformanceRequestCounter = 0 ;
172
+
173
+ ApplicationCallback * mCallback = nullptr ;
133
174
};
134
175
135
176
} // namespace Silabs
0 commit comments