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);
}
Aggregations