Ejemplo n.º 1
0
        private void ParseDnpEthernetDevice(int v)
        {
            string deviceName = _configData[v + 4].Trim(new char[] { '"' });
            Device d          = new Device()
            {
                Name = deviceName,
                Type = DeviceType.DnpSlaveEthernet
            };

            Ieds.Add(d);
            ParseDnpDevicePoints(v + 8, d);
        }
Ejemplo n.º 2
0
        private void ParseDnpSerialDevice(int v)
        {
            string deviceName = _configData[v + 1].Trim(new char[] { '"' });
            Device d          = new Device()
            {
                Name = deviceName,
                Type = DeviceType.DnpSlaveSerial
            };

            Ieds.Add(d);
            //Console.WriteLine($"Parsing Serial Dnp Device {_rtuName}.{deviceName}...");
            ParseDnpDevicePoints(v + 5, d);
        }
Ejemplo n.º 3
0
        private void ParseModbusDevice(int v, string device)
        {
            bool   eth = _configData[v + 1].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Length == 3;
            Device d   = new Device()
            {
                Name = device,
                Type = eth? DeviceType.ModbusEthernetIed: DeviceType.ModbusSerialIed
            };

            Ieds.Add(d);

            Regex r2 = new Regex("\"([^\"]*)\"");

            int offset = eth ? 3 : 2;

            for (int i = 0; i < 5; i++)
            {
                string line = _configData[v + offset + i];
                string tag  = r2.Match(line).Value.Trim(new char[] { '"' });

                if (!string.IsNullOrWhiteSpace(tag))
                {
                    _tagDeviceMap.Add(tag.ToLower(), d);
                }
            }

            for (int i = v + 15 + offset; i < _configData.Length; i++)
            {
                if (_configData[i].Split().Length < 7)
                {
                    break;
                }

                string line = _configData[i];
                foreach (Match m in r2.Matches(line))
                {
                    string tag = m.Value.Trim(new char[] { '"' });

                    if (!string.IsNullOrWhiteSpace(tag))
                    {
                        _tagDeviceMap.Add(tag.ToLower(), d);
                    }
                }
            }
        }