diff options
author | Juha Vuolle <juha.vuolle@insta.fi> | 2022-02-18 13:28:13 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-02-22 15:35:40 +0000 |
commit | d301b7972e506c31e52415d5d5361ef15846d7cc (patch) | |
tree | 405a38d57ac025c601b56dcfd55926249e5e32d8 | |
parent | 5452d474e29f57461c31be65af6f3d42fc368c4c (diff) | |
download | qtconnectivity-d301b7972e506c31e52415d5d5361ef15846d7cc.tar.gz |
Use the service's socket protocol info on Bluez bluetooth socket
The QBluetoothSocket::connectToService(QBluetoothServiceInfo) should
extract the socket protocol info (rfcomm/l2cap) from the provided
service info.
Fixes: QTBUG-101018
Change-Id: Ibbf4daef28a2661e4699759d6f834779d27ac750
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 29b51e28a961a09fb25d668da5a5e3c9d89390b9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/bluetooth/qbluetoothsocket_bluezdbus.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothsocket_bluezdbus.cpp b/src/bluetooth/qbluetoothsocket_bluezdbus.cpp index 5c24b013..58510036 100644 --- a/src/bluetooth/qbluetoothsocket_bluezdbus.cpp +++ b/src/bluetooth/qbluetoothsocket_bluezdbus.cpp @@ -284,6 +284,10 @@ void QBluetoothSocketPrivateBluezDBus::connectToService( return; } + if (service.socketProtocol() != QBluetoothServiceInfo::Protocol::UnknownProtocol) + socketType = service.socketProtocol(); + qCDebug(QT_BT_BLUEZ) << "Socket protocol used:" << socketType; + connectToService(service.device().address(), targetService, openMode); } diff --git a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp index f0a91d60..2d7db25a 100644 --- a/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp +++ b/tests/auto/qbluetoothsocket/tst_qbluetoothsocket.cpp @@ -143,7 +143,7 @@ void tst_QBluetoothSocket::initTestCase() qDebug() << "Starting discovery"; sda->setUuidFilter(QBluetoothUuid(QString(TEST_SERVICE_UUID))); - sda->start(QBluetoothServiceDiscoveryAgent::MinimalDiscovery); + sda->start(QBluetoothServiceDiscoveryAgent::FullDiscovery); for (int connectTime = MaxConnectTime; !done_discovery && connectTime > 0; connectTime -= 1000) QTest::qWait(1000); |