/// <summary> /// 用于显示通信报文 /// </summary> /// <param name="CommIndex"></param> /// <param name="item"></param> public void ShowMessage(int CommIndex, FrameQueueItem item) { if (MessageEvent != null) { MessageEvent(CommIndex, item); } }
/// <summary> /// 将接收到的错误字符进行处理和显示 /// </summary> /// <param name="ErrorBytes">接收到的错误字节</param> /// <param name="IPAddr"> /// 通信数据来源的IP地址:仅供TCP Server通信方式使用 /// </param> protected virtual void ProcessErrorString(ref string ErrorString, string IPAddr) { if (ErrorString.Length == 0) { return; } //用于显示 FrameQueueItem item; item = new FrameQueueItem(CommOrientaion.RECV, DateTime.Now, 0, 0, ErrorString, ErrorString, true, false, IPAddr); this.ShowMessage(this.m_CommIndex, item); ErrorString = string.Empty; }
/// <summary> /// 将接收到的错误字节进行处理和显示 /// </summary> /// <param name="ErrorBytes">接收到的错误字节</param> /// <param name="IPAddr"> /// 通信数据来源的IP地址:仅供TCP Server通信方式使用 /// </param> protected virtual void ProcessErrorBytes(List <byte> ErrorBytes, string IPAddr) { if (ErrorBytes.Count == 0) { return; } byte[] aByte = new byte[ErrorBytes.Count]; ErrorBytes.CopyTo(aByte); ErrorBytes.Clear(); //用于显示 FrameQueueItem item = new FrameQueueItem(CommOrientaion.RECV, DateTime.Now, 0, 0, HexEncoding.Instance.GetString(aByte), Encoding.ASCII.GetString(aByte), true, false, IPAddr); this.ShowMessage(this.m_CommIndex, item); }