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