use of com.alliander.osgp.adapter.protocol.iec61850.device.DeviceRequest in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850SsldDeviceService method updateDeviceSslCertification.
@Override
public void updateDeviceSslCertification(final UpdateDeviceSslCertificationDeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler) throws JMSException {
DeviceConnection deviceConnection = null;
try {
deviceConnection = this.connectToDevice(deviceRequest);
new Iec61850UpdateSslCertificateCommand().pushSslCertificateToDevice(this.iec61850Client, deviceConnection, deviceRequest.getCertification());
this.createSuccessfulDefaultResponse(deviceRequest, deviceResponseHandler);
} catch (final ConnectionFailureException se) {
this.handleConnectionFailureException(deviceRequest, deviceResponseHandler, se);
} catch (final Exception e) {
this.handleException(deviceRequest, deviceResponseHandler, e);
}
this.iec61850DeviceConnectionService.disconnect(deviceConnection, deviceRequest);
}
use of com.alliander.osgp.adapter.protocol.iec61850.device.DeviceRequest in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850SsldDeviceService method handleProtocolAdapterException.
private void handleProtocolAdapterException(final SetScheduleDeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler, final ProtocolAdapterException protocolAdapterException) {
LOGGER.error("Could not complete the request: " + deviceRequest.getMessageType() + " for device: " + deviceRequest.getDeviceIdentification(), protocolAdapterException);
final EmptyDeviceResponse deviceResponse = this.createDefaultResponse(deviceRequest, DeviceMessageStatus.FAILURE);
deviceResponseHandler.handleException(protocolAdapterException, deviceResponse);
}
use of com.alliander.osgp.adapter.protocol.iec61850.device.DeviceRequest in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850SsldDeviceService method getPowerUsageHistory.
@Override
public void getPowerUsageHistory(final GetPowerUsageHistoryDeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler) throws JMSException {
DeviceConnection deviceConnection = null;
try {
deviceConnection = this.connectToDevice(deviceRequest);
// Getting the SSLD for the device output-settings.
final Ssld ssld = this.ssldDataService.findDevice(deviceRequest.getDeviceIdentification());
final List<DeviceOutputSetting> deviceOutputSettingsLightRelays = this.ssldDataService.findByRelayType(ssld, RelayType.LIGHT);
final List<PowerUsageDataDto> powerUsageHistoryData = new Iec61850PowerUsageHistoryCommand().getPowerUsageHistoryDataFromDevice(this.iec61850Client, deviceConnection, deviceRequest.getPowerUsageHistoryContainer(), deviceOutputSettingsLightRelays);
final GetPowerUsageHistoryDeviceResponse deviceResponse = new GetPowerUsageHistoryDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), DeviceMessageStatus.OK, powerUsageHistoryData);
deviceResponseHandler.handleResponse(deviceResponse);
} catch (final ConnectionFailureException se) {
this.handleConnectionFailureException(deviceRequest, deviceResponseHandler, se);
} catch (final Exception e) {
this.handleException(deviceRequest, deviceResponseHandler, e);
}
this.iec61850DeviceConnectionService.disconnect(deviceConnection, deviceRequest);
}
use of com.alliander.osgp.adapter.protocol.iec61850.device.DeviceRequest in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850SsldDeviceService method setEventNotifications.
@Override
public void setEventNotifications(final SetEventNotificationsDeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler) throws JMSException {
final List<EventNotificationTypeDto> eventNotifications = deviceRequest.getEventNotificationsContainer().getEventNotifications();
final String filter = EventType.getEventTypeFilterMaskForNotificationTypes(eventNotifications);
DeviceConnection deviceConnection = null;
try {
deviceConnection = this.connectToDevice(deviceRequest);
new Iec61850SetEventNotificationFilterCommand().setEventNotificationFilterOnDevice(this.iec61850Client, deviceConnection, filter);
this.createSuccessfulDefaultResponse(deviceRequest, deviceResponseHandler);
} catch (final ConnectionFailureException se) {
this.handleConnectionFailureException(deviceRequest, deviceResponseHandler, se);
} catch (final Exception e) {
this.handleException(deviceRequest, deviceResponseHandler, e);
}
this.iec61850DeviceConnectionService.disconnect(deviceConnection, deviceRequest);
}
use of com.alliander.osgp.adapter.protocol.iec61850.device.DeviceRequest in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850SsldDeviceService method getFirmwareVersion.
@Override
public void getFirmwareVersion(final DeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler) throws JMSException {
DeviceConnection deviceConnection = null;
try {
deviceConnection = this.connectToDevice(deviceRequest);
final List<FirmwareVersionDto> firmwareVersions = new Iec61850GetFirmwareVersionCommand().getFirmwareVersionFromDevice(this.iec61850Client, deviceConnection);
final GetFirmwareVersionDeviceResponse deviceResponse = new GetFirmwareVersionDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), firmwareVersions);
deviceResponseHandler.handleResponse(deviceResponse);
} catch (final ConnectionFailureException se) {
this.handleConnectionFailureException(deviceRequest, deviceResponseHandler, se);
} catch (final Exception e) {
this.handleException(deviceRequest, deviceResponseHandler, e);
}
this.iec61850DeviceConnectionService.disconnect(deviceConnection, deviceRequest);
}
Aggregations