diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-06-06 17:08:05 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@digia.com> | 2014-06-16 14:17:25 +0200 |
commit | 9f973ffb423b9c6721162ede29e18b7950152a08 (patch) | |
tree | 8b1e01c41625f5631fed4c8762e90b66cb256c26 /src/bluetooth/qbluetoothsocket_bluez.cpp | |
parent | 9ad271c1448e1d08ccfece022fc2a8c571a6fd1f (diff) |
Connect to BTLE device
Change-Id: Iaae61b6a872124d17855d80d106f2b10996501de
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/bluetooth/qbluetoothsocket_bluez.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothsocket_bluez.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/bluetooth/qbluetoothsocket_bluez.cpp b/src/bluetooth/qbluetoothsocket_bluez.cpp index 31a5535c..16977f74 100644 --- a/src/bluetooth/qbluetoothsocket_bluez.cpp +++ b/src/bluetooth/qbluetoothsocket_bluez.cpp @@ -74,7 +74,8 @@ QBluetoothSocketPrivate::QBluetoothSocketPrivate() readNotifier(0), connectWriteNotifier(0), connecting(false), - discoveryAgent(0) + discoveryAgent(0), + isLowEnergySocket(false) { } @@ -161,7 +162,15 @@ void QBluetoothSocketPrivate::connectToService(const QBluetoothAddress &address, memset(&addr, 0, sizeof(addr)); addr.l2_family = AF_BLUETOOTH; - addr.l2_psm = port; + // This is an ugly hack but the socket class does what's needed already. + // For L2CP GATT we need a channel rather than a socket and the LE address type + // We don't want to make this public API offering + if (isLowEnergySocket) { + addr.l2_cid = port; + addr.l2_bdaddr_type = BDADDR_LE_PUBLIC; + } else { + addr.l2_psm = port; + } convertAddress(address.toUInt64(), addr.l2_bdaddr.b); |