ESPHome  2024.3.1
e131.h
Go to the documentation of this file.
1 #pragma once
2 
5 
6 #include <cinttypes>
7 #include <map>
8 #include <memory>
9 #include <set>
10 #include <vector>
11 
12 namespace esphome {
13 namespace e131 {
14 
15 class E131AddressableLightEffect;
16 
18 
20 
21 struct E131Packet {
22  uint16_t count;
24 };
25 
27  public:
28  E131Component();
29  ~E131Component();
30 
31  void setup() override;
32  void loop() override;
33  float get_setup_priority() const override { return setup_priority::AFTER_WIFI; }
34 
35  void add_effect(E131AddressableLightEffect *light_effect);
36  void remove_effect(E131AddressableLightEffect *light_effect);
37 
38  void set_method(E131ListenMethod listen_method) { this->listen_method_ = listen_method; }
39 
40  protected:
41  bool packet_(const std::vector<uint8_t> &data, int &universe, E131Packet &packet);
42  bool process_(int universe, const E131Packet &packet);
43  bool join_igmp_groups_();
44  void join_(int universe);
45  void leave_(int universe);
46 
48  std::unique_ptr<socket::Socket> socket_;
49  std::set<E131AddressableLightEffect *> light_effects_;
50  std::map<int, int> universe_consumers_;
51  std::map<int, E131Packet> universe_packets_;
52 };
53 
54 } // namespace e131
55 } // namespace esphome
void setup()
void loop()
std::map< int, E131Packet > universe_packets_
Definition: e131.h:51
const float AFTER_WIFI
For components that should be initialized after WiFi is connected.
Definition: component.cpp:26
std::unique_ptr< socket::Socket > socket_
Definition: e131.h:48
uint8_t values[E131_MAX_PROPERTY_VALUES_COUNT]
Definition: e131.h:23
uint16_t universe
std::map< int, int > universe_consumers_
Definition: e131.h:50
const int E131_MAX_PROPERTY_VALUES_COUNT
Definition: e131.h:19
float get_setup_priority() const override
Definition: e131.h:33
std::set< E131AddressableLightEffect * > light_effects_
Definition: e131.h:49
E131ListenMethod
Definition: e131.h:17
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
void set_method(E131ListenMethod listen_method)
Definition: e131.h:38