Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.7.0
-
None
-
bluez (5.43) QT (5.7.0) linux kernel (4.4.6)
Description
Using the QT Bluetooth BLE support in peripheral mode, I connect the QLowEnergyController::connected SIGNAL to a SLOT. Upon connecting to the peripheral, the connect SIGNAL is not emitted. However the disconnected SIGNAL is emitted upon disconnection of the connected device.
Enabling logging thru : QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
In the logs I can see:
Mar 27 12:47:22 worxim wxConfig[14933]: qt.bluetooth.bluez: HCI event triggered, type: 3e
Mar 27 12:47:22 worxim wxConfig[14933]: qt.bluetooth.bluez: received connection complete event, handle: 1025
Mar 27 12:47:22 worxim wxConfig[14933]: qt.bluetooth.bluez: GATT connection from device "B8:E8:56:31:99:73"
Mar 27 12:47:23 worxim wxConfig[14933]: qt.bluetooth.bluez: No settings found for peer device.
What could be inhibiting connected from being emitted?
Here is part of the relevant code setting up the QLowEnergyController:
//! [Start Advertising]
const QScopedPointer<QLowEnergyController> leController(QLowEnergyController::createPeripheral());
QSharedPointer<QLowEnergyService> service(leController->addService(serviceData));
leController->addService(deviceInfoServiceData);
leController->setRemoteAddressType(QLowEnergyController::RandomAddress);
leController->startAdvertising(QLowEnergyAdvertisingParameters(), advertisingData, scanResponseData);
//! [Start Advertising]
// This Lambda will be called after a BLE client has disconnected to allow us to restart advertising of our services and characteristics.
auto reconnect = [&leController, advertisingData, scanResponseData]()
;
auto ClientConnected = [&leController]()
;
QObject::connect(leController.data(), &QLowEnergyController::connected, ClientConnected);
Attachments
For Gerrit Dashboard: QTBUG-59754 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
190949,2 | Ensure that QLowEnergyController::connected() is emitted on BlueZ | 5.9 | qt/qtconnectivity | Status: MERGED | +2 | 0 |