Wirepas SDK
wms_sleep.h
Go to the documentation of this file.
1 /* Copyright 2019 Wirepas Ltd. All Rights Reserved.
2  *
3  * See file LICENSE.txt for full license details.
4  *
5  */
6 
29 #ifndef APP_LIB_SLEEP_H_
30 #define APP_LIB_SLEEP_H_
31 
32 #include <stdlib.h>
33 #include <stdint.h>
34 #include <stdbool.h>
35 
36 #include "wms_app.h"
37 
39 #define APP_LIB_LONGSLEEP_NAME 0x02f20818
40 
41 
42 #define APP_LIB_LONGSLEEP_VERSION 0x203
43 
47 typedef enum
48 {
49  // @brief No sleep ongoing
51  // @brief Sleep is started
53  // @brief Sleep is pending, i.e. requested but device has not yet
54  // disconnected from the network
57 
89 typedef app_res_e (*app_lib_sleep_stack_for_time_f)(uint32_t seconds,
90  uint32_t appconf_wait_s);
91 
109 
115 
121 typedef uint32_t (*app_lib_sleep_get_wakeup_f)(void);
122 
129 typedef void (*applib_wakeup_callback_f)(void);
130 
137 typedef
139 
154 typedef uint32_t (*app_lib_sleep_get_gotosleep)(void);
155 
162 typedef void (*applib_on_sleep_callback_f)(void);
163 
170 typedef
172 
173 
174 
178 typedef struct
179 {
188 
189 #endif /* APP_LIB_SLEEP_H_ */
app_lib_sleep_t::setOnWakeupCb
app_lib_sleep_wakeup_callback_f setOnWakeupCb
Definition: wms_sleep.h:184
app_lib_sleep_t::sleepStackforTime
app_lib_sleep_stack_for_time_f sleepStackforTime
Definition: wms_sleep.h:180
app_res_e
app_res_e
Definition: wms_app.h:201
app_lib_sleep_on_sleep_callback_f
void(* app_lib_sleep_on_sleep_callback_f)(applib_on_sleep_callback_f callback)
Set callback function to be called when stack starts sleep.
Definition: wms_sleep.h:171
wms_app.h
applib_on_sleep_callback_f
void(* applib_on_sleep_callback_f)(void)
Callback called when stack starts sleep.
Definition: wms_sleep.h:162
APP_LIB_SLEEP_STARTED
@ APP_LIB_SLEEP_STARTED
Definition: wms_sleep.h:52
app_lib_sleep_stack_state_e
app_lib_sleep_stack_state_e
Stack state flags.
Definition: wms_sleep.h:47
app_lib_sleep_t::getSleepLatestGotosleep
app_lib_sleep_get_gotosleep getSleepLatestGotosleep
Definition: wms_sleep.h:185
app_lib_sleep_stack_for_time_f
app_res_e(* app_lib_sleep_stack_for_time_f)(uint32_t seconds, uint32_t appconf_wait_s)
Start stack sleeping period for a given time.
Definition: wms_sleep.h:89
app_lib_sleep_wakeup_callback_f
void(* app_lib_sleep_wakeup_callback_f)(applib_wakeup_callback_f callback)
Set callback function to be called before stack wakes up.
Definition: wms_sleep.h:138
app_lib_sleep_t::getSleepState
app_lib_sleep_get_sleep_state_f getSleepState
Definition: wms_sleep.h:182
APP_LIB_SLEEP_PENDING
@ APP_LIB_SLEEP_PENDING
Definition: wms_sleep.h:55
app_lib_sleep_t::getStackWakeup
app_lib_sleep_get_wakeup_f getStackWakeup
Definition: wms_sleep.h:183
app_lib_sleep_get_gotosleep
uint32_t(* app_lib_sleep_get_gotosleep)(void)
Get latest time used before stack enters to sleep after NRLS sleep request given.
Definition: wms_sleep.h:154
app_lib_sleep_wakeup_stack_f
app_res_e(* app_lib_sleep_wakeup_stack_f)(void)
Wakeup stack from sleep.
Definition: wms_sleep.h:108
APP_LIB_SLEEP_STOPPED
@ APP_LIB_SLEEP_STOPPED
Definition: wms_sleep.h:50
app_lib_sleep_t::wakeupStack
app_lib_sleep_wakeup_stack_f wakeupStack
Definition: wms_sleep.h:181
app_lib_sleep_t
List of library functions.
Definition: wms_sleep.h:178
app_lib_sleep_get_sleep_state_f
app_lib_sleep_stack_state_e(* app_lib_sleep_get_sleep_state_f)(void)
Get sleep state of stack.
Definition: wms_sleep.h:114
app_lib_sleep_t::setOnSleepCb
app_lib_sleep_on_sleep_callback_f setOnSleepCb
Definition: wms_sleep.h:186
app_lib_sleep_get_wakeup_f
uint32_t(* app_lib_sleep_get_wakeup_f)(void)
Returns remaining sleep time in seconds.
Definition: wms_sleep.h:121
applib_wakeup_callback_f
void(* applib_wakeup_callback_f)(void)
Callback called before stack wakes up.
Definition: wms_sleep.h:129