mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 11:25:35 +00:00
Add the C++ `final` specifier to leaf, user-configurable component classes and automation action/trigger/condition primitives so that classes meant to be terminal cannot be subclassed by external components. Only classes never used as a base anywhere in the tree are marked. Part 19 of 21, split alphabetically by component (uart .. wl_134).
32 lines
729 B
C++
32 lines
729 B
C++
#pragma once
|
|
|
|
#include "esphome/core/component.h"
|
|
#include "esphome/components/event/event.h"
|
|
#include "esphome/components/uart/uart.h"
|
|
#include <vector>
|
|
|
|
namespace esphome::uart {
|
|
|
|
class UARTEvent final : public event::Event, public UARTDevice, public Component {
|
|
public:
|
|
void setup() override;
|
|
void loop() override;
|
|
void dump_config() override;
|
|
|
|
void add_event_matcher(const char *event_name, const uint8_t *match_data, size_t match_data_len);
|
|
|
|
protected:
|
|
struct EventMatcher {
|
|
const char *event_name;
|
|
const uint8_t *data;
|
|
size_t data_len;
|
|
};
|
|
|
|
void read_data_();
|
|
std::vector<EventMatcher> matchers_;
|
|
std::vector<uint8_t> buffer_;
|
|
size_t max_matcher_len_ = 0;
|
|
};
|
|
|
|
} // namespace esphome::uart
|