Search in sources :

Example 1 with SystemFilterDto

use of org.opensmartgridplatform.dto.valueobjects.microgrids.SystemFilterDto in project open-smart-grid-platform by OSGP.

the class CommunicationRecoveryService method createRequest.

private GetDataRequestDto createRequest(final RtuDevice rtu) {
    LOGGER.debug("Creating data request for rtu {}.", rtu.getDeviceIdentification());
    final List<MeasurementFilterDto> measurementFilters = new ArrayList<>();
    measurementFilters.add(new MeasurementFilterDto(MEASUREMENT_ID, MEASUREMENT_NODE, false));
    final List<SystemFilterDto> systemFilters = new ArrayList<>();
    systemFilters.add(new SystemFilterDto(SYSTEM_ID, SYSTEM_TYPE, measurementFilters, false));
    return new GetDataRequestDto(systemFilters);
}
Also used : GetDataRequestDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataRequestDto) SystemFilterDto(org.opensmartgridplatform.dto.valueobjects.microgrids.SystemFilterDto) ArrayList(java.util.ArrayList) MeasurementFilterDto(org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementFilterDto)

Example 2 with SystemFilterDto

use of org.opensmartgridplatform.dto.valueobjects.microgrids.SystemFilterDto in project open-smart-grid-platform by OSGP.

the class Iec61850RtuDeviceService method handleGetData.

// ========================
// PRIVATE HELPER METHODS =
// ========================
private GetDataResponseDto handleGetData(final DeviceConnection connection, final GetDataDeviceRequest deviceRequest) throws ProtocolAdapterException {
    final GetDataRequestDto requestedData = deviceRequest.getDataRequest();
    final Function<GetDataResponseDto> function = new Function<GetDataResponseDto>() {

        @Override
        public GetDataResponseDto apply(final DeviceMessageLog deviceMessageLog) throws ProtocolAdapterException {
            final List<GetDataSystemIdentifierDto> identifiers = new ArrayList<>();
            for (final SystemFilterDto systemFilter : requestedData.getSystemFilters()) {
                final SystemService systemService = Iec61850RtuDeviceService.this.systemServiceFactory.getSystemService(systemFilter);
                final GetDataSystemIdentifierDto getDataSystemIdentifier = systemService.getData(systemFilter, Iec61850RtuDeviceService.this.iec61850Client, connection);
                identifiers.add(getDataSystemIdentifier);
            }
            return new GetDataResponseDto(identifiers, null);
        }
    };
    return this.iec61850Client.sendCommandWithRetry(function, deviceRequest.getDeviceIdentification());
}
Also used : Function(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.Function) GetDataRequestDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataRequestDto) DeviceMessageLog(org.opensmartgridplatform.adapter.protocol.iec61850.domain.valueobjects.DeviceMessageLog) SystemFilterDto(org.opensmartgridplatform.dto.valueobjects.microgrids.SystemFilterDto) SystemService(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.SystemService) GetDataResponseDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataResponseDto) GetDataSystemIdentifierDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)2 GetDataRequestDto (org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataRequestDto)2 SystemFilterDto (org.opensmartgridplatform.dto.valueobjects.microgrids.SystemFilterDto)2 DeviceMessageLog (org.opensmartgridplatform.adapter.protocol.iec61850.domain.valueobjects.DeviceMessageLog)1 SystemService (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.SystemService)1 Function (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.Function)1 GetDataResponseDto (org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataResponseDto)1 GetDataSystemIdentifierDto (org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataSystemIdentifierDto)1 MeasurementFilterDto (org.opensmartgridplatform.dto.valueobjects.microgrids.MeasurementFilterDto)1