SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
|
Provides an easy way of calling a function based on the output of any ValueProducer. More...
#include <sensesp/system/lambda_consumer.h>
Public Member Functions | |
LambdaConsumer (std::function< void(IN)> function) | |
void | set_input (IN input, uint8_t input_channel=0) override |
Public Member Functions inherited from sensesp::ValueConsumer< IN > | |
void | connect_from (ValueProducer< IN > *producer, uint8_t input_channel=0) |
Protected Attributes | |
std::function< void(IN)> | function |
Provides an easy way of calling a function based on the output of any ValueProducer.
To use LambdaConsumer, you create the function in main.cpp as a lambda expression, and then pass it as the "function" parameter to the LambaConsumer constructor. See https://github.com/SignalK/SensESP/blob/master/examples/lambda_consumer.cpp for a detailed example.
IN | Consumer function input value type |
function | A pointer to the function that's being called. |
Definition at line 25 of file lambda_consumer.h.
|
inline |
Definition at line 27 of file lambda_consumer.h.
|
inlineoverridevirtual |
Used to set an input of this consumer. It is usually called automatically by a ValueProducer.
new_value | the value of the input |
input_channel | Consumers can have one or more inputs feeding them. This parameter allows you to specify which input number the producer is connecting to. For single input consumers, leave the index at zero. |
Reimplemented from sensesp::ValueConsumer< IN >.
Definition at line 30 of file lambda_consumer.h.
Definition at line 35 of file lambda_consumer.h.