public void ErrorCallback(TappyError code, byte[] data)
 {
     if (code == TappyError.Application)
     {
         ShowFailStatus(tappyDriver.AppErrorLookUp(data[2]));
     }
     else if (code == TappyError.Hardware)
     {
         ShowFailStatus("TappyUSB is not connected");
     }
     else if (code == TappyError.Nack)
     {
         ShowFailStatus("NACK was received");
     }
 }
Exemplo n.º 2
0
        private bool CheckForErrorsOrTimeout(ResponseFrame frame, Exception e)
        {
            if (e != null)
            {
                if (e.GetType() == typeof(HardwareException))
                {
                    ShowFailStatus("Tappy is not connected");
                }
                else
                {
                    ShowFailStatus("An error occured");
                }

                return(true);
            }
            else if (!TcmpFrame.IsValidFrame(frame))
            {
                ShowFailStatus("An error occured");

                return(true);
            }
            else if (frame.IsApplicationErrorFrame())
            {
                ApplicationErrorFrame errorFrame = (ApplicationErrorFrame)frame;
                ShowFailStatus(errorFrame.ErrorString);
                return(true);
            }
            else if (frame.CommandFamily0 == 0 && frame.CommandFamily1 == 0 && frame.ResponseCode < 0x05)
            {
                ShowFailStatus(TappyError.LookUp(frame.CommandFamily, frame.ResponseCode));
                return(true);
            }
            else if (frame.ResponseCode == 0x03)
            {
                ShowFailStatus("No tag detected");
                return(true);
            }
            else
            {
                return(false);
            }
        }