2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.dmx.internal.dmxoverethernet;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
18 * The {@link DmxOverEthernetPacket} is an abstract class for
19 * DMX over Ethernet packets (ArtNet, sACN)
21 * @author Jan N. Klug - Initial contribution
24 public abstract class DmxOverEthernetPacket {
25 protected int universeId;
26 protected int payloadSize;
27 protected byte[] rawPacket = new byte[0];
32 * @param payloadSize payload size (number of DMX channels in this packet)
34 public abstract void setPayloadSize(int payloadSize);
37 * sets universe, calculates sender name and broadcast-address
41 public abstract void setUniverse(int universeId);
46 * @param sequenceNo sequence number (0-255)
48 public abstract void setSequence(int sequenceNo);
51 * set DMX payload data
53 * @param payload byte array containing DMX channel data
55 public abstract void setPayload(byte[] payload);
60 * @param payload byte array containing DMX channel data
61 * @param payloadSize length of data (no. of channels)
63 public abstract void setPayload(byte[] payload, int payloadSize);
66 * get packet for transmission
68 * @return byte array with raw packet data
70 public byte[] getRawPacket() {
77 * @return full packet length
79 public abstract int getPacketLength();
82 * get universe of this packet
84 * @return universe number
87 public int getUniverse() {
88 return this.universeId;
94 * @return number of DMX channels in this packet
96 public int getPayloadSize() {
97 return this.payloadSize;