1 | #ifndef BNCSOCKET_H
|
---|
2 | #define BNCSOCKET_H
|
---|
3 |
|
---|
4 | #include <QtNetwork>
|
---|
5 | #include "bncconst.h"
|
---|
6 |
|
---|
7 | class bncSocket : public QThread {
|
---|
8 | Q_OBJECT
|
---|
9 |
|
---|
10 | public:
|
---|
11 | bncSocket();
|
---|
12 | ~bncSocket();
|
---|
13 |
|
---|
14 | void close();
|
---|
15 | qint64 bytesAvailable() const;
|
---|
16 | bool canReadLine() const;
|
---|
17 | QByteArray readLine(qint64 maxlen = 0);
|
---|
18 | bool waitForReadyRead(int msecs = 30000);
|
---|
19 | qint64 read(char *data, qint64 maxlen);
|
---|
20 | qint64 write(const char *data, qint64 len);
|
---|
21 | bool waitForBytesWritten(int msecs = 30000);
|
---|
22 | void connectToHost(const QString &hostName, quint16 port,
|
---|
23 | QIODevice::OpenMode mode = QIODevice::ReadWrite);
|
---|
24 | bool waitForConnected(int msecs = 30000);
|
---|
25 | QAbstractSocket::SocketState state() const;
|
---|
26 |
|
---|
27 | t_irc request(const QUrl& mountPoint, const QByteArray& latitude,
|
---|
28 | const QByteArray& longitude, const QByteArray& nmea,
|
---|
29 | const QByteArray& ntripVersion, int timeOut, QString& msg);
|
---|
30 |
|
---|
31 | signals:
|
---|
32 | void newMessage(QByteArray msg, bool showOnScreen);
|
---|
33 |
|
---|
34 | private slots:
|
---|
35 | void slotDone(bool);
|
---|
36 | void slotRequestFinished(int, bool);
|
---|
37 | void slotReadyRead();
|
---|
38 | void slotSslErrors(const QList<QSslError>&);
|
---|
39 |
|
---|
40 | private:
|
---|
41 | t_irc request2(const QUrl& url, const QByteArray& latitude,
|
---|
42 | const QByteArray& longitude, const QByteArray& nmea,
|
---|
43 | int timeOut, QString& msg);
|
---|
44 |
|
---|
45 | QTcpSocket* _socket;
|
---|
46 | QHttp* _http;
|
---|
47 | QBuffer* _buffer;
|
---|
48 | };
|
---|
49 |
|
---|
50 | #endif
|
---|