diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-06-26 18:17:06 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-06-26 22:20:01 -0700 |
commit | d0c3ef4cf88149ccc337b1e7c05625957216d4e1 (patch) | |
tree | f4c425556b66fff37f42b036695ec847b4d87254 /desktop-widgets/btdeviceselectiondialog.cpp | |
parent | bbde0a1741fe981a8dfe991e6fa3a740ba9b28ac (diff) | |
download | subsurface-d0c3ef4cf88149ccc337b1e7c05625957216d4e1.tar.gz |
Bluetooth: make LE-only devices add "LE:" as an address prefix
This seems a bit odd, but it actually has three different reasons for it:
- It's a visual indication of BT LE mode for users
- the rfcomm code only works with legacy BT support, and if we scan a
device that only does LE, we want the custom serial code to instead
automatically fall back on a "emulate serial over LE packets" model.
- we want rfcomm to remain the default for devices that do both legacy
BT _and_ LE, but we want people to have the ability to override the
choice manually. They can now do so by just editing the address
field and adding the "LE:" prefix manually, and it automatically gets
saved for next time.
So while a bit hacky, it's actually a very convenient model that not
only works automatically, but allows the manual override.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/btdeviceselectiondialog.cpp')
-rw-r--r-- | desktop-widgets/btdeviceselectiondialog.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/desktop-widgets/btdeviceselectiondialog.cpp b/desktop-widgets/btdeviceselectiondialog.cpp index 9a5e9ddab..2fa6b7679 100644 --- a/desktop-widgets/btdeviceselectiondialog.cpp +++ b/desktop-widgets/btdeviceselectiondialog.cpp @@ -420,7 +420,14 @@ void BtDeviceSelectionDialog::deviceDiscoveryError(QBluetoothDeviceDiscoveryAgen QString BtDeviceSelectionDialog::getSelectedDeviceAddress() { if (selectedRemoteDeviceInfo) { - return selectedRemoteDeviceInfo.data()->address().toString(); + QBluetoothDeviceInfo *deviceInfo = selectedRemoteDeviceInfo.data(); + QBluetoothDeviceInfo::CoreConfigurations flags; + QString prefix = ""; + + flags = deviceInfo->coreConfigurations(); + if (flags == QBluetoothDeviceInfo::LowEnergyCoreConfiguration) + prefix = "LE:"; + return prefix + deviceInfo->address().toString(); } return QString(); |