mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 01:43:23 +00:00
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>
This commit is contained in:
parent
54f4ed70ce
commit
89540e0fb2
2 changed files with 5 additions and 4 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#define SUCCESS 0
|
||||
#define BTH_ADDR_STR_LEN 40
|
||||
#define BTH_ADDR_PRETTY_STRING_LEN 17 // there are 6 two-digit hex values and 5 colons
|
||||
|
||||
#undef ERROR // this is already declared in our headers
|
||||
#undef IGNORE // this is already declared in our headers
|
||||
|
|
Loading…
Add table
Reference in a new issue