]> git.basschouten.com Git - openhab-addons.git/blob
2dddd2fd69daf0105e687f73cdf00b87d7c702a1
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.dmx.internal.dmxoverethernet;
14
15 /**
16  * The {@link DmxOverEthernetPacket} is an abstract class for
17  * DMX over Ethernet packets (ArtNet, sACN)
18  *
19  * @author Jan N. Klug - Initial contribution
20  */
21 public abstract class DmxOverEthernetPacket {
22
23     protected int universeId;
24     protected int payloadSize;
25     protected byte[] rawPacket;
26
27     /**
28      * set payload size
29      *
30      * @param payloadSize payload size (number of DMX channels in this packet)
31      */
32     public abstract void setPayloadSize(int payloadSize);
33
34     /**
35      * sets universe, calculates sender name and broadcast-address
36      *
37      * @param universe
38      */
39     public abstract void setUniverse(int universeId);
40
41     /**
42      * set sequence number
43      *
44      * @param sequenceNo sequence number (0-255)
45      */
46     public abstract void setSequence(int sequenceNo);
47
48     /**
49      * set DMX payload data
50      *
51      * @param payload byte array containing DMX channel data
52      */
53     public abstract void setPayload(byte[] payload);
54
55     /**
56      * set payload data
57      *
58      * @param payload byte array containing DMX channel data
59      * @param payloadSize length of data (no. of channels)
60      */
61     public abstract void setPayload(byte[] payload, int payloadSize);
62
63     /**
64      * get packet for transmission
65      *
66      * @return byte array with raw packet data
67      */
68     public byte[] getRawPacket() {
69         return rawPacket;
70     }
71
72     /**
73      * get packet length
74      *
75      * @return full packet length
76      */
77     public abstract int getPacketLength();
78
79     /**
80      * get universe of this packet
81      *
82      * @return universe number
83      *
84      */
85     public int getUniverse() {
86         return this.universeId;
87     }
88
89     /**
90      * get payload size
91      *
92      * @return number of DMX channels in this packet
93      */
94     public int getPayloadSize() {
95         return this.payloadSize;
96     }
97 }