bunti/src/main/java/de/ctdo/bunti/web/TestController.java

91 lines
2.1 KiB
Java

package de.ctdo.bunti.web;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import de.ctdo.bunti.control.BuntiController;
@Controller
public class TestController {
private static final Logger LOGGER = LoggerFactory.getLogger(TestController.class);
BuntiController buntiController;
@Autowired
public void setBuntiController(BuntiController buntiController) {
this.buntiController = buntiController;
}
@RequestMapping("/foobar")
public ModelAndView blafasel() {
Map<String,Object> options = new HashMap<String,Object>();
options.put("red", 124);
options.put("green", 23);
options.put("blue", 217);
buntiController.setDevice(0, options);
options.put("red", 0);
options.put("green", 255);
options.put("blue", 255);
buntiController.setDevice(1, options);
options.put("red", 42);
options.put("green", 222);
options.put("blue", 111);
buntiController.setDevice(2, options);
options.put("red", 10);
options.put("green", 25);
options.put("blue", 33);
buntiController.setDevice(3, options);
options.clear();
options.put("speed", 128);
options.put("intensity", 255);
buntiController.setDevice(4, options);
return new ModelAndView("hello.jsp");
}
@RequestMapping("/foobar2")
public ModelAndView blafasel2() {
Map<String,Object> options = new HashMap<String,Object>();
options.put("red", 0);
options.put("green", 23);
options.put("blue", 42);
buntiController.setDevice(2, options);
options.put("red", 111);
options.put("green", 78);
options.put("blue", 255);
buntiController.setDevice(3, options);
options.put("red", 55);
options.put("green", 44);
options.put("blue", 66);
options.put("mode", 22);
options.put("speed", 255);
buntiController.setDevice(5, options);
return new ModelAndView("hello.jsp");
}
}