SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
|
A base class for any sensor or piece of code that outputs a value for consumption elsewhere. More...
#include <sensesp/system/valueproducer.h>
Public Member Functions | |
ValueProducer () | |
virtual const T & | get () const |
void | connect_to (ValueConsumer< T > *consumer, uint8_t input_channel=0) |
template<typename CT > | |
void | connect_to (ValueConsumer< CT > *consumer, uint8_t input_channel=0) |
Connect a producer to a consumer of a different type. | |
template<typename T2 > | |
Transform< T, T2 > * | connect_to (Transform< T, T2 > *consumer_producer, uint8_t input_channel=0) |
template<typename TT , typename T2 > | |
Transform< TT, T2 > * | connect_to (Transform< TT, T2 > *consumer_producer, uint8_t input_channel=0) |
Connect a producer to a transform with a different input type. | |
void | emit (T new_value) |
Public Member Functions inherited from sensesp::Observable | |
Observable () | |
Observable (Observable &&other) | |
Move constructor. | |
void | notify () |
void | attach (std::function< void()> observer) |
Protected Attributes | |
T | output |
A base class for any sensor or piece of code that outputs a value for consumption elsewhere.
They are Observable, allowing code to be notified whenever a new value is available. They can be connected directly to ValueConsumer
s of the same type using the connect_to()
method.
Definition at line 24 of file valueproducer.h.
|
inline |
Definition at line 26 of file valueproducer.h.
|
inline |
If the consumer this producer is connecting to is ALSO a producer of values of the same type, connect_to() calls can be chained together, as this specialized version returns the producer/consumer being conencted to so connect_to() can be called on THAT object.
input_channel | Consumers can have one or more inputs feeding them This parameter allows you to specify which input number this producer is connecting to. For single input consumers, leave the index at zero. |
Definition at line 77 of file valueproducer.h.
|
inline |
Connect a producer to a transform with a different input type.
This allows you to connect a producer to a transform with a different input type. Automatic type conversion is performed.
consumer_producer | Transform object to connect to |
input_channel |
Definition at line 98 of file valueproducer.h.
|
inline |
Connect a producer to a consumer of a different type.
This allows you to connect a producer to a consumer of a different type. Automatic type conversion is performed.
CT | Consumer type |
consumer | Consumer object to connect to |
input_channel |
Definition at line 59 of file valueproducer.h.
|
inline |
Connects this producer to the specified consumer, registering that consumer for notifications to when this producer's value changes
input_channel | Consumers can have one or more inputs feeding them This parameter allows you to specify which input number this producer is connecting to. For single input consumers, leave the index at zero. |
Definition at line 42 of file valueproducer.h.
|
inline |
Definition at line 109 of file valueproducer.h.
|
inlinevirtual |
Returns the current value of this producer
Definition at line 31 of file valueproducer.h.
|
protected |
The current value of this producer is stored here in this output member (unless descendant classes override ValueProducer::get())
Definition at line 119 of file valueproducer.h.