summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothserviceinfo_winrt.cpp
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2018-08-08 15:06:15 +0200
committerOliver Wolff <oliver.wolff@qt.io>2018-08-15 07:56:43 +0000
commit84f0e76c647e7f09529b79525b2d4fbc698576d8 (patch)
treeb9fb1e01097c5d24b79387b0c1d778ec06c199bf /src/bluetooth/qbluetoothserviceinfo_winrt.cpp
parent3eb77fc4a0a9f8403baaa2a33aad9c0ef4802cb7 (diff)
winrt: Handle UUID cases in service registration
Change-Id: I227f9bd81e666d398366fc573573a0df973a5ff8 Reviewed-by: Andre de la Rocha <andre.rocha@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothserviceinfo_winrt.cpp')
-rw-r--r--src/bluetooth/qbluetoothserviceinfo_winrt.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/bluetooth/qbluetoothserviceinfo_winrt.cpp b/src/bluetooth/qbluetoothserviceinfo_winrt.cpp
index d54ac52d..5400c001 100644
--- a/src/bluetooth/qbluetoothserviceinfo_winrt.cpp
+++ b/src/bluetooth/qbluetoothserviceinfo_winrt.cpp
@@ -79,8 +79,9 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINRT)
#define TYPE_INT32 18
#define TYPE_INT64 19
//#define TYPE_INT128 20
-#define TYPE_SHORT_UUID 25
-#define TYPE_LONG_UUID 28
+#define TYPE_UUID16 25
+#define TYPE_UUID32 26
+#define TYPE_UUID128 28
#define TYPE_STRING 37
#define TYPE_BOOLEAN 40
#define TYPE_SEQUENCE 53
@@ -113,7 +114,7 @@ bool repairProfileDescriptorListIfNeeded(ComPtr<IBuffer> &buffer)
hr = reader->ReadByte(&type);
Q_ASSERT_SUCCEEDED(hr);
// We have to "repair" the structure if the outer sequence contains a uuid directly
- if (type == TYPE_SHORT_UUID && length == 4) {
+ if (type == TYPE_UUID16 && length == 4) {
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Repairing profile descriptor list";
quint16 uuid;
hr = reader->ReadUInt16(&uuid);
@@ -133,7 +134,7 @@ bool repairProfileDescriptorListIfNeeded(ComPtr<IBuffer> &buffer)
Q_ASSERT_SUCCEEDED(hr);
hr = writer->WriteByte(7);
Q_ASSERT_SUCCEEDED(hr);
- hr = writer->WriteByte(TYPE_SHORT_UUID);
+ hr = writer->WriteByte(TYPE_UUID16);
Q_ASSERT_SUCCEEDED(hr);
hr = writer->WriteUInt16(uuid);
Q_ASSERT_SUCCEEDED(hr);
@@ -258,25 +259,22 @@ static ComPtr<IBuffer> bufferFromAttribute(const QVariant &attribute)
break;
case 2:
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering Uuid attribute with length 2:" << uuid;
- hr = writer->WriteByte(TYPE_SHORT_UUID);
+ hr = writer->WriteByte(TYPE_UUID16);
Q_ASSERT_SUCCEEDED(hr);
hr = writer->WriteUInt16(uuid.toUInt16());
Q_ASSERT_SUCCEEDED(hr);
break;
case 4:
- qCWarning(QT_BT_WINRT) << "Don't know how to register Uuid of length 4";
- return nullptr;
- break;
- case 16:
- qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering Uuid attribute with length 16:" << uuid;
- hr = writer->WriteByte(TYPE_LONG_UUID);
+ qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering Uuid attribute with length 4:" << uuid;
+ hr = writer->WriteByte(TYPE_UUID32);
Q_ASSERT_SUCCEEDED(hr);
- hr = writer->WriteGuid(uuid);
+ hr = writer->WriteUInt32(uuid.toUInt32());
Q_ASSERT_SUCCEEDED(hr);
break;
+ case 16:
default:
qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering Uuid attribute:" << uuid;
- hr = writer->WriteByte(TYPE_LONG_UUID);
+ hr = writer->WriteByte(TYPE_UUID128);
Q_ASSERT_SUCCEEDED(hr);
hr = writer->WriteGuid(uuid);
Q_ASSERT_SUCCEEDED(hr);