summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLubomir I. Ivanov (VMware) <neolit123@gmail.com>2018-02-27 21:23:05 +0200
committerLubomir I. Ivanov <neolit123@gmail.com>2018-02-28 13:36:16 +0000
commitec54c731ad96df1b024fa4467a1f000672e5b7a6 (patch)
tree79c94a098df3dff4a799796c038f581ea3145e9a /src
parent6b3cfe2f836556c2d92b6c7915232fa00fd040f6 (diff)
qlecontroller_win: use lastIndexOf() in getDeviceAddress()
getDeviceAddress() does not work for all path cases, thus instead of using: firstbound = servicePath.indexOf(...) use: firstbound = servicePath.lastIndexOf(...) Example path that breaks the current code: "\\\\?\\bthledevice#{00001800-0000-1000-8000-00805f9b34fb}_dev_vid&01008f_pid&b00d_rev&0100_00802534ce0e#8&5481851&5&0001#{00001800-0000-1000-8000-00805f9b34fb}" The current code works with paths of this format: "\\\\?\\BTHLEDevice#{00001800-0000-1000-8000-00805f9b34fb}_7c669d8a6d7a#8&35290589&1&0001#{00001800-0000-1000-8000-00805f9b34fb}" Notice that there are more than one "_" in the path that breaks. Change-Id: I5f081b78d8f5bc5693ba05c8e73d4dcf0b42b6b2 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/qlowenergycontroller_win.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bluetooth/qlowenergycontroller_win.cpp b/src/bluetooth/qlowenergycontroller_win.cpp
index 56382e69..f7a1611f 100644
--- a/src/bluetooth/qlowenergycontroller_win.cpp
+++ b/src/bluetooth/qlowenergycontroller_win.cpp
@@ -96,7 +96,7 @@ static bool gattFunctionsResolved = false;
static QBluetoothAddress getDeviceAddress(const QString &servicePath)
{
- const int firstbound = servicePath.indexOf(QStringLiteral("_"));
+ const int firstbound = servicePath.lastIndexOf(QStringLiteral("_"));
const int lastbound = servicePath.indexOf(QLatin1Char('#'), firstbound);
const QString hex = servicePath.mid(firstbound + 1, lastbound - firstbound - 1);
bool ok = false;