diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2019-02-11 16:28:05 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2019-02-15 11:31:29 +0000 |
commit | 68982ef782d7e7c23ce25619f8be2bee1bca355d (patch) | |
tree | aed50b0efa6f7f3e61b19dd476536ee7acb3672a /src/bluetooth/qbluetoothserviceinfo_winrt.cpp | |
parent | 1606ccb76ba72990df652fbd7f01d709ae20b63c (diff) |
Ensure SDP records can be byte arrays/hex encoded
This addresses the issue on Bluez only. macOS ignore such
attribute values and WinRT implicitly converts them to hex strings.
The macOS debug stream operator produced slightly different output
compared to the other platforms. The output between the platforms
must match though. Therefore, the general version was copied over
to macOS.
Task-number: QTBUG-73328
Change-Id: Ieea2a3a559b5686f7f7d16d5c75dd9ef2782cdf5
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothserviceinfo_winrt.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothserviceinfo_winrt.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bluetooth/qbluetoothserviceinfo_winrt.cpp b/src/bluetooth/qbluetoothserviceinfo_winrt.cpp index 45262735..e806096f 100644 --- a/src/bluetooth/qbluetoothserviceinfo_winrt.cpp +++ b/src/bluetooth/qbluetoothserviceinfo_winrt.cpp @@ -297,6 +297,14 @@ static ComPtr<IBuffer> bufferFromAttribute(const QVariant &attribute) hr = writer->WriteInt64(attribute.value<qint64>()); Q_ASSERT_SUCCEEDED(hr); break; + case QMetaType::QByteArray: { + qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering attribute of type QMetaType::QByteArray:" << attribute.value<QString>(); + const QString stringValue = QString::fromLatin1(attribute.value<QByteArray>().toHex()); + const bool writeSuccess = writeStringHelper(stringValue, writer); + if (!writeSuccess) + return nullptr; + break; + } case QMetaType::QString: { qCDebug(QT_BT_WINRT) << Q_FUNC_INFO << "Registering attribute of type QMetaType::QString:" << attribute.value<QString>(); const QString stringValue = attribute.value<QString>(); |