use of org.opensmartgridplatform.adapter.domain.shared.GetLightSensorStatusResponse in project open-smart-grid-platform by OSGP.
the class AdHocManagementService method handleGetLightSensorStatusResponse.
// === GET LIGHT SENSOR STATUS ===
public void handleGetLightSensorStatusResponse(final LightSensorStatusDto lightSensorStatusDto, final CorrelationIds ids, final String messageType, final int messagePriority, final ResponseMessageResultType deviceResult, final OsgpException exception) {
LOGGER.info("handleResponse for MessageType: {}", messageType);
final GetLightSensorStatusResponse response = new GetLightSensorStatusResponse();
response.setOsgpException(exception);
response.setResult(deviceResult);
if (lightSensorStatusDto != null) {
response.setLightSensorStatus(new LightSensorStatus(LightSensorStatusType.valueOf(lightSensorStatusDto.getStatus().name())));
this.updateLastCommunicationTime(ids.getDeviceIdentification());
}
if (deviceResult == ResponseMessageResultType.NOT_OK || exception != null) {
LOGGER.error("Device Response not ok.", exception);
}
final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withIds(ids).withResult(response.getResult()).withOsgpException(response.getOsgpException()).withDataObject(response.getLightSensorStatus()).withMessagePriority(messagePriority).build();
if (!OsgpSystemCorrelationUid.CORRELATION_UID.equals(ids.getCorrelationUid())) {
this.webServiceResponseMessageSender.send(responseMessage);
} else {
LOGGER.info("We used sensor status to keep 104 LMDs connected, ignore response: {}", responseMessage);
}
}
Aggregations