示例#1
0
 @RequestMapping("/device_status")
 public @ResponseBody DeviceStatus[] getDeviceStatus() {
   Device devices[] = powerControlDeviceService.getDevices();
   DeviceStatus[] deviceStatus = new DeviceStatus[devices.length];
   for (int i = 0; i < devices.length; i++) {
     deviceStatus[i] = new DeviceStatus(devices[i]);
   }
   return deviceStatus;
 }
示例#2
0
 @RequestMapping("/device_status/{id}")
 public @ResponseBody DeviceStatus getDeviceStatus(@PathVariable("id") long id) {
   Device devices[] = powerControlDeviceService.getDevices();
   for (int i = 0; i < devices.length; i++) {
     if (devices[i].getId() == id) {
       return new DeviceStatus(devices[i]);
     }
   }
   return null;
 }