diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2016-08-03 14:06:57 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2016-08-03 13:51:17 +0000 |
commit | cef1148c0e0852232b664afef1510e25aa9c1d55 (patch) | |
tree | e00842e02817f56a87866c98c683482c45a3a4bd | |
parent | bb3f0064e60107c17ba5a90dd35d64116a4a8a89 (diff) |
Do not permit QLEController::connectToDevice() in peripheral mode
Change-Id: Ie6f0e1afdcd81cbd0d3c514d7f02a61109b58d1a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
-rw-r--r-- | src/bluetooth/qlowenergycontroller.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bluetooth/qlowenergycontroller.cpp b/src/bluetooth/qlowenergycontroller.cpp index 0095b90a..2b28a873 100644 --- a/src/bluetooth/qlowenergycontroller.cpp +++ b/src/bluetooth/qlowenergycontroller.cpp @@ -694,6 +694,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; |