Do some cleanup

This commit is contained in:
Juergen Jung 2012-03-04 01:21:00 +01:00
parent cd5c434198
commit e786db9406
11 changed files with 30 additions and 33 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ bunti.server.iml
.classpath .classpath
.project .project
.settings/ .settings/
target/

View File

@ -5,6 +5,6 @@ import de.ctdo.bunti.artnet.packets.ArtNetPacket;
public interface ArtNetSocket { public interface ArtNetSocket {
public boolean unicastPacket(ArtNetPacket pack, String address); boolean unicastPacket(ArtNetPacket pack, String address);
} }

View File

@ -4,6 +4,6 @@ import java.util.Map;
public interface SimpleArtNetSender { public interface SimpleArtNetSender {
public void sendDMXData(Map<Integer,Integer> dmxdata, String adr); void sendDMXData(Map<Integer,Integer> dmxdata, String adr);
} }

View File

@ -6,7 +6,7 @@ import de.ctdo.bunti.model.*;
public interface BuntiDevicesDAO { public interface BuntiDevicesDAO {
public Collection<BuntiDMXDevice> getAllDMXDevices(); Collection<BuntiDMXDevice> getAllDMXDevices();
public BuntiDevice getDeviceById(int deviceId); BuntiDevice getDeviceById(int deviceId);
} }

View File

@ -2,15 +2,20 @@ package de.ctdo.bunti.dmx;
public class DMX { public class DMX {
public static int DMX_CHANNELS_MAX = (byte) 511; public static final int DMX_CHANNELS_MAX = (byte) 511;
public static int DMX_CHANNELS_MIN = 0; public static final int DMX_CHANNELS_MIN = 0;
public static int DMX_CHANNEL_VALUE_MAX = (byte) 255; public static final int DMX_CHANNEL_VALUE_MAX = (byte) 255;
public static int DMX_CHANNEL_VALUE_MIN = 0; public static final int DMX_CHANNEL_VALUE_MIN = 0;
/** /**
* Offset by which startaddress differs from DMX512 Data Array location * Offset by which startaddress differs from DMX512 Data Array location
*/ */
public static int DMX_STARTADDRESS_OFFSET = -1; public static final int DMX_STARTADDRESS_OFFSET = -1;
private DMX(){
}
/** /**
* Checks the DMX Value boundaries * Checks the DMX Value boundaries

View File

@ -59,11 +59,11 @@ public class DMXChannels {
return false; return false;
} }
// entry must not exist by offset // entry must not exist by offset
if (this.channelByNumber.containsKey(channel.getOffset()) == true) { if (this.channelByNumber.containsKey(channel.getOffset())) {
return false; return false;
} }
// entry must not exist by name // entry must not exist by name
if (this.channelByName.containsKey(channel.getName()) == true) { if (this.channelByName.containsKey(channel.getName())) {
return false; return false;
} }
this.channelByNumber.put(channel.getOffset(), channel); this.channelByNumber.put(channel.getOffset(), channel);

View File

@ -6,7 +6,7 @@ import de.ctdo.bunti.model.BuntiDevice;
public interface DMXMixer { public interface DMXMixer {
public void setDMX512Channel(int channel, int value); void setDMX512Channel(int channel, int value);
public void updateDevice(BuntiDevice device, Map<String, Object> options); void updateDevice(BuntiDevice device, Map<String, Object> options);
} }

View File

@ -20,8 +20,8 @@ import de.ctdo.bunti.model.*;
@Component @Component
public class DMXMixerImpl implements DMXMixer, ApplicationListener<DeviceChangedEvent> { public class DMXMixerImpl implements DMXMixer, ApplicationListener<DeviceChangedEvent> {
private final Logger logger = LoggerFactory.getLogger(getClass()); private static final Logger LOGGER = LoggerFactory.getLogger(DMXMixerImpl.class);
private final String ARTNET_DEVICE_ADDRESS = "192.168.0.90"; private static final String ARTNET_DEVICE_ADDRESS = "192.168.0.90";
private final Map<Integer,Integer> dmxMap = Collections.synchronizedMap(new HashMap<Integer,Integer>()); private final Map<Integer,Integer> dmxMap = Collections.synchronizedMap(new HashMap<Integer,Integer>());
private SimpleArtNetSender artNetSender; private SimpleArtNetSender artNetSender;
@ -59,9 +59,9 @@ public class DMXMixerImpl implements DMXMixer, ApplicationListener<DeviceChanged
dmxMap.putAll(dmxDev.getChannelData()); dmxMap.putAll(dmxDev.getChannelData());
logger.info("setValuesFromOptions on " + device); LOGGER.info("setValuesFromOptions on " + device);
} else { } else {
logger.info("setValuesFromOptions on " + device + " failed"); LOGGER.info("setValuesFromOptions on " + device + " failed");
} }
} }

View File

@ -54,7 +54,7 @@ public class Par56Spot extends BuntiDMXDevice {
setChannelValueByName(CHANNEL_MODE, DMX.DMX_CHANNEL_VALUE_MIN); setChannelValueByName(CHANNEL_MODE, DMX.DMX_CHANNEL_VALUE_MIN);
setColorRed(DMX.DMX_CHANNEL_VALUE_MAX); setColorRed(DMX.DMX_CHANNEL_VALUE_MAX);
setColorGreen(DMX.DMX_CHANNEL_VALUE_MAX); setColorGreen(DMX.DMX_CHANNEL_VALUE_MAX);
setColorBlue(DMX.DMX_CHANNEL_VALUE_MAX);; setColorBlue(DMX.DMX_CHANNEL_VALUE_MAX);
setChannelValueByName(CHANNEL_SPEED, DMX.DMX_CHANNEL_VALUE_MIN); setChannelValueByName(CHANNEL_SPEED, DMX.DMX_CHANNEL_VALUE_MIN);
} }

View File

@ -15,7 +15,7 @@ import de.ctdo.bunti.control.BuntiController;
@Controller @Controller
public class TestController { public class TestController {
private Logger logger = LoggerFactory.getLogger(getClass()); private static final Logger LOGGER = LoggerFactory.getLogger(TestController.class);
BuntiController buntiController; BuntiController buntiController;
@Autowired @Autowired
@ -54,8 +54,7 @@ public class TestController {
buntiController.setDevice(4, options); buntiController.setDevice(4, options);
ModelAndView mav = new ModelAndView("hello.jsp"); return new ModelAndView("hello.jsp");
return mav;
} }
@ -84,8 +83,7 @@ public class TestController {
buntiController.setDevice(5, options); buntiController.setDevice(5, options);
ModelAndView mav = new ModelAndView("hello.jsp"); return new ModelAndView("hello.jsp");
return mav;
} }

View File

@ -1,17 +1,10 @@
package de.ctdo.bunti.websocket; package de.ctdo.bunti.websocket;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.sun.grizzly.websockets.WebSocketEngine;
// das klappt so jedenfalls alles noch nicht :) // das klappt so jedenfalls alles noch nicht :)
@Component @Component
public class BuntiControllerServlet { // extends HttpServlet { public class BuntiControllerServlet { // extends HttpServlet {