/// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public override void ReceiveData(object sender, DataTransmissionEventArgs args)
        {
            BaseCommand cmd = null;

            lock (m_ReadBuffer)
            {
                m_ReadBuffer.AddRange(args.EventData);
                if (m_ReadBuffer.Count >= MINACKLENTH)
                {
                    int endIndex = m_ReadBuffer.FindLastIndex((x) => { return(x == 0x03); });
                    //帧尾找不到,返回
                    if (endIndex < MINACKLENTH - 1)
                    {
                        return;
                    }
                    else
                    {
                        cmd = Unpackage();
                    }
                }
                else
                {
                    return;
                }
            }

            HangingBalanceEventArgs data = new HangingBalanceEventArgs(cmd, args.PortName);

            base.ReceiveData(sender, data);
        }
Exemplo n.º 2
0
 public HangingBalanceEventArgs(HangingBalanceEventArgs data)
     : base(null)
 {
     Command  = data.Command;
     PortName = data.PortName;
 }