Пример #1
0
 public SyncComReceiver(ComDtuConnection comconn, string dtuid, float timeout)
 {
     this.port          = comconn._port;
     this._comconn      = comconn;
     this.dtuId         = dtuid;
     this.timeout       = timeout;
     port.DataReceived += OnDataReceived;
 }
Пример #2
0
        // COM 建立连接.
        public IDtuConnection GetConnection(DtuNode dtuInfo)
        {
            ComDtuConnection cc    = null;
            string           dtuId = dtuInfo.DtuCode;

            if (!_connectPool.ContainsKey(dtuId))
            {
                cc = new ComDtuConnection(dtuInfo);
                _connectPool[dtuId] = cc;
            }
            else
            {
                cc = _connectPool[dtuId];
            }
            return(cc);
        }