Re: Detecting GATT connections over bus

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

 



Hi Petri,

On Thu, May 11, 2017 at 10:13 PM, Jonah Petri <jonah@xxxxxxxxx> wrote:
> Hello,
>
> I am writing a BTLE GATT peripheral using Bluez5 5.45 on Linux 4.1.15 and a bcm43xx chip.  I’m trying to use the DBus GATT and LEAdvertising interfaces.  I need to detect LE host connection and disconnection.
>
> I tried registering a dbus message match for PropertiesChanged on org.bluez.Device1, and watching Connected switch on and off, but that is not reliable, and seems to only happen when bluetoothd wants to resolve services on the connecting host.  In particular, I definitely see cases where:
>
> 1) Initially, all devices listed in ManagedObjects are “Connected" == false
> 2) btmon reveals a subsequent "LE Connection Complete” event
> 3) GATT transactions are initiated by the remote host and received by my application via DBus
> 4) No "Connected = true” PropertiesChanged message is ever received by my application
>
> This leads me to believe that the “Connected = true” transition occurs on some other event.  I do see it sometimes, but it doesn’t seems to correlate to a LE connection.
>
> What can I do to tell when a new host connects to my GATT peripheral?

Just check what bluetoothctl does, it does in fact use Connected
property as you can see bellow it should tell you when there is a
device connected:

[CHG] Device F3:43:74:BF:86:24 Connected: yes

-- 
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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