![]() |
semf
|
Conversion class for raw sensor measurement values from HardwareSensor
to converted values for Sensor
used by application level.
More...
#include <sensorconverter.h>
Public Member Functions | |
SensorConverter (HardwareSensor< T_RAW > &hardwareSensor, size_t index) | |
Constructor. More... | |
virtual | ~SensorConverter ()=default |
![]() | |
virtual | ~Sensor ()=default |
virtual T_CONVERTED | currentValue () const =0 |
Returns the last measured converted value. More... | |
virtual T_CONVERTED | averageValue () const =0 |
Returns the converted value of the average measured raw values. More... | |
virtual void | update ()=0 |
Triggers the sensor hardware to start a measurement cycle. More... | |
Protected Member Functions | |
virtual T_CONVERTED | convert (T_RAW value) const =0 |
Converts a raw sensor measurement value from HardwareSensor into the required format. More... | |
Additional Inherited Members | |
![]() | |
Signal | dataAvailable |
Conversion class for raw sensor measurement values from HardwareSensor
to converted values for Sensor
used by application level.
To use this base class, inherit from it and override the convert()
function. In order to trigger a new measurement the inherited update()
function can be used.
For building a measurement system, you need the following:
HardwareSensor
interface.SensorValueConverter
and implementing the convert()
function.UserSensor
objectT_RAW | Type of a raw sensor value, e.g. uint16_t for a 16-bit ADC value. |
T_CONVERTED | Type of an application/usable sensor value which has an unit, e.g. float for temperature [°C]. |
Sensor
HardwareSensor
Definition at line 40 of file sensorconverter.h.
semf::SensorConverter< T_RAW, T_CONVERTED >::SensorConverter | ( | HardwareSensor< T_RAW > & | hardwareSensor, |
size_t | index | ||
) |
Constructor.
hardwareSensor | Sensor hardware object. |
index | Index of the specific sensor. |
Definition at line 78 of file sensorconverter.h.
|
virtualdefault |
|
protectedpure virtual |
Converts a raw sensor measurement value from HardwareSensor
into the required format.
value | Raw value. |