summaryrefslogtreecommitdiffstats
path: root/core/btdiscovery.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-09-17 15:40:16 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-09-17 15:40:16 -0700
commitae209a3d9f8ed36e2228834d421ff4a6ac345ad9 (patch)
tree046937d0c944d3b6ad8ff9a8c49ab8bdcc3136d9 /core/btdiscovery.cpp
parent58b7c6f8ef703009e098351774b8db521cce48e3 (diff)
parent49fe120d9530682cf539d562c4ffcae3e195b9ab (diff)
downloadsubsurface-ae209a3d9f8ed36e2228834d421ff4a6ac345ad9.tar.gz
Merge branch 'macBLE' of github.com:Subsurface-divelog/subsurface
Diffstat (limited to 'core/btdiscovery.cpp')
-rw-r--r--core/btdiscovery.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/core/btdiscovery.cpp b/core/btdiscovery.cpp
index cab44b4a6..729ee9851 100644
--- a/core/btdiscovery.cpp
+++ b/core/btdiscovery.cpp
@@ -174,11 +174,10 @@ QString markBLEAddress(const QBluetoothDeviceInfo *device)
flags = device->coreConfigurations();
if (flags == QBluetoothDeviceInfo::LowEnergyCoreConfiguration)
prefix = "LE:";
-#if defined(Q_OS_IOS)
- return prefix + device->deviceUuid().toString();
-#else
- return prefix + device->address().toString();
-#endif
+ if (device->address().isNull())
+ return prefix + device->deviceUuid().toString();
+ else
+ return prefix + device->address().toString();
}
void BTDiscovery::btDeviceDiscovered(const QBluetoothDeviceInfo &device)
@@ -308,4 +307,18 @@ bool BTDiscovery::checkException(const char* method, const QAndroidJniObject *ob
}
#endif // Q_OS_ANDROID
+QHash<QString, QBluetoothDeviceInfo> btDeviceInfo;
+
+void saveBtDeviceInfo(const char* devaddr, QBluetoothDeviceInfo deviceInfo)
+{
+ btDeviceInfo[devaddr] = deviceInfo;
+}
+
+QBluetoothDeviceInfo getBtDeviceInfo(const char* devaddr)
+{
+ if (btDeviceInfo.contains(devaddr))
+ return btDeviceInfo[devaddr];
+ qDebug() << "need to scan for" << devaddr;
+ return QBluetoothDeviceInfo();
+}
#endif // BT_SUPPORT