Esempio n. 1
0
 public SerialCommand(UARTCommand uart, byte[] c, SerialCallback cb, int wantBytes, int _tag = 0, int _a0 = 0, int _a1 = 0)
 {
     sendcommand = c;
     callback    = cb;
     tag         = _tag;
     uartCommand = uart;
     returnbytes = wantBytes;
     a0          = _a0;
     a1          = _a1;
 }
Esempio n. 2
0
        // -------------------------------------------------------------------------------------------------
        // Sends a command
        //
        // \param   uart        The uart.
        // \param   sendBytes   The send in bytes.
        // \param   cb          The cb.
        // \param   wantbytes   The wantbytes.
        // \param   tag         (Optional) The tag.
        // -------------------------------------------------------------------------------------------------
        public void SendCommand(UARTCommand uart, byte[] sendBytes, SerialCallback cb, int wantbytes, int tag, int a0, int a1)
        {
            if (pause)
            {
                return;
            }

            if (commands.Count > 50)
            {
                return;
            }
            if (!mySerialPort.IsOpen)
            {
                return;
            }

            SerialCommand t = new SerialCommand(uart, sendBytes, cb, wantbytes, tag, a0, a1);

            commands.Enqueue(t);
        }