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
13 : QBluetoothSocketBasePrivate{qq}
14{
15 secFlags = QBluetooth::Security::NoSecurity;
16#ifndef QT_IOS_BLUETOOTH
17 printDummyWarning();
18#endif
19}
20
24
25bool QBluetoothSocketPrivateDummy::ensureNativeSocket(QBluetoothServiceInfo::Protocol type)
26{
27 socketType = type;
28 return false;
29}
30
31void QBluetoothSocketPrivateDummy::connectToServiceHelper(const QBluetoothAddress &address, quint16 port, QIODevice::OpenMode openMode)
32{
33 Q_UNUSED(openMode);
34 Q_UNUSED(address);
35 Q_UNUSED(port);
36}
37
39 const QBluetoothServiceInfo &service, QIODevice::OpenMode openMode)
40{
41 Q_UNUSED(service);
42 Q_UNUSED(openMode);
43
44 Q_Q(QBluetoothSocket);
45
46 qWarning() << "Using non-functional QBluetoothSocketPrivateDummy";
47 errorString = QBluetoothSocket::tr("Socket type not supported");
48 q->setSocketError(QBluetoothSocket::SocketError::UnsupportedProtocolError);
49}
50
52 const QBluetoothAddress &address, const QBluetoothUuid &uuid, QIODevice::OpenMode openMode)
53{
54 Q_UNUSED(address);
55 Q_UNUSED(uuid);
56 Q_UNUSED(openMode);
57
58 Q_Q(QBluetoothSocket);
59
60 qWarning() << "Using non-functional QBluetoothSocketPrivateDummy";
61 errorString = QBluetoothSocket::tr("Socket type not supported");
62 q->setSocketError(QBluetoothSocket::SocketError::UnsupportedProtocolError);
63}
64
66 const QBluetoothAddress &address, quint16 port, QIODevice::OpenMode openMode)
67{
68 Q_UNUSED(address);
69 Q_UNUSED(port);
70 Q_UNUSED(openMode);
71
72 Q_Q(QBluetoothSocket);
73
74 qWarning() << "Using non-functional QBluetoothSocketPrivateDummy";
75 errorString = QBluetoothSocket::tr("Socket type not supported");
76 q->setSocketError(QBluetoothSocket::SocketError::UnsupportedProtocolError);
77}
78
82
84{
85 return QString();
86}
87
89{
90 return QBluetoothAddress();
91}
92
94{
95 return 0;
96}
97
99{
100 return QString();
101}
102
104{
105 return QBluetoothAddress();
106}
107
109{
110 return 0;
111}
112
113qint64 QBluetoothSocketPrivateDummy::writeData(const char *data, qint64 maxSize)
114{
115 Q_UNUSED(data);
116 Q_UNUSED(maxSize);
117
118 Q_Q(QBluetoothSocket);
119
120 if (state != QBluetoothSocket::SocketState::ConnectedState) {
121 errorString = QBluetoothSocket::tr("Cannot write while not connected");
122 q->setSocketError(QBluetoothSocket::SocketError::OperationError);
123 return -1;
124 }
125 return -1;
126}
127
128qint64 QBluetoothSocketPrivateDummy::readData(char *data, qint64 maxSize)
129{
130 Q_UNUSED(data);
131 Q_UNUSED(maxSize);
132
133 Q_Q(QBluetoothSocket);
134
135 if (state != QBluetoothSocket::SocketState::ConnectedState) {
136 errorString = QBluetoothSocket::tr("Cannot read while not connected");
137 q->setSocketError(QBluetoothSocket::SocketError::OperationError);
138 return -1;
139 }
140
141 return -1;
142}
143
147
148bool QBluetoothSocketPrivateDummy::setSocketDescriptor(int socketDescriptor, QBluetoothServiceInfo::Protocol socketType,
149 QBluetoothSocket::SocketState socketState, QBluetoothSocket::OpenMode openMode)
150{
151 Q_UNUSED(socketDescriptor);
152 Q_UNUSED(socketType);
153 Q_UNUSED(socketState);
154 Q_UNUSED(openMode);
155 return false;
156}
157
159{
160 return 0;
161}
162
164{
165 return false;
166}
167
169{
170 return 0;
171}
172
173QT_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
\inmodule QtBluetooth
Combined button and popup list for selecting options.