Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
data.h
Go to the documentation of this file.
1
5
6/*
7 * Copyright (c) 2017 Nordic Semiconductor ASA
8 * Copyright (c) 2015-2016 Intel Corporation
9 *
10 * SPDX-License-Identifier: Apache-2.0
11 */
12#ifndef ZEPHYR_INCLUDE_BLUETOOTH_DATA_H_
13#define ZEPHYR_INCLUDE_BLUETOOTH_DATA_H_
14
15#include <stddef.h>
16#include <stdint.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
31#define BT_DATA_SERIALIZED_SIZE(data_len) ((data_len) + 2)
32
48
59#define BT_DATA(_type, _data, _data_len) \
60 { \
61 .type = (_type), \
62 .data_len = (_data_len), \
63 .data = (const uint8_t *)(_data), \
64 }
65
75#define BT_DATA_BYTES(_type, _bytes...) \
76 BT_DATA(_type, ((uint8_t []) { _bytes }), \
77 sizeof((uint8_t []) { _bytes }))
78
91size_t bt_data_get_len(const struct bt_data data[], size_t data_count);
92
106size_t bt_data_serialize(const struct bt_data *input, uint8_t *output);
107
108#ifdef __cplusplus
109}
110#endif
111
112#endif /* ZEPHYR_INCLUDE_BLUETOOTH_DATA_H_ */
size_t bt_data_serialize(const struct bt_data *input, uint8_t *output)
Serialize a bt_data struct into an advertising structure (a flat array).
size_t bt_data_get_len(const struct bt_data data[], size_t data_count)
Get the total size (in octets) of a given set of bt_data structures.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Bluetooth data.
Definition data.h:40
uint8_t type
Type of scan response data or advertisement data.
Definition data.h:42
uint8_t data_len
Length of scan response data or advertisement data.
Definition data.h:44
const uint8_t * data
Pointer to Scan response or advertisement data.
Definition data.h:46