summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2017-01-13 15:08:51 +0100
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2017-01-13 14:23:16 +0000
commitf9e85fb10a0560563e3106c4e8f6e269ece67659 (patch)
treebde1983b3635edfe9a1706075b04aa23b08a6d81
parent117db19dbc0c16e67812145d47d2d3e29a7f355d (diff)
BTLE - prefer advertised name (CoreBluetooth)
Invert CoreBluetooth's naming priorities: CoreBluetooth prefers the device's GAP name over advertised name; we instead give the higher priority to advertisement data (CBAdvertisementDataLocalNameKey). [ChangeLog][QtBluetooth] Prefer advertised name if set Task-number: QTBUG-58080 Change-Id: If40687c9c1de50986f61d5e6134001621bc5030b Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/bluetooth/osx/osxbtledeviceinquiry.mm9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/bluetooth/osx/osxbtledeviceinquiry.mm b/src/bluetooth/osx/osxbtledeviceinquiry.mm
index 2dabd0c1..3ce66d49 100644
--- a/src/bluetooth/osx/osxbtledeviceinquiry.mm
+++ b/src/bluetooth/osx/osxbtledeviceinquiry.mm
@@ -364,13 +364,10 @@ QT_USE_NAMESPACE
return;
}
- QString name;
- if (peripheral.name)
- name = QString::fromNSString(peripheral.name);
-
const AdvertisementData qtAdvData(advertisementData);
- if (!name.size()) // Probably, it's not possible to have one and not the other.
- name = qtAdvData.localName;
+ QString name(qtAdvData.localName);
+ if (!name.size() && peripheral.name)
+ name = QString::fromNSString(peripheral.name);
// TODO: fix 'classOfDevice' (0 for now).
QBluetoothDeviceInfo newDeviceInfo(deviceUuid, name, 0);