Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
4
#
include
"qbluetoothsocket.h"
5
#
include
"qbluetoothsocket_dummy_p.h"
6
#
ifndef
QT_IOS_BLUETOOTH
7
#
include
"dummy/dummy_helper_p.h"
8
#
endif
9
10
QT_BEGIN_NAMESPACE
11
12
QBluetoothSocketPrivateDummy
::
QBluetoothSocketPrivateDummy
(
QBluetoothSocket
*
qq
)
13
: QBluetoothSocketBasePrivate{qq}
14
{
15
secFlags = QBluetooth::Security::NoSecurity;
16
#
ifndef
QT_IOS_BLUETOOTH
17
printDummyWarning();
18
#
endif
19
}
20
21
QBluetoothSocketPrivateDummy
::~
QBluetoothSocketPrivateDummy
()
22
{
23
}
24
25
bool
QBluetoothSocketPrivateDummy
::ensureNativeSocket(QBluetoothServiceInfo::Protocol type)
26
{
27
socketType = type;
28
return
false
;
29
}
30
31
void
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
38
void
QBluetoothSocketPrivateDummy
::
connectToService
(
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
51
void
QBluetoothSocketPrivateDummy
::
connectToService
(
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
65
void
QBluetoothSocketPrivateDummy
::
connectToService
(
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
79
void
QBluetoothSocketPrivateDummy
::
abort
()
80
{
81
}
82
83
QString
QBluetoothSocketPrivateDummy
::
localName
()
const
84
{
85
return
QString();
86
}
87
88
QBluetoothAddress
QBluetoothSocketPrivateDummy
::
localAddress
()
const
89
{
90
return
QBluetoothAddress();
91
}
92
93
quint16
QBluetoothSocketPrivateDummy
::
localPort
()
const
94
{
95
return
0;
96
}
97
98
QString
QBluetoothSocketPrivateDummy
::
peerName
()
const
99
{
100
return
QString();
101
}
102
103
QBluetoothAddress
QBluetoothSocketPrivateDummy
::
peerAddress
()
const
104
{
105
return
QBluetoothAddress();
106
}
107
108
quint16
QBluetoothSocketPrivateDummy
::
peerPort
()
const
109
{
110
return
0;
111
}
112
113
qint64
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
128
qint64
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
144
void
QBluetoothSocketPrivateDummy
::
close
()
145
{
146
}
147
148
bool
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
158
qint64
QBluetoothSocketPrivateDummy
::
bytesAvailable
()
const
159
{
160
return
0;
161
}
162
163
bool
QBluetoothSocketPrivateDummy
::
canReadLine
()
const
164
{
165
return
false
;
166
}
167
168
qint64
QBluetoothSocketPrivateDummy
::
bytesToWrite
()
const
169
{
170
return
0;
171
}
172
173
QT_END_NAMESPACE
QBluetoothSocketPrivateDummy::peerName
QString peerName() const override
Definition
qbluetoothsocket_dummy.cpp:98
QBluetoothSocketPrivateDummy::~QBluetoothSocketPrivateDummy
~QBluetoothSocketPrivateDummy() override
Definition
qbluetoothsocket_dummy.cpp:21
QBluetoothSocketPrivateDummy::localAddress
QBluetoothAddress localAddress() const override
Definition
qbluetoothsocket_dummy.cpp:88
QBluetoothSocketPrivateDummy::close
void close() override
Definition
qbluetoothsocket_dummy.cpp:144
QBluetoothSocketPrivateDummy::abort
void abort() override
Definition
qbluetoothsocket_dummy.cpp:79
QBluetoothSocketPrivateDummy::connectToService
void connectToService(const QBluetoothServiceInfo &service, QIODevice::OpenMode openMode) override
Definition
qbluetoothsocket_dummy.cpp:38
QBluetoothSocketPrivateDummy::connectToServiceHelper
void connectToServiceHelper(const QBluetoothAddress &address, quint16 port, QIODevice::OpenMode openMode) override
Definition
qbluetoothsocket_dummy.cpp:31
QBluetoothSocketPrivateDummy::canReadLine
bool canReadLine() const override
Definition
qbluetoothsocket_dummy.cpp:163
QBluetoothSocketPrivateDummy::bytesAvailable
qint64 bytesAvailable() const override
Definition
qbluetoothsocket_dummy.cpp:158
QBluetoothSocketPrivateDummy::QBluetoothServerPrivate
friend class QBluetoothServerPrivate
Definition
qbluetoothsocket_dummy_p.h:27
QBluetoothSocketPrivateDummy::peerAddress
QBluetoothAddress peerAddress() const override
Definition
qbluetoothsocket_dummy.cpp:103
QBluetoothSocketPrivateDummy::connectToService
void connectToService(const QBluetoothAddress &address, const QBluetoothUuid &uuid, QIODevice::OpenMode openMode) override
Definition
qbluetoothsocket_dummy.cpp:51
QBluetoothSocketPrivateDummy::writeData
qint64 writeData(const char *data, qint64 maxSize) override
Definition
qbluetoothsocket_dummy.cpp:113
QBluetoothSocketPrivateDummy::peerPort
quint16 peerPort() const override
Definition
qbluetoothsocket_dummy.cpp:108
QBluetoothSocketPrivateDummy::setSocketDescriptor
bool setSocketDescriptor(int socketDescriptor, QBluetoothServiceInfo::Protocol socketType, QBluetoothSocket::SocketState socketState=QBluetoothSocket::SocketState::ConnectedState, QBluetoothSocket::OpenMode openMode=QBluetoothSocket::ReadWrite) override
Definition
qbluetoothsocket_dummy.cpp:148
QBluetoothSocketPrivateDummy::localPort
quint16 localPort() const override
Definition
qbluetoothsocket_dummy.cpp:93
QBluetoothSocketPrivateDummy::connectToService
void connectToService(const QBluetoothAddress &address, quint16 port, QIODevice::OpenMode openMode) override
Definition
qbluetoothsocket_dummy.cpp:65
QBluetoothSocketPrivateDummy::readData
qint64 readData(char *data, qint64 maxSize) override
Definition
qbluetoothsocket_dummy.cpp:128
QBluetoothSocketPrivateDummy::localName
QString localName() const override
Definition
qbluetoothsocket_dummy.cpp:83
QBluetoothSocketPrivateDummy::bytesToWrite
qint64 bytesToWrite() const override
Definition
qbluetoothsocket_dummy.cpp:168
QBluetoothSocket
\inmodule QtBluetooth
Definition
qbluetoothsocket.h:22
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtconnectivity
src
bluetooth
qbluetoothsocket_dummy.cpp
Generated on
for Qt by
1.18.0