This commit is contained in:
pls.153 2023-06-16 10:00:31 +02:00
parent c77d993496
commit f9e657fa83
5 changed files with 28 additions and 22 deletions

View file

@ -51,7 +51,16 @@ void BLE::scanServices() {
return;
}
if (!currentDevice.isValid()) {
currentDevice = devices.at(0);
if (initialDeviceName.isNull()) {
currentDevice = devices.at(0);
} else {
for (auto device : qAsConst(devices)) {
if (device.name().contains(initialDeviceName, Qt::CaseInsensitive)) {
currentDevice = device;
break;
}
}
}
}
services.clear();
qDebug() << "connecting to device...";