[Interest] [Qt BLE] multiple devices connected to an app

Oliver Wolff oliver.wolff at qt.io
Tue Dec 15 08:17:40 CET 2020


Hi Simon,

On 14/12/2020 16:36, Simon FEUTRIER wrote:
> I don't really have something useful to share and my code is quite big. 
> Moreover it is mainly inspired by the lowEnergyScanner example.
> 
> Here is my algorithm for BLE :
> -> MainWindow initiates a class called "apiComBluetooth".
> -> Then MainWindow calls ApiComBluetooth.startDiscovery() which is just 
> QBluetoothDeviceDiscoveryAgent.startDiscovery()
> -> After 5 seconds, the ApiComBluetooth receives the signal of 
> discoveryFinished. It sorts devices that I want and stores them in a 
> list of BleDevice (bluetooth device class like in the lowEnergyScanner 
> example).
> -> Then the (only) service that I use starts to be discovered for each 
> BleDevice created.
> -> To write or read to a specific device, MainWindow just accesses the 
> right device in the BleDevice list using an index. 
> "WriteCharacteristic" or messages received in the FIFO are managed 
> directly in the BleDevice class of the device.

My experience with BLE on Windows is, that everything is really 
sensitive when it comes to devices/BLE dongles and drivers. Can you give 
more information on the hardware you are using?

Windows API does not have the concept of connecting to a BLE device, so 
what we do behind the scenes is reading a characteristic if the device 
is not connected. This will trigger a connect that is initiated by the 
operating system. So the influence we have on the connection behavior 
itself is quite limited. Perhaps the hardware you are using at least 
gives some input.

Cheers, Olli

> 
> I don't know if this information can help you, thank you !
> 
> Best regards,
> 
> Simon Feutrier
> 
> 
> Le lun. 14 déc. 2020 à 16:05, Andreas Buhr <andreas.buhr at qt.io 
> <mailto:andreas.buhr at qt.io>> a écrit :
> 
>     Hi Simon,
> 
>     On 14.12.20 15:25, Simon FEUTRIER wrote:
>      > But when I write in the characteristic of the second remote
>     device, the
>      > connection with this device is immediately lost (Invalid service
>     : loss
>      > of connection with the underlying device)
> 
>     Would you be able to share more information? Could you share your code?
> 
>     best,
>     Andreas
>     _______________________________________________
>     Interest mailing list
>     Interest at qt-project.org <mailto:Interest at qt-project.org>
>     https://lists.qt-project.org/listinfo/interest
>     <https://lists.qt-project.org/listinfo/interest>
> 
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
> 


More information about the Interest mailing list