Wirepas SDK
waps_item.h
Go to the documentation of this file.
1 /* Copyright 2017 Wirepas Ltd. All Rights Reserved.
2  *
3  * See file LICENSE.txt for full license details.
4  *
5  */
6 
7 #ifndef WAPS_ITEM_H_
8 #define WAPS_ITEM_H_
9 
10 #include "mcu.h"
11 #include "waps_frames.h"
12 #include "util.h"
13 #include "sl_list.h"
14 
16 typedef enum
17 {
21 
23 typedef struct waps_item_t waps_item_t;
24 
26 typedef void (*waps_pre_tx_cb_f)(waps_item_t *);
27 
29 typedef void (*waps_post_tx_cb_f)(waps_item_t *);
30 
32 typedef void (*waps_free_item_threshold_cb_t)(void);
33 
34 typedef struct waps_item_t
35 {
38  uint32_t time;
43  /* Do padding automatically because waps_frame_t is packed structure which
44  * size can vary */
46 } waps_item_t;
47 
58  uint8_t func,
59  uint8_t len)
60 {
61  if (item != NULL)
62  {
63  item->pre_cb = NULL;
64  item->post_cb = NULL;
65  item->frame.sfunc = func;
66  item->frame.splen = len;
67  }
68 }
69 
73 void Waps_itemInit(waps_free_item_threshold_cb_t thresold_cb, uint8_t thresold_percent);
74 
82 
88 void Waps_itemFree(waps_item_t * item);
89 
90 #endif /* WAPS_ITEM_H_ */
Waps_itemFree
void Waps_itemFree(waps_item_t *item)
Free item for item bank.
WAPS_ITEM_TYPE_REQUEST
@ WAPS_ITEM_TYPE_REQUEST
Definition: waps_item.h:18
waps_frame_t::sfunc
uint8_t sfunc
Definition: waps_frames.h:67
waps_frame_t
Definition: waps_frames.h:64
Waps_itemReserve
waps_item_t * Waps_itemReserve(waps_item_type_e type)
Reserve item from item bank.
Waps_itemInit
void Waps_itemInit(waps_free_item_threshold_cb_t thresold_cb, uint8_t thresold_percent)
Initialize dynamic item bank.
waps_frame_t::splen
uint8_t splen
Definition: waps_frames.h:71
waps_item_t::time
uint32_t time
Definition: waps_item.h:38
Waps_item_init
__STATIC_INLINE void Waps_item_init(waps_item_t *item, uint8_t func, uint8_t len)
Initialize common frame fields.
Definition: waps_item.h:57
waps_item_t::frame
waps_frame_t frame
Definition: waps_item.h:42
waps_item_t::list
sl_list_t list
Definition: waps_item.h:36
__STATIC_INLINE
#define __STATIC_INLINE
Definition: wms_app.h:20
waps_free_item_threshold_cb_t
void(* waps_free_item_threshold_cb_t)(void)
Definition: waps_item.h:32
waps_frames.h
waps_post_tx_cb_f
void(* waps_post_tx_cb_f)(waps_item_t *)
Definition: waps_item.h:29
waps_pre_tx_cb_f
void(* waps_pre_tx_cb_f)(waps_item_t *)
Definition: waps_item.h:26
WAPS_ITEM_TYPE_INDICATION
@ WAPS_ITEM_TYPE_INDICATION
Definition: waps_item.h:19
waps_item_type_e
waps_item_type_e
Definition: waps_item.h:16
waps_item_t::STRUCT_ALIGN_4
STRUCT_ALIGN_4(waps_frame_t)
sl_list_t
Definition: sl_list.h:63
sl_list.h
util.h
waps_item_t::pre_cb
waps_pre_tx_cb_f pre_cb
Definition: waps_item.h:39
waps_item_t
Definition: waps_item.h:34
waps_item_t::post_cb
waps_post_tx_cb_f post_cb
Definition: waps_item.h:40