use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850GetLightSensorStatusCommand in project open-smart-grid-platform by OSGP.
the class Iec61850LmdDeviceService method getLightSensorStatus.
@Override
public void getLightSensorStatus(final DeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler) throws JMSException {
DeviceConnection devCon = null;
try {
final DeviceConnection deviceConnection = this.connectToDevice(deviceRequest);
devCon = deviceConnection;
final LightMeasurementDevice lmd = this.lmdDataService.findDevice(deviceRequest.getDeviceIdentification());
LOGGER.info("Iec61850LmdDeviceService.getLightSensorStatus() called for LMD: {}", lmd);
final LightSensorStatusDto lightSensorStatus = new Iec61850GetLightSensorStatusCommand(this.deviceMessageLoggingService).getStatusFromDevice(this.iec61850Client, deviceConnection, lmd);
final GetLightSensorStatusResponse lightSensorStatusResponse = new GetLightSensorStatusResponse(deviceRequest, lightSensorStatus);
deviceResponseHandler.handleResponse(lightSensorStatusResponse);
this.enableReporting(deviceConnection, deviceRequest);
} catch (final ConnectionFailureException se) {
this.handleConnectionFailureException(deviceRequest, deviceResponseHandler, se);
this.iec61850DeviceConnectionService.disconnect(devCon, deviceRequest);
} catch (final Exception e) {
this.handleException(deviceRequest, deviceResponseHandler, e);
this.iec61850DeviceConnectionService.disconnect(devCon, deviceRequest);
}
}
Aggregations