Search in sources :

Example 6 with DeviceMessageStatus

use of com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceMessageStatus in project Protocol-Adapter-OSLP by OSGP.

the class OslpDeviceService method handleOslpResponseSetTransition.

private void handleOslpResponseSetTransition(final DeviceRequest deviceRequest, final OslpEnvelope oslpResponse, final DeviceResponseHandler deviceResponseHandler) {
    this.saveOslpResponseLogEntry(deviceRequest, oslpResponse);
    this.updateSequenceNumber(deviceRequest.getDeviceIdentification(), oslpResponse);
    DeviceMessageStatus status;
    if (oslpResponse.getPayloadMessage().hasSetTransitionResponse()) {
        final Oslp.Status oslpStatus = oslpResponse.getPayloadMessage().getSetTransitionResponse().getStatus();
        status = this.mapper.map(oslpStatus, DeviceMessageStatus.class);
    } else {
        status = DeviceMessageStatus.FAILURE;
    }
    final DeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), status);
    deviceResponseHandler.handleResponse(deviceResponse);
}
Also used : DeviceMessageStatus(com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceMessageStatus) EmptyDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse) GetConfigurationDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse) GetStatusDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse) GetFirmwareVersionDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse) GetPowerUsageHistoryDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetPowerUsageHistoryDeviceResponse) GetActualPowerUsageDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetActualPowerUsageDeviceResponse) DeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceResponse) Oslp(com.alliander.osgp.oslp.Oslp) EmptyDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)

Example 7 with DeviceMessageStatus

use of com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceMessageStatus in project Protocol-Adapter-OSLP by OSGP.

the class OslpDeviceService method buildDeviceResponseSetDeviceVerificationKey.

private DeviceResponse buildDeviceResponseSetDeviceVerificationKey(final DeviceRequest deviceRequest, final OslpEnvelope oslpResponse) {
    DeviceMessageStatus status = null;
    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(), status);
}
Also used : DeviceMessageStatus(com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceMessageStatus) Oslp(com.alliander.osgp.oslp.Oslp) EmptyDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)

Example 8 with DeviceMessageStatus

use of com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceMessageStatus in project Protocol-Adapter-OSLP by OSGP.

the class OslpDeviceService method handleOslpResponseSetScheduleSingle.

private void handleOslpResponseSetScheduleSingle(final SetScheduleDeviceRequest deviceRequest, final OslpEnvelope oslpResponse, final DeviceResponseHandler deviceResponseHandler) {
    this.saveOslpResponseLogEntry(deviceRequest, oslpResponse);
    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(), status);
    deviceResponseHandler.handleResponse(deviceResponse);
}
Also used : DeviceMessageStatus(com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceMessageStatus) EmptyDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse) GetConfigurationDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse) GetStatusDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse) GetFirmwareVersionDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse) GetPowerUsageHistoryDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetPowerUsageHistoryDeviceResponse) GetActualPowerUsageDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetActualPowerUsageDeviceResponse) DeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceResponse) Oslp(com.alliander.osgp.oslp.Oslp) EmptyDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)

Example 9 with DeviceMessageStatus

use of com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceMessageStatus in project Protocol-Adapter-OSLP by OSGP.

the class OslpDeviceService method handleOslpResponseSetReboot.

private void handleOslpResponseSetReboot(final DeviceRequest deviceRequest, final OslpEnvelope oslpResponse, final DeviceResponseHandler deviceResponseHandler) {
    this.saveOslpResponseLogEntry(deviceRequest, oslpResponse);
    this.updateSequenceNumber(deviceRequest.getDeviceIdentification(), oslpResponse);
    DeviceMessageStatus status;
    if (oslpResponse.getPayloadMessage().hasSetRebootResponse()) {
        final Oslp.Status oslpStatus = oslpResponse.getPayloadMessage().getSetRebootResponse().getStatus();
        status = this.mapper.map(oslpStatus, DeviceMessageStatus.class);
    } else {
        status = DeviceMessageStatus.FAILURE;
    }
    final DeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), status);
    deviceResponseHandler.handleResponse(deviceResponse);
}
Also used : DeviceMessageStatus(com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceMessageStatus) EmptyDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse) GetConfigurationDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse) GetStatusDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse) GetFirmwareVersionDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse) GetPowerUsageHistoryDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetPowerUsageHistoryDeviceResponse) GetActualPowerUsageDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetActualPowerUsageDeviceResponse) DeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceResponse) Oslp(com.alliander.osgp.oslp.Oslp) EmptyDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)

Example 10 with DeviceMessageStatus

use of com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceMessageStatus in project Protocol-Adapter-OSLP by OSGP.

the class OslpDeviceService method buildDeviceResponseUpdateDeviceSslCertification.

private DeviceResponse buildDeviceResponseUpdateDeviceSslCertification(final DeviceRequest deviceRequest, final OslpEnvelope oslpResponse) {
    DeviceMessageStatus status = null;
    if (oslpResponse.getPayloadMessage().hasUpdateDeviceSslCertificationResponse()) {
        final Oslp.UpdateDeviceSslCertificationResponse updateDeviceSslCertificationResponse = oslpResponse.getPayloadMessage().getUpdateDeviceSslCertificationResponse();
        status = this.mapper.map(updateDeviceSslCertificationResponse.getStatus(), DeviceMessageStatus.class);
    } else {
        status = DeviceMessageStatus.FAILURE;
    }
    return new EmptyDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), status);
}
Also used : DeviceMessageStatus(com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceMessageStatus) Oslp(com.alliander.osgp.oslp.Oslp) EmptyDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)

Aggregations

DeviceMessageStatus (com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceMessageStatus)18 Oslp (com.alliander.osgp.oslp.Oslp)18 EmptyDeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.EmptyDeviceResponse)15 GetActualPowerUsageDeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetActualPowerUsageDeviceResponse)12 GetConfigurationDeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse)12 GetPowerUsageHistoryDeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetPowerUsageHistoryDeviceResponse)12 DeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceResponse)11 GetFirmwareVersionDeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetFirmwareVersionDeviceResponse)11 GetStatusDeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse)11 PowerUsageDataDto (com.alliander.osgp.dto.valueobjects.PowerUsageDataDto)2 ConfigurationDto (com.alliander.osgp.dto.valueobjects.ConfigurationDto)1 IOException (java.io.IOException)1