コード例 #1
0
            public void HandleByte(byte[] aByte)
            {
                if (iCurrentCommand == null)
                {
                    // Don't know where this is intended for
                    return;
                }

                iCurrentCommand.HandleReceived(aByte);

                while ((iCurrentCommand != null) && iCurrentCommand.Done)
                {
                    if (iCommandQueue.Count != 0)
                    {
                        iCurrentCommand = iCommandQueue.Dequeue();
                        iCurrentCommand.SendCommand(this);
                        if (iCurrentCommand.RequiredReturnBytes != 0)
                        {
                            iForm.backgroundSerial.RunWorkerAsync(iCurrentCommand.RequiredReturnBytes);
                        }
                        else
                        {
                            iCurrentCommand = null;
                        }
                    }
                    else
                    {
                        iCurrentCommand = null;
                    }
                }
            }
コード例 #2
0
            /**
             * @brief
             * Add a Boxdorfer command
             *
             * @param aCommand
             * The command to add
             *
             * This executes the command if the serial port is not in use or queues it
             * to be executed when the port is free.
             */
            public void AddCommand(IBoxdorferCommand aCommand)
            {
                if (iCurrentCommand != null)
                {
                    iCommandQueue.Enqueue(aCommand);
                    return;
                }

                iCurrentCommand = aCommand;
                iCurrentCommand.SendCommand(this);

                if (iCurrentCommand.RequiredReturnBytes != 0)
                {
                    iForm.backgroundSerial.RunWorkerAsync(iCurrentCommand.RequiredReturnBytes);
                }
                else
                {
                    iCurrentCommand = null;
                }
            }
コード例 #3
0
            /**
             * @brief
             * Add a Boxdorfer command
             *
             * @param aCommand
             * The command to add
             *
             * This executes the command if the serial port is not in use or queues it
             * to be executed when the port is free.
             */
            public void AddCommand(IBoxdorferCommand aCommand)
            {
                if (iCurrentCommand != null)
                {
                    iCommandQueue.Enqueue(aCommand);
                    return;
                }

                iCurrentCommand = aCommand;
                iCurrentCommand.SendCommand(this);

                if (iCurrentCommand.RequiredReturnBytes != 0)
                {
                    iForm.backgroundSerial.RunWorkerAsync(iCurrentCommand.RequiredReturnBytes);
                }
                else
                {
                    iCurrentCommand = null;
                }
            }
コード例 #4
0
            public void HandleByte(byte[] aByte)
            {
                if (iCurrentCommand == null)
                {
                    // Don't know where this is intended for
                    return;
                }

                iCurrentCommand.HandleReceived(aByte);

                while ((iCurrentCommand != null) && iCurrentCommand.Done)
                {
                    if (iCommandQueue.Count != 0)
                    {
                        iCurrentCommand = iCommandQueue.Dequeue();
                        iCurrentCommand.SendCommand(this);
                        if (iCurrentCommand.RequiredReturnBytes != 0)
                        {
                            iForm.backgroundSerial.RunWorkerAsync(iCurrentCommand.RequiredReturnBytes);
                        }
                        else
                        {
                            iCurrentCommand = null;
                        }
                    }
                    else
                    {
                        iCurrentCommand = null;
                    }
                }
            }
コード例 #5
0
 public void Flush()
 {
     iCommandQueue.Clear();
     iCurrentCommand = null;
 }
コード例 #6
0
 public void Flush()
 {
     iCommandQueue.Clear();
     iCurrentCommand = null;
 }