Re: advertising data


Johan Hedberg
 

Hi Tamra,

The format of the data (behind ad->data with length ad->len) is
specified in the Bluetooth Core Specification (5.0) Volume 3, Part C,
section 11 (page 2086 in the pdf). In practice it's just a sequence of
<1 byte length><1 byte type><N byte payload> elements, and you can use
the recently added bt_data_parse() API to help parse these.

You'll find defines for the various data types in
include/bluetooth/hci.h with the prefix BT_DATA_*. The actual formats
and meanings of the different types are defined in the Core
Specification Supplement document. Both the Core Specification and the
Supplement can be found here:

https://www.bluetooth.com/specifications/bluetooth-core-specification

Johan

On Tue, Jun 26, 2018, Tamra Oyama wrote:
Hi all,

Thanks for the help. From what I can tell "*ad*" from "*struct
net_buf_simple *ad*" is the payload, and so I'm wondering what format is
the payload in. (i.e if i convert it to binary where in the Bluetooth spec
can I find what these values mean?

Thanks,
Tamra


On Tue, Jun 26, 2018 at 6:37 AM, Johan Hedberg <johan.hedberg@...>
wrote:

Hi,

On Tue, Jun 26, 2018, Luiz Augusto von Dentz wrote:
On Tue, Jun 26, 2018 at 3:55 AM, Tamra <tamrako@...> wrote:
I'm looking at the central_hr example. I was wondering what
information is
packed into the net_buf_simple *ad? The function and output is below.

static void device_found(const bt_addr_le_t *addr, s8_t rssi, u8_t
type,
struct net_buf_simple *ad)

[DEVICE]: 34:3c:99:ab:65:6d (random), AD evt type 3, AD data len 31,
RSSI
-83 data: 2818606536
The type you will be able to find in the assigned number for GAP:

https://www.bluetooth.com/specifications/assigned-
numbers/generic-access-profile

AD payload format for each type is described in the CSS, for instance
type 3 is <<Complete List of 16-bit Service UUIDs>> which consists in
a list of 16-bit Service UUIDs.
Actually the event type is no the AD type, sorry about that, so 0x03
refers to BT_LE_ADV_NONCONN_IND.
I'd like to add here that we've just merged a new helper API for parsing
the advertising data:

https://github.com/zephyrproject-rtos/zephyr/pull/8560

This pull request also included updating the central_hr sample, so you
might want to take a second look at that code.

Johan

Join {devel@lists.zephyrproject.org to automatically receive all group messages.