Wirepas SDK
|
This library allows multiple application modules to control the NRLS feature of the stack at the same time without conflicts. Ie, when the stack can freely disconnect from the network and enter offline mode. The purpose of this mode is to save energy.
Definition in file shared_offline.h.
Go to the source code of this file.
Typedefs | |
typedef void(* | offline_cb_f) (uint32_t delay_s) |
Offline callback called when the node enter offline state It means that all the module are ready to enter offline mode. More... | |
typedef void(* | online_cb_f) (uint32_t delay_from_deadline_s) |
Online callback called when the node enter online state. More... | |
Functions | |
shared_offline_res_e | Shared_Offline_init (void) |
Initialize shared offline module. More... | |
shared_offline_res_e | Shared_Offline_register (uint8_t *id_p, offline_setting_conf_t cbs) |
Register to offline share lib It is required to take part of the offline arbitration. More... | |
shared_offline_res_e | Shared_Offline_unregister (uint8_t id_p) |
Unregister from offline share lib Once done, you will not be notified anymore for online/offline event. More... | |
shared_offline_res_e | Shared_Offline_enter_offline_state (uint8_t id, uint32_t delay_s) |
Call to asynchronously enter in offline state. More... | |
shared_offline_res_e | Shared_Offline_enter_online_state (uint8_t id) |
Call to asynchronously enter in online state. More... | |
shared_offline_status_e | Shared_Offline_get_status (uint32_t *elapsed_s_p, uint32_t *remaining_s_p) |
Get the current status. More... | |
Data Structures | |
struct | offline_setting_conf_t |
Enumerations | |
enum | shared_offline_res_e { SHARED_OFFLINE_RES_OK = 0, SHARED_OFFLINE_RES_NO_MORE_ROOM = 1, SHARED_OFFLINE_RES_WRONG_ID = 2, SHARED_OFFLINE_RES_UNINITIALIZED = 3, SHARED_OFFLINE_RES_ALREADY_ONLINE = 4, SHARED_OFFLINE_RES_WRONG_ROLE = 5 } |
List of return code. More... | |
enum | shared_offline_status_e { SHARED_OFFLINE_STATUS_OFFLINE = 0, SHARED_OFFLINE_STATUS_ONLINE = 1, SHARED_OFFLINE_STATUS_UNINITIALIZED = 3 } |
Offline state. More... | |
Macros | |
#define | SHARED_OFFLINE_INFINITE_DELAY (uint32_t)(-1) |
typedef void(* offline_cb_f) (uint32_t delay_s) |
Offline callback called when the node enter offline state It means that all the module are ready to enter offline mode.
delay_s | Delay the node will stay offline if none of the registered module ask to enter online state asynchronously |
Definition at line 70 of file shared_offline.h.
typedef void(* online_cb_f) (uint32_t delay_from_deadline_s) |
Online callback called when the node enter online state.
delay_from_deadline_s | Delay in second per module relative to the initially requested time. If two registered modules M1 and M2 ask at the same time to stay offline for 3600 and 4000 seconds respectively, this variable will be set at 0 for M1 and 400 for M2. In fact online event happens 400s before initial M2 online request time. |
Definition at line 93 of file shared_offline.h.
shared_offline_res_e Shared_Offline_enter_offline_state | ( | uint8_t | id, |
uint32_t | delay_s | ||
) |
Call to asynchronously enter in offline state.
id | Id of the module asking for offline state |
delay_s | Maximum delay in s to stay offline |
shared_offline_res_e Shared_Offline_enter_online_state | ( | uint8_t | id | ) |
Call to asynchronously enter in online state.
id | Id of the module asking for online state |
shared_offline_status_e Shared_Offline_get_status | ( | uint32_t * | elapsed_s_p, |
uint32_t * | remaining_s_p | ||
) |
Get the current status.
elapsed_s_p | Pointer to get the time in s already elapsed in the current state Can be NULL if caller is not interested by the info. |
remaining_s_p | Pointer to get the time in s remaining in this state if no other event happens. Can be NULL if caller is not interested by the info. |
shared_offline_res_e Shared_Offline_init | ( | void | ) |
Initialize shared offline module.
shared_offline_res_e Shared_Offline_register | ( | uint8_t * | id_p, |
offline_setting_conf_t | cbs | ||
) |
Register to offline share lib It is required to take part of the offline arbitration.
id_p | Pointer to store the id assigned to the module |
cbs | Callbacks for module event |
shared_offline_res_e Shared_Offline_unregister | ( | uint8_t | id_p | ) |
Unregister from offline share lib Once done, you will not be notified anymore for online/offline event.
id_p | Pointer to store the id assigned to the module |
struct offline_setting_conf_t |
Definition at line 95 of file shared_offline.h.
Data Fields | ||
---|---|---|
offline_cb_f | on_offline_event | |
online_cb_f | on_online_event |
enum shared_offline_res_e |
List of return code.
Definition at line 32 of file shared_offline.h.
Offline state.
Enumerator | |
---|---|
SHARED_OFFLINE_STATUS_OFFLINE | Operation is successful |
SHARED_OFFLINE_STATUS_ONLINE | No more tasks available |
SHARED_OFFLINE_STATUS_UNINITIALIZED |
Definition at line 51 of file shared_offline.h.
#define SHARED_OFFLINE_INFINITE_DELAY (uint32_t)(-1) |
Definition at line 61 of file shared_offline.h.