Пример #1
0
 void logbook_CommandFailed(object sender, CommandFailedEventArgs e)
 {
     log.Append("logbook_CommandFailed", "Logbook Command Failed");
     UpdateTextBoxInvoke(textBox1, String.Format("{0}", e.FailedCommand.name), logLines);
 }
Пример #2
0
 protected virtual void OnCommandFailed(CommandFailedEventArgs e)
 {
     if (CommandFailed != null)
     {
         // Invokes the delegates.
         CommandFailed(this, e);
         sendNextCommand();
     }
 }
Пример #3
0
        protected virtual void FireCommandFailed(CommandFailedEventArgs e)
        {
            //See how many Commands have failed...
            if (commandFailedCount < 2)
            {
                //Don't bother resending if another Command has already failed and been retried
                commandFailedCount++;

                if (commandFailedCount == 1)
                {
                    //If the first resend didn't work then try to reconnect
                    if (active)
                    {
                        reconnect();
                    }
                }
                //Make sure no Commands are going to be processed
                lock (commandQueue)
                {
                    port.DiscardInBuffer();
                    //port.DiscardOutBuffer();
                    //then requeue the failed Command to try again.
                    Queue<Command> newCommandQueue = new Queue<Command>(commandQueueMax + 1);
                    newCommandQueue.Enqueue(e.FailedCommand);
                    while (commandQueue.Count > 0)
                    {
                        newCommandQueue.Enqueue(commandQueue.Dequeue());
                    }
                    commandQueue = newCommandQueue;
                }
                commandQWait.Set();
            }
            else
            {
                if (CommandFailed != null)
                {
                    // Invokes the delegates.
                    CommandFailed(this, e);
                }
                if (disconnectAfterResult)
                {
                    ClosePort();
                    FireOnDisconnected();
                }
                else
                {
                    commandQWait.Set();
                }
            }
        }
Пример #4
0
        void logbook_CommandFailed(object sender, CommandFailedEventArgs ev)
        {
            log.Append("logbook_CommandFailed", String.Format("Command {0} failed: {1}", ev.FailedCommand.name, ev.reason));
             if (ev.response.Length > 0)
             {
            log.Append("logbook_CommandFailed", "Resposnse: " + Encoding.ASCII.GetString(ev.response, 0, ev.response.Length));
             }
             logbookConnectionError = true;

             if (ev.FailedCommand.Equals(Logbook.Command.ReadASCII))
             {
            ReadASCIICommandFailed(true);
             }
        }
Пример #5
0
 void logbook_CommandFailed(object sender, CommandFailedEventArgs e)
 {
     if (e.FailedCommand == Logbook.Command.ReadASCII)
      {
     UpdateLabel(testReadingLabel, "Failed");
      }
      if (e.FailedCommand == Logbook.Command.InputPowerOn)
      {
     UpdateLabel(identifyLabel, "Power on failed");
      }
      if (e.FailedCommand == Logbook.Command.IdentifySensors)
      {
     UpdateLabel(identifyLabel, "Identify Failed");
      }
      if (e.FailedCommand == Logbook.Command.GetSensorRanges)
      {
     UpdateLabel(identifyLabel, "Get Range Failed");
      }
 }