summaryrefslogtreecommitdiffstats
path: root/qt-ui/btdeviceselectiondialog.cpp
diff options
context:
space:
mode:
authorGravatar Claudiu Olteanu <olteanu.claudiu@ymail.com>2015-09-19 19:14:51 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-19 09:43:06 -0700
commit89540e0fb2051b667135e2588e70b8ad49f61cd4 (patch)
tree62fd46584a10dbc3f27937dba38e3ec6c5b01d61 /qt-ui/btdeviceselectiondialog.cpp
parent54f4ed70ce545283b3fbb0b7549d57fef1d84095 (diff)
downloadsubsurface-89540e0fb2051b667135e2588e70b8ad49f61cd4.tar.gz
Fix Bluetooth address truncation issues on Windows
On some Windows platforms when we convert a Bth address to a String it is formatted as "(XX:XX:XX:XX:XX:XX)". Therefore we first try to remove the round parentheses and finally we truncate the string to 17 because there are 6 two-digit hex values and 5 colons. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/btdeviceselectiondialog.cpp')
-rw-r--r--qt-ui/btdeviceselectiondialog.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/qt-ui/btdeviceselectiondialog.cpp b/qt-ui/btdeviceselectiondialog.cpp
index 74afda616..40d57314f 100644
--- a/qt-ui/btdeviceselectiondialog.cpp
+++ b/qt-ui/btdeviceselectiondialog.cpp
@@ -609,14 +609,14 @@ void WinBluetoothDeviceDiscoveryAgent::run()
break;
}
- // Save the name of the discovered device and truncate the address
- QString deviceName = QString(pResults->lpszServiceInstanceName);
- deviceAddress.truncate(addressSize / sizeof(wchar_t));
-
// Remove the round parentheses
deviceAddress.remove(')');
deviceAddress.remove('(');
+ // Save the name of the discovered device and truncate the address
+ QString deviceName = QString(pResults->lpszServiceInstanceName);
+ deviceAddress.truncate(BTH_ADDR_PRETTY_STRING_LEN);
+
// Create an object with information about the discovered device
QBluetoothDeviceInfo deviceInfo = QBluetoothDeviceInfo(QBluetoothAddress(deviceAddress), deviceName, 0);