Search in sources :

Example 1 with GetLightSensorStatusResponse

use of org.opensmartgridplatform.adapter.protocol.iec61850.device.lmd.GetLightSensorStatusResponse in project open-smart-grid-platform by OSGP.

the class PublicLightingGetLightSensorStatusRequestMessageProcessor method handleDeviceResponse.

@Override
public void handleDeviceResponse(final DeviceResponse deviceResponse, final org.opensmartgridplatform.shared.infra.jms.ResponseMessageSender responseMessageSender, final DomainInformation domainInformation, final String messageType, final int retryCount, final boolean isScheduled) {
    LOGGER.info("Override for handleDeviceResponse() by PublicLightingGetLightSensorStatusRequestMessageProcessor");
    final GetLightSensorStatusResponse response = (GetLightSensorStatusResponse) deviceResponse;
    this.handleGetLightSensorStatusResponse(response, responseMessageSender, domainInformation, messageType, retryCount, isScheduled);
}
Also used : GetLightSensorStatusResponse(org.opensmartgridplatform.adapter.protocol.iec61850.device.lmd.GetLightSensorStatusResponse)

Example 2 with GetLightSensorStatusResponse

use of org.opensmartgridplatform.adapter.protocol.iec61850.device.lmd.GetLightSensorStatusResponse 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);
    }
}
Also used : Iec61850GetLightSensorStatusCommand(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850GetLightSensorStatusCommand) LightMeasurementDevice(org.opensmartgridplatform.core.db.api.iec61850.entities.LightMeasurementDevice) GetLightSensorStatusResponse(org.opensmartgridplatform.adapter.protocol.iec61850.device.lmd.GetLightSensorStatusResponse) ConnectionFailureException(org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ConnectionFailureException) DeviceConnection(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection) LightSensorStatusDto(org.opensmartgridplatform.dto.valueobjects.LightSensorStatusDto) ConnectionFailureException(org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ConnectionFailureException) JMSException(javax.jms.JMSException) NodeException(org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.NodeException)

Aggregations

GetLightSensorStatusResponse (org.opensmartgridplatform.adapter.protocol.iec61850.device.lmd.GetLightSensorStatusResponse)2 JMSException (javax.jms.JMSException)1 ConnectionFailureException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ConnectionFailureException)1 NodeException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.NodeException)1 DeviceConnection (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection)1 Iec61850GetLightSensorStatusCommand (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850GetLightSensorStatusCommand)1 LightMeasurementDevice (org.opensmartgridplatform.core.db.api.iec61850.entities.LightMeasurementDevice)1 LightSensorStatusDto (org.opensmartgridplatform.dto.valueobjects.LightSensorStatusDto)1