public CBarCOM(EBarType barType, int idNo = 0, string name = "IBarCode") { this._idNo = idNo; this._name = name; this._barType = barType; object obj = load(barType.ToString()); if (obj != null) { _devBar = (IBarCode)obj; _devBar.OnRecved += new OnRecvHandler(onRecvTriger); this._comMode = _devBar.comMode; } }
/// <summary> /// 打开串口 /// </summary> /// <param name="comName"></param> /// <param name="er"></param> /// <param name="setting"></param> /// <returns></returns> public bool Open(string comName, out string er, string setting = "115200,n,8,1", bool recvThreshold = false) { er = string.Empty; try { if (_devBar == null) { er = _barType.ToString() + "未找到程序集,请检查"; return(false); } return(_devBar.Open(comName, out er, setting, recvThreshold)); } catch (Exception e) { er = e.ToString(); return(false); } }