diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2019-05-09 15:17:32 +0200 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@qt.io> | 2019-05-27 15:45:37 +0200 |
commit | 672ebe7690455c6ee13f96ad05d030183a7e57f8 (patch) | |
tree | 8cb691389fde4a9225aa0f095fa7acc9d8e870f7 /src/bluetooth/qbluetoothsocket_winrt_p.h | |
parent | ea85065cbbc2c51482039384f82ab9bbf32104b1 (diff) |
qbluetoothsocket_winrt: Use recommended service connection approach if possible
MSDN documentation states that the recommended way of RFCOMM service
connection is via connectionHostName and connectionServiceName (see
https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.rfcomm.rfcommdeviceservice).
So whenever possible, we should use this information from the native
device service when connecting directly to the discovered service.
As QBluetoothServiceInfo is basically just a wrapper for the attributes
map this information is stored in its private pendant and extracted when
a connection attempt is being made.
Task-number: QTBUG-62520
Change-Id: I95be5df89a722531393b45fd136d37f302393ca8
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothsocket_winrt_p.h')
-rw-r--r-- | src/bluetooth/qbluetoothsocket_winrt_p.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/bluetooth/qbluetoothsocket_winrt_p.h b/src/bluetooth/qbluetoothsocket_winrt_p.h index 40e87f01..de8b7d67 100644 --- a/src/bluetooth/qbluetoothsocket_winrt_p.h +++ b/src/bluetooth/qbluetoothsocket_winrt_p.h @@ -57,6 +57,19 @@ QT_FORWARD_DECLARE_CLASS(SocketWorker) +namespace ABI { + namespace Windows { + namespace Networking { + struct IHostName; + } + } +} + +namespace Microsoft { + namespace WRL { + template <typename T> class ComPtr; + } +} QT_BEGIN_NAMESPACE class QBluetoothSocketPrivateWinRT final: public QBluetoothSocketBasePrivate @@ -125,6 +138,8 @@ private slots: void handleError(QBluetoothSocket::SocketError error); private: + void connectToService(Microsoft::WRL::ComPtr<ABI::Windows::Networking::IHostName> hostName, + const QString &serviceName, QIODevice::OpenMode openMode); HRESULT handleConnectOpFinished(ABI::Windows::Foundation::IAsyncAction *action, ABI::Windows::Foundation::AsyncStatus status); |