summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@qt.io>2023-04-03 09:27:26 +0300
committerJuha Vuolle <juha.vuolle@qt.io>2023-04-04 08:35:08 +0300
commit63f77a6833fffad5347dff7b5dd3760522600dfd (patch)
treefe0f6469eb766e1be872d01406d54a0fccb0bedc
parent05b91367b3e1189e3deb2c61a2ba8a51399b806d (diff)
downloadqtconnectivity-63f77a6833fffad5347dff7b5dd3760522600dfd.tar.gz
[Darwin] Fix LE controller initialization
Peripheral applications don't work properly due to permission-related initialization changes. The underlying CBPeripheralManager was instantiated only when startAdvertising() was called, which can be too late; the peripheral manager is needed already earlier if the application calls addService(). Calling addService() before startAdvertising() is not mandatory though, and hence the lazy initialization needs to be attempted in both functions. Amends ae1a1f5efce291f613a13757ff6f744fcca2d2ce Task-number: QTBUG-112215 Change-Id: I7771a2e1bd951093e33030546e5da69538c8dcd1 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r--src/bluetooth/qlowenergycontroller_darwin.mm2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bluetooth/qlowenergycontroller_darwin.mm b/src/bluetooth/qlowenergycontroller_darwin.mm
index ccac9d30..40c95182 100644
--- a/src/bluetooth/qlowenergycontroller_darwin.mm
+++ b/src/bluetooth/qlowenergycontroller_darwin.mm
@@ -319,7 +319,7 @@ void QLowEnergyControllerPrivateDarwin::readRssi()
QLowEnergyService * QLowEnergyControllerPrivateDarwin::addServiceHelper(const QLowEnergyServiceData &service)
{
- if (!isValid()) {
+ if (!lazyInit() || !isValid()) {
qCWarning(QT_BT_DARWIN) << "invalid peripheral";
return nullptr;
}