diff options
-rw-r--r-- | core/btdiscovery.cpp | 12 | ||||
-rw-r--r-- | desktop-widgets/btdeviceselectiondialog.cpp | 14 |
2 files changed, 16 insertions, 10 deletions
diff --git a/core/btdiscovery.cpp b/core/btdiscovery.cpp index 6a66ab6a4..2b7ef4ce6 100644 --- a/core/btdiscovery.cpp +++ b/core/btdiscovery.cpp @@ -105,6 +105,18 @@ extern void addBtUuid(QBluetoothUuid uuid); extern QHash<QString, QStringList> productList; extern QStringList vendorList; +QString markBLEAddress(const QBluetoothDeviceInfo *device) +{ + QBluetoothDeviceInfo::CoreConfigurations flags; + QString prefix = ""; + + flags = device->coreConfigurations(); + if (flags == QBluetoothDeviceInfo::LowEnergyCoreConfiguration) + prefix = "LE:"; + + return prefix + device->address().toString(); +} + void BTDiscovery::btDeviceDiscovered(const QBluetoothDeviceInfo &device) { #if defined(SSRF_CUSTOM_IO) diff --git a/desktop-widgets/btdeviceselectiondialog.cpp b/desktop-widgets/btdeviceselectiondialog.cpp index 6502978c4..049246703 100644 --- a/desktop-widgets/btdeviceselectiondialog.cpp +++ b/desktop-widgets/btdeviceselectiondialog.cpp @@ -424,18 +424,12 @@ void BtDeviceSelectionDialog::deviceDiscoveryError(QBluetoothDeviceDiscoveryAgen ui->dialogStatus->setText(tr("Device discovery error: %1.").arg(errorDescription)); } +extern QString markBLEAddress(const QBluetoothDeviceInfo *device); + QString BtDeviceSelectionDialog::getSelectedDeviceAddress() { - if (selectedRemoteDeviceInfo) { - QBluetoothDeviceInfo *deviceInfo = selectedRemoteDeviceInfo.data(); - QBluetoothDeviceInfo::CoreConfigurations flags; - QString prefix = ""; - - flags = deviceInfo->coreConfigurations(); - if (flags == QBluetoothDeviceInfo::LowEnergyCoreConfiguration) - prefix = "LE:"; - return prefix + deviceInfo->address().toString(); - } + if (selectedRemoteDeviceInfo) + return markBLEAddress(selectedRemoteDeviceInfo.data()); return QString(); } |