Bluetooth - multi QT app connect to the same BLE device
-
Hi, i am using QT BLE lib.
how about if 2 BLE applications connect to the same BLE device at the same time.
i tested on iOS, if the first app connected to the device, so the second app cannot discovery the device.
seem, QT don't support that, right? any detail information around this issue? and on different platforms?
thanks. -
anyone can help? ^^!
-
Hi
The docs says
" It is important to mention that some platforms such as a BlueZ based Linux cannot maintain two connected instances of QLowEnergyController to the same remote device. In such cases the second call to connectToDevice() may fail. This limitation may disappear at some stage in the future."So that could also be the case with iOS.
Im not sure what backend is used there.
-
@mrjj the issue happened on iOS, Android and MacOS. i haven't tested on Windows and Linux yet.
seem, this is a issue in QT code. from QT code, to support that, i think QT should use the function:retrieveConnectedPeripheralsWithServices on iOS , MacOS
and https://developer.android.com/reference/android/bluetooth/BluetoothManager#getConnectedDevices(int) on android.our team. find a way that create a interface class call direct those functions from OS BLE lib to get Connected headset and call it 1 more time to get data with QT API to keep work flow using QT API.
what reasons don't QT use those function? i hope QT can support it soon in the near future
-
@Pham-Hoang
Hi
Please go and open an enhancement ticket at
https://bugreports.qt.io/secure/Dashboard.jspaand post the link here. Then people can vote for it.
-
-
@Pham-Hoang you're doing this with Qt5 I assume.
AFAIK Bluetooth and BLE will get a big overhaul in Qt6 (have a few issues I run into myself over the years that require "breaking" changes)
IIRC Bluetooth is scheduled for 6.2 so chances are relatively high this could make it in time 🤷♂️. Or at least I hope so. It is an important feature after all. But I wouldn't necessarily hold my breath over it.
-
thank @J-Hilk for your information.
can you share me what your issues you talked around BLE that make a big changes in Qt6?
our company applications/our devices are using BLE as main connections. it is very important to understand issues around.and here is a issue i raised before: https://forum.qt.io/topic/120105/bluetooth-permission-from-mac-os-11-0
-
@J-Hilk and 1 more issue. uhm, we are still support Windows 8. but QT is crashing when run on Win 8 with BLE lib. that made us cannot use QT BLE for windows built.
i know that QT BLE don't work on Win 8. but is there a way to make it don't crash? -
can you share me what your issues you talked around BLE
sure, for example this is not forwarded/handled correctly
https://developer.apple.com/documentation/corebluetooth/cbperipheraldelegate/1518865-peripheral?language=objci know that QT BLE don't work on Win 8. but is there a way to make it don't crash
so do you make an extra binary for windows 8 ? than simply #ifdef the part out, important here to also consider os guards in the pro file otherwise the build will depend on BT anyway
-
@Pham-Hoang well,
I'm not sure if you can do much then.You may get away with it, if you branch inside your code and only instanciante BlueTooth components/objects when you're not on win8
Because as soon as you do, the bluetoothlib is being loaded, and will try to do native calls that probably aren't there on win8 what leads to your crash (presumably)