Snorktracker
 All Data Structures Files Functions Variables Macros Pages
Data Structures | Public Member Functions | Data Fields
MyData Class Reference

#include <Data.h>

Data Structures

class  RtcData
 

Public Member Functions

 MyData ()
 
long secondsSincePowerOn ()
 
long getActiveTimeSec ()
 
long getLowPowerActiveTimeSec ()
 
long getPowerOnTimeSec ()
 
long getLowPowerPowerOnTimeSec ()
 
double getPowerConsumption ()
 
double getLowPowerPowerConsumption ()
 

Data Fields

class MyData::RtcData rtcData
 Data to store in the RTC memory.
 
String status
 Status information.
 
String restartInfo
 Information on restart.
 
bool isOtaActive
 Is OverTheAir update active?
 
bool isPowerOn
 Is the power of the sim808 switched on?
 
bool isLowPower
 Is the power below min voltage?
 
bool isGsmActive
 Is the sim808 modul connected to a gsm network?
 
bool isGpsActive
 Is the gs part of the sim808 activated?
 
long secondsToDeepSleep
 Time until next deepsleep. -1 = disabled.
 
long awakeTimeOffsetSec
 Awake time offset for SaveSettings.
 
double voltage
 Current supply voltage.
 
double temperature
 Current BME280 temperature.
 
double humidity
 Current BME280 humidity.
 
double pressure
 Current BME280 pressure.
 
String softAPIP
 registered ip of the access point
 
String softAPmacAddress
 module mac address
 
String stationIP
 registered station ip
 
String modemInfo
 Information from SIM808.
 
String modemIP
 registered modem ip
 
String imei
 IMEI of the sim card.
 
String cop
 Operator selection.
 
String signalQuality
 Quality of the signal.
 
String batteryLevel
 Battery level of the sim808 module.
 
String batteryVolt
 Battery volt of the sim808 module.
 
long lastGpsUpdateSec
 Elapsed Time of last read.
 
bool waitingForGps
 We are trying to get a location.
 
bool isMoving
 Is moving recognized.
 
double movingDistance
 Minimum distance for moving flag.
 
StringList consoleCmds
 open commands to send to the sim808 module
 
StringList logInfos
 received sim808 answers or other logs
 

Detailed Description

Helper class to store all the global determined data in one place.

Definition at line 27 of file Data.h.

Constructor & Destructor Documentation

MyData::MyData ( )

Constructor

Definition at line 167 of file Data.h.

168  : isOtaActive(false)
169  , isPowerOn(false)
170  , isLowPower(false)
171  , isGsmActive(false)
172  , isGpsActive(false)
173  , secondsToDeepSleep(-1)
174  , awakeTimeOffsetSec(0)
175  , voltage(0.0)
176  , temperature(0.0)
177  , humidity(0.0)
178  , pressure(0.0)
179  , isMoving(false)
180  , movingDistance(0.0)
181  , lastGpsUpdateSec(0)
182  , waitingForGps(false)
183 {
184 }
long awakeTimeOffsetSec
Awake time offset for SaveSettings.
Definition: Data.h:72
bool waitingForGps
We are trying to get a location.
Definition: Data.h:92
double temperature
Current BME280 temperature.
Definition: Data.h:75
bool isGpsActive
Is the gs part of the sim808 activated?
Definition: Data.h:69
double pressure
Current BME280 pressure.
Definition: Data.h:77
bool isPowerOn
Is the power of the sim808 switched on?
Definition: Data.h:66
bool isMoving
Is moving recognized.
Definition: Data.h:94
double voltage
Current supply voltage.
Definition: Data.h:74
long secondsToDeepSleep
Time until next deepsleep. -1 = disabled.
Definition: Data.h:71
bool isGsmActive
Is the sim808 modul connected to a gsm network?
Definition: Data.h:68
long lastGpsUpdateSec
Elapsed Time of last read.
Definition: Data.h:91
double humidity
Current BME280 humidity.
Definition: Data.h:76
bool isOtaActive
Is OverTheAir update active?
Definition: Data.h:65
double movingDistance
Minimum distance for moving flag.
Definition: Data.h:95
bool isLowPower
Is the power below min voltage?
Definition: Data.h:67

Member Function Documentation

long MyData::getActiveTimeSec ( )

Return all the active over all deep sleeps plus the current active time.

Definition at line 193 of file Data.h.

References MyData::RtcData::aktiveTimeSec, and rtcData.

Referenced by getPowerConsumption(), MyMqtt::handleClient(), MyWebServer::handleLoadInfoInfo(), MyWebServer::handleLoadMainInfo(), and secondsSincePowerOn().

194 {
195  return rtcData.aktiveTimeSec + millis() / 1000;
196 }
long aktiveTimeSec
Time in active mode without current millis().
Definition: Data.h:37
class MyData::RtcData rtcData
Data to store in the RTC memory.
long MyData::getLowPowerActiveTimeSec ( )

Return all the active over all deep sleeps plus the current active time.

Definition at line 199 of file Data.h.

References isLowPower, MyData::RtcData::lowPowerActiveTimeSec, and rtcData.

Referenced by getLowPowerPowerConsumption().

200 {
201  if (!isLowPower) {
203  } else {
204  return rtcData.lowPowerActiveTimeSec + millis() / 1000;
205  }
206 }
class MyData::RtcData rtcData
Data to store in the RTC memory.
long lowPowerActiveTimeSec
Timestamp of the last deep sleep start.
Definition: Data.h:42
bool isLowPower
Is the power below min voltage?
Definition: Data.h:67
double MyData::getLowPowerPowerConsumption ( )

Calculates the power consumption on low power from power on. In mA/h

Definition at line 241 of file Data.h.

References MyData::RtcData::deepSleepTimeSec, getLowPowerActiveTimeSec(), getLowPowerPowerOnTimeSec(), POWER_CONSUMPTION_ACTIVE, POWER_CONSUMPTION_DEEP_SLEEP, POWER_CONSUMPTION_POWER_ON, and rtcData.

Referenced by MyMqtt::handleClient(), MyWebServer::handleLoadInfoInfo(), and MyWebServer::handleLoadMainInfo().

242 {
246 }
long getLowPowerPowerOnTimeSec()
Definition: Data.h:219
class MyData::RtcData rtcData
Data to store in the RTC memory.
#define POWER_CONSUMPTION_ACTIVE
Power consumption if Active in mA.
Definition: Config.h:42
#define POWER_CONSUMPTION_POWER_ON
Power consumption if SIM808 Active in mA.
Definition: Config.h:43
#define POWER_CONSUMPTION_DEEP_SLEEP
Power consumption if in deep sleep mode in mA.
Definition: Config.h:44
long getLowPowerActiveTimeSec()
Definition: Data.h:199
long deepSleepTimeSec
Time in deep sleep mode.
Definition: Data.h:39
long MyData::getLowPowerPowerOnTimeSec ( )

Return all the time with power on on low power supply.

Definition at line 219 of file Data.h.

References isLowPower, isPowerOn, MyData::RtcData::lowPowerPowerOnTimeSec, and rtcData.

Referenced by getLowPowerPowerConsumption().

220 {
221  if (!isLowPower || !isPowerOn) {
223  } else {
224  return rtcData.lowPowerPowerOnTimeSec + millis() / 1000;
225  }
226 }
long lowPowerPowerOnTimeSec
Timestamp of the last deep sleep start.
Definition: Data.h:43
class MyData::RtcData rtcData
Data to store in the RTC memory.
bool isPowerOn
Is the power of the sim808 switched on?
Definition: Data.h:66
bool isLowPower
Is the power below min voltage?
Definition: Data.h:67
double MyData::getPowerConsumption ( )

Calculates the power consumption from power on. In mA/h

Definition at line 231 of file Data.h.

References MyData::RtcData::deepSleepTimeSec, getActiveTimeSec(), getPowerOnTimeSec(), POWER_CONSUMPTION_ACTIVE, POWER_CONSUMPTION_DEEP_SLEEP, POWER_CONSUMPTION_POWER_ON, and rtcData.

Referenced by MyMqtt::handleClient(), MyWebServer::handleLoadInfoInfo(), and MyWebServer::handleLoadMainInfo().

232 {
236 }
class MyData::RtcData rtcData
Data to store in the RTC memory.
#define POWER_CONSUMPTION_ACTIVE
Power consumption if Active in mA.
Definition: Config.h:42
#define POWER_CONSUMPTION_POWER_ON
Power consumption if SIM808 Active in mA.
Definition: Config.h:43
#define POWER_CONSUMPTION_DEEP_SLEEP
Power consumption if in deep sleep mode in mA.
Definition: Config.h:44
long getPowerOnTimeSec()
Definition: Data.h:209
long deepSleepTimeSec
Time in deep sleep mode.
Definition: Data.h:39
long getActiveTimeSec()
Definition: Data.h:193
long MyData::getPowerOnTimeSec ( )

Returns the power on time over all deep sleeps plus the current active time if power is on.

Definition at line 209 of file Data.h.

References isPowerOn, MyData::RtcData::powerOnTimeSec, and rtcData.

Referenced by getPowerConsumption(), MyWebServer::handleLoadInfoInfo(), and MyWebServer::handleLoadMainInfo().

210 {
211  if (!isPowerOn) {
212  return rtcData.powerOnTimeSec;
213  } else {
214  return rtcData.powerOnTimeSec + millis() / 1000;
215  }
216 }
class MyData::RtcData rtcData
Data to store in the RTC memory.
long powerOnTimeSec
Time the sim808 is on power without current millis..
Definition: Data.h:38
bool isPowerOn
Is the power of the sim808 switched on?
Definition: Data.h:66
long MyData::secondsSincePowerOn ( )

Returns the seconds since power up (not since last deep sleep).

Definition at line 187 of file Data.h.

References MyData::RtcData::deepSleepTimeSec, getActiveTimeSec(), and rtcData.

Referenced by secondsSincePowerOn().

188 {
190 }
class MyData::RtcData rtcData
Data to store in the RTC memory.
long deepSleepTimeSec
Time in deep sleep mode.
Definition: Data.h:39
long getActiveTimeSec()
Definition: Data.h:193

The documentation for this class was generated from the following file: