[Interest] QtBluetooth Low Energy: How to find my peripheral?

Prashant Vaibhav prashant.vaibhav at tobyrich.com
Thu Oct 13 17:10:56 CEST 2016


Hi Alexander,

Is it possible you’re referring to Bluetooth Classic while my issue appears with Bluetooth Smart (Low Energy)?

Perhaps what’s happening is: line 447 checks for a valid BluetoothClass being returned, which for BLE devices will be null (at least for my device it is). Then line 448 return an empty QBluetoothDeviceInfo? This would explain why the only valid piece of info I get is the rssi which is a bare int.

Another thing I noticed here:
http://code.qt.io/cgit/qt/qtconnectivity.git/tree/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java#n113 <http://code.qt.io/cgit/qt/qtconnectivity.git/tree/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java#n113>
is that the byte[] scanRecord is being ignored – this where the advertised service UUID(s) would be (needs to be parsed).

(An aside, if you could point me to a starting point on getting the sources and building QtBluetooth module myself, that’ll be helpful. I will gladly contribute patches.)

Kind Regards,
Prashant Vaibhav




> On 13 Oct 2016, at 16:43, Alexander Blasche <alexander.blasche at qt.io> wrote:
> 
> In general the device search does add the found service UUIDs to the QBluetoothDeviceInfo. The relevant code section that extracts the service UUIDs can be found under:
> 
> http://code.qt.io/cgit/qt/qtconnectivity.git/tree/src/bluetooth/android/devicediscoverybroadcastreceiver.cpp?h=5.6.2#n469
> 
> Have you tried other Android devices? Maybe your device does not extract this type of information properly. At least on my test hardware the above lines produce the UUIDs. I suggest to debug around this area of code.
> 
> --
> Alex
> 
> ________________________________________
> From: Prashant Vaibhav <prashant.vaibhav at tobyrich.com>
> Sent: Wednesday, 12 October 2016 4:34:56 PM
> To: Alexander Blasche
> Cc: interest at qt-project.org
> Subject: Re: [Interest] QtBluetooth Low Energy: How to find my peripheral?
> 
> Oops, pasted wrong bug report link.
> I meant this: https://bugreports.qt.io/browse/QTBUG-46008
> 
> 
> Kind Regards,
> Prashant Vaibhav
> 
> 
> 
> On 12 Oct 2016, at 16:34, Prashant Vaibhav <prashant.vaibhav at tobyrich.com<mailto:prashant.vaibhav at tobyrich.com>> wrote:
> 
> Hi Alexander,
> 
> Comments inline below. Thanks.
> 
> Kind Regards,
> Prashant Vaibhav
> 
> 
> 
> On 12 Oct 2016, at 15:45, Alexander Blasche <alexander.blasche at qt.io<mailto:alexander.blasche at qt.io>> wrote:
> 
> 
> 
> -----Original Message-----
> From: Interest [mailto:interest-bounces+alexander.blasche=qt.io<http://qt.io/>@qt-
> project.org<http://project.org/>] On Behalf Of Prashant Vaibhav
> Sent: Wednesday, 12 October 2016 13:45
> To: interest at qt-project.org<mailto:interest at qt-project.org>
> Subject: [Interest] QtBluetooth Low Energy: How to find my peripheral?
> 
> Hi all,
> 
> I’m using QtBluetooth low energy API on Qt 5.7 / Android 5/6. Targeting API level
> 19 (android 4.4+).
> 
> What are you using Qt 5.6 or 5.7?
> 
> I’m using Qt 5.7.0.
> 
> 
> My problem is that I cannot find a way to decide which of the BLE devices
> returned during scan is mine:
> 
> - The advertising data is inaccessible (no API).
> - The QBluetoothDeviceInfo.serviceUuids() function returns nothing (apparently
> it’s for classic bluetooth)
> - The QBluetoothDeviceInfo.name() function is null (empty string)
> 
> So the only information I have is the rssi (QBluetoothDeviceInfo.rssi()), which is
> not enough to figure out the scanned device is ours. Furthermore, I cannot show
> a list to the user to pick the device manually, since all it will have is the signal level
> (and perhaps MAC address).
> 
> 
> I believe you may experience https://bugreports.qt.io/browse/QTBUG-54867.
> 
> It was fixed in Qt 5.6.2 and 5.7.1. Alternatively you may cherry-pick the referenced patches into your Qt build.
> 
> Thanks for the link, I checked and it doesn’t seem relevant to my issue. Our BLE device doesn’t have major/minor numbers in its advertising packet. It does have the primary service UUID (128 bit) which we are using to identify it on iOS (native code).
> 
> Perhaps you meant https://bugreports.qt.io/browse/QTBUG-54867 ?
> 
> 
> --
> Alex
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20161013/403480c9/attachment.html>


More information about the Interest mailing list