![]() |
Wirepas SDK
|
The Non-Router Long Sleep (NRLS) Library is used to sleep Wirepas Mesh stack for time periods. Once waking-up from the sleep, Wirepas Mesh stack wakes up from the sleep without system reset. During Wirepas Mesh stack sleep, Single-MCU application can be running using the libraries which does not have dependency to Wirepas Mesh stack functionalities. Before entering to NRLS sleep, Wirepas Mesh stack needs to be running.
Non-Router Long Sleep libraries can be used with Wirepas Mesh stack which is configured to be running as Non-Router mode without any role extensions (APP_LIB_SETTINGS_ROLE_SUBNODE in app_lib_settings_base_role_e and APP_LIB_SETTINGS_ROLE_FLAG_RESV in app_lib_settings_flag_role_e). Any other app_lib_settings_base_role_e and app_lib_settings_flag_role_e definitions do not allow to use NRLS functionality.
Library services are accessed via lib_sleep handle.
Definition in file sleep.h.
Go to the source code of this file.
Typedefs | |
| typedef 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. More... | |
| typedef app_res_e(* | app_lib_sleep_wakeup_stack_f) (void) |
| Wakeup stack from sleep. More... | |
| typedef app_lib_sleep_stack_state_e(* | app_lib_sleep_get_sleep_state_f) (void) |
| Get sleep state of stack. More... | |
| typedef uint32_t(* | app_lib_sleep_get_wakeup_f) (void) |
| Returns remaining sleep time. More... | |
| typedef void(* | applib_wakeup_callback_f) (void) |
| Callback called before stack wakes up. More... | |
| typedef void(* | app_lib_sleep_wakeup_callback_f) (applib_wakeup_callback_f callback) |
| Set callback function to be called before stack wakes up. More... | |
| typedef uint32_t(* | app_lib_sleep_get_gotosleep) (void) |
| Get latest time used before stack enters to sleep after NRLS sleep request given. More... | |
Data Structures | |
| struct | app_lib_sleep_t |
| List of library functions. More... | |
Enumerations | |
| enum | app_lib_sleep_stack_state_e { APP_LIB_SLEEP_STOPPED = 0, APP_LIB_SLEEP_STARTED } |
| Stack state flags. More... | |
Macros | |
| #define | APP_LIB_LONGSLEEP_NAME 0x02f20818 |
| Library symbolic name. More... | |
| #define | APP_LIB_LONGSLEEP_VERSION 0x201 |
| Maximum supported library version. More... | |
| typedef uint32_t(* app_lib_sleep_get_gotosleep) (void) |
Get latest time used before stack enters to sleep after NRLS sleep request given.
Returns time in seconds which was used in previous NRLS sleep request starting from application request lib_sleep->sleepStackforTime() until stack enters to NRLS sleep. This value can be used to estimate needed parameter configuration for appconf_wait_s in lib_sleep->sleepStackforTime() function.
| typedef app_lib_sleep_stack_state_e(* app_lib_sleep_get_sleep_state_f) (void) |
Get sleep state of stack.
| typedef uint32_t(* app_lib_sleep_get_wakeup_f) (void) |
Returns remaining sleep time.
Returns remaining sleep time in seconds. Time period is updated every 3 second. The NRLS sleep time is not decreased while the network disconnection ongoing, once network disconnection is completed, the NRLS sleep time count down is started.
| typedef 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.
| seconds | sleep time in seconds. Sleep time starts when the node gets disconnected from Mesh network. To disconnect from the network, some time is needed for signaling before disconnection is completed (the sleep time does not include this time needed for signaling before going to sleep). Signaling before actual stack sleep start might take time up to 30 seconds or more depending of used radio. If set to 0 - there is APP_RES_INVALID_VALUE response and sleep is not started. |
| appconf_wait_s | Wait time in seconds for app config data from network before NRLS stack sleep.
|
appconf_wait_s long enough (minimum 4 seconds) to make sure that app config data is received before going to NRLS sleep | typedef void(* app_lib_sleep_wakeup_callback_f) (applib_wakeup_callback_f callback) |
| typedef app_res_e(* app_lib_sleep_wakeup_stack_f) (void) |
Wakeup stack from sleep.
Starts the stack from sleep if application wants to wake-up the stack from NRLS sleep before NRLS sleep time has elapsed.
| typedef void(* applib_wakeup_callback_f) (void) |
Callback called before stack wakes up.
Used with lib_sleep->setOnWakeupCb() service
| struct app_lib_sleep_t |
| Data Fields | ||
|---|---|---|
| app_lib_sleep_get_gotosleep | getSleepLatestGotosleep | |
| app_lib_sleep_get_sleep_state_f | getSleepState | |
| app_lib_sleep_get_wakeup_f | getStackWakeup | |
| app_lib_sleep_wakeup_callback_f | setOnWakeupCb | |
| app_lib_sleep_stack_for_time_f | sleepStackforTime | |
| app_lib_sleep_wakeup_stack_f | wakeupStack | |
| #define APP_LIB_LONGSLEEP_NAME 0x02f20818 |