コード例 #1
0
        //Kiem tra firmware build time qua cong telnet
        public bool excuteTelnet()
        {
            bool ret = false;
            var  prop_firmwareresult = testingInfo.GetType().GetProperty("firmwareResult");

            prop_firmwareresult.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;
                }
                int count = 0;
RE:
                count++;
                string data = camera.getFirmwareBuildTime();
                log_value += data;
                prop_logsystem.SetValue(testingInfo, log_value);

                if (string.IsNullOrEmpty(std_value) || string.IsNullOrWhiteSpace(std_value))
                {
                    goto END;
                }
                if (data != null)
                {
                    ret = data.ToUpper().Contains(std_value.ToUpper());
                }
                if (!ret)
                {
                    if (count < retry_time)
                    {
                        goto RE;
                    }
                }
            }
            catch (Exception ex) {
                log_value += ex.ToString();
                prop_logsystem.SetValue(testingInfo, log_value);
                goto END;
            }

END:
            prop_firmwareresult.SetValue(testingInfo, ret ? "Passed" : "Failed");
            return(ret);
        }
コード例 #2
0
        bool _checkFWBuildTime(Dut.IPCamera <U> camera, string std_value, out string fw_build_time)
        {
            var    prop_logsystem = uploadInfo.GetType().GetProperty("logSystem");
            string log_value      = (string)prop_logsystem.GetValue(uploadInfo);

            bool ret   = false;
            int  count = 0;

            fw_build_time = "";

RE:
            count++;
            string data = camera.getFirmwareBuildTime();

            log_value += data;
            prop_logsystem.SetValue(uploadInfo, log_value);

            if (string.IsNullOrEmpty(std_value) || string.IsNullOrWhiteSpace(std_value))
            {
                return(false);
            }
            ret = data.Contains(std_value);
            if (!ret)
            {
                if (count < 3)
                {
                    goto RE;
                }
            }

            if (data != null && data.Length > 0)
            {
                fw_build_time = data.Split('\n')[2].Replace("\n", "").Replace("\r", "").Trim();
            }

            return(ret);
        }