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;
16 * The {@link DmxOverEthernetPacket} is an abstract class for
17 * DMX over Ethernet packets (ArtNet, sACN)
19 * @author Jan N. Klug - Initial contribution
21 public abstract class DmxOverEthernetPacket {
23 protected int universeId;
24 protected int payloadSize;
25 protected byte[] rawPacket;
30 * @param payloadSize payload size (number of DMX channels in this packet)
32 public abstract void setPayloadSize(int payloadSize);
35 * sets universe, calculates sender name and broadcast-address
39 public abstract void setUniverse(int universeId);
44 * @param sequenceNo sequence number (0-255)
46 public abstract void setSequence(int sequenceNo);
49 * set DMX payload data
51 * @param payload byte array containing DMX channel data
53 public abstract void setPayload(byte[] payload);
58 * @param payload byte array containing DMX channel data
59 * @param payloadSize length of data (no. of channels)
61 public abstract void setPayload(byte[] payload, int payloadSize);
64 * get packet for transmission
66 * @return byte array with raw packet data
68 public byte[] getRawPacket() {
75 * @return full packet length
77 public abstract int getPacketLength();
80 * get universe of this packet
82 * @return universe number
85 public int getUniverse() {
86 return this.universeId;
92 * @return number of DMX channels in this packet
94 public int getPayloadSize() {
95 return this.payloadSize;