Class LXDatagram

All Implemented Interfaces:
LXPath, LXSerializable, LXOutput.InetOutput, LXParameterListener
Direct Known Subclasses:
ArtNetDatagram, ArtSyncDatagram, DDPDatagram, KinetDatagram, OPCDatagram, StreamingACNDatagram

public abstract class LXDatagram extends LXBufferOutput implements LXOutput.InetOutput
  • Field Details

    • buffer

      protected final byte[] buffer
    • error

      public final BooleanParameter error
      Whether this datagram is in an error state
  • Constructor Details

    • LXDatagram

      protected LXDatagram(LX lx, IndexBuffer indexBuffer, int datagramSize)
  • Method Details

    • validateBufferSize

      protected void validateBufferSize()
    • setSocket

      public LXDatagram setSocket(DatagramSocket socket)
    • getErrorState

      protected LXDatagram.ErrorState getErrorState()
    • setAddress

      public LXDatagram setAddress(InetAddress address)
      Sets the destination address of this datagram
      Specified by:
      setAddress in interface LXOutput.InetOutput
      Parameters:
      address - Destination address
      Returns:
      this
    • getAddress

      public InetAddress getAddress()
      Gets the address this datagram sends to
      Specified by:
      getAddress in interface LXOutput.InetOutput
      Returns:
      Destination address
    • setPort

      public LXDatagram setPort(int port)
      Sets the destination port number to send this datagram to
      Specified by:
      setPort in interface LXOutput.InetOutput
      Parameters:
      port - Port number
      Returns:
      this
    • getPort

      public int getPort()
      Gets the destination port number this datagram is sent to
      Specified by:
      getPort in interface LXOutput.InetOutput
      Returns:
      Destination port number
    • getDataBuffer

      public byte[] getDataBuffer()
      Returns the data buffer
      Specified by:
      getDataBuffer in class LXBufferOutput
      Returns:
      Raw byte buffer for output data
    • updateSequenceNumber

      protected void updateSequenceNumber()
      Subclasses may override to update a sequence number in the packet when appropriate as part of the protocol.
    • onSend

      protected void onSend(int[] colors, LXOutput.GammaTable glut, double brightness)
      Invoked by engine to send this packet when new color data is available. The LXDatagram should update the packet object accordingly to contain the appropriate buffer.
      Specified by:
      onSend in class LXOutput
      Parameters:
      colors - Color buffer
      glut - Look-up table with gamma curves for 0-255 levels
      brightness - Brightness level to send at
    • dispose

      public void dispose()
      Invoked when the datagram is no longer needed. Typically a no-op, but subclasses may override if cleanup work is necessary.
      Overrides:
      dispose in class LXComponent