implemented keep alive

This commit is contained in:
Dorian Zedler 2020-10-15 16:57:07 +02:00
parent dad7187909
commit 45ce9b1cd7
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37

View file

@ -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;