use of com.alliander.osgp.oslp.Oslp.RelayConfiguration in project Protocol-Adapter-OSLP by OSGP.
the class OslpChannelHandler method createRelayConfiguration.
/**
* Create relay configuration based on stored configuration values.
*/
private static RelayConfiguration createRelayConfiguration(final List<DeviceOutputSetting> outputSettings) {
final RelayConfiguration.Builder configuration = RelayConfiguration.newBuilder();
for (final DeviceOutputSetting dos : outputSettings) {
final IndexAddressMap.Builder relayMap = IndexAddressMap.newBuilder().setIndex(OslpUtils.integerToByteString(dos.getInternalId())).setAddress(OslpUtils.integerToByteString(dos.getExternalId()));
// Map device-simulator enum OutputType to OSLP enum RelayType
if (dos.getOutputType() == OutputType.LIGHT) {
relayMap.setRelayType(RelayType.LIGHT);
} else if (dos.getOutputType() == OutputType.TARIFF) {
relayMap.setRelayType(RelayType.TARIFF);
} else {
relayMap.setRelayType(RelayType.RT_NOT_SET);
}
configuration.addAddressMap(relayMap);
}
return configuration.build();
}
Aggregations