summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2018-08-29 15:22:32 +0200
committerAlex Blasche <alexander.blasche@qt.io>2018-08-30 07:12:59 +0000
commit96ce6cee40889e45691ca50f31a26b5943ee2470 (patch)
treeec38d59d11bdc00a78de686bb95293737ffc0795 /src
parent819bb06c2cb3372cb1bb9ddd7f3a504f78d3452d (diff)
Fix LEController peripheral mode on BlueZ
LEController in peripheral mode uses QBluetoothSocket::setSocketDescriptor(). Since QBluetoothsocket was ported to DBus (enabled when Bluez is 5.46 or later) setSocketDescriptor()/server mode does not work. That's why f602d7fef2e2f067e123e5740d4b0bf16c4ec0e2 made sure that QBluetoothServer uses the old raw socket implementation. Unfortunately QLowEnergyController was forgotten and needs the same workaround. Change-Id: I6ba3654ee199d0ffcf4b69f16dfbc5508d6b13d4 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/qlowenergycontroller_bluez.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp
index f8ebd02c..ea43bbc0 100644
--- a/src/bluetooth/qlowenergycontroller_bluez.cpp
+++ b/src/bluetooth/qlowenergycontroller_bluez.cpp
@@ -41,6 +41,7 @@
#include "lecmaccalculator_p.h"
#include "qlowenergycontroller_bluez_p.h"
#include "qbluetoothsocketbase_p.h"
+#include "qbluetoothsocket_bluez_p.h"
#include "qleadvertiser_p.h"
#include "bluez/bluez_data_p.h"
#include "bluez/hcimanager_p.h"
@@ -3111,7 +3112,10 @@ void QLowEnergyControllerPrivateBluez::handleConnectionRequest()
qCWarning(QT_BT_BLUEZ) << "Received client connection, but no connection complete event";
closeServerSocket();
- l2cpSocket = new QBluetoothSocket(QBluetoothServiceInfo::L2capProtocol, this);
+
+ QBluetoothSocketPrivateBluez *rawSocketPrivate = new QBluetoothSocketPrivateBluez();
+ l2cpSocket = new QBluetoothSocket(
+ rawSocketPrivate, QBluetoothServiceInfo::L2capProtocol, this);
connect(l2cpSocket, &QBluetoothSocket::disconnected,
this, &QLowEnergyControllerPrivateBluez::l2cpDisconnected);
connect(l2cpSocket, static_cast<void (QBluetoothSocket::*)(QBluetoothSocket::SocketError)>