use of org.opensmartgridplatform.webdevicesimulator.domain.entities.DeviceMessageStatus in project open-smart-grid-platform by OSGP.
the class DeviceManagementController method sendRegisterDeviceCommand.
@PostMapping(value = COMMAND_REGISTER_URL)
@ResponseBody
public String sendRegisterDeviceCommand(@RequestBody final RegisterDeviceRequest request) {
// Find device
final Device device = this.deviceManagementService.findDevice(request.getDeviceId());
final DeviceMessageStatus status = this.registerDevice.sendRegisterDeviceCommand(request.getDeviceId(), request.getHasSchedule());
if (status == DeviceMessageStatus.OK) {
return this.getFeedbackMessage(FEEDBACK_MESSAGE_KEY_DEVICE_REGISTERED, device.getDeviceIdentification(), this.registerDevice.getCurrentTime());
} else if (status == DeviceMessageStatus.FAILURE) {
return this.getFeedbackMessage(FEEDBACK_MESSAGE_KEY_DEVICE_ERROR, device.getDeviceIdentification(), this.registerDevice.getErrorMessage());
} else {
return FAILURE_URL;
}
}
Aggregations