Re: iBeacon with the dbus advertising-api

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Marco,
On Wed, Mar 6, 2019 at 5:53 PM Marco Okker <marco@xxxxxxxx> wrote:
>
> Dear Bluez advertising-api developers,
>
> I got a problem with the advertising-api. It seems to be impossible to make an iBeacon advertisement with the api.
> I know it can be done with my bluetooth module because it is possible with the hcitool*.
>
> An iBeacon sends the following at the start of an advertisement: 0x0201061aff4c000215.
>
> With the advertising-api I am able to advertise a big part of the iBeacon(with the manufacturer data property):
> 0x1AFF4C0002155E2B092544064DFEB06D66D7AFB0F84C59659D46AC
>
> If I modify the bluetooth config(/etc/bluetooth/main.conf) setting "ControllerMode = le"  it will add  0x020104 to the packet(this is the closest I got to an iBeacon):
> 0x0201041AFF4C0002155E2B092544064DFEB06D66D7AFB0F84C59659D46AC
>
> However I can't make the api advertise the following(the most important part at the start of the advertisement(0x020106) can't be done):
> 0x0201061AFF4C0002155E2B092544064DFEB06D66D7AFB0F84C59659D46AC
>
> I have tried all properties of the advertising-api, none of them seem to be able to add "0x020106" at the start of the advertisement.

So this is about the so called flags (ad type 0x01), you want it to be
set as 0x06, as opposed to 0x04, which is:

bit 1: LE General Discoveral Mode
bit 2: BR/EDR not Supported

I don't think the BR/EDR bit really matter so I guess all you need is
to switch the discoverable mode, which you can do as follow:

bluetoothctl> power on
bluetoothctl> advertise.discoverable on
bluetoothctl> advertise.manufacturer 0x004c [data...]
bluetoothctl> advertise on

@ MGMT Command: Add Advertising (0x003e) plen 19
        Instance: 1
        Flags: 0x00000001
          Switch into Connectable mode
        Duration: 0
        Timeout: 0
        Advertising data length: 8
        Company: Apple, Inc. (76)
        Flags: 0x02
          LE General Discoverable Mode
        Scan response length: 0

If the implementation is really pedantic about the BR/EDR flag then
you should probably attempt to enable it by setting ControllerMode =
le. If discoverable is not set perhaps you have an old version of
bluetoothd which don't have support for it, but as I show you above it
is possible to for Discoverable mode though that means the
advertisement would work as peripheral role since broadcast cannot
have flags:

https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/advertising.c#n1030

> To summarize, my question is:
> Can you modify the dbus advertising-api of Bluez so that it is possible to advertise an iBeacon?
>
> Greetings,
> Marco
>
> * hcitool example:
> ############################ 02 01 06 1A FF 4C 00 02 15 # Apple's fixed iBeacon advertising prefix
> hcitool -i hci0 cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 FB 0B 57 A2 82 28 44 CD 91 3A 94 A1 22 BA 12
> (Source: https://en.wikipedia.org/wiki/IBeacon)



-- 
Luiz Augusto von Dentz



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux