예제 #1
0
        //kiem tra ir cut qua cong UART
        public bool excuteUart(Grid grid_container)
        {
            bool ret = false;

            var prop_ircutresult = testingInfo.GetType().GetProperty("irCutResult");

            prop_ircutresult.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);

                //show form confirm
                log_value += "...hiển thị giao diện xác nhận trạng thái khối ir cut.\n";
                prop_logsystem.SetValue(testingInfo, log_value);

                Application.Current.Dispatcher.Invoke(new Action(() => {
                    uc_ircut = new UI.ucIRCut();
                    grid_container.Children.Clear();
                    grid_container.Children.Add(uc_ircut);
                }));


                //play ir cut
                log_value += "...thiết lập camera giả lập ir cut.\n";
                prop_logsystem.SetValue(testingInfo, log_value);
                camera.virtualIRCut();

RE:
                if (uc_ircut.isTryAgain)
                {
                    camera.virtualIRCut(); uc_ircut.isTryAgain = false;
                }

                ret = uc_ircut.ircutResult != -1;
                if (!ret)
                {
                    Thread.Sleep(100); goto RE;
                }
                if (uc_ircut.ircutResult != 0)
                {
                    ret = false;
                }

                //phán định
                log_value += string.Format("...\n");
                log_value += string.Format("... ===> \"{0}\" <===\n", uc_ircut.ircutMessage);
                log_value += string.Format("...\n");
                prop_logsystem.SetValue(testingInfo, log_value);

                //stop ir cut
                log_value += "...thiết lập camera dừng giả lập ir cut.\n";
                prop_logsystem.SetValue(testingInfo, log_value);
                camera.switchCameraMode(false);

                goto END;
            }
            catch (Exception ex) {
                log_value += ex.ToString();
                prop_logsystem.SetValue(testingInfo, log_value);
                goto END;
            }

END:
            prop_ircutresult.SetValue(testingInfo, ret ? "Passed" : "Failed");
            return(ret);
        }
예제 #2
0
        //Kiem tra ethernet qua cong telnet
        public bool excuteTelnet(Grid grid_container)
        {
            bool ret = false;
            var  prop_imagesensorresult = testingInfo.GetType().GetProperty("imageSensorResult");

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

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

            string rtsp_link    = (string)settingInfo.GetType().GetProperty("cameraRtspLink").GetValue(settingInfo);
            double sharpness    = (double)settingInfo.GetType().GetProperty("sharpnessStandard").GetValue(settingInfo);
            double tolerance    = (double)settingInfo.GetType().GetProperty("toleranceSharpness").GetValue(settingInfo);
            string areatest     = (string)settingInfo.GetType().GetProperty("areaTestChart").GetValue(settingInfo);
            string mac_ethernet = (string)testingInfo.GetType().GetProperty("macFromBarcode").GetValue(testingInfo);

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

                //chuyen camera sang mode BGR
                camera.switchCameraMode(false);
                Application.Current.Dispatcher.Invoke(new Action(() => { uc_imagesensor = new UI.ucImageSensor(13, areatest, sharpness, tolerance, rtsp_link, mac_ethernet); }));
                Thread.Sleep(3000);

                Application.Current.Dispatcher.Invoke(new Action(() => {
                    grid_container.Children.Clear();
                    grid_container.Children.Add(uc_imagesensor);
                }));

RE:
                ret = uc_imagesensor.imageResult != -1 || uc_imagesensor.timeOut == 0;
                if (!ret)
                {
                    Thread.Sleep(100); goto RE;
                }
                if (uc_imagesensor.imageResult != 0)
                {
                    ret = false;
                }

                //close stream
                uc_imagesensor.Dispose();

                //chuyen camera ve mode normal
                camera.switchCameraMode(false);
                Thread.Sleep(1000);

                log_value += uc_imagesensor.imageMessage;
                prop_logsystem.SetValue(testingInfo, log_value);

                goto END;
            }
            catch (Exception ex) {
                log_value += ex.ToString();
                prop_logsystem.SetValue(testingInfo, log_value);
                goto END;
            }

END:
            prop_imagesensorresult.SetValue(testingInfo, ret ? "Passed" : "Failed");
            if (uc_imagesensor.imageInfo.imageSource != null)
            {
                testingInfo.GetType().GetProperty("imageSharpness").SetValue(testingInfo, uc_imagesensor.imageInfo.imageSource);
            }
            return(ret);
        }
예제 #3
0
        //Kiem tra night vision qua cong telnet
        public bool excuteTelnet(Grid grid_container)
        {
            bool ret = false;
            var  prop_nightvisionresult = testingInfo.GetType().GetProperty("nightVisionResult");

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

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

            string rtsp_link     = (string)settingInfo.GetType().GetProperty("cameraRtspLink").GetValue(settingInfo);
            int    rgb_diffvalue = (int)settingInfo.GetType().GetProperty("toleranceRGBNightVision").GetValue(settingInfo);
            string mac_ethernet  = (string)testingInfo.GetType().GetProperty("macFromBarcode").GetValue(testingInfo);

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

                //chuyen camera sang mode night vision
                camera.switchCameraMode(true);
                Application.Current.Dispatcher.Invoke(new Action(() => { uc_nightvision = new UI.ucNightVision(13, rgb_diffvalue, rtsp_link, mac_ethernet); }));
                Thread.Sleep(3000);

                Application.Current.Dispatcher.Invoke(new Action(() => {
                    grid_container.Children.Clear();
                    grid_container.Children.Add(uc_nightvision);
                }));
                Thread.Sleep(1000);

RE:
                ret = uc_nightvision.nightResult != -1 || uc_nightvision.timeOut == 0;
                if (!ret)
                {
                    Thread.Sleep(100); goto RE;
                }
                if (uc_nightvision.nightResult != 0)
                {
                    ret = false;
                }

                //close stream
                uc_nightvision.Dispose();

                //chuyen camera ve mode normal
                camera.switchCameraMode(false);
                Thread.Sleep(1000);

                log_value += uc_nightvision.nightMessage;
                prop_logsystem.SetValue(testingInfo, log_value);

                goto END;
            }
            catch (Exception ex) {
                log_value += ex.ToString();
                prop_logsystem.SetValue(testingInfo, log_value);
                goto END;
            }

END:
            prop_nightvisionresult.SetValue(testingInfo, ret ? "Passed" : "Failed");
            if (uc_nightvision.nightInfo.imageSource != null)
            {
                testingInfo.GetType().GetProperty("imageNightVision").SetValue(testingInfo, uc_nightvision.nightInfo.imageSource);
            }
            return(ret);
        }