public static void Register(PointVirtualCollcet points, ILog log)
        {
            var mapping = ModbusPointMapping.GetInstance(log);

            foreach (var point in points.BoolPoints)
            {
                if (mapping.Find(point.Name))
                {
                    log.ErrorLog(string.Concat("Point Register Error:Duplication point name <", point.Name, ">"));
                }
                else
                {
                    mapping.Register(point.Name, point);
                }
            }
            foreach (var point in points.UshortPoints)
            {
                if (mapping.Find(point.Name))
                {
                    log.ErrorLog(string.Concat("Point Register Error:Duplication point name <", point.Name, ">"));
                }
                else
                {
                    mapping.Register(point.Name, point);
                }
            }
        }
Exemplo n.º 2
0
 //public void Init(ILog log)
 //{
 //    this.log = log;
 //    indexList = new List<ModbusPointMeta>();
 //    coilMapping = new Dictionary<string, IPoint<bool>>(10000);
 //    inputStatusMapping = new Dictionary<string, IPoint<bool>>(10000);
 //    inPutRegisterMapping = new Dictionary<string, IPoint<ushort>>(10000);
 //    holdRegisterMapping = new Dictionary<string, IPoint<ushort>>(10000);
 //}
 public static ModbusPointMapping GetInstance(ILog log)
 {
     if (instance == null)
     {
         lock (locker)
         {
             if (instance == null)
             {
                 instance = new ModbusPointMapping(log);
             }
         }
     }
     return(instance);
 }
Exemplo n.º 3
0
        public bool Init()
        {
            _mapping = ModbusPointMapping.GetInstance(_log);

            var factory = new SocketServerFactroy(_ipString, _port, _log, _timeOut, readCacheSize, _maxConnect);

            _socketServer = factory.CreateInstance(_socketServerType);
            if (_socketServer.Init())
            {
                _socketServer.ReadComplete += recivceDataHanding;
                _socketServer.SendComplete += sendComplete;
                return(true);
            }
            return(false);
        }