Example #1
0
        public void SendCommandToDevice(String command)
        {
            ushort usbcheck;

            if (usb.connectionReady())
            {
                var buffer = Encoding.ASCII.GetBytes(command).ToArray();
                usbcheck = usb.write(buffer);
                usb.flush();
            }

            if (command.Contains("M114"))
            {
                bool        isRead = true;
                ushort      usbavt;
                byte        t;
                List <byte> _ByteList = new List <byte>();

                ushort readBuf = usb.read();
                while (isRead)
                {
                    // usb.@lock();
                    usbavt = usb.available();
                    t      = (byte)readBuf;
                    _ByteList.Add(t);
                    if (usbavt == 0)
                    {
                        //no more data to read
                        isRead = false;
                    }
                    readBuf = usb.read();
                }
            }
        }