ESPHome  2022.12.8
e131.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef USE_ARDUINO
4 
6 
7 #include <map>
8 #include <memory>
9 #include <set>
10 #include <vector>
11 
12 class UDP;
13 
14 namespace esphome {
15 namespace e131 {
16 
17 class E131AddressableLightEffect;
18 
20 
22 
23 struct E131Packet {
24  uint16_t count;
26 };
27 
29  public:
30  E131Component();
31  ~E131Component();
32 
33  void setup() override;
34  void loop() override;
35  float get_setup_priority() const override { return setup_priority::AFTER_WIFI; }
36 
37  void add_effect(E131AddressableLightEffect *light_effect);
38  void remove_effect(E131AddressableLightEffect *light_effect);
39 
40  void set_method(E131ListenMethod listen_method) { this->listen_method_ = listen_method; }
41 
42  protected:
43  bool packet_(const std::vector<uint8_t> &data, int &universe, E131Packet &packet);
44  bool process_(int universe, const E131Packet &packet);
45  bool join_igmp_groups_();
46  void join_(int universe);
47  void leave_(int universe);
48 
50  std::unique_ptr<UDP> udp_;
51  std::set<E131AddressableLightEffect *> light_effects_;
52  std::map<int, int> universe_consumers_;
53  std::map<int, E131Packet> universe_packets_;
54 };
55 
56 } // namespace e131
57 } // namespace esphome
58 
59 #endif // USE_ARDUINO
void setup()
void loop()
std::map< int, E131Packet > universe_packets_
Definition: e131.h:53
const float AFTER_WIFI
For components that should be initialized after WiFi is connected.
Definition: component.cpp:25
uint8_t values[E131_MAX_PROPERTY_VALUES_COUNT]
Definition: e131.h:25
uint16_t universe
std::map< int, int > universe_consumers_
Definition: e131.h:52
std::unique_ptr< UDP > udp_
Definition: e131.h:50
const int E131_MAX_PROPERTY_VALUES_COUNT
Definition: e131.h:21
float get_setup_priority() const override
Definition: e131.h:35
std::set< E131AddressableLightEffect * > light_effects_
Definition: e131.h:51
E131ListenMethod
Definition: e131.h:19
Definition: a4988.cpp:4
void set_method(E131ListenMethod listen_method)
Definition: e131.h:40