[Interest] Bluetooth LE: HowTo inspect QBluetoothDeviceInfo::serviceUuids
ekke
ekke at ekkes-corner.org
Tue Apr 18 11:12:05 CEST 2017
Am 18.04.17 um 10:26 schrieb Oliver Wolff:
> On 13/04/2017 19:01, ekke wrote:
>>
>> from QBluetoothDeviceInfo::serviceUuids I'm getting a list of Service
>> UUIDs ( QBluetoothUuid) without connecting to the device and
>> inspecting the Services.
>>
>> there's per ex:
>>
>> {0000180d-0000-1000-8000-00805f9b34fb}
>>
>> and I know this means the device supports
>>
>>
>> HeartRate
>>
>> 0x180d
>>
>>
>> How can I inspect the QBluetoothUuid to get 0x180d
>>
>>
>> I found some Java code like this:
>>
>>
>> private static int getAssignedNumber(UUID uuid) {
>> // Keep only the significant bits of the UUID
>> return (int) ((uuid.getMostSignificantBits() &
>> 0x0000FFFF00000000L) >> 32);
>> }
>>
>>
>> but have no idea HowTo do the same from Qt
>>
>
> Hi ekke,
>
> I am not sure I fully understand the problem. If you want to check the
> availability of a heart rate sensor, you can just compare the Uuids
> with QBluetoothUuid(QBluetoothUuid::HeartRate) can't you?
Hi Oliver,
as soon as I connect to the device and discovered Services I can compare
with QBluetoothUuid::HeartRate (0x180d)
if I only discover the Devices without connecting, most devices provide
ServiceUUIDs
http://doc.qt.io/qt-5/qbluetoothdeviceinfo.html#serviceUuids
but here the UUID isn't 0x180d for HeartRateService, but
{0000180d-0000-1000-8000-00805f9b34fb}
so looking at the ServiceUUIDs I don't have to nonnect to the device to
know that it supports HeartRate :)
now I'm simply comparing found ServiceUUIDs with the full value
{0000180d-0000-1000-8000-00805f9b34fb}
to detect the Device as a HeartRate Device
googled and found that there's a (Java) way to get the most significant
Bits from ServiceUUID to compare with
QBluetoothUuid::HeartRate (0x180d)
would make the example app easier to understand
I'm just finishing a new BT LE Example APP - will be published soon
ekke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170418/b159891c/attachment.html>
More information about the Interest
mailing list