summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothserviceinfo_bluez.cpp
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2019-02-11 16:28:05 +0100
committerAlex Blasche <alexander.blasche@qt.io>2019-02-15 11:31:29 +0000
commit68982ef782d7e7c23ce25619f8be2bee1bca355d (patch)
treeaed50b0efa6f7f3e61b19dd476536ee7acb3672a /src/bluetooth/qbluetoothserviceinfo_bluez.cpp
parent1606ccb76ba72990df652fbd7f01d709ae20b63c (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_bluez.cpp')
-rw-r--r--src/bluetooth/qbluetoothserviceinfo_bluez.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/bluetooth/qbluetoothserviceinfo_bluez.cpp b/src/bluetooth/qbluetoothserviceinfo_bluez.cpp
index 09829b13..5f57e19e 100644
--- a/src/bluetooth/qbluetoothserviceinfo_bluez.cpp
+++ b/src/bluetooth/qbluetoothserviceinfo_bluez.cpp
@@ -103,17 +103,16 @@ static void writeAttribute(QXmlStreamWriter *stream, const QVariant &attribute)
QString::number(attribute.value<qint32>(), 16));
//stream->writeAttribute(QStringLiteral("name"), foo);
break;
+ case QMetaType::QByteArray:
+ stream->writeEmptyElement(QStringLiteral("text"));
+ stream->writeAttribute(QStringLiteral("value"),
+ QString::fromLatin1(attribute.value<QByteArray>().toHex().constData()));
+ stream->writeAttribute(QStringLiteral("encoding"), QStringLiteral("hex"));
+ break;
case QMetaType::QString:
stream->writeEmptyElement(QStringLiteral("text"));
- if (/* require hex encoding */ false) {
- stream->writeAttribute(QStringLiteral("value"), QString::fromLatin1(
- attribute.value<QString>().toUtf8().toHex().constData()));
- stream->writeAttribute(QStringLiteral("encoding"), QStringLiteral("hex"));
- } else {
- stream->writeAttribute(QStringLiteral("value"), attribute.value<QString>());
- stream->writeAttribute(QStringLiteral("encoding"), QStringLiteral("normal"));
- }
- //stream->writeAttribute(QStringLiteral("name"), foo);
+ stream->writeAttribute(QStringLiteral("value"), attribute.value<QString>());
+ stream->writeAttribute(QStringLiteral("encoding"), QStringLiteral("normal"));
break;
case QMetaType::Bool:
stream->writeEmptyElement(QStringLiteral("boolean"));