Abstract class that acts as an interface for all sensor classes. More...
#include <Sensor.h>
Public Types | |
| using | sensorVal_t = float |
| Type definition used by Sensor class. | |
Public Member Functions | |
| virtual void | begin (void)=0 |
| Initializes the sensors used by this object. Not needed if only using simulated sensor values. | |
| virtual void | read (void)=0 |
| Reads the sensor and updates the value stored within this object. | |
| void | simulate (void) |
| Simulates a new sensor value, storing the results in this object. | |
| const sensorVal_t | value (void) const |
| Returns the sensor value. | |
Protected Member Functions | |
| Sensor (sensorVal_t initialValue, sensorVal_t maxVal, sensorVal_t minVal, sensorVal_t simDelta) | |
| Protected constructor for Sensor. | |
| ~Sensor (void)=default | |
| Destroy the Sensor object. | |
Protected Attributes | |
| sensorVal_t | _value |
| Most recent sensor reading. | |
Abstract class that acts as an interface for all sensor classes.
This class also provides a basic simulation capability that can be used when the real sensors are not available. The simulation varies the sensor value in a saw-tooth pattern between minVal and maxVal.
| using Sensor::sensorVal_t = float |
Type definition used by Sensor class.
|
inlineprotected |
Protected constructor for Sensor.
| [in] | initialValue | Initial simulation value |
| [in] | maxVal | Max simulated value |
| [in] | minVal | Min simulated value |
| [in] | simDelta | Change in value for each simulation step |
|
protecteddefault |
Destroy the Sensor object.
|
pure virtual |
Initializes the sensors used by this object. Not needed if only using simulated sensor values.
Implemented in ChillerTempSensor, KettleTempSensor, and KettleVolSensor.
|
pure virtual |
Reads the sensor and updates the value stored within this object.
Implemented in ChillerTempSensor, KettleTempSensor, and KettleVolSensor.
| void Sensor::simulate | ( | void | ) |
Simulates a new sensor value, storing the results in this object.
|
inline |
Returns the sensor value.
|
protected |
Most recent sensor reading.