2015-05-27 09:08:28 -04:00
|
|
|
#ifndef WSPRNET_H
|
|
|
|
#define WSPRNET_H
|
|
|
|
|
|
|
|
#include <QObject>
|
2015-06-09 10:30:23 -04:00
|
|
|
#include <QString>
|
|
|
|
#include <QList>
|
|
|
|
#include <QHash>
|
|
|
|
#include <QQueue>
|
|
|
|
|
|
|
|
class QNetworkAccessManager;
|
|
|
|
class QTimer;
|
|
|
|
class QNetworkReply;
|
2015-05-27 09:08:28 -04:00
|
|
|
|
|
|
|
class WSPRNet : public QObject
|
|
|
|
{
|
2015-06-09 10:30:23 -04:00
|
|
|
Q_OBJECT;
|
|
|
|
|
2015-05-27 09:08:28 -04:00
|
|
|
public:
|
2015-12-24 06:41:05 -05:00
|
|
|
explicit WSPRNet(QNetworkAccessManager *, QObject *parent = nullptr);
|
2015-06-09 10:30:23 -04:00
|
|
|
void upload(QString const& call, QString const& grid, QString const& rfreq, QString const& tfreq,
|
|
|
|
QString const& mode, QString const& tpct, QString const& dbm, QString const& version,
|
|
|
|
QString const& fileName);
|
|
|
|
static bool decodeLine(QString const& line, QHash<QString,QString> &query);
|
2015-05-27 09:08:28 -04:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void uploadStatus(QString);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void networkReply(QNetworkReply *);
|
|
|
|
void work();
|
2015-06-09 10:30:23 -04:00
|
|
|
void abortOutstandingRequests ();
|
2015-05-27 09:08:28 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
QNetworkAccessManager *networkManager;
|
2015-06-09 10:30:23 -04:00
|
|
|
QList<QNetworkReply *> m_outstandingRequests;
|
2015-05-27 09:08:28 -04:00
|
|
|
QString m_call, m_grid, m_rfreq, m_tfreq, m_mode, m_tpct, m_dbm, m_vers, m_file;
|
|
|
|
QQueue<QString> urlQueue;
|
|
|
|
QTimer *uploadTimer;
|
|
|
|
int m_urlQueueSize;
|
|
|
|
int m_uploadType;
|
|
|
|
|
|
|
|
QString urlEncodeNoSpot();
|
2015-06-09 10:30:23 -04:00
|
|
|
QString urlEncodeSpot(QHash<QString,QString> const& spot);
|
2015-05-27 09:08:28 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // WSPRNET_H
|