implemented keep alive
This commit is contained in:
parent
dad7187909
commit
45ce9b1cd7
1 changed files with 2 additions and 2 deletions
|
@ -114,7 +114,7 @@ bool QBluetoothLeUart::connectToDevice(QBluetoothLeUartDevice *device){
|
||||||
|
|
||||||
// initialize QLowEnergyController
|
// initialize QLowEnergyController
|
||||||
bluetoothController = new QLowEnergyController(currentBluetoothDevice->getDevice(), this);
|
bluetoothController = new QLowEnergyController(currentBluetoothDevice->getDevice(), this);
|
||||||
bluetoothController ->setRemoteAddressType(QLowEnergyController::RandomAddress);
|
bluetoothController->setRemoteAddressType(QLowEnergyController::RandomAddress);
|
||||||
|
|
||||||
connect(this->bluetoothController, &QLowEnergyController::serviceDiscovered, this, &QBluetoothLeUart::handleServiceDiscovered);
|
connect(this->bluetoothController, &QLowEnergyController::serviceDiscovered, this, &QBluetoothLeUart::handleServiceDiscovered);
|
||||||
connect(this->bluetoothController, &QLowEnergyController::discoveryFinished, this, &QBluetoothLeUart::handleServiceScanDone);
|
connect(this->bluetoothController, &QLowEnergyController::discoveryFinished, this, &QBluetoothLeUart::handleServiceScanDone);
|
||||||
|
@ -177,7 +177,7 @@ void QBluetoothLeUart::handleDeviceDiscovered(const QBluetoothDeviceInfo &device
|
||||||
{
|
{
|
||||||
// Is it a BLE device?
|
// Is it a BLE device?
|
||||||
if (device.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration) {
|
if (device.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration) {
|
||||||
//qWarning() << "Discovered BLE Device: name: " << device.name() << " Address: " << device.address().toString();
|
qWarning() << "Discovered BLE Device: name: " << device.name() << " Address: " << device.address().toString() << " UUIDs: " << device.serviceUuids();
|
||||||
// ignore all devices that to not support our service
|
// ignore all devices that to not support our service
|
||||||
if(!device.serviceUuids().contains(QBluetoothUuid(this->uartServiceUUID)))
|
if(!device.serviceUuids().contains(QBluetoothUuid(this->uartServiceUUID)))
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue