use of org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.Iec61850SetScheduleFunction in project open-smart-grid-platform by OSGP.
the class Iec61850SetScheduleCommand method setScheduleOnDevice.
public void setScheduleOnDevice(final Iec61850Client iec61850Client, final DeviceConnection deviceConnection, final SetScheduleDeviceRequest deviceRequest, final Ssld ssld) throws ProtocolAdapterException {
final ScheduleDto scheduleDto = deviceRequest.getSchedule();
final RelayTypeDto relayType = deviceRequest.getRelayType();
final List<ScheduleEntryDto> scheduleList = scheduleDto.getScheduleList();
try {
// Creating a list of all Schedule entries, grouped by relay index.
final Map<Integer, List<ScheduleEntry>> relaySchedulesEntries = this.createScheduleEntries(scheduleList, ssld, relayType);
final Function<Void> function = new Iec61850SetScheduleFunction(iec61850Client, deviceConnection, deviceRequest, ssld, relaySchedulesEntries, this.loggingService, this.ssldDataService);
iec61850Client.sendCommandWithRetry(function, "SetSchedule", deviceConnection.getDeviceIdentification());
} catch (final FunctionalException e) {
throw new ProtocolAdapterException(e.getMessage(), e);
}
}
Aggregations