summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothsocket_winrt.cpp
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2017-02-03 09:38:14 +0100
committerOliver Wolff <oliver.wolff@qt.io>2017-02-03 11:06:26 +0000
commitbcf6ef95b8304c6cf7a1b79337d7d9b151dfe492 (patch)
treeb3c1a31ce77e548131b376de16eb2c0164e8719c /src/bluetooth/qbluetoothsocket_winrt.cpp
parentf07c94c0037a2e9a51b8177edb757063206e00cc (diff)
winrt: Use custom setSocketDescriptor function
We have to use a similar approach to the one that is used on android as the ComPtr cannot reliably passed as an int. Change-Id: Ia52c78d4725fb3240eafa62fcb55531a282c0cd3 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothsocket_winrt.cpp')
-rw-r--r--src/bluetooth/qbluetoothsocket_winrt.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/bluetooth/qbluetoothsocket_winrt.cpp b/src/bluetooth/qbluetoothsocket_winrt.cpp
index fb0587cc..323200cd 100644
--- a/src/bluetooth/qbluetoothsocket_winrt.cpp
+++ b/src/bluetooth/qbluetoothsocket_winrt.cpp
@@ -539,16 +539,22 @@ void QBluetoothSocketPrivate::close()
bool QBluetoothSocketPrivate::setSocketDescriptor(int socketDescriptor, QBluetoothServiceInfo::Protocol socketType,
QBluetoothSocket::SocketState socketState, QBluetoothSocket::OpenMode openMode)
{
+ Q_UNUSED(socketDescriptor);
+ Q_UNUSED(socketType)
+ Q_UNUSED(socketState);
+ Q_UNUSED(openMode);
+ qCWarning(QT_BT_WINRT) << "No socket descriptor support on WinRT.";
+ return false;
+}
+
+bool QBluetoothSocketPrivate::setSocketDescriptor(ComPtr<IStreamSocket> socketPtr, QBluetoothServiceInfo::Protocol socketType,
+ QBluetoothSocket::SocketState socketState, QBluetoothSocket::OpenMode openMode)
+{
Q_Q(QBluetoothSocket);
- if (socketType != QBluetoothServiceInfo::RfcommProtocol)
+ if (socketType != QBluetoothServiceInfo::RfcommProtocol || !socketPtr)
return false;
- m_socketObject = nullptr;
- socket = -1;
-
- m_socketObject = reinterpret_cast<IStreamSocket *>(qintptr(socketDescriptor));
- if (!m_socketObject)
- return false;
+ m_socketObject = socketPtr;
socket = qintptr(m_socketObject.Get());
m_worker->setSocket(m_socketObject);
if (socketState == QBluetoothSocket::ConnectedState)