Skip to contentSkip to conversation

D-Bus for LE

DISCUSSION Marco Sinigaglia 2 participants 2 messages Mar 3, 2011 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hi All,

I am looking the D-Bus API for low energy and I cannot find a way to run a discover for LE devices and connect to them. Are these API implemented? if not, are they going to be?

Looking the attribute-api it should be possible to do some stuff on the local device but, on my box, it looks like not working. I am sure that the blutoothd is kicking off the attribute server (sdptool is showing the le profiles), nevertheless the test-attrib is showing nothing:

Quoted 1 line

sudo ./test-attrib -i hci0

[nothing]

Cheers
Marco

Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom

#1 lore raw

Hi,

Quoted 7 lines · Marco Sinigaglia

Hi All,

I am looking the D-Bus API for low energy and I cannot find a way to run a discover for LE devices and connect to them.
Are these API implemented? if not, are they going to be?

Quoted 7 lines

Looking the attribute-api it should be possible to do some stuff on the local device but, on my box, it looks like not working.
I am sure that the blutoothd is kicking off the attribute server (sdptool is showing the le profiles), nevertheless the test-attrib is showing nothing:

Quoted 1 line

sudo ./test-attrib  -i hci0

[nothing]

Did you connect to the remote first using "test-device create" ? Also make sure the remote is advertising with Flags = 0x06 (bits "BR/EDR not supported" and "general discoverable mode") if the remove is dual mode, otherwise it will attempt a BR/EDR connection.

In summary:

1) On the remote device enable advertising and (if a dual mode) set flags to 0x06:

hcitool -i hciX cmd 0x08 0x0008 03 02 01 06
hciconfig hciX leadv

2) on the local side, start discovery (so the adv data is saved by bluez) followed by test-device create:

test-discovery (wait for it to finish or at least show the device you will connect to)
test-device create <bdaddr>

3) not the tricky part: you need to reenable advertising on the remote side (see step #1) for test-attrib to work. This is because remote disabled advertising after the LE connection during test-device create was done, and IIRC test-device create does not keep connection open. test-attrib will them open a new connection which only works with advertising enabled on remote side.

3) you can now run test-attrib:

./test-attrib -i hciX

Note this API is ongoing some changes and most of the steps above will be automatic. See the "TODO" file on BlueZ source for the planned changes.

HTH,

Signature · 3 lines
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil