16 virtual bool save(
const std::string &value) {
return true; }
18 virtual void setup(uint32_t
id, std::string &value) {}
27 bool save(
const std::string &value)
override {
28 int diff = value.compare(this->
prev_);
32 int size = value.size();
35 unsigned char temp[SZ + 1];
36 memcpy(temp + 1, value.c_str(), size);
38 temp[0] = ((
unsigned char) size);
40 this->
prev_.assign(value);
49 void setup(uint32_t
id, std::string &value)
override {
56 value.assign(temp + 1, (
size_t) temp[0]);
59 this->
prev_.assign(value);
67 void setup()
override;
78 void control(
const std::string &value)
override;
virtual ESPPreferenceObject make_preference(size_t length, uint32_t type, bool in_flash)=0
This class simplifies creating components that periodically check a state.
Lightweight wrapper for template platform lambdas (stateless function pointers only).
void set(optional< T >(*f)(Args...))
Set the lambda function pointer.
void set_optimistic(bool optimistic)
TemplateLambda< std::string > f_
std::string initial_value_
void set_value_saver(TemplateTextSaverBase *restore_value_saver)
Trigger< std::string > * get_set_trigger() const
void dump_config() override
void set_initial_value(const std::string &initial_value)
TemplateTextSaverBase * pref_
Trigger< std::string > * set_trigger_
void control(const std::string &value) override
float get_setup_priority() const override
virtual bool save(const std::string &value)
virtual void setup(uint32_t id, std::string &value)
ESPPreferenceObject pref_
void setup(uint32_t id, std::string &value) override
bool save(const std::string &value) override
Base-class for all text inputs.
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Providing packet encoding functions for exchanging data with a remote host.
ESPPreferences * global_preferences