ESPHome 2026.2.4
Loading...
Searching...
No Matches
e131.h
Go to the documentation of this file.
1#pragma once
3#ifdef USE_NETWORK
4#if defined(USE_SOCKET_IMPL_BSD_SOCKETS) || defined(USE_SOCKET_IMPL_LWIP_SOCKETS)
6#elif defined(USE_SOCKET_IMPL_LWIP_TCP)
7#include <WiFiUdp.h>
8#endif
10
11#include <cinttypes>
12#include <map>
13#include <memory>
14#include <vector>
15
16namespace esphome {
17namespace e131 {
18
19class E131AddressableLightEffect;
20
22
24
29
31 public:
34
35 void setup() override;
36 void loop() override;
37 float get_setup_priority() const override { return setup_priority::AFTER_WIFI; }
38
39 void add_effect(E131AddressableLightEffect *light_effect);
40 void remove_effect(E131AddressableLightEffect *light_effect);
41
42 void set_method(E131ListenMethod listen_method) { this->listen_method_ = listen_method; }
43
44 protected:
45 bool packet_(const uint8_t *data, size_t len, int &universe, E131Packet &packet);
46 bool process_(int universe, const E131Packet &packet);
47 bool join_igmp_groups_();
48 void join_(int universe);
49 void leave_(int universe);
50
52#if defined(USE_SOCKET_IMPL_BSD_SOCKETS) || defined(USE_SOCKET_IMPL_LWIP_SOCKETS)
53 std::unique_ptr<socket::Socket> socket_;
54#elif defined(USE_SOCKET_IMPL_LWIP_TCP)
55 WiFiUDP udp_;
56#endif
57 std::vector<E131AddressableLightEffect *> light_effects_;
58 std::map<int, int> universe_consumers_;
59};
60
61} // namespace e131
62} // namespace esphome
63#endif
std::vector< E131AddressableLightEffect * > light_effects_
Definition e131.h:57
void loop() override
Definition e131.cpp:69
void add_effect(E131AddressableLightEffect *light_effect)
Definition e131.cpp:106
E131ListenMethod listen_method_
Definition e131.h:51
void remove_effect(E131AddressableLightEffect *light_effect)
Definition e131.cpp:122
bool packet_(const uint8_t *data, size_t len, int &universe, E131Packet &packet)
bool process_(int universe, const E131Packet &packet)
Definition e131.cpp:141
std::unique_ptr< socket::Socket > socket_
Definition e131.h:53
void setup() override
Definition e131.cpp:26
std::map< int, int > universe_consumers_
Definition e131.h:58
void set_method(E131ListenMethod listen_method)
Definition e131.h:42
float get_setup_priority() const override
Definition e131.h:37
uint16_t universe
const int E131_MAX_PROPERTY_VALUES_COUNT
Definition e131.h:23
E131ListenMethod
Definition e131.h:21
@ E131_UNICAST
Definition e131.h:21
@ E131_MULTICAST
Definition e131.h:21
const float AFTER_WIFI
For components that should be initialized after WiFi is connected.
Definition component.cpp:91
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
std::string size_t len
Definition helpers.h:692
uint8_t values[E131_MAX_PROPERTY_VALUES_COUNT]
Definition e131.h:27