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

#include <Data.h>

Public Member Functions

bool isValid ()
 
void setCRC ()
 
long getCRC ()
 

Data Fields

MyGps lastGps
 Last known gps location without timeout.
 
long aktiveTimeSec
 Time in active mode without current millis().
 
long powerOnTimeSec
 Time the sim808 is on power without current millis..
 
long deepSleepTimeSec
 Time in deep sleep mode.
 
long deepSleepStartSec
 Timestamp of the last deep sleep start.
 
long lowPowerActiveTimeSec
 Timestamp of the last deep sleep start.
 
long lowPowerPowerOnTimeSec
 Timestamp of the last deep sleep start.
 
long lastBme280ReadSec
 Timestamp of the last BME280 read.
 
long lastSmsCheckSec
 Timestamp of the last sms check.
 
long lastGpsReadSec
 Timestamp of the last gps read.
 
long lastMqttPublishSec
 Timestamp from the last send.
 
long mqttSendCount
 How many time the mqtt data successfully sent.
 
long mqttLastSentTime
 Last mqtt sent timestamp.
 
long crcValue
 CRC of the RtcData.
 

Detailed Description

Data to store in the RTC memory

Definition at line 33 of file Data.h.

Member Function Documentation

long MyData::RtcData::getCRC ( )

Creates a CRC of all the member variables.

Definition at line 145 of file Data.h.

References crc32().

Referenced by isValid().

146 {
147  long crc = 0;
148 
149  crc = crc32(crc, (unsigned char *) &lastGps, sizeof(MyGps));
150  crc = crc32(crc, (unsigned char *) &aktiveTimeSec, sizeof(long));
151  crc = crc32(crc, (unsigned char *) &powerOnTimeSec, sizeof(long));
152  crc = crc32(crc, (unsigned char *) &deepSleepTimeSec, sizeof(long));
153  crc = crc32(crc, (unsigned char *) &deepSleepStartSec, sizeof(long));
154  crc = crc32(crc, (unsigned char *) &lowPowerActiveTimeSec, sizeof(long));
155  crc = crc32(crc, (unsigned char *) &lowPowerPowerOnTimeSec, sizeof(long));
156  crc = crc32(crc, (unsigned char *) &lastBme280ReadSec, sizeof(long));
157  crc = crc32(crc, (unsigned char *) &lastSmsCheckSec, sizeof(long));
158  crc = crc32(crc, (unsigned char *) &lastGpsReadSec, sizeof(long));
159  crc = crc32(crc, (unsigned char *) &lastMqttPublishSec, sizeof(long));
160  crc = crc32(crc, (unsigned char *) &mqttSendCount, sizeof(long));
161  crc = crc32(crc, (unsigned char *) &mqttLastSentTime, sizeof(long));
162 
163  return crc;
164 }
long aktiveTimeSec
Time in active mode without current millis().
Definition: Data.h:37
long lowPowerPowerOnTimeSec
Timestamp of the last deep sleep start.
Definition: Data.h:43
long crc32(long crc, unsigned char *buf, size_t len)
Definition: Utils.h:77
long powerOnTimeSec
Time the sim808 is on power without current millis..
Definition: Data.h:38
long mqttLastSentTime
Last mqtt sent timestamp.
Definition: Data.h:51
MyGps lastGps
Last known gps location without timeout.
Definition: Data.h:35
long lowPowerActiveTimeSec
Timestamp of the last deep sleep start.
Definition: Data.h:42
long mqttSendCount
How many time the mqtt data successfully sent.
Definition: Data.h:50
long lastMqttPublishSec
Timestamp from the last send.
Definition: Data.h:48
long deepSleepTimeSec
Time in deep sleep mode.
Definition: Data.h:39
long deepSleepStartSec
Timestamp of the last deep sleep start.
Definition: Data.h:40
long lastBme280ReadSec
Timestamp of the last BME280 read.
Definition: Data.h:45
long lastSmsCheckSec
Timestamp of the last sms check.
Definition: Data.h:46
long lastGpsReadSec
Timestamp of the last gps read.
Definition: Data.h:47
Definition: Gps.h:129
bool MyData::RtcData::isValid ( )

Does the CRC fit s the content

Definition at line 133 of file Data.h.

References crcValue, and getCRC().

Referenced by MyDeepSleep::begin().

134 {
135  return getCRC() == crcValue;
136 }
long crcValue
CRC of the RtcData.
Definition: Data.h:53
long getCRC()
Definition: Data.h:145
void MyData::RtcData::setCRC ( )

Creates the CRC of all the data and save it in the class.

Definition at line 139 of file Data.h.

Referenced by MyDeepSleep::sleep().

140 {
141  crcValue = getCRC();
142 }
long crcValue
CRC of the RtcData.
Definition: Data.h:53
long getCRC()
Definition: Data.h:145

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