8static const char *
const TAG =
"select";
59 ESP_LOGW(TAG,
"'%s' - Select has no options", name);
72 ESP_LOGD(TAG,
"'%s' - Setting", name);
74 ESP_LOGW(TAG,
"'%s' - No option set", name);
81 ESP_LOGD(TAG,
"'%s' - Selecting %s, with%s cycling", name,
83 this->
cycle_ ? LOG_STR_LITERAL(
"") : LOG_STR_LITERAL(
"out"));
85 const auto size =
options.size();
97 return active_index - 1;
101 return active_index + 1;
112 ESP_LOGW(TAG,
"'%s' - SelectCall performed without selecting an operation", name);
117 auto target_index = this->calculate_target_index_(name);
118 if (!target_index.has_value()) {
122 auto idx = target_index.value();
124 ESP_LOGD(TAG,
"'%s' - Set selected option to: %s", name, parent->option_at(idx));
125 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 std::string &option)
SelectCall & with_option(const std::string &option)
SelectCall & select_first()
size_t size() const
Return the number of options in this select component.
optional< size_t > index_of(const std::string &option) const
Find the (optional) index offset of the provided option value.
const FixedVector< const char * > & get_options() const
Providing packet encoding functions for exchanging data with a remote host.