From 5aad7c5de78c4768ee5c731f4a1dc686dbc3abd5 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 1 Mar 2016 11:07:03 +0100 Subject: BLE: Write the whole 31 bytes of advertising data to the controller. The specification says: "Only the significant part of the Advertising Data is transmitted in the advertising packets". This seems to refer to the data that is actually sent by the hardware and not to the data used in the HCI command, as our original implementation assumed. At least there seem to be controllers who won't accept such "short" packets. Change-Id: I732cfc1e05fc135fd336d832e725d969c98b60cf Reviewed-by: Alex Blasche --- src/bluetooth/qleadvertiser_bluez.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bluetooth/qleadvertiser_bluez.cpp b/src/bluetooth/qleadvertiser_bluez.cpp index d4494bc0..52f4dd73 100644 --- a/src/bluetooth/qleadvertiser_bluez.cpp +++ b/src/bluetooth/qleadvertiser_bluez.cpp @@ -353,7 +353,9 @@ void QLeAdvertiserBluez::setData(bool isScanResponseData) setManufacturerData(sourceData, theData); } - const QByteArray dataToSend = byteArrayFromStruct(theData, 1 + theData.length); + std::memset(theData.data + theData.length, 0, sizeof theData.data - theData.length); + const QByteArray dataToSend = byteArrayFromStruct(theData); + if (!isScanResponseData) { qCDebug(QT_BT_BLUEZ) << "advertising data:" << dataToSend.toHex(); queueCommand(OcfLeSetAdvData, dataToSend); -- cgit v1.2.3