[Interest] Qt5.7 BLE advertising, contents added twice
Christian Kandeler
christian.kandeler at qt.io
Fri Aug 26 17:39:29 CEST 2016
On 08/26/2016 03:00 PM, Marco Trapanese wrote:
> With Qt5.7 under Linux Debian (kernel 4.4.11-v7+, bluez 5.40) I set up
> my own GATT server.
> In my code I set up the advertising packet in this way:
>
>> QLowEnergyAdvertisingData advertisingData;
As explained in the documentation of this class, advertising data is a
scarce resource: There are only 31 bytes available in such a packet.
>> advertisingData.setDiscoverability(QLowEnergyAdvertisingData::DiscoverabilityGeneral);
This information takes one byte plus two bytes of meta data. You have 28
bytes left.
>> advertisingData.setLocalName("0123456789");
This information takes 10 bytes plus two bytes of meta data. You have 16
bytes left.
>> advertisingData.setServices(QList<QBluetoothUuid>() <<
[my-128-bit-uuid]);
This information takes 16 bytes plus two bytes of meta data. You would
have -2 bytes left. Hence this message:
>> qt.bluetooth.bluez: services data does not fit into advertising data
>> packet
is correct.
> inspecting the advertising data with the Android app from Nordic, I see
> the LocalName is set 2 times!
Nah, whatever you see there is just an artifact of whatever the client
app does.
> And I can't see my uuid.
Obviously not, as it could not be added on the server side.
> Is this the correct behavior? Am I missing something?
Yes, it is. You need to shorten the local name to eight bytes or less.
Christian
More information about the Interest
mailing list