Search in sources :

Example 11 with DeviceMessageStatus

use of org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus in project open-smart-grid-platform by OSGP.

the class OslpDeviceService method handleOslpResponseSetScheduleAstronomicalOffsets.

private void handleOslpResponseSetScheduleAstronomicalOffsets(final SetScheduleDeviceRequest deviceRequest, final OslpEnvelope oslpResponse, final DeviceResponseHandler deviceResponseHandler) {
    this.saveOslpResponseLogEntry(deviceRequest, oslpResponse);
    final DeviceMessageStatus status;
    if (oslpResponse.getPayloadMessage().hasSetConfigurationResponse()) {
        final Oslp.Status oslpStatus = oslpResponse.getPayloadMessage().getSetConfigurationResponse().getStatus();
        status = this.mapper.map(oslpStatus, DeviceMessageStatus.class);
    } else {
        status = DeviceMessageStatus.FAILURE;
    }
    this.updateSequenceNumber(deviceRequest.getDeviceIdentification(), oslpResponse);
    final DeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), deviceRequest.getMessagePriority(), status);
    deviceResponseHandler.handleResponse(deviceResponse);
}
Also used : DeviceMessageStatus(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse) DeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponse) GetConfigurationDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse) GetStatusDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse) GetFirmwareVersionDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse) Oslp(org.opensmartgridplatform.oslp.Oslp) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)

Example 12 with DeviceMessageStatus

use of org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus in project open-smart-grid-platform by OSGP.

the class OslpDeviceService method handleOslpResponseSetReboot.

private void handleOslpResponseSetReboot(final SetScheduleDeviceRequest deviceRequest, final OslpEnvelope oslpResponse, final DeviceResponseHandler deviceResponseHandler) {
    this.saveOslpResponseLogEntry(deviceRequest, oslpResponse);
    final DeviceMessageStatus status;
    if (oslpResponse.getPayloadMessage().hasSetScheduleResponse()) {
        final Oslp.Status oslpStatus = oslpResponse.getPayloadMessage().getSetScheduleResponse().getStatus();
        status = this.mapper.map(oslpStatus, DeviceMessageStatus.class);
    } else {
        status = DeviceMessageStatus.FAILURE;
    }
    this.updateSequenceNumber(deviceRequest.getDeviceIdentification(), oslpResponse);
    final DeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), deviceRequest.getMessagePriority(), status);
    deviceResponseHandler.handleResponse(deviceResponse);
}
Also used : DeviceMessageStatus(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse) DeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponse) GetConfigurationDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse) GetStatusDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse) GetFirmwareVersionDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse) Oslp(org.opensmartgridplatform.oslp.Oslp) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)

Example 13 with DeviceMessageStatus

use of org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus in project open-smart-grid-platform by OSGP.

the class OslpDeviceService method handleOslpResponseStopSelfTest.

private void handleOslpResponseStopSelfTest(final DeviceRequest deviceRequest, final OslpEnvelope oslpResponse, final DeviceResponseHandler deviceResponseHandler) {
    this.saveOslpResponseLogEntry(deviceRequest, oslpResponse);
    this.updateSequenceNumber(deviceRequest.getDeviceIdentification(), oslpResponse);
    final DeviceMessageStatus status;
    if (oslpResponse.getPayloadMessage().hasStopSelfTestResponse()) {
        final Oslp.Status oslpStatus = oslpResponse.getPayloadMessage().getStopSelfTestResponse().getStatus();
        status = this.mapper.map(oslpStatus, DeviceMessageStatus.class);
    } else {
        status = DeviceMessageStatus.FAILURE;
    }
    final DeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), deviceRequest.getMessagePriority(), status);
    deviceResponseHandler.handleResponse(deviceResponse);
}
Also used : DeviceMessageStatus(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse) DeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponse) GetConfigurationDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse) GetStatusDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse) GetFirmwareVersionDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse) Oslp(org.opensmartgridplatform.oslp.Oslp) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)

Example 14 with DeviceMessageStatus

use of org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus in project open-smart-grid-platform by OSGP.

the class OslpDeviceService method buildDeviceResponseSetDeviceVerificationKey.

private DeviceResponse buildDeviceResponseSetDeviceVerificationKey(final DeviceRequest deviceRequest, final OslpEnvelope oslpResponse) {
    final DeviceMessageStatus status;
    if (oslpResponse.getPayloadMessage().hasSetDeviceVerificationKeyResponse()) {
        final Oslp.SetDeviceVerificationKeyResponse setDeviceVerificationKeyResponse = oslpResponse.getPayloadMessage().getSetDeviceVerificationKeyResponse();
        status = this.mapper.map(setDeviceVerificationKeyResponse.getStatus(), DeviceMessageStatus.class);
    } else {
        status = DeviceMessageStatus.FAILURE;
    }
    return new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), deviceRequest.getMessagePriority(), status);
}
Also used : DeviceMessageStatus(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus) Oslp(org.opensmartgridplatform.oslp.Oslp) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)

Example 15 with DeviceMessageStatus

use of org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus in project open-smart-grid-platform by OSGP.

the class OslpDeviceService method handleOslpResponseSetConfiguration.

private void handleOslpResponseSetConfiguration(final DeviceRequest setConfigurationDeviceRequest, final DeviceRequest setRebootDeviceRequest, final OslpEnvelope oslpResponse, final DeviceResponseHandler setConfigurationDeviceResponseHandler, final DeviceResponseHandler setRebootDeviceResponseHandler) {
    this.saveOslpResponseLogEntry(setConfigurationDeviceRequest, oslpResponse);
    this.updateSequenceNumber(setConfigurationDeviceRequest.getDeviceIdentification(), oslpResponse);
    final DeviceMessageStatus status;
    if (oslpResponse.getPayloadMessage().hasSetConfigurationResponse()) {
        final Oslp.Status oslpStatus = oslpResponse.getPayloadMessage().getSetConfigurationResponse().getStatus();
        status = this.mapper.map(oslpStatus, DeviceMessageStatus.class);
    } else {
        status = DeviceMessageStatus.FAILURE;
    }
    final DeviceResponse deviceResponse = new EmptyDeviceResponse(setConfigurationDeviceRequest.getOrganisationIdentification(), setConfigurationDeviceRequest.getDeviceIdentification(), setConfigurationDeviceRequest.getCorrelationUid(), setConfigurationDeviceRequest.getMessagePriority(), status);
    setConfigurationDeviceResponseHandler.handleResponse(deviceResponse);
    if (this.executeRebootAfterSetConfiguration && status.equals(DeviceMessageStatus.OK)) {
        LOGGER.info("Sending SetRebootRequest for device: {}", setConfigurationDeviceRequest.getDeviceIdentification());
        this.setReboot(setRebootDeviceRequest);
    } else {
        LOGGER.info("Not sending SetRebootRequest for device: {} because executeRebootAfterSetConfiguration is false or DeviceMessageStatus is not OK", setConfigurationDeviceRequest.getDeviceIdentification());
        final DeviceResponse emptyDeviceResponse = new EmptyDeviceResponse(setConfigurationDeviceRequest.getOrganisationIdentification(), setConfigurationDeviceRequest.getDeviceIdentification(), setConfigurationDeviceRequest.getCorrelationUid(), setConfigurationDeviceRequest.getMessagePriority(), status);
        setRebootDeviceResponseHandler.handleResponse(emptyDeviceResponse);
    }
}
Also used : DeviceMessageStatus(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse) DeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponse) GetConfigurationDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse) GetStatusDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse) GetFirmwareVersionDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse) Oslp(org.opensmartgridplatform.oslp.Oslp) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)

Aggregations

DeviceMessageStatus (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceMessageStatus)18 Oslp (org.opensmartgridplatform.oslp.Oslp)18 EmptyDeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)17 GetConfigurationDeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse)14 DeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.DeviceResponse)13 GetFirmwareVersionDeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse)13 GetStatusDeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse)13 ConfigurationDto (org.opensmartgridplatform.dto.valueobjects.ConfigurationDto)1