diff --git a/pom.xml b/pom.xml
index c877eb5..a69d414 100644
--- a/pom.xml
+++ b/pom.xml
@@ -123,6 +123,13 @@
4.10
+
+ org.easymock
+ easymock
+ 3.0
+ test
+
+
org.eclipse.jetty
jetty-server
diff --git a/src/main/java/de/ctdo/bunti/artnet/ByteUtils.java b/src/main/java/de/ctdo/bunti/artnet/ByteUtils.java
index 33cf9c1..c702647 100644
--- a/src/main/java/de/ctdo/bunti/artnet/ByteUtils.java
+++ b/src/main/java/de/ctdo/bunti/artnet/ByteUtils.java
@@ -31,11 +31,11 @@ public class ByteUtils {
this.data = data;
}
- public static final int byteToUint(byte b) {
+ public static int byteToUint(byte b) {
return (b < 0 ? BYTE_OVERFLOW + b : b);
}
- public static final byte uintToByte(int i) {
+ public static byte uintToByte(int i) {
return (byte)(i & BYTE_MAX);
}
diff --git a/src/main/java/de/ctdo/bunti/artnet/packets/ArtDmxPacket.java b/src/main/java/de/ctdo/bunti/artnet/packets/ArtDmxPacket.java
index 759d475..511f57c 100644
--- a/src/main/java/de/ctdo/bunti/artnet/packets/ArtDmxPacket.java
+++ b/src/main/java/de/ctdo/bunti/artnet/packets/ArtDmxPacket.java
@@ -119,8 +119,8 @@ public class ArtDmxPacket extends ArtNetPacket {
/**
* Sets universe and subnet into data array. Needed because subnet and universe are both 4 bit and share one byte
- * @param subnetID
- * @param universeID
+ * @param subnetID The ArtNet Subnet ID from 0 to 3
+ * @param universeID The ArtNet Universe ID from 0 to 3
*/
private void setUniverse(int subnetID, int universeID) {
getData().setInt16LE(subnetID << HALF_BYTE | universeID, OFFSET_UNIVERSE);
diff --git a/src/main/java/de/ctdo/bunti/dmx/DMXMixerImpl.java b/src/main/java/de/ctdo/bunti/dmx/DMXMixerImpl.java
index 0241d5f..c316c81 100644
--- a/src/main/java/de/ctdo/bunti/dmx/DMXMixerImpl.java
+++ b/src/main/java/de/ctdo/bunti/dmx/DMXMixerImpl.java
@@ -45,6 +45,7 @@ public class DMXMixerImpl implements DMXMixer, ApplicationListener options);
+
}
diff --git a/src/main/java/de/ctdo/bunti/model/Par56Spot.java b/src/main/java/de/ctdo/bunti/model/Par56Spot.java
index d1d1f13..c59c0e2 100644
--- a/src/main/java/de/ctdo/bunti/model/Par56Spot.java
+++ b/src/main/java/de/ctdo/bunti/model/Par56Spot.java
@@ -21,45 +21,45 @@ public class Par56Spot extends BuntiDMXDevice {
addChannel(new DMXChannel(offset, CHANNEL_SPEED));
}
- public final void setColorRed(int value) {
+ public final void setRed(int value) {
setChannelValueByName(CHANNEL_RED, value);
}
- public final void setColorGreen(int value) {
+ public final void setGreen(int value) {
setChannelValueByName(CHANNEL_GREEN, value);
}
- public final void setColorBlue(int value) {
+ public final void setBlue(int value) {
setChannelValueByName(CHANNEL_BLUE, value);
}
- public final int getColorRed() {
+ public final int getRed() {
return getChannelValueByName(CHANNEL_RED);
}
- public final int getColorGreen() {
+ public final int getGreen() {
return getChannelValueByName(CHANNEL_GREEN);
}
- public final int getColorBlue() {
+ public final int getBlue() {
return getChannelValueByName(CHANNEL_BLUE);
}
@Override
public final void switchOff() {
setChannelValueByName(CHANNEL_MODE, DMX.DMX_CHANNEL_VALUE_MIN);
- setColorRed(DMX.DMX_CHANNEL_VALUE_MIN);
- setColorGreen(DMX.DMX_CHANNEL_VALUE_MIN);
- setColorBlue(DMX.DMX_CHANNEL_VALUE_MIN);
+ setRed(DMX.DMX_CHANNEL_VALUE_MIN);
+ setGreen(DMX.DMX_CHANNEL_VALUE_MIN);
+ setBlue(DMX.DMX_CHANNEL_VALUE_MIN);
setChannelValueByName(CHANNEL_SPEED, DMX.DMX_CHANNEL_VALUE_MIN);
}
@Override
public final void switchOn() {
setChannelValueByName(CHANNEL_MODE, DMX.DMX_CHANNEL_VALUE_MIN);
- setColorRed(DMX.DMX_CHANNEL_VALUE_MAX);
- setColorGreen(DMX.DMX_CHANNEL_VALUE_MAX);
- setColorBlue(DMX.DMX_CHANNEL_VALUE_MAX);
+ setRed(DMX.DMX_CHANNEL_VALUE_MAX);
+ setGreen(DMX.DMX_CHANNEL_VALUE_MAX);
+ setBlue(DMX.DMX_CHANNEL_VALUE_MAX);
setChannelValueByName(CHANNEL_SPEED, DMX.DMX_CHANNEL_VALUE_MIN);
}
@@ -71,11 +71,11 @@ public class Par56Spot extends BuntiDMXDevice {
sb.append(", ");
sb.append(getDeviceName());
sb.append(" [");
- sb.append(getColorRed());
+ sb.append(getRed());
sb.append(",");
- sb.append(getColorGreen());
+ sb.append(getGreen());
sb.append(",");
- sb.append(getColorBlue());
+ sb.append(getBlue());
sb.append("]");
return sb.toString();
}
diff --git a/src/main/java/de/ctdo/bunti/web/RestController.java b/src/main/java/de/ctdo/bunti/web/RestController.java
index e7a62c7..3cf790e 100644
--- a/src/main/java/de/ctdo/bunti/web/RestController.java
+++ b/src/main/java/de/ctdo/bunti/web/RestController.java
@@ -30,18 +30,6 @@ public class RestController {
this.controller = controller;
}
- @RequestMapping(value = "/devices2", method = RequestMethod.GET)
- public @ResponseBody DeviceUpdate testGet() {
- DeviceUpdate update = new DeviceUpdate();
- update.setDeviceId(23);
- Map options = new HashMap();
- options.put("red", 111);
- options.put("green", 2);
- options.put("blue", 33);
- update.setOptions(options);
- return update;
- }
-
@RequestMapping(value = "/devices", method = RequestMethod.GET)
public @ResponseBody Collection getAll() {
LOGGER.info("handle GET /devices request");
@@ -54,37 +42,26 @@ public class RestController {
return controller.getDeviceById(id);
}
- @RequestMapping(value = "/devices/{id}", method = RequestMethod.PUT)
- public String setDeviceById(@PathVariable("id") int id, @RequestBody Map update) {
+ @RequestMapping(value = "/devices/{id}", method = RequestMethod.POST)
+ public @ResponseBody BuntiDevice setDeviceById(@PathVariable("id") int id, @RequestBody DeviceUpdate update) {
LOGGER.info("handle PUT /devices/" + id + " request update=" + update.toString() );
- controller.updateDeviceData(id, update);
- return "redirect:devices/" + id;
+
+ controller.updateDeviceData(id, update.getOptions());
+ return controller.getDeviceById(id);
}
- @RequestMapping(value = "/devices", method = RequestMethod.PUT)
- public String setDevices(@RequestBody ArrayList updates) {
+ @RequestMapping(value = "/devices", method = RequestMethod.POST)
+ public String setDevices(@RequestBody DeviceUpdates updates) {
LOGGER.info("handle PUT /devices" + " request update=" + updates.toString() );
- for (DeviceUpdate update: updates) {
+ for (DeviceUpdate update: updates.getUpdates()) {
LOGGER.info("Update deviceId=" + update.getDeviceId());
controller.updateDeviceData(update.getDeviceId(), update.getOptions());
}
- return "redirect:devices";
- }
-
- @RequestMapping(value = "/devices2", method = RequestMethod.PUT)
- public String setDevices2(@RequestBody DeviceUpdate update) {
- LOGGER.info("handle PUT /devices" + " request update=" + update.toString() );
-
- LOGGER.info("Update deviceId=" + update.getDeviceId());
-
- controller.updateDeviceData(update.getDeviceId(), update.getOptions());
-
-
- return "redirect:devices";
+ return "bla";
}
}
diff --git a/src/main/java/de/ctdo/bunti/webmodel/DeviceUpdates.java b/src/main/java/de/ctdo/bunti/webmodel/DeviceUpdates.java
index f8abcd0..55a4b84 100644
--- a/src/main/java/de/ctdo/bunti/webmodel/DeviceUpdates.java
+++ b/src/main/java/de/ctdo/bunti/webmodel/DeviceUpdates.java
@@ -1,10 +1,29 @@
package de.ctdo.bunti.webmodel;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
public class DeviceUpdates {
+ private long timeStamp = 0;
+
+ private List updates = new ArrayList();
+ public List getUpdates() {
+ return updates;
+ }
+ public void setUpdates(List updates) {
+ this.updates = updates;
+ }
+
+ public long getTimeStamp() {
+ return timeStamp;
+ }
+
+ public void setTimeStamp(long timeStamp) {
+ this.timeStamp = timeStamp;
+ }
}
diff --git a/src/main/resources/log4j.xml b/src/main/resources/log4j.xml
index f299a85..d62be13 100644
--- a/src/main/resources/log4j.xml
+++ b/src/main/resources/log4j.xml
@@ -12,7 +12,7 @@
-
+
diff --git a/src/main/webapp/WEB-INF/jsp/index.jsp b/src/main/webapp/WEB-INF/jsp/index.jsp
index fcf046e..3347166 100644
--- a/src/main/webapp/WEB-INF/jsp/index.jsp
+++ b/src/main/webapp/WEB-INF/jsp/index.jsp
@@ -14,53 +14,74 @@
">
Bunti Steuerung
-
+
-
+
-
+