27#ifndef NET_BLUETIL_AD_H
28#define NET_BLUETIL_AD_H
43#define BLUETIL_AD_INIT(b,p,s) { .buf = b, .pos = p, .size = s }
48#define BLUETIL_AD_FLAGS_DEFAULT (BLE_GAP_DISCOVERABLE | \
49 BLE_GAP_FLAG_BREDR_NOTSUP)
112 const void *val,
size_t val_len);
131 char *str,
size_t str_len);
145 const void *data,
size_t data_len);
195 void *buf,
size_t buf_len,
int bluetil_ad_find(const bluetil_ad_t *ad, uint8_t type, bluetil_ad_data_t *data)
Find a specific field in the given advertising data.
static int bluetil_ad_add_flags(bluetil_ad_t *ad, uint8_t flags)
Convenience function to add the "flags" field.
int bluetil_ad_find_and_cmp(const bluetil_ad_t *ad, uint8_t type, const void *val, size_t val_len)
Find a specific field and compare its value against the given data.
int bluetil_ad_find_str(const bluetil_ad_t *ad, uint8_t type, char *str, size_t str_len)
Find the given field and copy its payload into a string.
int bluetil_ad_add(bluetil_ad_t *ad, uint8_t type, const void *data, size_t data_len)
Add a new field to the given advertising data.
void bluetil_ad_init(bluetil_ad_t *ad, void *buf, size_t pos, size_t size)
Initialize the given advertising data descriptor.
static int bluetil_ad_add_name(bluetil_ad_t *ad, const char *name)
Convenience function to add the "full name" field.
static int bluetil_ad_init_with_flags(bluetil_ad_t *ad, void *buf, size_t buf_len, uint8_t flags)
Convenience function for initializing the advertising data descriptor and directly adding the flags f...
@ BLUETIL_AD_NOTFOUND
entry not found
@ BLUETIL_AD_NOMEM
insufficient memory to write field
@ BLUETIL_AD_OK
everything went as expected
Struct used for returning the contents of a selected field.
uint8_t * data
pointer a field's payload
size_t len
length of the payload
Descriptor for a buffer containing advertising data.
size_t pos
current write position in the buffer
size_t size
overall length of the buffer
uint8_t * buf
buffer containing the advertising data
General BLE values as defined by the BT standard.