Thread (8 messages) flat view 8 messages, 3 authors, 2014-03-04

Re: Receiving data in BLE non-connectable undirected advertisements

From: Marcel Holtmann <marcel@holtmann.org>
Date: 2014-02-28 15:46:19

Hi Benjamin,
as the subject notes, I'm trying to receive non-connectable undirected advertisements from a bluetooth low energy device, namely TI's SensorTag. Their SDK contains a sample app named SimpleBLEBroadcaster, that, supposedly, sends those advertisements including some data. There is an overview of TI's understanding of this mechanism for download at

http://e2e.ti.com/support/low_power_rf/m/videos__files/653593/download.aspx

Is it possible to receive/display the *data* (up to 31 bytes, I believe) that can be contained in those advertisements using bluez? I currently don't care whether it's a commandline tool, C-based API, python, DBUS, anything.

When I start SimpleBLEBroadcaster, btmon alone doesn't show anything, but "hcitool lescan" says.

	LE Scan ...
	90:59:AF:0B:8A:7D (unknown)

The complete output of a btmon during lescan is attached below.

https://github.com/bmpm/bcast-observer-demos and a script named "test-bluetooth-observer" made me believe that there should be an org.bluez.Observer interface for this, which I couldn't find using qdbusviewer.

I asked on #bluez before, but it seems noone knew.

Thanks!
ben

###################################################################

####### start "btmon"

Bluetooth monitor ver 5.14
= New Index: 00:02:72:33:29:55 (BR/EDR,USB,hci0)             [hci0] 0.377191

####### start "hcitool lescan" in another shell

< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7   [hci0] 4.457403
       Type: Active (0x01)
       Interval: 10.000 msec (0x0010)
       Window: 10.000 msec (0x0010)
       Own address type: Public (0x00)
       Filter policy: Accept all advertisement (0x00)
quoted
HCI Event: Command Complete (0x0e) plen 4                  [hci0] 4.458949
     LE Set Scan Parameters (0x08|0x000b) ncmd 1
       Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2       [hci0] 4.459094
       Scanning: Enabled (0x01)
       Filter duplicates: Enabled (0x01)
quoted
HCI Event: Command Complete (0x0e) plen 4                  [hci0] 4.459957
     LE Set Scan Enable (0x08|0x000c) ncmd 1
       Status: Success (0x00)

####### Power-on the SensorTag
quoted
HCI Event: LE Meta Event (0x3e) plen 20                    [hci0] 9.481376
     LE Advertising Report (0x02)
       Num reports: 1
       Event type: Non connectable undirected - ADV_NONCONN_IND (0x03)
       Address type: Public (0x00)
       Address: 90:59:AF:0B:8A:7D (Texas Instruments)
       Data length: 8
       Flags: 0x04
         BR/EDR Not Supported
       Company: not assigned (513)
         Data: 03
seems the TI engineers are as incapable of understanding little endian as the iOS engineers. Company identifiers are little endian, people ;)
       RSSI: -80 dBm (0xb0)

####### Quit hcitool

< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2      [hci0] 20.647504
       Scanning: Disabled (0x00)
       Filter duplicates: Enabled (0x01)
quoted
HCI Event: Command Complete (0x0e) plen 4                 [hci0] 20.650124
     LE Set Scan Enable (0x08|0x000c) ncmd 1
       Status: Success (0x00)

#
You can just write an advertising receiver by using Bluetooth HCI User Channel feature from the 3.13 kernel.  With the help of src/shared/hci.c (if that license is acceptable to you), this is trivial. If the license is not acceptable, then you have to write your own HCI handling.

The BlueZ source code contains samples in form of tools/ibeacon.c and others on how to write such small program for direct access of the HCI interface. If you use this sample code, then please comply with the license as well here.

Our bluetoothd itself has zero interest in providing this functionality since we do have to look into the advertising data to make sense out of it.

Regards

Marcel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help