use of com.automatak.dnp3.EventBufferConfig in project solarnetwork-node by SolarNetwork.
the class OutstationService method createEventBufferConfig.
private EventBufferConfig createEventBufferConfig(Map<MeasurementType, List<MeasurementConfig>> configs, Map<ControlType, List<ControlConfig>> controlConfigs) {
EventBufferConfig config = EventBufferConfig.allTypes(0);
final int size = getEventBufferSize();
if (configs != null) {
for (Map.Entry<MeasurementType, List<MeasurementConfig>> me : configs.entrySet()) {
MeasurementType type = me.getKey();
List<MeasurementConfig> list = me.getValue();
if (type == null || list == null || list.isEmpty()) {
continue;
}
switch(type) {
case AnalogInput:
config.maxAnalogEvents = size;
break;
case AnalogOutputStatus:
config.maxAnalogOutputStatusEvents = size;
break;
case BinaryInput:
config.maxBinaryEvents = size;
break;
case BinaryOutputStatus:
config.maxBinaryOutputStatusEvents = size;
break;
case Counter:
config.maxCounterEvents = size;
break;
case DoubleBitBinaryInput:
config.maxDoubleBinaryEvents = size;
break;
case FrozenCounter:
config.maxFrozenCounterEvents = size;
break;
}
}
}
if (controlConfigs != null) {
for (Map.Entry<ControlType, List<ControlConfig>> me : controlConfigs.entrySet()) {
ControlType type = me.getKey();
List<ControlConfig> list = me.getValue();
if (type == null || list == null || list.isEmpty()) {
continue;
}
switch(type) {
case Analog:
config.maxAnalogOutputStatusEvents = size;
break;
case Binary:
config.maxBinaryOutputStatusEvents = size;
break;
}
}
}
return config;
}
Aggregations