Esempio n. 1
0
 protected virtual bool Send(string str)
 {
     str = _4FE + str;
     if (MsgEvent != null)
     {
         MsgEvent(true, str);
     }
     return(_sp.Send(str));
 }
Esempio n. 2
0
        protected virtual bool Send(string str)
        {
            bool ret = false;

            str = _4FEString + str;//根据645协议,加4个FE通讯会好很多
            try
            {
                SerialPortCom _sp = new SerialPortCom(_portName, _baudRate);
                _sp.ReceiveFinishEven += ReceiveFinishJudge;

                ret = _sp.Send(str);
                if (MsgEvent != null)
                {
                    MsgEvent(true, str);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ret);
        }