ESPHome  2024.11.1
e131.h
Go to the documentation of this file.
1 #pragma once
2 #include "esphome/core/defines.h"
3 #ifdef USE_NETWORK
6 
7 #include <cinttypes>
8 #include <map>
9 #include <memory>
10 #include <set>
11 #include <vector>
12 
13 namespace esphome {
14 namespace e131 {
15 
16 class E131AddressableLightEffect;
17 
19 
21 
22 struct E131Packet {
23  uint16_t count;
25 };
26 
28  public:
29  E131Component();
30  ~E131Component();
31 
32  void setup() override;
33  void loop() override;
34  float get_setup_priority() const override { return setup_priority::AFTER_WIFI; }
35 
36  void add_effect(E131AddressableLightEffect *light_effect);
37  void remove_effect(E131AddressableLightEffect *light_effect);
38 
39  void set_method(E131ListenMethod listen_method) { this->listen_method_ = listen_method; }
40 
41  protected:
42  bool packet_(const std::vector<uint8_t> &data, int &universe, E131Packet &packet);
43  bool process_(int universe, const E131Packet &packet);
44  bool join_igmp_groups_();
45  void join_(int universe);
46  void leave_(int universe);
47 
49  std::unique_ptr<socket::Socket> socket_;
50  std::set<E131AddressableLightEffect *> light_effects_;
51  std::map<int, int> universe_consumers_;
52  std::map<int, E131Packet> universe_packets_;
53 };
54 
55 } // namespace e131
56 } // namespace esphome
57 #endif
void setup()
void loop()
std::map< int, E131Packet > universe_packets_
Definition: e131.h:52
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:49
uint8_t values[E131_MAX_PROPERTY_VALUES_COUNT]
Definition: e131.h:24
uint16_t universe
std::map< int, int > universe_consumers_
Definition: e131.h:51
const int E131_MAX_PROPERTY_VALUES_COUNT
Definition: e131.h:20
float get_setup_priority() const override
Definition: e131.h:34
std::set< E131AddressableLightEffect * > light_effects_
Definition: e131.h:50
E131ListenMethod
Definition: e131.h:18
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_method(E131ListenMethod listen_method)
Definition: e131.h:39