10#include <lwip/ip4_addr.h>
11#include <lwip/ip_addr.h>
16static const char *
const TAG =
"e131";
18static const uint8_t ACN_ID[12] = {0x41, 0x53, 0x43, 0x2d, 0x45, 0x31, 0x2e, 0x31, 0x37, 0x00, 0x00, 0x00};
19static const uint32_t VECTOR_ROOT = 4;
20static const uint32_t VECTOR_FRAME = 2;
21static const uint8_t VECTOR_DMP = 2;
27 uint16_t preamble_size;
28 uint16_t postamble_size;
30 uint16_t root_flength;
35 uint16_t frame_flength;
36 uint32_t frame_vector;
37 uint8_t source_name[64];
40 uint8_t sequence_number;
48 uint16_t first_address;
49 uint16_t address_increment;
50 uint16_t property_value_count;
74 auto err = igmp_joingroup(IP4_ADDR_ANY4, &multicast_addr);
77 ESP_LOGW(TAG,
"IGMP join for %d universe of E1.31 failed. Multicast might not work.",
universe.first);
93 ESP_LOGD(TAG,
"Joined %d universe for E1.31.",
universe);
107 igmp_leavegroup(IP4_ADDR_ANY4, &multicast_addr);
110 ESP_LOGD(TAG,
"Left %d universe for E1.31.",
universe);
117 auto *sbuff =
reinterpret_cast<const E131RawPacket *
>(&data[0]);
119 if (memcmp(sbuff->acn_id, ACN_ID,
sizeof(sbuff->acn_id)) != 0)
121 if (htonl(sbuff->root_vector) != VECTOR_ROOT)
123 if (htonl(sbuff->frame_vector) != VECTOR_FRAME)
125 if (sbuff->dmp_vector != VECTOR_DMP)
127 if (sbuff->property_values[0] != 0)
131 packet.
count = htons(sbuff->property_value_count);
135 memcpy(packet.
values, sbuff->property_values, packet.
count);
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]