Re: Extracting iBeacon Advertisement Packets


Luiz Augusto von Dentz
 

Hi Martin,

There is an API to help parsing advertisements:

https://github.com/zephyrproject-rtos/zephyr/blob/master/include/bluetooth/bluetooth.h#L480

It will call the callback given for each data type found, for instance
the sample on the site has flags + manufacturer data, you probably are
only interested in the second. You can also parse the UUID using:

https://github.com/zephyrproject-rtos/zephyr/blob/master/include/bluetooth/uuid.h#L48

On Thu, Nov 22, 2018 at 12:50 AM Martin <ma@jgs-wg.de> wrote:

Sorry, I was copying the wrong code..

int i;

//print adv. packet
for(i=0;i<buf->len;i++) {
printk("%d %02X\n",i, buf->data[i]);
}

//print major
printk("maj: %d\n",((buf->data[25] & 0xff) * 0x100 + (buf->data[26] & 0xff) ));
Am Mi., 21. Nov. 2018 um 18:12 Uhr schrieb Martin <ma@jgs-wg.de>:

Well, simple enough.

int i;

for(i=0; i<5; i++) {
printf("i%d\n", i+1);
}

prints the advertisement packet's bytes in decimals and includes the
UUID acc. to the kontakt.io article. Hope this helps anyone...

Martin
Am Mi., 21. Nov. 2018 um 17:56 Uhr schrieb Martin <ma@jgs-wg.de>:

Hi,
I am quite new to Zephyr and want to extract iBeacon Advertisement
Packets. I already have access to them as a net_buf_simple structure,
but I want to read the major and minor for example. I realize that I
have to probably read some certain bytes out of net_buf_simple
(according to https://support.kontakt.io/hc/en-gb/articles/201492492-Advertising-packet-structure).
Can someone point me to a direction (function) to do this?

Thanks,
Martin




--
Luiz Augusto von Dentz

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