diff --git a/bunti_server/src/main/java/de/ctdo/bunti/artnet/.gitignore b/bunti_server/src/main/java/de/ctdo/bunti/artnet/.gitignore new file mode 100644 index 0000000..4144361 --- /dev/null +++ b/bunti_server/src/main/java/de/ctdo/bunti/artnet/.gitignore @@ -0,0 +1 @@ +/SimpleArtNetSenderImpl.java diff --git a/bunti_server/src/main/java/de/ctdo/bunti/artnet/SimpleArtNetSenderImpl.java b/bunti_server/src/main/java/de/ctdo/bunti/artnet/SimpleArtNetSenderImpl.java deleted file mode 100644 index 87a8c74..0000000 --- a/bunti_server/src/main/java/de/ctdo/bunti/artnet/SimpleArtNetSenderImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -package de.ctdo.bunti.artnet; - -import java.util.Map; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - - -import de.ctdo.bunti.artnet.packets.ArtDmxPacket; - -@Component -public class SimpleArtNetSenderImpl implements SimpleArtNetSender { - - private ArtNetSocket socket; - private int sequence = 0; - - @Autowired - public void setSocket(ArtNetSocket socket) { - this.socket = socket; - } - - @Override - public void sendDMXData(Map dmxdata, String adr) { - - ArtDmxPacket packet = new ArtDmxPacket(); - int size = dmxdata.size(); - - byte[] arr = new byte[size]; - - for (int i = 0; i < dmxdata.size(); i++) { - arr[i] = (byte)(dmxdata.get(i) & 0xff); - } - - packet.setSequenceID(sequence++); - packet.setDMX(arr, arr.length); - packet.setUniverse(0, 0); - - socket.unicastPacket(packet, adr); - - } -} diff --git a/bunti_server/src/main/java/de/ctdo/bunti/artnet/packets/ArtDmxPacket.java b/bunti_server/src/main/java/de/ctdo/bunti/artnet/packets/ArtDmxPacket.java index 4f93f20..18e736d 100644 --- a/bunti_server/src/main/java/de/ctdo/bunti/artnet/packets/ArtDmxPacket.java +++ b/bunti_server/src/main/java/de/ctdo/bunti/artnet/packets/ArtDmxPacket.java @@ -19,7 +19,6 @@ package de.ctdo.bunti.artnet.packets; - public class ArtDmxPacket extends ArtNetPacket { private int numChannels; diff --git a/bunti_server/src/main/java/de/ctdo/bunti/dmx/DMX.java b/bunti_server/src/main/java/de/ctdo/bunti/dmx/DMX.java index 84b4c2b..e54a0df 100644 --- a/bunti_server/src/main/java/de/ctdo/bunti/dmx/DMX.java +++ b/bunti_server/src/main/java/de/ctdo/bunti/dmx/DMX.java @@ -2,9 +2,9 @@ package de.ctdo.bunti.dmx; public class DMX { - public static int DMX_CHANNELS_MAX = 511; + public static int DMX_CHANNELS_MAX = (byte) 511; public static int DMX_CHANNELS_MIN = 0; - public static int DMX_CHANNEL_VALUE_MAX = 255; + public static int DMX_CHANNEL_VALUE_MAX = (byte) 255; public static int DMX_CHANNEL_VALUE_MIN = 0; /** diff --git a/bunti_server/src/main/java/de/ctdo/bunti/dmx/DMXMixerImpl.java b/bunti_server/src/main/java/de/ctdo/bunti/dmx/DMXMixerImpl.java index 9263ff7..92e7ded 100644 --- a/bunti_server/src/main/java/de/ctdo/bunti/dmx/DMXMixerImpl.java +++ b/bunti_server/src/main/java/de/ctdo/bunti/dmx/DMXMixerImpl.java @@ -6,8 +6,10 @@ import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; + import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -16,6 +18,7 @@ import de.ctdo.bunti.artnet.SimpleArtNetSender; import de.ctdo.bunti.model.*; @Component + public class DMXMixerImpl implements DMXMixer, ApplicationListener { private final Logger logger = LoggerFactory.getLogger(getClass()); private final String ARTNET_DEVICE_ADDRESS = "192.168.0.90"; @@ -29,12 +32,14 @@ public class DMXMixerImpl implements DMXMixer, ApplicationListener