8static const char *
const TAG =
"select";
47 const auto &traits = parent->traits;
48 auto options = traits.get_options();
51 ESP_LOGW(TAG,
"'%s' - SelectCall performed without selecting an operation", name);
55 ESP_LOGW(TAG,
"'%s' - Cannot perform SelectCall, select has no options", name);
59 std::string target_value;
62 ESP_LOGD(TAG,
"'%s' - Setting", name);
64 ESP_LOGW(TAG,
"'%s' - No option value set for SelectCall", name);
70 ESP_LOGW(TAG,
"'%s' - No index value set for SelectCall", name);
74 ESP_LOGW(TAG,
"'%s' - Index value %zu out of bounds", name, this->
index_.
value());
86 if (!parent->has_state()) {
89 auto index = parent->index_of(parent->state);
90 if (index.has_value()) {
94 target_value =
options[use_index];
97 target_value =
options[index.value() - 1];
99 target_value =
options[index.value() + 1];
111 ESP_LOGW(TAG,
"'%s' - Option %s is not a valid option", name, target_value.c_str());
115 ESP_LOGD(TAG,
"'%s' - Set selected option to: %s", name, target_value.c_str());
116 parent->control(target_value);
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()
optional< std::string > option_
Providing packet encoding functions for exchanging data with a remote host.