1#ifndef SENSESP_SRC_SENSESP_TRANSFORMS_REPEAT_H_
2#define SENSESP_SRC_SENSESP_TRANSFORMS_REPEAT_H_
4#include <elapsedMillis.h>
27template <
typename FROM,
typename TO>
32 ESP_LOGW(
"Repeat",
"Interval is 0. This will cause a busy loop.");
36 virtual void set(
const FROM& input)
override {
76 virtual void set(
const T& input)
override {
116 ESP_LOGD(
"RepeatExpiring",
"interval: %lu, max_age: %lu", interval,
129 virtual void set(
const T& input)
override {
151 this->
emit(this->
get().invalid());
181 void set(T input)
override {
Template class that supports a special invalid magic value for a type.
Repeat transform that emits the last value at a constant interval.
void set(T input) override
RepeatConstantRate(unsigned long interval, unsigned long max_age)
Repeat transform that emits an expired value if the value age exceeds max_age.
RepeatExpiring(unsigned long interval, unsigned long max_age)
virtual void set(const T &input) override
Repeat the input at specific intervals.
virtual void set(const FROM &input) override
reactesp::RepeatEvent * repeat_event_
Repeat(unsigned long interval)
Repeat transform that stops emitting if the value age exceeds max_age.
virtual void set(const T &input) override
RepeatStopping(unsigned long interval, unsigned long max_age)
virtual const T & get() const
void emit(const TO &new_value)
std::shared_ptr< reactesp::EventLoop > event_loop()