-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPvOutput.h
48 lines (38 loc) · 1.23 KB
/
PvOutput.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
#ifndef PVOUTPUT_H
#define PVOUTPUT_H
#include <string>
#include <vector>
#include <ctime>
class EnergyMonitorConfig;
class PvOutput
{
public:
explicit PvOutput(const EnergyMonitorConfig& config);
virtual ~PvOutput() {}
void outputEnergy(time_t startTime, int dayExport, int dayImportPeak, int dayImportOffPeak);
double getGeneratedYesterday();
double getConsumedYesterday();
double getGeneratedMonth();
double getConsumedMonth();
double getGeneratedYear();
double getConsumedYear();
private:
void updateStatisticData();
bool getStatisticData(time_t startDate, time_t endDate, double& generated, double& consumed);
static std::string pvOutputDate(time_t timestamp);
static size_t storeCurlData(char* ptr, size_t size, size_t nmemb, void* userdata);
static std::vector<std::string> splitData(const std::string& data);
private:
std::string myAddOutputUrl;
std::string myStatisticUrl;
std::string myApiKey;
std::string mySystemId;
time_t myCachedDate;
double myYesterdayGenerated;
double myYesterdayConsumed;
double myMonthGenerated;
double myMonthConsumed;
double myYearGenerated;
double myYearConsumed;
};
#endif /* PVOUTPUT_H */