summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bluetooth/qlowenergycontroller.cpp17
-rw-r--r--src/bluetooth/qlowenergycontroller.h1
-rw-r--r--src/bluetooth/qlowenergycontroller_osx.mm7
-rw-r--r--tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp3
4 files changed, 27 insertions, 1 deletions
diff --git a/src/bluetooth/qlowenergycontroller.cpp b/src/bluetooth/qlowenergycontroller.cpp
index 2b28a873..89e65ce7 100644
--- a/src/bluetooth/qlowenergycontroller.cpp
+++ b/src/bluetooth/qlowenergycontroller.cpp
@@ -635,6 +635,23 @@ QBluetoothAddress QLowEnergyController::remoteAddress() const
}
/*!
+ Returns the unique identifier of the remote Bluetooth Low Energy device.
+
+ On macOS/iOS/tvOS CoreBluetooth does not expose/accept hardware addresses for
+ LE devices; instead developers are supposed to use unique 128-bit UUIDs, generated
+ by CoreBluetooth. These UUIDS will stay constant for the same central <-> peripheral
+ pair and we use them when connecting to a remote device. For a controller in the
+ \l CentralRole, this value will always be the one passed in when the controller
+ object was created. For a controller in the \l PeripheralRole, this value is invalid.
+
+ \since 5.8
+ */
+QBluetoothUuid QLowEnergyController::remoteDeviceUuid() const
+{
+ return QBluetoothUuid();
+}
+
+/*!
Returns the name of the remote Bluetooth Low Energy device, if the controller is in the
\l CentralRole. Otherwise the result is unspecified.
diff --git a/src/bluetooth/qlowenergycontroller.h b/src/bluetooth/qlowenergycontroller.h
index 4ee07531..1c4fa83f 100644
--- a/src/bluetooth/qlowenergycontroller.h
+++ b/src/bluetooth/qlowenergycontroller.h
@@ -107,6 +107,7 @@ public:
QBluetoothAddress localAddress() const;
QBluetoothAddress remoteAddress() const;
+ QBluetoothUuid remoteDeviceUuid() const;
QString remoteName() const;
diff --git a/src/bluetooth/qlowenergycontroller_osx.mm b/src/bluetooth/qlowenergycontroller_osx.mm
index f2b7b0bd..80ef72af 100644
--- a/src/bluetooth/qlowenergycontroller_osx.mm
+++ b/src/bluetooth/qlowenergycontroller_osx.mm
@@ -1098,6 +1098,13 @@ QBluetoothAddress QLowEnergyController::remoteAddress() const
return osx_d_ptr->remoteAddress;
}
+QBluetoothUuid QLowEnergyController::remoteDeviceUuid() const
+{
+ OSX_D_PTR;
+
+ return osx_d_ptr->deviceUuid;
+}
+
QString QLowEnergyController::remoteName() const
{
OSX_D_PTR;
diff --git a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
index 4acfe4d1..6475b8c4 100644
--- a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
+++ b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
@@ -142,7 +142,7 @@ void tst_QLowEnergyController::initTestCase()
QVERIFY(finishedSpy.isEmpty());
bool deviceFound = false;
- devAgent->start();
+ devAgent->start(QBluetoothDeviceDiscoveryAgent::LowEnergyMethod);
QTRY_VERIFY_WITH_TIMEOUT(finishedSpy.count() > 0, 30000);
foreach (const QBluetoothDeviceInfo &info, devAgent->discoveredDevices()) {
#ifndef Q_OS_MAC
@@ -252,6 +252,7 @@ void tst_QLowEnergyController::tst_connect()
QSKIP("No local Bluetooth or remote BTLE device found. Skipping test.");
QLowEnergyController control(remoteDeviceInfo);
+ QCOMPARE(remoteDeviceInfo.deviceUuid(), control.remoteDeviceUuid());
QCOMPARE(control.role(), QLowEnergyController::CentralRole);
QSignalSpy connectedSpy(&control, SIGNAL(connected()));
QSignalSpy disconnectedSpy(&control, SIGNAL(disconnected()));