6namespace key_collector {
8static const char *
const TAG =
"key_collector";
18 ESP_LOGCONFIG(TAG,
"Key Collector:");
20 ESP_LOGCONFIG(TAG,
" min length: %d", this->
min_length_);
22 ESP_LOGCONFIG(TAG,
" max length: %d", this->
max_length_);
24 ESP_LOGCONFIG(TAG,
" erase keys '%s'", this->
back_keys_.c_str());
26 ESP_LOGCONFIG(TAG,
" clear keys '%s'", this->
clear_keys_.c_str());
28 ESP_LOGCONFIG(TAG,
" start keys '%s'", this->
start_keys_.c_str());
32 " end key is required: %s",
36 ESP_LOGCONFIG(TAG,
" allowed keys '%s'", this->
allowed_keys_.c_str());
38 ESP_LOGCONFIG(TAG,
" entry timeout: %0.1f", this->
timeout_ / 1000.0);
56 if (progress_update && had_state) {
66 if (!this->
start_keys_.empty() && !this->start_key_) {
67 if (this->
start_keys_.find(key) != std::string::npos) {
73 if (this->
back_keys_.find(key) != std::string::npos) {
80 if (this->
clear_keys_.find(key) != std::string::npos) {
84 if (this->
end_keys_.find(key) != std::string::npos) {
91 if (!this->
allowed_keys_.empty() && this->allowed_keys_.find(key) == std::string::npos)
98 if ((this->
max_length_ > 0) && (this->
result_.size() == this->max_length_) && (!this->end_key_required_)) {
void enable_loop()
Enable this component's loop.
void disable_loop()
Disable this component's loop.
LazyCallbackManager< void(const std::string &, uint8_t)> timeout_callbacks_
void set_enabled(bool enabled)
void send_key(uint8_t key)
void add_provider(key_provider::KeyProvider *provider)
std::string allowed_keys_
LazyCallbackManager< void(const std::string &, uint8_t)> progress_callbacks_
void dump_config() override
void clear(bool progress_update=true)
LazyCallbackManager< void(const std::string &, uint8_t, uint8_t)> result_callbacks_
interface for components that provide keypresses
void add_on_key_callback(std::function< void(uint8_t)> &&callback)
Providing packet encoding functions for exchanging data with a remote host.
uint32_t IRAM_ATTR HOT millis()