rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes
ProxySensor Class Referencefinal

#include <proxy_sensor.h>

Inheritance diagram for ProxySensor:
Inheritance graph
[legend]
Collaboration diagram for ProxySensor:
Collaboration graph
[legend]

Public Types

typedef SensorResult(* functionFunctionPtr) (SensorResult)
 

Public Member Functions

 ProxySensor (SensorType type)
 
void setProxiedSensor (SensorType proxiedSensor)
 
void showInfo (const char *sensorName) const override
 
bool isRedundant () const override
 
void setConverter (functionFunctionPtr p_converter)
 
- Public Member Functions inherited from Sensor
bool Register ()
 
const chargetSensorName () const
 
virtual float getRaw () const
 
void unregister ()
 
SensorType type () const
 

Private Member Functions

SensorResult get () const override
 
bool hasSensor () const override
 

Private Attributes

functionFunctionPtr converter
 
SensorType m_proxiedSensor = SensorType::Invalid
 

Additional Inherited Members

- Static Public Member Functions inherited from Sensor
static void showAllSensorInfo ()
 
static void showInfo (SensorType type)
 
static void resetRegistry ()
 
static const SensorgetSensorOfType (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 resetMockValue (SensorType type)
 
static void resetAllMocks ()
 
static void inhibitTimeouts (bool inhibit)
 
static const chargetSensorName (SensorType type)
 
- Protected Member Functions inherited from Sensor
 Sensor (SensorType type)
 
- Static Protected Attributes inherited from Sensor
static bool s_inhibitSensorTimeouts = false
 

Detailed Description

Definition at line 16 of file proxy_sensor.h.

Member Typedef Documentation

◆ functionFunctionPtr

typedef SensorResult(* ProxySensor::functionFunctionPtr) (SensorResult)

Definition at line 31 of file proxy_sensor.h.

Constructor & Destructor Documentation

◆ ProxySensor()

ProxySensor::ProxySensor ( SensorType  type)
inlineexplicit

Definition at line 18 of file proxy_sensor.h.

18: Sensor(type) {}
SensorType type() const
Definition sensor.h:162

Member Function Documentation

◆ get()

SensorResult ProxySensor::get ( ) const
inlineoverrideprivatevirtual

Implements Sensor.

Definition at line 42 of file proxy_sensor.h.

42 {
44 return converter(proxiedValue);
45 }
functionFunctionPtr converter
SensorType m_proxiedSensor
virtual SensorResult get() const =0
expected< float > SensorResult
Definition sensor.h:46
Here is the call graph for this function:

◆ hasSensor()

bool ProxySensor::hasSensor ( ) const
inlineoverrideprivatevirtual

Reimplemented from Sensor.

Definition at line 47 of file proxy_sensor.h.

47 {
48 // query if the underlying sensor exists
50 }
virtual bool hasSensor() const
Definition sensor.h:141
Here is the call graph for this function:

◆ isRedundant()

bool ProxySensor::isRedundant ( ) const
inlineoverridevirtual

Reimplemented from Sensor.

Definition at line 26 of file proxy_sensor.h.

26 {
27 const Sensor *proxied = getSensorOfType(m_proxiedSensor);
28 return proxied ? proxied->isRedundant() : false;
29 }
static bool isRedundant(SensorType type)
Definition sensor.cpp:183
static const Sensor * getSensorOfType(SensorType type)
Definition sensor.cpp:158
Here is the call graph for this function:

◆ setConverter()

void ProxySensor::setConverter ( functionFunctionPtr  p_converter)
inline

Definition at line 33 of file proxy_sensor.h.

33 {
34 converter = p_converter;
35 }

Referenced by initTps().

Here is the caller graph for this function:

◆ setProxiedSensor()

void ProxySensor::setProxiedSensor ( SensorType  proxiedSensor)
inline

Definition at line 20 of file proxy_sensor.h.

20 {
21 m_proxiedSensor = proxiedSensor;
22 }

Referenced by initFluidPressure(), and initTps().

Here is the caller graph for this function:

◆ showInfo()

void ProxySensor::showInfo ( const char sensorName) const
overridevirtual

Implements Sensor.

Definition at line 22 of file sensor_info_printing.cpp.

22 {
23 efiPrintf("Sensor \"%s\" proxied from sensor \"%s\"", sensorName, getSensorName(m_proxiedSensor));
24}
const char * getSensorName() const
Definition sensor.h:130
Here is the call graph for this function:

Field Documentation

◆ converter

functionFunctionPtr ProxySensor::converter
private
Initial value:
= [](SensorResult arg) {
return arg;
}

Definition at line 38 of file proxy_sensor.h.

38 {
39 return arg;
40 };

Referenced by get(), and setConverter().

◆ m_proxiedSensor

SensorType ProxySensor::m_proxiedSensor = SensorType::Invalid
private

Definition at line 52 of file proxy_sensor.h.

Referenced by get(), hasSensor(), isRedundant(), setProxiedSensor(), and showInfo().


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