Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /**************************************************************************** |
---|---|
2 | ** |
3 | ** Copyright (C) 2017-2016 Ford Motor Company |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtRemoteObjects module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #ifndef QQNXNATIVEIO_H |
41 | #define QQNXNATIVEIO_H |
42 | |
43 | #include <QtNetwork/qabstractsocket.h> |
44 | #include <QtRemoteObjects/qtremoteobjectglobal.h> |
45 | |
46 | QT_BEGIN_NAMESPACE |
47 | |
48 | /* |
49 | * The implementation of the Source and Replica |
50 | * side QIODevice look like they will be fairly |
51 | * different, including different APIs. So |
52 | * creating a 2nd derived type for the source. |
53 | * |
54 | * TODO: revisit if these can be combined into a |
55 | * single type. |
56 | * |
57 | * With two types, QQnxNativeIo will need to get |
58 | * Source or Replica added. Not sure what intuitive |
59 | * names are yet. So for now, QQnxNativeIo is the |
60 | * Replica side, QIOQnxSourcePrivate is the Source |
61 | * side. Revisit the name as this matures. |
62 | * |
63 | */ |
64 | class QQnxNativeIoPrivate; |
65 | class QIOQnxSourcePrivate; |
66 | |
67 | class Q_REMOTEOBJECTS_EXPORT QQnxNativeIo : public QIODevice |
68 | { |
69 | Q_OBJECT |
70 | Q_DECLARE_PRIVATE(QQnxNativeIo) |
71 | |
72 | public: |
73 | explicit QQnxNativeIo(QObject *parent = nullptr); |
74 | ~QQnxNativeIo() override; |
75 | |
76 | bool connectToServer(OpenMode openMode = ReadWrite); |
77 | bool connectToServer(const QString &name, OpenMode openMode = ReadWrite); |
78 | void disconnectFromServer(); |
79 | |
80 | void setServerName(const QString &name); |
81 | QString serverName() const; |
82 | |
83 | void abort(); |
84 | bool isSequential() const override; |
85 | qint64 bytesAvailable() const override; |
86 | qint64 bytesToWrite() const override; |
87 | bool open(OpenMode openMode = ReadWrite) override; |
88 | void close() override; |
89 | QAbstractSocket::SocketError error() const; |
90 | bool flush(); |
91 | bool isValid() const; |
92 | |
93 | QAbstractSocket::SocketState state() const; |
94 | bool waitForBytesWritten(int msecs = 30000) override; |
95 | bool waitForConnected(int msecs = 30000); |
96 | bool waitForDisconnected(int msecs = 30000); |
97 | bool waitForReadyRead(int msecs = 30000) override; |
98 | |
99 | Q_SIGNALS: |
100 | void connected(); |
101 | void disconnected(); |
102 | void error(QAbstractSocket::SocketError socketError); |
103 | void stateChanged(QAbstractSocket::SocketState socketState); |
104 | |
105 | protected: |
106 | qint64 readData(char*, qint64) override; |
107 | qint64 writeData(const char*, qint64) override; |
108 | |
109 | private: |
110 | Q_DISABLE_COPY(QQnxNativeIo) |
111 | }; |
112 | Q_DECLARE_TYPEINFO(QQnxNativeIo, Q_MOVABLE_TYPE); |
113 | |
114 | class Q_REMOTEOBJECTS_EXPORT QIOQnxSource : public QIODevice |
115 | { |
116 | Q_OBJECT |
117 | Q_DECLARE_PRIVATE(QIOQnxSource) |
118 | |
119 | public: |
120 | explicit QIOQnxSource(int rcvid, QObject *parent = nullptr); |
121 | ~QIOQnxSource() override; |
122 | |
123 | bool isSequential() const override; |
124 | qint64 bytesAvailable() const override; |
125 | qint64 bytesToWrite() const override; |
126 | void close() override; |
127 | QAbstractSocket::SocketError error() const; |
128 | bool isValid() const; |
129 | |
130 | QAbstractSocket::SocketState state() const; |
131 | bool waitForBytesWritten(int msecs = 30000) override; |
132 | bool waitForConnected(int msecs = 30000); |
133 | bool waitForDisconnected(int msecs = 30000); |
134 | bool waitForReadyRead(int msecs = 30000) override; |
135 | |
136 | Q_SIGNALS: |
137 | void disconnected(); |
138 | void error(QAbstractSocket::SocketError socketError); |
139 | void stateChanged(QAbstractSocket::SocketState socketState); |
140 | |
141 | protected: |
142 | qint64 readData(char*, qint64) override; |
143 | qint64 writeData(const char*, qint64) override; |
144 | bool open(OpenMode openMode) override; |
145 | |
146 | private Q_SLOTS: |
147 | void onDisconnected(); |
148 | |
149 | private: |
150 | Q_DISABLE_COPY(QIOQnxSource) |
151 | friend class QQnxNativeServerPrivate; |
152 | friend class QnxServerIo; |
153 | }; |
154 | Q_DECLARE_TYPEINFO(QIOQnxSource, Q_MOVABLE_TYPE); |
155 | |
156 | QT_END_NAMESPACE |
157 | |
158 | #endif // QQNXNATIVEIO_H |
159 |
Warning: That file was not part of the compilation database. It may have many parsing errors.