use of com.alliander.osgp.webdevicesimulator.domain.valueobjects.OutputType in project Protocol-Adapter-OSLP by OSGP.
the class OslpChannelHandler method handleSetConfigurationRequest.
private void handleSetConfigurationRequest(final Device device, final Oslp.SetConfigurationRequest setConfigurationRequest) {
if (setConfigurationRequest.hasPreferredLinkType()) {
device.setPreferredLinkType(Enum.valueOf(LinkType.class, setConfigurationRequest.getPreferredLinkType().name()));
}
if (setConfigurationRequest.hasLightType()) {
device.setLightType(Enum.valueOf(LightType.class, setConfigurationRequest.getLightType().name()));
}
if (setConfigurationRequest.hasRelayConfiguration()) {
final List<DeviceOutputSetting> outputSettings = new ArrayList<>();
for (final IndexAddressMap iam : setConfigurationRequest.getRelayConfiguration().getAddressMapList()) {
final int index = iam.getIndex().byteAt(0);
final int address = iam.getAddress().byteAt(0);
final OutputType outputType = OutputType.valueOf(iam.getRelayType().name());
outputSettings.add(new DeviceOutputSetting(index, address, outputType));
}
device.setOutputSettings(outputSettings);
}
}
Aggregations