예제 #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);
        }
예제 #2
0
        bool _waitCameraUploadComplete(Dut.IPCamera <U> camera, int time_out)
        {
            bool   ret            = false;
            int    count          = 0;
            var    prop_logsystem = uploadInfo.GetType().GetProperty("logSystem");
            string log_value      = (string)prop_logsystem.GetValue(uploadInfo);
            string data           = "";

RE:
            count++;
            string tmpStr = camera.captureLog();

            data      += tmpStr;
            log_value += tmpStr;
            prop_logsystem.SetValue(uploadInfo, log_value);
            ret = string.IsNullOrEmpty(data) || string.IsNullOrWhiteSpace(data) ? false : data.Contains("~ #");
            if (!ret)
            {
                if (count < time_out)
                {
                    Thread.Sleep(1000);
                    goto RE;
                }
            }
            if (ret)
            {
                ret = data.Contains("updatefirmware success");
            }

            return(ret);
        }
예제 #3
0
        //kiem tra sd card qua cong UART
        public bool excuteUart(Grid grid_container)
        {
            bool ret = false;

            var prop_buttonresult = testingInfo.GetType().GetProperty("buttonResult");

            prop_buttonresult.SetValue(testingInfo, "Waiting...");

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

            try {
                if (!camera.IsConnected())
                {
                    goto END;
                }
                Thread.Sleep(500);

                Application.Current.Dispatcher.Invoke(new Action(() => {
                    uc_button = new UI.ucButton(30);
                    grid_container.Children.Clear();
                    grid_container.Children.Add(uc_button);
                }));
RE:
                string data = camera.captureLog();
                log_value  += data;
                prop_logsystem.SetValue(testingInfo, log_value);

                if (data != null)
                {
                    ret = data.ToUpper().Contains(std_value.ToUpper());
                }
                if (!ret)
                {
                    if (uc_button.timeOut > 0)
                    {
                        Thread.Sleep(500);
                        goto RE;
                    }
                }
                goto END;
            }
            catch (Exception ex) {
                log_value += ex.ToString();
                prop_logsystem.SetValue(testingInfo, log_value);
                goto END;
            }

END:
            prop_buttonresult.SetValue(testingInfo, ret ? "Passed" : "Failed");
            return(ret);
        }