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

#include <MyPersistentData.h>

Inheritance diagram for sensorConfigData:

Classes

class  SensorData

Public Member Functions

uint16_t get_pollingRate () const
uint16_t get_threshold1 () const
 For the Get functions, used to retrieve the value of the variable.
uint16_t get_threshold2 () 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 set_pollingRate (uint16_t value)
void set_threshold1 (uint16_t value)
void set_threshold2 (uint16_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 sensorConfigDatainstance ()
 Gets the singleton instance of this class, allocating it if necessary.

Public Attributes

SensorData sensorData

Protected Member Functions

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

Static Protected Attributes

static sensorConfigData_instance
 Singleton instance of this class.
static const uint32_t SENSOR_DATA_MAGIC = 0x20a47e74
static const uint16_t SENSOR_DATA_VERSION = 1

Detailed Description

Definition at line 333 of file MyPersistentData.h.

Constructor & Destructor Documentation

◆ sensorConfigData() [1/2]

sensorConfigData::sensorConfigData ( )
protected

The constructor is protected because the class is a singleton.

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

Definition at line 354 of file MyPersistentData.cpp.

References persistentDataPathSensor, SENSOR_DATA_MAGIC, SENSOR_DATA_VERSION, and sensorData.

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

◆ ~sensorConfigData()

sensorConfigData::~sensorConfigData ( )
protectedvirtual

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

Definition at line 357 of file MyPersistentData.cpp.

◆ sensorConfigData() [2/2]

sensorConfigData::sensorConfigData ( const sensorConfigData & )
protecteddelete

This class is a singleton and cannot be copied.

References sensorConfigData().

Member Function Documentation

◆ get_pollingRate()

uint16_t sensorConfigData::get_pollingRate ( ) const

Definition at line 408 of file MyPersistentData.cpp.

◆ get_threshold1()

uint16_t sensorConfigData::get_threshold1 ( ) 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 393 of file MyPersistentData.cpp.

◆ get_threshold2()

uint16_t sensorConfigData::get_threshold2 ( ) const

Definition at line 401 of file MyPersistentData.cpp.

◆ initialize()

void sensorConfigData::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 384 of file MyPersistentData.cpp.

◆ instance()

sensorConfigData & sensorConfigData::instance ( )
static

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

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

Definition at line 347 of file MyPersistentData.cpp.

References _instance, and sensorConfigData().

◆ loadCurrentDefaults()

void sensorConfigData::loadCurrentDefaults ( )

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

◆ loop()

void sensorConfigData::loop ( )

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

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

Definition at line 367 of file MyPersistentData.cpp.

References sensorConfig.

◆ operator=()

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

This class is a singleton and cannot be copied.

References sensorConfigData().

◆ set_pollingRate()

void sensorConfigData::set_pollingRate ( uint16_t value)

Definition at line 412 of file MyPersistentData.cpp.

◆ set_threshold1()

void sensorConfigData::set_threshold1 ( uint16_t value)

Definition at line 397 of file MyPersistentData.cpp.

◆ set_threshold2()

void sensorConfigData::set_threshold2 ( uint16_t value)

Definition at line 405 of file MyPersistentData.cpp.

◆ setup()

void sensorConfigData::setup ( )

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

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

Definition at line 360 of file MyPersistentData.cpp.

References sensorConfig.

◆ validate()

bool sensorConfigData::validate ( size_t dataSize)

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

Definition at line 371 of file MyPersistentData.cpp.

References sensorConfig.

Member Data Documentation

◆ _instance

sensorConfigData * sensorConfigData::_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 455 of file MyPersistentData.h.

Referenced by instance().

◆ SENSOR_DATA_MAGIC

const uint32_t sensorConfigData::SENSOR_DATA_MAGIC = 0x20a47e74
staticprotected

Definition at line 458 of file MyPersistentData.h.

Referenced by sensorConfigData().

◆ SENSOR_DATA_VERSION

const uint16_t sensorConfigData::SENSOR_DATA_VERSION = 1
staticprotected

Definition at line 459 of file MyPersistentData.h.

Referenced by sensorConfigData().

◆ sensorData

SensorData sensorConfigData::sensorData

Definition at line 392 of file MyPersistentData.h.

Referenced by sensorConfigData().


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