Rev | Line | |
---|
[1372] | 1 | #ifndef BNCNETQUERY_H
|
---|
| 2 | #define BNCNETQUERY_H
|
---|
| 3 |
|
---|
| 4 | #include <QtNetwork>
|
---|
| 5 | #include "bncconst.h"
|
---|
[5070] | 6 | #include "bnccore.h"
|
---|
[1372] | 7 |
|
---|
| 8 | class bncNetQuery : public QObject {
|
---|
| 9 | Q_OBJECT
|
---|
| 10 |
|
---|
| 11 | public:
|
---|
[1816] | 12 | enum queryStatus {init, running, finished, error};
|
---|
[1374] | 13 |
|
---|
[1383] | 14 | bncNetQuery() {
|
---|
[5066] | 15 | connect(this, SIGNAL(newMessage(QByteArray,bool)),
|
---|
[5068] | 16 | BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
|
---|
[1383] | 17 | }
|
---|
[1711] | 18 | virtual ~bncNetQuery() {}
|
---|
[1390] | 19 |
|
---|
| 20 | virtual void stop() = 0;
|
---|
[1379] | 21 | virtual void waitForRequestResult(const QUrl& url, QByteArray& outData) = 0;
|
---|
[1380] | 22 | virtual void startRequest(const QUrl& url, const QByteArray& gga) = 0;
|
---|
[1379] | 23 | virtual void waitForReadyRead(QByteArray& outData) = 0;
|
---|
[1716] | 24 |
|
---|
| 25 | void sendNMEA(const QByteArray& gga) {
|
---|
| 26 | stop();
|
---|
| 27 | startRequest(_url, gga);
|
---|
| 28 | }
|
---|
[1374] | 29 |
|
---|
| 30 | queryStatus status() const {return _status;}
|
---|
| 31 |
|
---|
[1372] | 32 | signals:
|
---|
| 33 | void newMessage(QByteArray msg, bool showOnScreen);
|
---|
| 34 |
|
---|
| 35 | private slots:
|
---|
| 36 |
|
---|
[1379] | 37 | protected:
|
---|
[1499] | 38 | queryStatus _status;
|
---|
| 39 | int _timeOut;
|
---|
[1500] | 40 | QUrl _url;
|
---|
[1372] | 41 | };
|
---|
| 42 |
|
---|
| 43 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.