Search in sources :

Example 1 with GetActualPowerUsageDeviceResponse

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

the class OslpDeviceService method buildDeviceResponseGetActualPowerUsage.

private DeviceResponse buildDeviceResponseGetActualPowerUsage(final DeviceRequest deviceRequest, final OslpEnvelope oslpResponse) {
    PowerUsageDataDto actualPowerUsageData = null;
    DeviceMessageStatus status = null;
    if (oslpResponse.getPayloadMessage().hasGetActualPowerUsageResponse()) {
        final Oslp.GetActualPowerUsageResponse response = oslpResponse.getPayloadMessage().getGetActualPowerUsageResponse();
        actualPowerUsageData = this.mapper.map(response.getPowerUsageData(), PowerUsageDataDto.class);
        status = this.mapper.map(response.getStatus(), DeviceMessageStatus.class);
    } else {
        status = DeviceMessageStatus.FAILURE;
    }
    return new GetActualPowerUsageDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), status, actualPowerUsageData);
}
Also used : DeviceMessageStatus(com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceMessageStatus) GetActualPowerUsageDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetActualPowerUsageDeviceResponse) PowerUsageDataDto(com.alliander.osgp.dto.valueobjects.PowerUsageDataDto) Oslp(com.alliander.osgp.oslp.Oslp)

Aggregations

DeviceMessageStatus (com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceMessageStatus)1 GetActualPowerUsageDeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetActualPowerUsageDeviceResponse)1 PowerUsageDataDto (com.alliander.osgp.dto.valueobjects.PowerUsageDataDto)1 Oslp (com.alliander.osgp.oslp.Oslp)1