summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergycontroller.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bluetooth/qlowenergycontroller.cpp')
-rw-r--r--src/bluetooth/qlowenergycontroller.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/bluetooth/qlowenergycontroller.cpp b/src/bluetooth/qlowenergycontroller.cpp
index 6581c4ad..4df92a39 100644
--- a/src/bluetooth/qlowenergycontroller.cpp
+++ b/src/bluetooth/qlowenergycontroller.cpp
@@ -198,13 +198,17 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT)
This signal is emitted when the controller successfully connects to the remote
Low Energy device (if the controller is in the \l CentralRole) or if a remote Low Energy
device connected to the controller (if the controller is in the \l PeripheralRole).
+ On iOS and OS X this signal is not reliable if the controller is in the \l PeripheralRole
+ - the controller only guesses that some central connected to our peripheral as
+ soon as this central tries to write/read a characteristic/descriptor.
*/
/*!
\fn void QLowEnergyController::disconnected()
This signal is emitted when the controller disconnects from the remote
- Low Energy device or vice versa.
+ Low Energy device or vice versa. On iOS and OS X this signal is unreliable
+ if the controller is in the \l PeripheralRole.
*/
/*!
@@ -308,6 +312,9 @@ void QLowEnergyControllerPrivate::setError(
bool QLowEnergyControllerPrivate::isValidLocalAdapter()
{
+#ifdef QT_WINRT_BLUETOOTH
+ return true;
+#endif
if (localAdapter.isNull())
return false;
@@ -628,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.
@@ -687,6 +711,11 @@ void QLowEnergyController::connectToDevice()
{
Q_D(QLowEnergyController);
+ if (role() != CentralRole) {
+ qCWarning(QT_BT) << "Connection can only be established while in central role";
+ return;
+ }
+
if (!d->isValidLocalAdapter()) {
d->setError(QLowEnergyController::InvalidBluetoothAdapterError);
return;