Wirepas SDK
shared_offline.h
Go to the documentation of this file.
1 /* Copyright 2020 Wirepas Ltd. All Rights Reserved.
2  *
3  * See file LICENSE.txt for full license details.
4  *
5  */
6 
23 #ifndef _SHARED_OFFLINE_H_
24 #define _SHARED_OFFLINE_H_
25 
26 #include <stdint.h>
27 #include <stdbool.h>
28 
32 typedef enum
33 {
40  /* Module is not initialized */
42  /* Stack is already online */
44  /* Role is wrong to enter offline */
47 
51 typedef enum
52 {
57  /* Module is not initialized */
60 
61 #define SHARED_OFFLINE_INFINITE_DELAY (uint32_t)(-1)
62 
70 typedef void (*offline_cb_f)(uint32_t delay_s);
71 
93 typedef void (*online_cb_f)(uint32_t delay_from_deadline_s);
94 
95 typedef struct {
99 
107 
119 
128 
138  uint32_t delay_s);
139 
147 
159  uint32_t * remaining_s_p);
160 
161 
162 #endif //_SHARED_OFFLINE_H_
online_cb_f
void(* online_cb_f)(uint32_t delay_from_deadline_s)
Online callback called when the node enter online state.
Definition: shared_offline.h:93
Shared_Offline_get_status
shared_offline_status_e Shared_Offline_get_status(uint32_t *elapsed_s_p, uint32_t *remaining_s_p)
Get the current status.
Shared_Offline_register
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.
offline_setting_conf_t::on_offline_event
offline_cb_f on_offline_event
Definition: shared_offline.h:96
offline_setting_conf_t
Definition: shared_offline.h:95
SHARED_OFFLINE_RES_OK
@ SHARED_OFFLINE_RES_OK
Definition: shared_offline.h:35
Shared_Offline_enter_online_state
shared_offline_res_e Shared_Offline_enter_online_state(uint8_t id)
Call to asynchronously enter in online state.
SHARED_OFFLINE_RES_UNINITIALIZED
@ SHARED_OFFLINE_RES_UNINITIALIZED
Definition: shared_offline.h:41
SHARED_OFFLINE_STATUS_ONLINE
@ SHARED_OFFLINE_STATUS_ONLINE
Definition: shared_offline.h:56
SHARED_OFFLINE_RES_WRONG_ROLE
@ SHARED_OFFLINE_RES_WRONG_ROLE
Definition: shared_offline.h:45
offline_cb_f
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 e...
Definition: shared_offline.h:70
Shared_Offline_enter_offline_state
shared_offline_res_e Shared_Offline_enter_offline_state(uint8_t id, uint32_t delay_s)
Call to asynchronously enter in offline state.
SHARED_OFFLINE_RES_ALREADY_ONLINE
@ SHARED_OFFLINE_RES_ALREADY_ONLINE
Definition: shared_offline.h:43
SHARED_OFFLINE_RES_NO_MORE_ROOM
@ SHARED_OFFLINE_RES_NO_MORE_ROOM
Definition: shared_offline.h:37
offline_setting_conf_t::on_online_event
online_cb_f on_online_event
Definition: shared_offline.h:97
shared_offline_res_e
shared_offline_res_e
List of return code.
Definition: shared_offline.h:32
SHARED_OFFLINE_STATUS_OFFLINE
@ SHARED_OFFLINE_STATUS_OFFLINE
Definition: shared_offline.h:54
SHARED_OFFLINE_RES_WRONG_ID
@ SHARED_OFFLINE_RES_WRONG_ID
Definition: shared_offline.h:39
Shared_Offline_unregister
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 even...
Shared_Offline_init
shared_offline_res_e Shared_Offline_init(void)
Initialize shared offline module.
shared_offline_status_e
shared_offline_status_e
Offline state.
Definition: shared_offline.h:51
SHARED_OFFLINE_STATUS_UNINITIALIZED
@ SHARED_OFFLINE_STATUS_UNINITIALIZED
Definition: shared_offline.h:58