Wirepas SDK
tlv.h
Go to the documentation of this file.
1 
6 #ifndef TLV_H_
7 #define TLV_H_
8 
9 #include <stdint.h>
10 
14 typedef enum
15 {
19 } tlv_res_e;
20 
21 
25 typedef struct
26 {
27  uint8_t * value;
28  uint16_t type;
29  uint8_t length;
30 } tlv_item_t;
31 
36 typedef struct
37 {
38  uint8_t * buffer;
39  uint8_t length;
40  uint8_t index;
41 } tlv_record;
42 
51 void Tlv_init(tlv_record * rcd, uint8_t * buffer, uint8_t length);
52 
61 
70 
78 
79 #endif /* TLV_H_ */
Tlv_Decode_getNextItem
tlv_res_e Tlv_Decode_getNextItem(tlv_record *rcd, tlv_item_t *item)
Decode the next tlv_item in the tlv_record passed in parameter.
Tlv_Encode_addItem
tlv_res_e Tlv_Encode_addItem(tlv_record *rcd, tlv_item_t *item)
Add a TLV item to the buffer contained in the TLV record.
TLV_RES_ERROR
@ TLV_RES_ERROR
Definition: tlv.h:17
tlv_record::buffer
uint8_t * buffer
Definition: tlv.h:38
tlv_item_t::length
uint8_t length
Definition: tlv.h:29
Tlv_init
void Tlv_init(tlv_record *rcd, uint8_t *buffer, uint8_t length)
Initialize a TLV record.
TLV_RES_OK
@ TLV_RES_OK
Definition: tlv.h:16
Tlv_Encode_getBufferSize
int Tlv_Encode_getBufferSize(tlv_record *rcd)
Returns the size of the generated buffer by successive calls to Tlv_Encode_addItem.
tlv_item_t::value
uint8_t * value
Definition: tlv.h:27
tlv_res_e
tlv_res_e
List of return codes.
Definition: tlv.h:14
tlv_item_t
Structure describing a Type Length Value item.
Definition: tlv.h:25
tlv_record
This structure holds the buffer containing TLV items and data to manage it, max. buffer size and curr...
Definition: tlv.h:36
tlv_record::index
uint8_t index
Definition: tlv.h:40
TLV_RES_END
@ TLV_RES_END
Definition: tlv.h:18
tlv_item_t::type
uint16_t type
Definition: tlv.h:28