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;
78 err = igmp_joingroup(IP4_ADDR_ANY4, &multicast_addr);
82 ESP_LOGW(TAG,
"IGMP join for %d universe of E1.31 failed. Multicast might not work.",
universe.first);
98 ESP_LOGD(TAG,
"Joined %d universe for E1.31.",
universe);
113 igmp_leavegroup(IP4_ADDR_ANY4, &multicast_addr);
116 ESP_LOGD(TAG,
"Left %d universe for E1.31.",
universe);
123 auto *sbuff =
reinterpret_cast<const E131RawPacket *
>(&data[0]);
125 if (memcmp(sbuff->acn_id, ACN_ID,
sizeof(sbuff->acn_id)) != 0)
127 if (htonl(sbuff->root_vector) != VECTOR_ROOT)
129 if (htonl(sbuff->frame_vector) != VECTOR_FRAME)
131 if (sbuff->dmp_vector != VECTOR_DMP)
133 if (sbuff->property_values[0] != 0)
137 packet.
count = htons(sbuff->property_value_count);
141 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_
std::unique_ptr< socket::Socket > socket_
std::map< int, int > universe_consumers_
bool packet_(const std::vector< uint8_t > &data, int &universe, E131Packet &packet)
struct @67::@68 __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]