Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qbluetoothsocket_dummy.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
6#ifndef QT_IOS_BLUETOOTH
7#include "dummy/dummy_helper_p.h"
8#endif
9
11
12QBluetoothSocketPrivateDummy::QBluetoothSocketPrivateDummy()
13{
14 secFlags = QBluetooth::Security::NoSecurity;
15#ifndef QT_IOS_BLUETOOTH
16 printDummyWarning();
17#endif
18}
19
23
24bool QBluetoothSocketPrivateDummy::ensureNativeSocket(QBluetoothServiceInfo::Protocol type)
25{
26 socketType = type;
27 return false;
28}
29
30void QBluetoothSocketPrivateDummy::connectToServiceHelper(const QBluetoothAddress &address, quint16 port, QIODevice::OpenMode openMode)
31{
32 Q_UNUSED(openMode);
33 Q_UNUSED(address);
34 Q_UNUSED(port);
35}
36
38 const QBluetoothServiceInfo &service, QIODevice::OpenMode openMode)
39{
40 Q_UNUSED(service);
41 Q_UNUSED(openMode);
42
43 Q_Q(QBluetoothSocket);
44
45 qWarning() << "Using non-functional QBluetoothSocketPrivateDummy";
46 errorString = QBluetoothSocket::tr("Socket type not supported");
47 q->setSocketError(QBluetoothSocket::SocketError::UnsupportedProtocolError);
48}
49
51 const QBluetoothAddress &address, const QBluetoothUuid &uuid, QIODevice::OpenMode openMode)
52{
53 Q_UNUSED(address);
54 Q_UNUSED(uuid);
55 Q_UNUSED(openMode);
56
57 Q_Q(QBluetoothSocket);
58
59 qWarning() << "Using non-functional QBluetoothSocketPrivateDummy";
60 errorString = QBluetoothSocket::tr("Socket type not supported");
61 q->setSocketError(QBluetoothSocket::SocketError::UnsupportedProtocolError);
62}
63
65 const QBluetoothAddress &address, quint16 port, QIODevice::OpenMode openMode)
66{
67 Q_UNUSED(address);
68 Q_UNUSED(port);
69 Q_UNUSED(openMode);
70
71 Q_Q(QBluetoothSocket);
72
73 qWarning() << "Using non-functional QBluetoothSocketPrivateDummy";
74 errorString = QBluetoothSocket::tr("Socket type not supported");
75 q->setSocketError(QBluetoothSocket::SocketError::UnsupportedProtocolError);
76}
77
81
83{
84 return QString();
85}
86
88{
89 return QBluetoothAddress();
90}
91
93{
94 return 0;
95}
96
98{
99 return QString();
100}
101
103{
104 return QBluetoothAddress();
105}
106
108{
109 return 0;
110}
111
112qint64 QBluetoothSocketPrivateDummy::writeData(const char *data, qint64 maxSize)
113{
114 Q_UNUSED(data);
115 Q_UNUSED(maxSize);
116
117 Q_Q(QBluetoothSocket);
118
119 if (state != QBluetoothSocket::SocketState::ConnectedState) {
120 errorString = QBluetoothSocket::tr("Cannot write while not connected");
121 q->setSocketError(QBluetoothSocket::SocketError::OperationError);
122 return -1;
123 }
124 return -1;
125}
126
127qint64 QBluetoothSocketPrivateDummy::readData(char *data, qint64 maxSize)
128{
129 Q_UNUSED(data);
130 Q_UNUSED(maxSize);
131
132 Q_Q(QBluetoothSocket);
133
134 if (state != QBluetoothSocket::SocketState::ConnectedState) {
135 errorString = QBluetoothSocket::tr("Cannot read while not connected");
136 q->setSocketError(QBluetoothSocket::SocketError::OperationError);
137 return -1;
138 }
139
140 return -1;
141}
142
146
147bool QBluetoothSocketPrivateDummy::setSocketDescriptor(int socketDescriptor, QBluetoothServiceInfo::Protocol socketType,
148 QBluetoothSocket::SocketState socketState, QBluetoothSocket::OpenMode openMode)
149{
150 Q_UNUSED(socketDescriptor);
151 Q_UNUSED(socketType);
152 Q_UNUSED(socketState);
153 Q_UNUSED(openMode);
154 return false;
155}
156
158{
159 return 0;
160}
161
163{
164 return false;
165}
166
168{
169 return 0;
170}
171
172QT_END_NAMESPACE
QBluetoothAddress localAddress() const override
void connectToService(const QBluetoothServiceInfo &service, QIODevice::OpenMode openMode) override
void connectToServiceHelper(const QBluetoothAddress &address, quint16 port, QIODevice::OpenMode openMode) override
QBluetoothAddress peerAddress() const override
void connectToService(const QBluetoothAddress &address, const QBluetoothUuid &uuid, QIODevice::OpenMode openMode) override
qint64 writeData(const char *data, qint64 maxSize) override
bool setSocketDescriptor(int socketDescriptor, QBluetoothServiceInfo::Protocol socketType, QBluetoothSocket::SocketState socketState=QBluetoothSocket::SocketState::ConnectedState, QBluetoothSocket::OpenMode openMode=QBluetoothSocket::ReadWrite) override
void connectToService(const QBluetoothAddress &address, quint16 port, QIODevice::OpenMode openMode) override
qint64 readData(char *data, qint64 maxSize) override