Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
5.12, 5.13
-
None
Description
I'm trying to connect an android smatphone (central role) where my application run, to a Bluetooth low energy device (peripheral role).
When I call requestPairing method from my code, the QBluetoothLocalDevice::PairingError signal occurs immediately. However the OS panel to pair the device is shown but connection is closed and operation is aborted, so no pairing is possible.
Here my code, where "target" is a QBluetoothDeviceInfo* from a list of devices discovered by QBluetoothDeviceDiscoveryAgent
bleController = new QLowEnergyController(*target); myAdapter = new QBluetoothLocalDevice(); qDebug() << "Pairing Status is " << myAdapter->pairingStatus(target->address()); if (myAdapter->pairingStatus(target->address()) != QBluetoothLocalDevice::Paired) { connect(myAdapter,SIGNAL(error(QBluetoothLocalDevice::Error)),this,SLOT(pairingError(QBluetoothLocalDevice::Error))); connect(myAdapter,SIGNAL(pairingFinished(QBluetoothAddress,QBluetoothLocalDevice::Pairing)),this,SLOT(pairingSuccess(QBluetoothAddress,QBluetoothLocalDevice::Pairing))); connect(myAdapter,SIGNAL(hostModeStateChanged(QBluetoothLocalDevice::HostMode)),this,SLOT(modeStateChanged(QBluetoothLocalDevice::HostMode))); myAdapter->requestPairing(target->address(),QBluetoothLocalDevice::Paired); } else { bleController->connectToDevice(); }
and here my log messages
D libBleBonding.so: Pairing Status is QBluetoothLocalDevice::Unpaired
I BluetoothDevice: createBond() for device D9:A5:56:7F:EB:EC called by pid: 17396 tid: 17412
D libBleBonding.so: paring error QBluetoothLocalDevice::PairingError QLowEnergyController::UnconnectedState QBluetoothLocalDevice::Unpaired
I tested same code with QT 5.9.8 and it works well.
I tried to bond my target device by android settings menu, and here, operative system ask me passkey and the operation go to conclude properly.
In these conditions pairing seems impossibe. Rest of my code needs QT >= 5.12, is there a work around to pair a device?
Attachments
Issue Links
- relates to
-
QTBUG-76565 BLE pairing with pin code fails on Android because Qt does not ask for the pin code but generates a random one
-
- Closed
-