renamed controller and removed duplicate function to update device data.
This commit is contained in:
parent
c09e08200f
commit
04f77c6553
|
@ -14,11 +14,10 @@ import java.util.*;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping(value = "/control")
|
@RequestMapping(value = "/control")
|
||||||
public class RestController {
|
public class DeviceControlController {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(RestController.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(DeviceControlController.class);
|
||||||
private BuntiController controller;
|
private BuntiController controller;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public final void setController(BuntiController controller) {
|
public final void setController(BuntiController controller) {
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
|
@ -36,15 +35,6 @@ public class RestController {
|
||||||
return controller.getDeviceById(id);
|
return controller.getDeviceById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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.getOptions());
|
|
||||||
return controller.getDeviceById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "/devices", method = RequestMethod.POST)
|
@RequestMapping(value = "/devices", method = RequestMethod.POST)
|
||||||
public String setDevices(@RequestBody DeviceUpdates updates) {
|
public String setDevices(@RequestBody DeviceUpdates updates) {
|
||||||
LOGGER.info("handle PUT /devices" + " request update=" + updates.toString() );
|
LOGGER.info("handle PUT /devices" + " request update=" + updates.toString() );
|
Loading…
Reference in New Issue