Skip to content

NetworkReceiveEffect

Source: NetworkReceiveEffect.h

NetworkReceiveEffect

class NetworkReceiveEffect
src/light/effects/NetworkReceiveEffect.h:39

Inherits: EffectBase

Effect that paints the layer from received Art-Net/E1.31/DDP pixels.

NetworkReceiveEffect card NetworkReceiveEffect controls

External light data is another module writing into the layer buffer. So it composes with modifiers and blending like any generated effect. This is the end-to-end pair with NetworkSendDriver, and the receive side for industry senders.

Prior art: MoonLight's D_NetworkIn, WLED's realtime UDP input, and MoonLight v1's ArtNetInModule.

Public Attributes

uint16_t universeStart = 0 : Mirrors the sender's own universe start, for ArtNet and E1.31.

uint16_t channelsPerUniverse = static_cast<uint16_t>(MAX_CHANNELS_PER_UNIVERSE) : Bytes a universe maps to, which also clamps the payload against bleeding into the next.

Public Methods

virtual inline const char * tags() const override : Catalog tags: network input, of MoonLight and v1 lineage.

virtual inline Dim dimensions() const override : The sender decides the geometry, so this writes whatever the layer has.

virtual inline void defineControls() override : Publish the universe start and the per-universe stride.

virtual inline void release() override : Close the three sockets, then chain so the staging buffer is freed too.

virtual inline void prepare() override : Bind the three receive sockets independently, and size the staging buffer to the layer.

virtual inline void tick() override : Drain all three sockets, then copy staging to the layer when anything changed.

inline void applyDmx(uint16_t universe, const uint8_t * data, uint16_t len) : Place one universe's payload, clamped to its stride and ignoring universes outside the buffer.

inline void applyBytes(size_t offset, const uint8_t * data, uint16_t len) : The one clamped write into staging, bound-checked before any addition against an overflow.

inline const uint8_t * stagingData() const : Test seam: the staging bytes, so a test can pin the buffer's lifecycle.

inline size_t stagingBytes() const : Test seam: how many staging bytes are allocated.

More info

Three protocols at once

The effect binds ArtNet 6454, E1.31 5568 and DDP 4048, validating each packet against its format. There is deliberately no protocol control: whatever a sender speaks works. The status field then shows which protocol is arriving and from where. Controllers find the device by broadcasting ArtPoll, which this answers with ArtPollReply.

Hold-last-frame, through a staging buffer

Packets drain into an owned staging buffer, which is copied to the layer each tick. Without that the lights would strobe black between frames. The drain is non-blocking and bounded per tick, so a packet flood cannot wedge the render loop. Sequence fields and DDP's push flag are ignored, so the last write into staging wins.