Search in sources :

Example 1 with EventBufferConfig

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;
}
Also used : EventBufferConfig(com.automatak.dnp3.EventBufferConfig) MeasurementConfig(net.solarnetwork.node.io.dnp3.domain.MeasurementConfig) ControlConfig(net.solarnetwork.node.io.dnp3.domain.ControlConfig) MeasurementType(net.solarnetwork.node.io.dnp3.domain.MeasurementType) List(java.util.List) ArrayList(java.util.ArrayList) ControlType(net.solarnetwork.node.io.dnp3.domain.ControlType) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

EventBufferConfig (com.automatak.dnp3.EventBufferConfig)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1 ControlConfig (net.solarnetwork.node.io.dnp3.domain.ControlConfig)1 ControlType (net.solarnetwork.node.io.dnp3.domain.ControlType)1 MeasurementConfig (net.solarnetwork.node.io.dnp3.domain.MeasurementConfig)1 MeasurementType (net.solarnetwork.node.io.dnp3.domain.MeasurementType)1