35#ifndef __MYPERSISTENTDATA_H
36#define __MYPERSISTENTDATA_H
39#include "StorageHelperRK.h"
41#define current currentStatusData::instance()
42#define sysStatus sysStatusData::instance()
43#define sensorConfig sensorConfigData::instance()
136 StorageHelperRK::PersistentDataBase::SavedDataHeader
sysHeader;
CountingMode
Counting mode defines how the device processes sensor events.
OperatingMode
Operating mode defines power and connectivity behavior.
StorageHelperRK::PersistentDataBase::SavedDataHeader currentHeader
time_t occupancyStartTime
uint32_t totalOccupiedSeconds
uint32_t lastOccupancyEvent
void set_gestureScore(uint16_t value)
time_t get_lastAlertTime() const
uint16_t get_gestureScore() const
uint32_t get_lastOccupancyEvent() const
float get_internalTempC() const
void setup()
Perform setup operations; call this from global application setup().
static currentStatusData & instance()
Gets the singleton instance of this class, allocating it if necessary.
void resetEverything()
Resets the current and hourly counts.
void set_internalTempC(float value)
void initialize()
Will reinitialize data if it is found not to be valid.
void raiseAlert(int8_t value)
Raise an alert, keeping the highest severity code when multiple occur.
uint32_t get_totalOccupiedSeconds() const
void set_faceNumber(uint16_t value)
void loadCurrentDefaults()
Load the appropriate system defaults - good ot initialize a system to "factory settings".
float get_stateOfCharge() const
uint16_t get_dailyCount() const
int8_t get_alertCode() const
uint16_t get_hourlyCount() const
time_t get_occupancyStartTime() const
void set_batteryState(uint8_t value)
static const uint16_t CURRENT_DATA_VERSION
void set_gestureType(uint16_t value)
currentStatusData()
The constructor is protected because the class is a singleton.
float get_externalTempC() const
uint8_t get_batteryState() const
bool get_occupied() const
void set_externalTempC(float value)
void set_alertCode(int8_t value)
currentStatusData(const currentStatusData &)=delete
This class is a singleton and cannot be copied.
static currentStatusData * _instance
Singleton instance of this class.
time_t get_lastCountTime() const
void set_lastCountTime(time_t value)
static const uint32_t CURRENT_DATA_MAGIC
void set_lastOccupancyEvent(uint32_t value)
void set_occupied(bool value)
bool validate(size_t dataSize)
Validates values and, if valid, checks that data is in the correct range.
void loop()
Perform application loop operations; call this from global application loop().
void set_hourlyCount(uint16_t value)
uint16_t get_faceScore() const
void set_dailyCount(uint16_t value)
virtual ~currentStatusData()
The destructor is protected because the class is a singleton and cannot be deleted.
void set_faceScore(uint16_t value)
void set_totalOccupiedSeconds(uint32_t value)
uint16_t get_gestureType() const
void set_stateOfCharge(float value)
uint16_t get_faceNumber() const
For the Get functions, used to retrieve the value of the variable.
void set_lastAlertTime(time_t value)
currentStatusData & operator=(const currentStatusData &)=delete
This class is a singleton and cannot be copied.
void set_occupancyStartTime(time_t value)
StorageHelperRK::PersistentDataBase::SavedDataHeader sensorHeader
static sensorConfigData & instance()
Gets the singleton instance of this class, allocating it if necessary.
uint16_t get_pollingRate() const
static sensorConfigData * _instance
Singleton instance of this class.
static const uint32_t SENSOR_DATA_MAGIC
virtual ~sensorConfigData()
The destructor is protected because the class is a singleton and cannot be deleted.
uint16_t get_threshold1() const
For the Get functions, used to retrieve the value of the variable.
void setup()
Perform setup operations; call this from global application setup().
sensorConfigData()
The constructor is protected because the class is a singleton.
bool validate(size_t dataSize)
Validates values and, if valid, checks that data is in the correct range.
sensorConfigData & operator=(const sensorConfigData &)=delete
This class is a singleton and cannot be copied.
void set_pollingRate(uint16_t value)
void set_threshold2(uint16_t value)
void loadCurrentDefaults()
Load the appropriate system defaults - good ot initialize a system to "factory settings".
void initialize()
Will reinitialize data if it is found not to be valid.
void set_threshold1(uint16_t value)
sensorConfigData(const sensorConfigData &)=delete
This class is a singleton and cannot be copied.
void loop()
Perform application loop operations; call this from global application loop().
static const uint16_t SENSOR_DATA_VERSION
uint16_t get_threshold2() const
uint16_t lastConnectionDuration
uint16_t modemOffBudgetSec
uint16_t cloudDisconnectBudgetSec
uint8_t structuresVersion
uint16_t reportingInterval
uint16_t connectedReportingIntervalSec
StorageHelperRK::PersistentDataBase::SavedDataHeader sysHeader
uint32_t occupancyDebounceMs
uint16_t connectAttemptBudgetSec
uint16_t lowPowerReportingIntervalSec
time_t get_lastReport() const
uint16_t get_connectAttemptBudgetSec() const
void set_modemOffBudgetSec(uint16_t value)
bool get_solarPowerMode() const
sysStatusData & operator=(const sysStatusData &)=delete
This class is a singleton and cannot be copied.
time_t get_lastHookResponse() const
void set_lastConnectionDuration(uint16_t value)
uint8_t get_operatingMode() const
time_t get_lastDailyCleanup() const
bool set_timeZoneStr(const char *str)
uint8_t get_resetCount() const
void set_connectAttemptBudgetSec(uint16_t value)
bool get_lowPowerMode() const
void set_lastHookResponse(time_t value)
void set_cloudDisconnectBudgetSec(uint16_t value)
uint8_t get_structuresVersion() const
For the Get functions, used to retrieve the value of the variable.
uint16_t get_reportingInterval() const
uint8_t get_sensorType() const
void set_lastReport(time_t value)
void set_serialConnected(bool value)
static sysStatusData & instance()
Gets the singleton instance of this class, allocating it if necessary.
sysStatusData(const sysStatusData &)=delete
This class is a singleton and cannot be copied.
uint16_t get_lastConnectionDuration() const
void set_disconnectedMode(bool value)
void set_lowPowerReportingIntervalSec(uint16_t value)
void set_resetCount(uint8_t value)
void set_countingMode(uint8_t value)
void set_solarPowerMode(bool value)
void set_connectedReportingIntervalSec(uint16_t value)
void set_lowBatteryMode(bool value)
sysStatusData()
The constructor is protected because the class is a singleton.
void set_updatesPending(bool value)
void set_alertCodeNode(uint8_t value)
bool get_disconnectedMode() const
void set_closeTime(uint8_t value)
static sysStatusData * _instance
Singleton instance of this class.
uint32_t get_occupancyDebounceMs() const
static const uint32_t SYS_DATA_MAGIC
void set_openTime(uint8_t value)
uint16_t get_cloudDisconnectBudgetSec() const
void loop()
Perform application loop operations; call this from global application loop().
uint16_t get_modemOffBudgetSec() const
uint8_t get_alertCodeNode() const
String get_timeZoneStr() const
bool get_lowBatteryMode() const
void set_structuresVersion(uint8_t value)
void initialize()
Will reinitialize data if it is found not to be valid.
uint16_t get_connectedReportingIntervalSec() const
void set_sensorType(uint8_t value)
void set_lowPowerMode(bool value)
void setup()
Perform setup operations; call this from global application setup().
void set_alertTimestampNode(time_t value)
void set_reportingInterval(uint16_t value)
uint8_t get_closeTime() const
static const uint16_t SYS_DATA_VERSION
bool get_serialConnected() const
virtual ~sysStatusData()
The destructor is protected because the class is a singleton and cannot be deleted.
void set_occupancyDebounceMs(uint32_t value)
void set_verboseMode(bool value)
bool get_updatesPending() const
bool get_verboseMode() const
void set_lastDailyCleanup(time_t value)
uint8_t get_openTime() const
void set_operatingMode(uint8_t value)
time_t get_lastTimeSync() const
time_t get_lastConnection() const
void set_lastConnection(time_t value)
void set_lastTimeSync(time_t value)
time_t get_alertTimestampNode() const
bool validate(size_t dataSize)
Validates values and, if valid, checks that data is in the correct range.
uint8_t get_countingMode() const
uint16_t get_lowPowerReportingIntervalSec() const