2017-05-29 15:59:11 +02:00
|
|
|
// qt includes
|
|
|
|
#include <QNetworkAccessManager>
|
|
|
|
#include <QNetworkRequest>
|
|
|
|
#include <QNetworkReply>
|
|
|
|
#include <QUrl>
|
|
|
|
#include <QUrlQuery>
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
|
|
// hyperion includes
|
|
|
|
#include <utils/Logger.h>
|
2017-06-17 23:27:41 +02:00
|
|
|
#include <hyperion/Hyperion.h>
|
2017-05-29 15:59:11 +02:00
|
|
|
|
|
|
|
class Stats : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-06-17 23:27:41 +02:00
|
|
|
Stats();
|
2018-12-28 18:12:45 +01:00
|
|
|
static Stats* getInstance() { return instance; };
|
|
|
|
static Stats* instance;
|
|
|
|
|
|
|
|
void handleDataUpdate(const QJsonObject& config);
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class HyperionDaemon;
|
|
|
|
Stats(const QJsonObject& config);
|
2017-05-29 15:59:11 +02:00
|
|
|
~Stats();
|
|
|
|
|
|
|
|
private:
|
|
|
|
Logger* _log;
|
2017-06-17 23:27:41 +02:00
|
|
|
Hyperion* _hyperion;
|
2017-05-29 15:59:11 +02:00
|
|
|
QString _hash = "";
|
2017-05-29 21:34:47 +02:00
|
|
|
QByteArray _ba;
|
|
|
|
QNetworkRequest _req;
|
2017-05-29 15:59:11 +02:00
|
|
|
QNetworkAccessManager _mgr;
|
|
|
|
|
|
|
|
bool trigger(bool set = false);
|
|
|
|
|
|
|
|
private slots:
|
2017-06-17 23:27:41 +02:00
|
|
|
void initialExec();
|
2017-05-29 21:34:47 +02:00
|
|
|
void sendHTTP();
|
|
|
|
void sendHTTPp();
|
2017-05-29 15:59:11 +02:00
|
|
|
void resolveReply(QNetworkReply *reply);
|
|
|
|
|
|
|
|
};
|