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
21
23typedef struct waps_item_t waps_item_t;
24
26typedef void (*waps_pre_tx_cb_f)(waps_item_t *);
27
29typedef void (*waps_post_tx_cb_f)(waps_item_t *);
30
32typedef void (*waps_free_item_threshold_cb_t)(void);
33
34typedef 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 */
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
73void Waps_itemInit(waps_free_item_threshold_cb_t thresold_cb, uint8_t thresold_percent);
74
82
89
90#endif /* WAPS_ITEM_H_ */
STRUCT_ALIGN_4(waps_frame_t)
waps_pre_tx_cb_f pre_cb
Definition waps_item.h:39
waps_post_tx_cb_f post_cb
Definition waps_item.h:40
sl_list_t list
Definition waps_item.h:36
uint32_t time
Definition waps_item.h:38
waps_frame_t frame
Definition waps_item.h:42
uint8_t splen
Definition waps_frames.h:71
uint8_t sfunc
Definition waps_frames.h:67
waps_item_t * Waps_itemReserve(waps_item_type_e type)
Reserve item from item bank.
void(* waps_pre_tx_cb_f)(waps_item_t *)
Definition waps_item.h:26
void Waps_itemInit(waps_free_item_threshold_cb_t thresold_cb, uint8_t thresold_percent)
Initialize dynamic item bank.
void Waps_itemFree(waps_item_t *item)
Free item for item bank.
__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
void(* waps_free_item_threshold_cb_t)(void)
Definition waps_item.h:32
waps_item_type_e
Definition waps_item.h:17
@ WAPS_ITEM_TYPE_INDICATION
Definition waps_item.h:19
@ WAPS_ITEM_TYPE_REQUEST
Definition waps_item.h:18
void(* waps_post_tx_cb_f)(waps_item_t *)
Definition waps_item.h:29
#define __STATIC_INLINE
Definition wms_app.h:20