8static const char *
const TAG =
"event";
12 const char *found =
nullptr;
14 if (strcmp(
type, event_type.c_str()) == 0) {
19 if (found ==
nullptr) {
20 ESP_LOGE(TAG,
"'%s': invalid event type for trigger(): %s", this->
get_name().c_str(), event_type.c_str());
23 this->last_event_type_ = found;
24 ESP_LOGV(TAG,
"'%s' >> '%s'", this->
get_name().c_str(), this->last_event_type_);
26#if defined(USE_EVENT) && defined(USE_CONTROLLER_REGISTRY)
27 ControllerRegistry::notify_event(
this);
33 for (
const char *
type : event_types) {
36 this->last_event_type_ =
nullptr;
41 for (
const char *
type : event_types) {
44 this->last_event_type_ =
nullptr;
const StringRef & get_name() const
Fixed-capacity vector - allocates once at runtime, never reallocates This avoids std::vector template...
void push_back(const T &value)
Add element without bounds checking Caller must ensure sufficient capacity was allocated via init() S...
StringRef is a reference to a string owned by something else.
LazyCallbackManager< void(StringRef event_type)> event_callback_
void set_event_types(std::initializer_list< const char * > event_types)
Set the event types supported by this event (from initializer list).
void trigger(const std::string &event_type)
FixedVector< const char * > types_