11#include <lwip/ip4_addr.h>
12#include <lwip/ip_addr.h>
17static const char *
const TAG =
"e131";
19static const uint8_t ACN_ID[12] = {0x41, 0x53, 0x43, 0x2d, 0x45, 0x31, 0x2e, 0x31, 0x37, 0x00, 0x00, 0x00};
20static const uint32_t VECTOR_ROOT = 4;
21static const uint32_t VECTOR_FRAME = 2;
22static const uint8_t VECTOR_DMP = 2;
28 uint16_t preamble_size;
29 uint16_t postamble_size;
31 uint16_t root_flength;
36 uint16_t frame_flength;
37 uint32_t frame_vector;
38 uint8_t source_name[64];
41 uint8_t sequence_number;
49 uint16_t first_address;
50 uint16_t address_increment;
51 uint16_t property_value_count;
65#if defined(USE_SOCKET_IMPL_BSD_SOCKETS) || defined(USE_SOCKET_IMPL_LWIP_SOCKETS)
75 network::IPAddress(239, 255, ((entry.universe >> 8) & 0xff), ((entry.universe >> 0) & 0xff));
80 err = igmp_joingroup(IP4_ADDR_ANY4, &multicast_addr);
84 ESP_LOGW(TAG,
"IGMP join for %d universe of E1.31 failed. Multicast might not work.", entry.universe);
102 if (consumer !=
nullptr) {
103 if (consumer->consumers++ > 0) {
111 ESP_LOGD(TAG,
"Joined %d universe for E1.31.",
universe);
117 if (consumer ==
nullptr)
120 if (--consumer->consumers > 0) {
128 igmp_leavegroup(IP4_ADDR_ANY4, &multicast_addr);
131 ESP_LOGD(TAG,
"Left %d universe for E1.31.",
universe);
138 auto *sbuff =
reinterpret_cast<const E131RawPacket *
>(data);
140 if (memcmp(sbuff->acn_id, ACN_ID,
sizeof(sbuff->acn_id)) != 0)
142 if (htonl(sbuff->root_vector) != VECTOR_ROOT)
144 if (htonl(sbuff->frame_vector) != VECTOR_FRAME)
146 if (sbuff->dmp_vector != VECTOR_DMP)
148 if (sbuff->property_values[0] != 0)
152 packet.
count = htons(sbuff->property_value_count);
156 memcpy(packet.
values, sbuff->property_values, packet.
count);
Helper class to lock the lwIP TCPIP core when making lwIP API calls from non-TCPIP threads.
void leave_(int universe)
E131ListenMethod listen_method_
bool packet_(const uint8_t *data, size_t len, int &universe, E131Packet &packet)
std::unique_ptr< socket::Socket > socket_
UniverseConsumer * find_universe_(int universe)
std::vector< UniverseConsumer > universe_consumers_
struct @65::@66 __attribute__
uint8_t property_values[E131_MAX_PROPERTY_VALUES_COUNT]
const int E131_MAX_PROPERTY_VALUES_COUNT
const size_t E131_MIN_PACKET_SIZE
Providing packet encoding functions for exchanging data with a remote host.
uint8_t values[E131_MAX_PROPERTY_VALUES_COUNT]