コード例 #1
0
        bool _loginToUboot(int time_out)
        {
            bool ret = false;

            //get logsytem
            var    prop_logsystem = testingInfo.GetType().GetProperty("logSystem");
            string log_value      = (string)prop_logsystem.GetValue(testingInfo);

            //get log uart
            var prop_loguart = testingInfo.GetType().GetProperty("logUart");

            log_value += string.Format("\n-------------------------------\n");
            log_value += string.Format("{0}, login to uboot, timeout = {1}\n", DateTime.Now, time_out);
            prop_logsystem.SetValue(testingInfo, log_value);

            int    count     = 0;
            string reg_text  = "Hit any key to stop autoboot";
            int    delay_ms  = 100;
            int    max_count = (time_out * 1000) / delay_ms;

RE:
            count++;
            camera.captureLog();
            string loguart = (string)prop_loguart.GetValue(testingInfo);

            ret = loguart.ToLower().Contains(reg_text.ToLower());

            if ((count * delay_ms) % 1000 == 0)
            {
                log_value += string.Format("...{0}\n", (count * delay_ms) / 1000);
                prop_logsystem.SetValue(testingInfo, log_value);
            }

            if (!ret)
            {
                if (count < max_count)
                {
                    Thread.Sleep(delay_ms);
                    goto RE;
                }
            }
            else
            {
                ret = camera.loginToUboot();
            }

            return(ret);
        }