forked from orkblutt/MinerLamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnanopoolapi.h
83 lines (60 loc) · 1.52 KB
/
nanopoolapi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef NANOPOOLAPI_H
#define NANOPOOLAPI_H
#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QJsonDocument>
#include <QJsonObject>
class workerObject : public QObject
{
Q_OBJECT
public:
workerObject();
void setName(QString& name);
void setAvrgHR(double& hashrate);
void setShareNumber(unsigned int share);
const QString& getName();
const double& getAvrgHR();
const unsigned int& getShareNumber();
private:
QString _workerName;
double _averageHashRate;
unsigned int _shareNumber;
};
class userAccount : public QObject
{
Q_OBJECT
public:
userAccount(QString account, QObject* parent);
protected:
QString _accountAddress;
double _currentCalcultatedHashRate;
double _reportedHashRate;
double _averageHashRate6H;
double _averageHashRate12H;
double _averageHashRate24H;
double _userBalance;
double _totalPayment;
QList<workerObject*> _wokerList;
};
class nanopoolAPI : public userAccount
{
Q_OBJECT
public:
nanopoolAPI(QString account, QObject* parent);
void getUserInfo();
void getBalance();
void getHashrate();
void setAccount(QString& account);
private:
QNetworkAccessManager* _networkManager;
QNetworkReply* _userinfoReply;
QNetworkReply* _balanceReply;
QNetworkReply* _hashrateReply;
public slots:
void replyFinished(QNetworkReply* reply);
signals:
void emitBalance(double balance);
};
#endif // NANOPOOLAPI_H