mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
BLE handling: create helper function to add the LE: prefix
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a4d4d1c83b
commit
6837120bb1
2 changed files with 16 additions and 10 deletions
|
@ -105,6 +105,18 @@ extern void addBtUuid(QBluetoothUuid uuid);
|
||||||
extern QHash<QString, QStringList> productList;
|
extern QHash<QString, QStringList> productList;
|
||||||
extern QStringList vendorList;
|
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)
|
void BTDiscovery::btDeviceDiscovered(const QBluetoothDeviceInfo &device)
|
||||||
{
|
{
|
||||||
#if defined(SSRF_CUSTOM_IO)
|
#if defined(SSRF_CUSTOM_IO)
|
||||||
|
|
|
@ -424,18 +424,12 @@ void BtDeviceSelectionDialog::deviceDiscoveryError(QBluetoothDeviceDiscoveryAgen
|
||||||
ui->dialogStatus->setText(tr("Device discovery error: %1.").arg(errorDescription));
|
ui->dialogStatus->setText(tr("Device discovery error: %1.").arg(errorDescription));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern QString markBLEAddress(const QBluetoothDeviceInfo *device);
|
||||||
|
|
||||||
QString BtDeviceSelectionDialog::getSelectedDeviceAddress()
|
QString BtDeviceSelectionDialog::getSelectedDeviceAddress()
|
||||||
{
|
{
|
||||||
if (selectedRemoteDeviceInfo) {
|
if (selectedRemoteDeviceInfo)
|
||||||
QBluetoothDeviceInfo *deviceInfo = selectedRemoteDeviceInfo.data();
|
return markBLEAddress(selectedRemoteDeviceInfo.data());
|
||||||
QBluetoothDeviceInfo::CoreConfigurations flags;
|
|
||||||
QString prefix = "";
|
|
||||||
|
|
||||||
flags = deviceInfo->coreConfigurations();
|
|
||||||
if (flags == QBluetoothDeviceInfo::LowEnergyCoreConfiguration)
|
|
||||||
prefix = "LE:";
|
|
||||||
return prefix + deviceInfo->address().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue