9static const char *
const TAG =
"event";
13 const char *found =
nullptr;
15 if (strcmp(
type, event_type.c_str()) == 0) {
20 if (found ==
nullptr) {
21 ESP_LOGE(TAG,
"'%s': invalid event type for trigger(): %s", this->
get_name().c_str(), event_type.c_str());
24 this->last_event_type_ = found;
25 ESP_LOGD(TAG,
"'%s' Triggered event '%s'", this->
get_name().c_str(), this->last_event_type_);
27#if defined(USE_EVENT) && defined(USE_CONTROLLER_REGISTRY)
34 for (
const char *
type : event_types) {
37 this->last_event_type_ =
nullptr;
42 for (
const char *
type : event_types) {
45 this->last_event_type_ =
nullptr;
static void notify_event(event::Event *obj)
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...
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)
void add_on_event_callback(std::function< void(const std::string &event_type)> &&callback)
FixedVector< const char * > types_
CallbackManager< void(const std::string &event_type)> event_callback_
Providing packet encoding functions for exchanging data with a remote host.