7static const char *
const TAG =
"select";
54 ESP_LOGW(TAG,
"'%s' - Select has no options", name);
67 ESP_LOGD(TAG,
"'%s' - Setting", name);
69 ESP_LOGW(TAG,
"'%s' - No option set", name);
76 ESP_LOGD(TAG,
"'%s' - Selecting %s, with%s cycling", name,
78 this->
cycle_ ? LOG_STR_LITERAL(
"") : LOG_STR_LITERAL(
"out"));
80 const auto size =
options.size();
92 return active_index - 1;
96 return active_index + 1;
107 ESP_LOGW(TAG,
"'%s' - SelectCall performed without selecting an operation", name);
112 auto target_index = this->calculate_target_index_(name);
113 if (!target_index.has_value()) {
117 auto idx = target_index.value();
119 ESP_LOGD(TAG,
"'%s' - Set selected option to: %s", name, parent->option_at(idx));
120 parent->control(idx);
const StringRef & get_name() const
constexpr const char * c_str() const
value_type const & value() const
SelectCall & select_next(bool cycle)
SelectCall & with_index(size_t index)
optional< size_t > index_
SelectCall & select_last()
SelectCall & with_cycle(bool cycle)
SelectCall & select_previous(bool cycle)
SelectOperation operation_
SelectCall & with_operation(SelectOperation operation)
SelectCall & set_index(size_t index)
SelectCall & set_option(const char *option, size_t len)
SelectCall & select_first()
SelectCall & with_option(const char *option, size_t len)
size_t size() const
Return the number of options in this select component.
optional< size_t > index_of(const char *option, size_t len) const
Find the (optional) index offset of the provided option value.
const FixedVector< const char * > & get_options() const