Search in sources :

Example 1 with SetDataSystemIdentifierDto

use of com.alliander.osgp.dto.valueobjects.microgrids.SetDataSystemIdentifierDto in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850RtuDeviceService method handleSetData.

private void handleSetData(final DeviceConnection connection, final SetDataDeviceRequest deviceRequest) throws ProtocolAdapterException {
    final SetDataRequestDto setDataRequest = deviceRequest.getSetDataRequest();
    final String serverName = this.getServerName(deviceRequest);
    final Function<Void> function = new Function<Void>() {

        @Override
        public Void apply(final DeviceMessageLog deviceMessageLog) throws Exception {
            final Iec61850RtuDeviceReportingService reportingService = new Iec61850RtuDeviceReportingService(serverName);
            reportingService.enableReportingOnDevice(connection, deviceRequest.getDeviceIdentification());
            for (final SetDataSystemIdentifierDto identifier : setDataRequest.getSetDataSystemIdentifiers()) {
                final SystemService systemService = Iec61850RtuDeviceService.this.systemServiceFactory.getSystemService(identifier.getSystemType());
                systemService.setData(identifier, Iec61850RtuDeviceService.this.iec61850Client, connection);
            }
            return null;
        }
    };
    this.iec61850Client.sendCommandWithRetry(function, deviceRequest.getDeviceIdentification());
}
Also used : Function(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.Function) DeviceMessageLog(com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.DeviceMessageLog) SystemService(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.SystemService) SetDataRequestDto(com.alliander.osgp.dto.valueobjects.microgrids.SetDataRequestDto) Iec61850RtuDeviceReportingService(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.reporting.Iec61850RtuDeviceReportingService) SetDataSystemIdentifierDto(com.alliander.osgp.dto.valueobjects.microgrids.SetDataSystemIdentifierDto)

Aggregations

DeviceMessageLog (com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.DeviceMessageLog)1 SystemService (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.SystemService)1 Function (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.Function)1 Iec61850RtuDeviceReportingService (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.reporting.Iec61850RtuDeviceReportingService)1 SetDataRequestDto (com.alliander.osgp.dto.valueobjects.microgrids.SetDataRequestDto)1 SetDataSystemIdentifierDto (com.alliander.osgp.dto.valueobjects.microgrids.SetDataSystemIdentifierDto)1