Esempio n. 1
0
        protected void DetectBaudRate(string port)
        {
            var supportedBaudRates = new int[] { 115200, 57600, 38400, 19200, 9600 };

            foreach (int rate in supportedBaudRates)
            {
                OpenComPort(port, rate);

                try
                {
                    vc0706.SetComPort(serialPort);
                    GetImageSize();

                    Debug.WriteLine("BaudRate detected: " + rate.ToString());
                    return;
                }
                catch //(Exception e)
                {
                }
                CloseComPort();
            }
            throw new ApplicationException("BaudRate detection failed - is your camera connected?");
        }