rusEFI
The most advanced open source ECU
|
Base class for sensors that compute a value on one thread, and want to make it available to consumers asynchronously. More...
#include <stored_value_sensor.h>
Public Member Functions | |
SensorResult | get () const final override |
StoredValueSensor (SensorType type, efidur_t timeoutNt) | |
void | invalidate () |
void | invalidate (UnexpectedCode why) |
void | setValidValue (float value, efitick_t timestamp) |
void | showInfo (const char *sensorName) const override |
virtual void | setTimeout (int timeoutMs) |
Public Member Functions inherited from Sensor | |
bool | Register () |
const char * | getSensorName () const |
virtual bool | hasSensor () const |
virtual float | getRaw () const |
virtual bool | isRedundant () const |
void | unregister () |
SensorType | type () const |
Private Attributes | |
SensorResult | m_result |
efidur_t | m_timeoutPeriod |
efitick_t | m_lastUpdate = 0 |
Additional Inherited Members | |
Static Public Member Functions inherited from Sensor | |
static void | showAllSensorInfo () |
static void | showInfo (SensorType type) |
static void | resetRegistry () |
static const Sensor * | getSensorOfType (SensorType type) |
static SensorResult | get (SensorType type) |
static float | getOrZero (SensorType type) |
static float | getRaw (SensorType type) |
static bool | isRedundant (SensorType type) |
static bool | hasSensor (SensorType type) |
static void | setMockValue (SensorType type, float value, bool mockRedundant=false) |
static void | setInvalidMockValue (SensorType type) |
static void | setMockValue (int type, float value) |
static void | resetMockValue (SensorType type) |
static void | resetAllMocks () |
static void | inhibitTimeouts (bool inhibit) |
static const char * | getSensorName (SensorType type) |
Protected Member Functions inherited from Sensor | |
Sensor (SensorType type) | |
Static Protected Attributes inherited from Sensor | |
static bool | s_inhibitSensorTimeouts = false |
Base class for sensors that compute a value on one thread, and want to make it available to consumers asynchronously.
Common examples include sensors that have to do heavy lifting to produce a reading, and don't want to perform that conversion at the time of consumption.
To use this class, create a class for your sensor that inherits StoredValueSensor, and call Invalidate() and SetValidValue(float) as appropriate when readings are available (or known to be invalid) for your sensor.
Consumers will retrieve the last set (or invalidated) value.
Definition at line 30 of file stored_value_sensor.h.
|
inline |
Definition at line 54 of file stored_value_sensor.h.
|
inlinefinaloverridevirtual |
Implements Sensor.
Definition at line 32 of file stored_value_sensor.h.
Referenced by MapAverager::showInfo(), RpmCalculator::showInfo(), CanSensorBase::showInfo(), FunctionalSensor::showInfo(), showInfo(), and Lps25Sensor::showInfo().
|
inline |
Definition at line 62 of file stored_value_sensor.h.
Referenced by AemXSeriesWideband::decodeAemXSeries(), AemXSeriesWideband::decodeRusefiStandard(), flexCallback(), HellaOilLevelSensor::onEdge(), FunctionalSensor::postRawValue(), and Lps25Sensor::update().
|
inline |
Definition at line 67 of file stored_value_sensor.h.
|
inlinevirtual |
Definition at line 80 of file stored_value_sensor.h.
|
inline |
Definition at line 72 of file stored_value_sensor.h.
Referenced by RpmCalculator::assignRpmValue(), configureRusefiLuaHooks(), AemXSeriesWideband::decodeAemXSeries(), CanSensor< TStorage, TScale >::decodeFrame(), ObdCanSensor< Size, Offset >::decodeFrame(), AemXSeriesEgt::decodeFrame(), AemXSeriesWideband::decodeRusefiStandard(), flexCallback(), HellaOilLevelSensor::onEdge(), FunctionalSensor::postRawValue(), processCanRxVss(), processHyundai(), processNissanSecondVss(), sentTpsDecode(), MapAverager::stop(), and Lps25Sensor::update().
|
overridevirtual |
Implements Sensor.
Reimplemented in Lps25Sensor, and FrequencySensor.
Definition at line 16 of file sensor_info_printing.cpp.
|
private |
Definition at line 88 of file stored_value_sensor.h.
Referenced by get(), and setValidValue().
|
private |
Definition at line 85 of file stored_value_sensor.h.
Referenced by get(), invalidate(), and setValidValue().
|
private |
Definition at line 87 of file stored_value_sensor.h.
Referenced by get(), and setTimeout().