Repository navigation
Expand file tree
/
Copy pathAppData.cpp
More file actions
111 lines (85 loc) · 2.02 KB
/
Copy pathAppData.cpp
File metadata and controls
111 lines (85 loc) · 2.02 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiUdp.h>
#include <AppData.hpp>
AppData appData; // Definição da variável global appData (SEM extern)
void AppData::setFWVersion(const String& fwversion) { // const String&
m_FWVersion = fwversion;
}
void AppData::setLogServerIPInfo(const String& lsIP) { // const String&
m_logServerIP = lsIP;
}
void AppData::setPZEMState(uint8_t state) {
m_PZEMState = state;
}
String AppData::getPZEMState() {
switch (m_PZEMState) {
case PZEM_DISCONNECTED: return String("Not Connected");
case PZEM_CONNECTING: return String("Connecting");
case PZEM_CONNECTED: return String("Connected");
case PZEM_CONNECTFAIL: return String("Connect Failed");
default: return ("State Error");
}
}
void AppData::setVoltage(float Vin) {
m_V = Vin;
}
String AppData::getVoltage() {
return String(m_V);
}
void AppData::setCurrent(float Iin) {
m_I = Iin;
}
String AppData::getCurrent() {
return String(m_I);
}
void AppData::setPower(float Pin) {
m_P = Pin;
}
String AppData::getPower() {
return String(m_P);
}
void AppData::setEnergy(float Ein) {
m_E = Ein;
}
String AppData::getEnergy() {
return String(m_E);
}
void AppData::setSamplesOK() {
m_samplesOK++;
}
void AppData::setSamplesNOK() {
m_samplesNOK++;
}
String AppData::getSamplesOK() {
return String(m_samplesOK);
}
String AppData::getSamplesNOK() {
return String(m_samplesNOK);
}
String AppData::getFWVersion() {
return m_FWVersion;
}
String AppData::getSSID() {
return WiFi.SSID();
}
String AppData::getRSSI() {
return String(WiFi.RSSI());
}
String AppData::getDevIP() {
IPAddress ipdev = WiFi.localIP();
return ipdev.toString();
}
String AppData::getGWIP() {
IPAddress ipgw = WiFi.gatewayIP();
return ipgw.toString();
}
String AppData::getLogServerIPInfo() {
return m_logServerIP;
}
String AppData::getHeap() {
return String(ESP.getFreeHeap());
}
String AppData::getDevMAC() {
return WiFi.macAddress();
}