summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2022-02-07 16:58:02 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-02-10 13:57:52 +0000
commitc5d858f24524295f0aca28019d8930711d820c7d (patch)
tree8c41dc70f0a149c0464baa878bffcd167696a070
parent1d440f48dece58c147db1dd7cc5287f81d67fb8a (diff)
Keep the bluetooth service name if the remote has provided it
For example the "Bt Chat Server" example application service would always show up as a "Custom Service". Change-Id: If73423d90d5681ee0c3655ef7ee3ad6cd7638755 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit e27c6600eca2c9b704c73a0b6d28780eb236cefb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp
index 998472f2..d36a01e3 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp
@@ -256,7 +256,10 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_finishSdpScan(QBluetoothServiceD
for (const QBluetoothUuid &id : serviceClassUuids) {
if (id.minimumSize() == 16) {
serviceInfo.setServiceUuid(id);
- serviceInfo.setServiceName(QBluetoothServiceDiscoveryAgent::tr("Custom Service"));
+ if (serviceInfo.serviceName().isEmpty()) {
+ serviceInfo.setServiceName(
+ QBluetoothServiceDiscoveryAgent::tr("Custom Service"));
+ }
QBluetoothServiceInfo::Sequence modSeq =
serviceInfo.attribute(QBluetoothServiceInfo::ServiceClassIds).value<QBluetoothServiceInfo::Sequence>();
modSeq.removeOne(QVariant::fromValue(id));