Search in sources :

Example 16 with Device

use of com.alliander.osgp.webdevicesimulator.domain.entities.Device in project Protocol-Adapter-OSLP by OSGP.

the class SwitchingServices method tariffSwitchHigh.

public void tariffSwitchHigh(final long deviceId) {
    // Find device
    Device device = this.deviceManagementService.findDevice(deviceId);
    device.setTariffOn(true);
    device = this.deviceManagementService.updateDevice(device);
}
Also used : Device(com.alliander.osgp.webdevicesimulator.domain.entities.Device)

Example 17 with Device

use of com.alliander.osgp.webdevicesimulator.domain.entities.Device in project Protocol-Adapter-OSLP by OSGP.

the class SwitchingServices method lightSwitchOff.

public void lightSwitchOff(final long deviceId) {
    // Find device
    Device device = this.deviceManagementService.findDevice(deviceId);
    device.setLightOn(false);
    device = this.deviceManagementService.updateDevice(device);
}
Also used : Device(com.alliander.osgp.webdevicesimulator.domain.entities.Device)

Example 18 with Device

use of com.alliander.osgp.webdevicesimulator.domain.entities.Device in project Protocol-Adapter-OSLP by OSGP.

the class SwitchingServices method lightSwitchOn.

public void lightSwitchOn(final long deviceId) {
    // Find device
    Device device = this.deviceManagementService.findDevice(deviceId);
    device.setLightOn(true);
    device = this.deviceManagementService.updateDevice(device);
}
Also used : Device(com.alliander.osgp.webdevicesimulator.domain.entities.Device)

Example 19 with Device

use of com.alliander.osgp.webdevicesimulator.domain.entities.Device in project Protocol-Adapter-OSLP by OSGP.

the class SwitchingServices method tariffSwitchLow.

public void tariffSwitchLow(final long deviceId) {
    // Find device
    Device device = this.deviceManagementService.findDevice(deviceId);
    device.setTariffOn(true);
    device = this.deviceManagementService.updateDevice(device);
}
Also used : Device(com.alliander.osgp.webdevicesimulator.domain.entities.Device)

Example 20 with Device

use of com.alliander.osgp.webdevicesimulator.domain.entities.Device in project Protocol-Adapter-OSLP by OSGP.

the class DeviceManagementController method sendEventNotificationCommandAll.

@RequestMapping(value = COMMAND_SENDNOTIFICATION_URL, method = RequestMethod.POST)
@ResponseBody
public String sendEventNotificationCommandAll(@RequestBody final SendEventNotificationRequest request) {
    // Find device
    final Device device = this.deviceManagementService.findDevice(request.getDeviceId());
    final DeviceMessageStatus status = this.registerDevice.sendEventNotificationCommand(request.getDeviceId(), request.getEvent(), request.getDescription(), request.getIndex(), request.getHasTimestamp());
    if (status == DeviceMessageStatus.OK) {
        return this.getFeedbackMessage(FEEDBACK_MESSAGE_KEY_EVENTNOTIFICATION_SENT, device.getDeviceIdentification());
    } else if (status == DeviceMessageStatus.FAILURE) {
        return this.getFeedbackMessage(FEEDBACK_MESSAGE_KEY_DEVICE_ERROR, device.getDeviceIdentification(), this.registerDevice.getErrorMessage());
    } else {
        return FAILURE_URL;
    }
}
Also used : DeviceMessageStatus(com.alliander.osgp.webdevicesimulator.domain.entities.DeviceMessageStatus) Device(com.alliander.osgp.webdevicesimulator.domain.entities.Device) RegisterDevice(com.alliander.osgp.webdevicesimulator.service.RegisterDevice) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

Device (com.alliander.osgp.webdevicesimulator.domain.entities.Device)23 RegisterDevice (com.alliander.osgp.webdevicesimulator.service.RegisterDevice)15 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)5 DeviceSimulatorException (com.alliander.osgp.webdevicesimulator.exceptions.DeviceSimulatorException)4 OslpEnvelope (com.alliander.osgp.oslp.OslpEnvelope)3 DeviceMessageStatus (com.alliander.osgp.webdevicesimulator.domain.entities.DeviceMessageStatus)3 IOException (java.io.IOException)3 UnknownHostException (java.net.UnknownHostException)3 Oslp (com.alliander.osgp.oslp.Oslp)2 ByteString (com.google.protobuf.ByteString)2 Message (com.alliander.osgp.oslp.Oslp.Message)1 OutOfSequenceEvent (com.alliander.osgp.webdevicesimulator.service.OslpChannelHandler.OutOfSequenceEvent)1