SensESP 3.0.1
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 (const IN &input) override |
Public Member Functions inherited from sensesp::ValueConsumer< IN > | |
virtual void | set_input (const IN &new_value) |
void | connect_from (ValueProducer< IN > *producer) |
Protected Attributes | |
std::function< void(IN)> | function |
Additional Inherited Members | |
Public Types inherited from sensesp::ValueConsumer< IN > | |
using | input_type |
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 called automatically by a ValueProducer but can also be called manually.
new_value | the value of the input |
Reimplemented from sensesp::ValueConsumer< IN >.
Definition at line 30 of file lambda_consumer.h.
|
protected |
Definition at line 33 of file lambda_consumer.h.