Generalized-Core-Counter 3.20
Particle-based generalized core counter firmware
Loading...
Searching...
No Matches
currentStatusData Class Reference

#include <MyPersistentData.h>

Inheritance diagram for currentStatusData:

Classes

class  CurrentData

Public Member Functions

int8_t get_alertCode () const
uint8_t get_batteryState () const
uint16_t get_dailyCount () const
float get_externalTempC () const
uint16_t get_faceNumber () const
 For the Get functions, used to retrieve the value of the variable.
uint16_t get_faceScore () const
uint16_t get_gestureScore () const
uint16_t get_gestureType () const
uint16_t get_hourlyCount () const
float get_internalTempC () const
time_t get_lastAlertTime () const
time_t get_lastCountTime () const
uint32_t get_lastOccupancyEvent () const
time_t get_occupancyStartTime () const
bool get_occupied () const
float get_stateOfCharge () const
uint32_t get_totalOccupiedSeconds () const
void initialize ()
 Will reinitialize data if it is found not to be valid.
void loadCurrentDefaults ()
 Load the appropriate system defaults - good ot initialize a system to "factory settings".
void loop ()
 Perform application loop operations; call this from global application loop().
void raiseAlert (int8_t value)
 Raise an alert, keeping the highest severity code when multiple occur.
void resetEverything ()
 Resets the current and hourly counts.
void set_alertCode (int8_t value)
void set_batteryState (uint8_t value)
void set_dailyCount (uint16_t value)
void set_externalTempC (float value)
void set_faceNumber (uint16_t value)
void set_faceScore (uint16_t value)
void set_gestureScore (uint16_t value)
void set_gestureType (uint16_t value)
void set_hourlyCount (uint16_t value)
void set_internalTempC (float value)
void set_lastAlertTime (time_t value)
void set_lastCountTime (time_t value)
void set_lastOccupancyEvent (uint32_t value)
void set_occupancyStartTime (time_t value)
void set_occupied (bool value)
void set_stateOfCharge (float value)
void set_totalOccupiedSeconds (uint32_t value)
void setup ()
 Perform setup operations; call this from global application setup().
bool validate (size_t dataSize)
 Validates values and, if valid, checks that data is in the correct range.

Static Public Member Functions

static currentStatusDatainstance ()
 Gets the singleton instance of this class, allocating it if necessary.

Public Attributes

CurrentData currentData

Protected Member Functions

 currentStatusData ()
 The constructor is protected because the class is a singleton.
 currentStatusData (const currentStatusData &)=delete
 This class is a singleton and cannot be copied.
currentStatusDataoperator= (const currentStatusData &)=delete
 This class is a singleton and cannot be copied.
virtual ~currentStatusData ()
 The destructor is protected because the class is a singleton and cannot be deleted.

Static Protected Attributes

static currentStatusData_instance
 Singleton instance of this class.
static const uint32_t CURRENT_DATA_MAGIC = 0x20a99e74
static const uint16_t CURRENT_DATA_VERSION = 1

Detailed Description

Definition at line 467 of file MyPersistentData.h.

Constructor & Destructor Documentation

◆ currentStatusData() [1/2]

currentStatusData::currentStatusData ( )
protected

The constructor is protected because the class is a singleton.

Use MyPersistentData::instance() to instantiate the singleton.

Definition at line 435 of file MyPersistentData.cpp.

References CURRENT_DATA_MAGIC, CURRENT_DATA_VERSION, currentData, and persistentDataPathCurrent.

Referenced by currentStatusData(), instance(), and operator=().

◆ ~currentStatusData()

currentStatusData::~currentStatusData ( )
protectedvirtual

The destructor is protected because the class is a singleton and cannot be deleted.

Definition at line 438 of file MyPersistentData.cpp.

◆ currentStatusData() [2/2]

currentStatusData::currentStatusData ( const currentStatusData & )
protecteddelete

This class is a singleton and cannot be copied.

References currentStatusData().

Member Function Documentation

◆ get_alertCode()

int8_t currentStatusData::get_alertCode ( ) const

Definition at line 548 of file MyPersistentData.cpp.

Referenced by raiseAlert().

◆ get_batteryState()

uint8_t currentStatusData::get_batteryState ( ) const

Definition at line 615 of file MyPersistentData.cpp.

◆ get_dailyCount()

uint16_t currentStatusData::get_dailyCount ( ) const

Definition at line 631 of file MyPersistentData.cpp.

◆ get_externalTempC()

float currentStatusData::get_externalTempC ( ) const

Definition at line 540 of file MyPersistentData.cpp.

◆ get_faceNumber()

uint16_t currentStatusData::get_faceNumber ( ) const

For the Get functions, used to retrieve the value of the variable.

Specific to the location in the object and the type of the variable

Parameters
Nothingneeded
Returns
The value of the variable in the corret type

For the Set functions, used to set the value of the variable

Specific to the location in the object and the type of the variable

Parameters
Valueto set the variable - correct type - for Strings they are truncated if too long
Returns
None needed

Definition at line 493 of file MyPersistentData.cpp.

◆ get_faceScore()

uint16_t currentStatusData::get_faceScore ( ) const

Definition at line 501 of file MyPersistentData.cpp.

◆ get_gestureScore()

uint16_t currentStatusData::get_gestureScore ( ) const

Definition at line 516 of file MyPersistentData.cpp.

◆ get_gestureType()

uint16_t currentStatusData::get_gestureType ( ) const

Definition at line 508 of file MyPersistentData.cpp.

◆ get_hourlyCount()

uint16_t currentStatusData::get_hourlyCount ( ) const

Definition at line 624 of file MyPersistentData.cpp.

◆ get_internalTempC()

float currentStatusData::get_internalTempC ( ) const

Definition at line 532 of file MyPersistentData.cpp.

◆ get_lastAlertTime()

time_t currentStatusData::get_lastAlertTime ( ) const

Definition at line 556 of file MyPersistentData.cpp.

◆ get_lastCountTime()

time_t currentStatusData::get_lastCountTime ( ) const

Definition at line 524 of file MyPersistentData.cpp.

◆ get_lastOccupancyEvent()

uint32_t currentStatusData::get_lastOccupancyEvent ( ) const

Definition at line 647 of file MyPersistentData.cpp.

◆ get_occupancyStartTime()

time_t currentStatusData::get_occupancyStartTime ( ) const

Definition at line 654 of file MyPersistentData.cpp.

◆ get_occupied()

bool currentStatusData::get_occupied ( ) const

Definition at line 640 of file MyPersistentData.cpp.

◆ get_stateOfCharge()

float currentStatusData::get_stateOfCharge ( ) const

Definition at line 608 of file MyPersistentData.cpp.

◆ get_totalOccupiedSeconds()

uint32_t currentStatusData::get_totalOccupiedSeconds ( ) const

Definition at line 661 of file MyPersistentData.cpp.

◆ initialize()

void currentStatusData::initialize ( )

Will reinitialize data if it is found not to be valid.

Be careful doing this, because when MyData is extended to add new fields, the initialize method is not called! This is only called when first initialized.

Definition at line 482 of file MyPersistentData.cpp.

References resetEverything().

◆ instance()

currentStatusData & currentStatusData::instance ( )
static

Gets the singleton instance of this class, allocating it if necessary.

Use MyPersistentData::instance() to instantiate the singleton.

Definition at line 428 of file MyPersistentData.cpp.

References _instance, and currentStatusData().

◆ loadCurrentDefaults()

void currentStatusData::loadCurrentDefaults ( )

Load the appropriate system defaults - good ot initialize a system to "factory settings".

◆ loop()

void currentStatusData::loop ( )

Perform application loop operations; call this from global application loop().

You typically use MyPersistentData::instance().loop();

Definition at line 448 of file MyPersistentData.cpp.

References current.

◆ operator=()

currentStatusData & currentStatusData::operator= ( const currentStatusData & )
protecteddelete

This class is a singleton and cannot be copied.

References currentStatusData().

◆ raiseAlert()

void currentStatusData::raiseAlert ( int8_t value)

Raise an alert, keeping the highest severity code when multiple occur.

If an alert is already set, this helper compares the severity of the existing code to the new one and only overwrites when the new alert is more severe. This prevents a later, less serious warning from masking a prior critical condition.

Definition at line 596 of file MyPersistentData.cpp.

References get_alertCode(), set_alertCode(), and set_lastAlertTime().

◆ resetEverything()

void currentStatusData::resetEverything ( )

Resets the current and hourly counts.

Definition at line 452 of file MyPersistentData.cpp.

References current, and sysStatus.

Referenced by initialize().

◆ set_alertCode()

void currentStatusData::set_alertCode ( int8_t value)

Definition at line 552 of file MyPersistentData.cpp.

Referenced by raiseAlert().

◆ set_batteryState()

void currentStatusData::set_batteryState ( uint8_t value)

Definition at line 618 of file MyPersistentData.cpp.

◆ set_dailyCount()

void currentStatusData::set_dailyCount ( uint16_t value)

Definition at line 634 of file MyPersistentData.cpp.

◆ set_externalTempC()

void currentStatusData::set_externalTempC ( float value)

Definition at line 544 of file MyPersistentData.cpp.

◆ set_faceNumber()

void currentStatusData::set_faceNumber ( uint16_t value)

Definition at line 497 of file MyPersistentData.cpp.

◆ set_faceScore()

void currentStatusData::set_faceScore ( uint16_t value)

Definition at line 505 of file MyPersistentData.cpp.

◆ set_gestureScore()

void currentStatusData::set_gestureScore ( uint16_t value)

Definition at line 520 of file MyPersistentData.cpp.

◆ set_gestureType()

void currentStatusData::set_gestureType ( uint16_t value)

Definition at line 512 of file MyPersistentData.cpp.

◆ set_hourlyCount()

void currentStatusData::set_hourlyCount ( uint16_t value)

Definition at line 627 of file MyPersistentData.cpp.

◆ set_internalTempC()

void currentStatusData::set_internalTempC ( float value)

Definition at line 536 of file MyPersistentData.cpp.

◆ set_lastAlertTime()

void currentStatusData::set_lastAlertTime ( time_t value)

Definition at line 561 of file MyPersistentData.cpp.

Referenced by raiseAlert().

◆ set_lastCountTime()

void currentStatusData::set_lastCountTime ( time_t value)

Definition at line 528 of file MyPersistentData.cpp.

◆ set_lastOccupancyEvent()

void currentStatusData::set_lastOccupancyEvent ( uint32_t value)

Definition at line 650 of file MyPersistentData.cpp.

◆ set_occupancyStartTime()

void currentStatusData::set_occupancyStartTime ( time_t value)

Definition at line 657 of file MyPersistentData.cpp.

◆ set_occupied()

void currentStatusData::set_occupied ( bool value)

Definition at line 643 of file MyPersistentData.cpp.

◆ set_stateOfCharge()

void currentStatusData::set_stateOfCharge ( float value)

Definition at line 611 of file MyPersistentData.cpp.

◆ set_totalOccupiedSeconds()

void currentStatusData::set_totalOccupiedSeconds ( uint32_t value)

Definition at line 664 of file MyPersistentData.cpp.

◆ setup()

void currentStatusData::setup ( )

Perform setup operations; call this from global application setup().

You typically use MyPersistentData::instance().setup();

Definition at line 441 of file MyPersistentData.cpp.

References current.

◆ validate()

bool currentStatusData::validate ( size_t dataSize)

Validates values and, if valid, checks that data is in the correct range.

Definition at line 467 of file MyPersistentData.cpp.

References current.

Member Data Documentation

◆ _instance

currentStatusData * currentStatusData::_instance
staticprotected

Singleton instance of this class.

The object pointer to this class is stored here. It's NULL at system boot.

Definition at line 670 of file MyPersistentData.h.

Referenced by instance().

◆ CURRENT_DATA_MAGIC

const uint32_t currentStatusData::CURRENT_DATA_MAGIC = 0x20a99e74
staticprotected

Definition at line 673 of file MyPersistentData.h.

Referenced by currentStatusData().

◆ CURRENT_DATA_VERSION

const uint16_t currentStatusData::CURRENT_DATA_VERSION = 1
staticprotected

Definition at line 674 of file MyPersistentData.h.

Referenced by currentStatusData().

◆ currentData

CurrentData currentStatusData::currentData

Definition at line 549 of file MyPersistentData.h.

Referenced by currentStatusData().


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