Skip to contentSkip to conversation

Connection handler and btmgmt/bluetoothctl

DISCUSSION Clément Jacquemin 2 participants 4 messages Jul 12, 2016 – Oct 17, 2016 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hi,

I am implementing my own GATT server using the "tool/gatt-service.c" as example. Create services and read/write characteristics is not a problem, but I need a way to track connection and disconnection of clients. Is there any way to make a handler or callback function that trigger when a client connects/disconnects to my server?

Another question about best practice. For the moment I use "btmgmt" to configure my daemon. However, the "bluetoothctl" binary seems to be a more stable alternative except that i cannot find any way to do the "le on" command as in "btmgmt". Is there any way to activate the low energy option with bluetoothctl?

Regards,

Clément.

#1 lore raw

Hi Clément,

Quoted 5 lines · Clément Jacquemin

Another question about best practice. For the moment I use "btmgmt" to configure my daemon. However, the "bluetoothctl" binary seems to be a more stable alternative except that i cannot find any way to do the "le on" command as in "btmgmt".
Is there any way to activate the low energy option with bluetoothctl?

bluetoothctl talks to bluetoothd and bluetoothd already automatically enables LE support whenever it's reported to be supported by the kernel.

Johan

#2 lore raw

Thanks for your answer Johan!

Quoted 11 lines · Johan Hedberg
Quoted 5 lines · Clément Jacquemin

Another question about best practice. For the moment I use "btmgmt" to configure my daemon. However, the "bluetoothctl" binary seems to be a more stable alternative except that i cannot find any way to do the "le on" command as in "btmgmt".
Is there any way to activate the low energy option with bluetoothctl?

bluetoothctl talks to bluetoothd and bluetoothd already automatically enables LE support whenever it's reported to be supported by the kernel.

Johan

I still have some questions.

First, is there any equivalent of the 'bt_gatt_server_send_notification' method from "src/shared/gatt-server.c" but with the GATT D-BUS API. I did not find anything about that.

Second, when one of my characteristic need more than 5 seconds to process the data, the client is systematically disconnect 5 seconds after requesting a read action on that characteristic. I suppose there is a timeout configuration somewhere, but where ?

Clément.

#3 lore raw

Hello,

I am still looking for an answer about these two problems of timeout and notifications.

Thank you!

Quoted 28 lines · Clément Jacquemin

Thanks for your answer Johan!

Quoted 8 lines · Johan Hedberg
Quoted 6 lines · Clément Jacquemin

Another question about best practice. For the moment I use "btmgmt" to configure my daemon. However, the "bluetoothctl" binary seems to be a more
stable alternative except that i cannot find any way to do the "le on" command as in "btmgmt".
Is there any way to activate the low energy option with bluetoothctl?

Quoted 4 lines

bluetoothctl talks to bluetoothd and bluetoothd already automatically enables LE support whenever it's reported to be supported by the kernel.

Johan

I still have some questions.

First, is there any equivalent of the 'bt_gatt_server_send_notification' method from "src/shared/gatt-server.c" but with the GATT D-BUS API. I did not find anything about that.

Second, when one of my characteristic need more than 5 seconds to process the data, the client is systematically disconnect 5 seconds after requesting a read action on that characteristic. I suppose there is a timeout configuration somewhere, but where ?

Clément.

Signature · 3 lines
Clément Jacquemin
Root GISTRE 2016
[email protected]