Ejemplo n.º 1
0
        //test image sensor
        private bool _item_test_imagesensor(Common.Dut.IPCamera <TestingInformation> camera_indoor)
        {
            if (!stationVariable.myTesting.IsCheckImageSensor)
            {
                return(true);
            }
            bool r = false;

            stationVariable.myTesting.logSystem += "\n+++++++++++++++++++++++++++++++++++++++\n";
            stationVariable.myTesting.logSystem += "KIỂM TRA CẢM BIẾN ẢNH\n";
            var ex_test_imagesensor = new Common.Excute.exTestImageSensor <TestingInformation, SettingInformation>(camera_indoor, stationVariable.myTesting, stationVariable.mySetting, int.Parse(stationVariable.mySetting.RetryTime));

            stationVariable.myTesting.logSystem += string.Format("...Tiêu chuẩn: \"{0}\"\n", string.Format("Giá trị độ nét cảm biến ảnh >= {0}.",
                                                                                                           stationVariable.mySetting.sharpnessStandard - stationVariable.mySetting.toleranceSharpness));
            stationVariable.myTesting.logSystem += string.Format("...Thực tế:\n");
            stationVariable.myTesting.logSystem += string.Format("...\n");
            r = ex_test_imagesensor.excuteTelnet(grid_debug);
            stationVariable.myTesting.logSystem += string.Format("\n...\n");
            stationVariable.myTesting.logSystem += string.Format("...Kết quả: {0}\n", r ? "Passed" : "Failed");

            //add tab log
            Dispatcher.Invoke(new Action(() => {
                this.grid_debug.Children.Clear();
                this.grid_debug.Children.Add(uc_tablog);
            }));

            return(r);
        }
Ejemplo n.º 2
0
        //test night vision
        private bool _item_test_nightvision(Common.Dut.IPCamera <TestingInformation> camera_indoor)
        {
            if (!stationVariable.myTesting.IsCheckNightVision)
            {
                return(true);
            }
            bool r = false;

            stationVariable.myTesting.logSystem += "\n+++++++++++++++++++++++++++++++++++++++\n";
            stationVariable.myTesting.logSystem += "KIỂM TRA CHẾ ĐỘ NIGHT VISION\n";
            var ex_test_nightvision = new Common.Excute.exTestNightVision <TestingInformation, SettingInformation>(camera_indoor, stationVariable.myTesting, stationVariable.mySetting);

            stationVariable.myTesting.logSystem += string.Format("...Tiêu chuẩn: \"{0}\"\n", string.Format("Độ lệch R,G,B tại 3 điểm p1=[10,10], p2=[width/2, height/2] và p3=[width-10, height-10] phải nhỏ hơn hoặc bằng {0}.", stationVariable.mySetting.toleranceRGBNightVision));
            stationVariable.myTesting.logSystem += string.Format("...Thực tế:\n");
            stationVariable.myTesting.logSystem += string.Format("...\n");
            r = ex_test_nightvision.excuteTelnet(grid_debug);
            stationVariable.myTesting.logSystem += string.Format("\n...\n");
            stationVariable.myTesting.logSystem += string.Format("...Kết quả: {0}\n", r ? "Passed" : "Failed");

            //add tab log
            Dispatcher.Invoke(new Action(() => {
                this.grid_debug.Children.Clear();
                this.grid_debug.Children.Add(uc_tablog);
            }));

            return(r);
        }
Ejemplo n.º 3
0
        private bool _calib_dark(CalibNightVisionItemInfo calibItem)
        {
            try {
                bool ret   = false;
                int  count = 0;

                stationVariable.myTesting.logSystem += string.Format("......camera {0}\n", calibItem.macEthernet);
                calibItem.calibDarkResult            = "Waiting...";

                //login telnet to camera
                count = 0;
RE_LOGIN:
                count++;
                Common.Dut.IPCamera <TestingInformation> camera_indoor = new Common.Dut.IPCamera <TestingInformation>(stationVariable.myTesting, calibItem.ipAddress, stationVariable.mySetting.cameraTelnetUser, stationVariable.mySetting.cameraTelnetPassword);
                camera_indoor.Login();
                ret = camera_indoor.IsConnected();
                stationVariable.myTesting.logSystem += string.Format(".........login to {0} is {1}\n", calibItem.ipAddress, ret);
                if (!ret)
                {
                    if (count < 3)
                    {
                        Thread.Sleep(500); goto RE_LOGIN;
                    }
                    else
                    {
                        camera_indoor.Close();
                        calibItem.calibDarkResult = "Failed";
                        return(false);
                    }
                }

                //calib dark
                count = 0;
RE_CALIB:
                count++;
                ret = camera_indoor.calibNightVisionModeDark();
                stationVariable.myTesting.logSystem += string.Format(".........calib low threshold result {0}\n", ret);
                if (!ret)
                {
                    if (count < 3)
                    {
                        Thread.Sleep(500); goto RE_CALIB;
                    }
                    else
                    {
                        camera_indoor.Close();
                        calibItem.calibDarkResult = "Failed";
                        return(false);
                    }
                }

                camera_indoor.Close();
                calibItem.calibDarkResult = "Passed";
                return(true);
            }
            catch {
                calibItem.calibDarkResult = "Failed";
                return(false);
            }
        }
Ejemplo n.º 4
0
        //test light sensor
        private bool _item_test_lightsensor(Common.Dut.IPCamera <TestingInformation> camera_indoor)
        {
            if (!stationVariable.myTesting.IsCheckLightSensor)
            {
                return(true);
            }
            bool r = false;

            stationVariable.myTesting.logSystem += "\n+++++++++++++++++++++++++++++++++++++++\n";
            stationVariable.myTesting.logSystem += "KIỂM TRA CẢM BIẾN ÁNH SÁNG\n";
            var ex_test_lightsensor = new Common.Excute.exTestLightSensor <TestingInformation, SettingInformation>(camera_indoor, stationVariable.myTesting, stationVariable.mySetting);

            stationVariable.myTesting.logSystem += string.Format("...Tiêu chuẩn: \"{0}\"\n", ex_test_lightsensor.std_value);
            stationVariable.myTesting.logSystem += string.Format("...Thực tế:\n");
            stationVariable.myTesting.logSystem += string.Format("...\n");
            r = ex_test_lightsensor.excuteUart(grid_debug);
            stationVariable.myTesting.logSystem += string.Format("\n...\n");
            stationVariable.myTesting.logSystem += string.Format("...Kết quả: {0}\n", r ? "Passed" : "Failed");

            //add tab log
            Dispatcher.Invoke(new Action(() => {
                this.grid_debug.Children.Clear();
                this.grid_debug.Children.Add(uc_tablog);
            }));

            return(r);
        }
Ejemplo n.º 5
0
        //test button
        private bool _item_test_button(Common.Dut.IPCamera <TestingInformation> camera_indoor)
        {
            if (!stationVariable.myTesting.IsCheckButton)
            {
                return(true);
            }
            bool r = false;

            stationVariable.myTesting.logSystem += "\n+++++++++++++++++++++++++++++++++++++++\n";
            stationVariable.myTesting.logSystem += "KIỂM TRA NÚT NHẤN\n";
            var ex_test_button = new Common.Excute.exTestButton <TestingInformation>(camera_indoor, stationVariable.myTesting);

            stationVariable.myTesting.logSystem += string.Format("...Tiêu chuẩn: \"{0}\"\n", ex_test_button.std_value);
            stationVariable.myTesting.logSystem += string.Format("...Thực tế:\n");
            stationVariable.myTesting.logSystem += string.Format("...\n");
            r = ex_test_button.excuteTelnet(grid_debug);
            stationVariable.myTesting.logSystem += string.Format("\n...\n");
            stationVariable.myTesting.logSystem += string.Format("...Kết quả: {0}\n", r ? "Passed" : "Failed");

            //add tab log
            Dispatcher.Invoke(new Action(() => {
                this.grid_debug.Children.Clear();
                this.grid_debug.Children.Add(uc_tablog);
            }));

            return(r);
        }
Ejemplo n.º 6
0
 //get mac ethernet
 private bool _item_get_mac_ethernet(Common.Dut.IPCamera <TestingInformation> camera_indoor)
 {
     stationVariable.myTesting.logSystem  += "\n+++++++++++++++++++++++++++++++++++++++\n";
     stationVariable.myTesting.logSystem  += "ĐỌC ĐỊA CHỈ MAC ETHERNET\n";
     stationVariable.myTesting.macEthernet = camera_indoor.getMacEthernet();
     stationVariable.myTesting.logSystem  += string.Format("...Kết quả: {0}\n", stationVariable.myTesting.macEthernet);
     return(true);
 }
Ejemplo n.º 7
0
 //get mac wlan
 private bool _item_get_mac_wlan(Common.Dut.IPCamera <TestingInformation> camera_indoor)
 {
     stationVariable.myTesting.logSystem += "\n+++++++++++++++++++++++++++++++++++++++\n";
     stationVariable.myTesting.logSystem += "ĐỌC ĐỊA CHỈ MAC WLAN\n";
     stationVariable.myTesting.macWlan    = camera_indoor.getMacWlan();
     stationVariable.myTesting.logSystem += string.Format("...Kết quả: {0}\n", stationVariable.myTesting.macWlan);
     return(true);
 }
Ejemplo n.º 8
0
        //login
        private bool _item_test_login(ref Common.Dut.IPCamera <TestingInformation> camera_indoor)
        {
            bool r = false;

            stationVariable.myTesting.logSystem += "\n+++++++++++++++++++++++++++++++++++++++\n";
            stationVariable.myTesting.logSystem += "LOGIN VÀO IP CAMERA\n";
            stationVariable.myTesting.logSystem += string.Format("...IP \"{0}\", telnet user \"{1}\", telnet pass \"{2}\"\n", stationVariable.mySetting.cameraIP, stationVariable.mySetting.cameraTelnetUser, stationVariable.mySetting.cameraTelnetPassword);
            camera_indoor = new Common.Dut.IPCamera <TestingInformation>(stationVariable.myTesting, stationVariable.mySetting.cameraIP, stationVariable.mySetting.cameraTelnetUser, stationVariable.mySetting.cameraTelnetPassword);
            camera_indoor.Login();
            r = camera_indoor.IsConnected();
            stationVariable.myTesting.logSystem += string.Format("...Kết quả: {0}\n", r ? "Passed" : "Failed");
            return(r);
        }
Ejemplo n.º 9
0
        //login
        private bool _item_test_login(ref Common.Dut.IPCamera <TestingInformation> camera_indoor)
        {
            bool r = false;

            stationVariable.myTesting.logSystem += "\n+++++++++++++++++++++++++++++++++++++++\n";
            stationVariable.myTesting.logSystem += "LOGIN VÀO IP CAMERA\n";
            stationVariable.myTesting.logSystem += string.Format("...Cổng {0}, tốc độ baud {1}\n", stationVariable.mySetting.SerialPortName, stationVariable.mySetting.SerialBaudRate);
            camera_indoor = new Common.Dut.IPCamera <TestingInformation>(stationVariable.myTesting, stationVariable.mySetting.SerialPortName, int.Parse(stationVariable.mySetting.SerialBaudRate), 8);
            camera_indoor.Login();
            r = camera_indoor.IsConnected();
            stationVariable.myTesting.logSystem += string.Format("...Kết quả: {0}\n", r ? "Passed" : "Failed");
            return(r);
        }
Ejemplo n.º 10
0
        //write serial number
        private bool _item_write_serialnumber(Common.Dut.IPCamera <TestingInformation> camera_indoor)
        {
            if (!stationVariable.myTesting.IsWriteSerialNumber)
            {
                return(true);
            }
            bool r = false;

            stationVariable.myTesting.logSystem += "\n+++++++++++++++++++++++++++++++++++++++\n";
            stationVariable.myTesting.logSystem += "GHI SERIAL NUMBER CHO CAMERA\n";
            var ex_write_sn = new Common.Excute.exWriteSerialNumber <TestingInformation>(camera_indoor, stationVariable.myTesting, int.Parse(stationVariable.mySetting.RetryTime));

            stationVariable.myTesting.logSystem += string.Format("...Giá trị nhập từ tem: \"{0}\"\n", ex_write_sn.std_value);
            stationVariable.myTesting.logSystem += string.Format("...\n");
            r = ex_write_sn.excuteTelnet();
            stationVariable.myTesting.logSystem += string.Format("\n...\n");
            stationVariable.myTesting.logSystem += string.Format("...Kết quả: {0}\n", r ? "Passed" : "Failed");
            return(r);
        }
Ejemplo n.º 11
0
        //write hardware version
        private bool _item_write_hardwareversion(Common.Dut.IPCamera <TestingInformation> camera_indoor)
        {
            if (!stationVariable.myTesting.IsWriteHardwareVersion)
            {
                return(true);
            }
            bool r = false;

            stationVariable.myTesting.logSystem += "\n+++++++++++++++++++++++++++++++++++++++\n";
            stationVariable.myTesting.logSystem += "GHI HARDWARE VERSION CHO CAMERA\n";
            var ex_write_hw = new Common.Excute.exWriteHardwareVersion <TestingInformation, SettingInformation>(camera_indoor, stationVariable.myTesting, stationVariable.mySetting, int.Parse(stationVariable.mySetting.RetryTime));

            stationVariable.myTesting.logSystem += string.Format("...Giá trị setting: \"{0}\"\n", ex_write_hw.std_value);
            stationVariable.myTesting.logSystem += string.Format("...\n");
            r = ex_write_hw.excuteTelnet();
            stationVariable.myTesting.logSystem += string.Format("\n...\n");
            stationVariable.myTesting.logSystem += string.Format("...Kết quả: {0}\n", r ? "Passed" : "Failed");
            return(r);
        }
Ejemplo n.º 12
0
        //test sd card
        private bool _item_test_sdcard(Common.Dut.IPCamera <TestingInformation> camera_indoor)
        {
            if (!stationVariable.myTesting.IsCheckSdCard)
            {
                return(true);
            }
            bool r = false;

            stationVariable.myTesting.logSystem += "\n+++++++++++++++++++++++++++++++++++++++\n";
            stationVariable.myTesting.logSystem += "KIỂM TRA KHỐI GIAO TIẾP SD CARD\n";
            var ex_test_sdcard = new Common.Excute.exTestSDCard <TestingInformation>(camera_indoor, stationVariable.myTesting, int.Parse(stationVariable.mySetting.RetryTime));

            stationVariable.myTesting.logSystem += string.Format("...Tiêu chuẩn: \"{0}\"\n", ex_test_sdcard.std_value);
            stationVariable.myTesting.logSystem += string.Format("...Thực tế:\n");
            stationVariable.myTesting.logSystem += string.Format("...\n");
            r = ex_test_sdcard.excuteTelnet();
            stationVariable.myTesting.logSystem += string.Format("\n...\n");
            stationVariable.myTesting.logSystem += string.Format("...Kết quả: {0}\n", r ? "Passed" : "Failed");
            return(r);
        }
Ejemplo n.º 13
0
        //test wifi
        private bool _item_test_wifi(Common.Dut.IPCamera <TestingInformation> camera_indoor)
        {
            if (!stationVariable.myTesting.IsCheckWifi)
            {
                return(true);
            }
            bool r = false;

            stationVariable.myTesting.logSystem += "\n+++++++++++++++++++++++++++++++++++++++\n";
            stationVariable.myTesting.logSystem += "KIỂM TRA KHỐI GIAO TIẾP WIFI\n";
            var ex_test_wifi = new Common.Excute.exTestWiFi <TestingInformation, SettingInformation>(camera_indoor, stationVariable.myTesting, stationVariable.mySetting, int.Parse(stationVariable.mySetting.RetryTime));

            stationVariable.myTesting.logSystem += string.Format("...Giá trị tiêu chuẩn: camera liệt kê được ssid 2G \"{0}\" và ssid 5G \"{1}\"\n", stationVariable.mySetting.wifiSSID2G, stationVariable.mySetting.wifiSSID5G);
            stationVariable.myTesting.logSystem += string.Format("...Thực tế:\n");
            stationVariable.myTesting.logSystem += string.Format("...\n");
            r = ex_test_wifi.excuteTelnet();
            stationVariable.myTesting.logSystem += string.Format("\n...\n");
            stationVariable.myTesting.logSystem += string.Format("...Kết quả: {0}\n", r ? "Passed" : "Failed");
            return(r);
        }
Ejemplo n.º 14
0
        //check uid
        private bool _item_test_uid(Common.Dut.IPCamera <TestingInformation> camera_indoor)
        {
            if (!stationVariable.myTesting.IsCheckUID)
            {
                return(true);
            }
            bool r = false;

            stationVariable.myTesting.logSystem += "\n+++++++++++++++++++++++++++++++++++++++\n";
            stationVariable.myTesting.logSystem += "KIỂM TRA TRÙNG KHỚP MÃ UID TRÊN TEM VÀ MÃ UID TRONG CAMERA\n";
            var ex_test_uid = new Common.Excute.exTestUID <TestingInformation>(camera_indoor, stationVariable.myTesting, int.Parse(stationVariable.mySetting.RetryTime));

            stationVariable.myTesting.logSystem += string.Format("...Giá trị uid trên tem: \"{0}\"\n", ex_test_uid.std_value);
            stationVariable.myTesting.logSystem += string.Format("...Giá trị uid thực tế trong camera:\n");
            stationVariable.myTesting.logSystem += string.Format("...\n");
            r = ex_test_uid.excuteTelnet();
            stationVariable.myTesting.logSystem += string.Format("\n...\n");
            stationVariable.myTesting.logSystem += string.Format("...Kết quả: {0}\n", r ? "Passed" : "Failed");
            return(r);
        }
Ejemplo n.º 15
0
        //check firmware build time
        private bool _item_test_firmware_buildtime(Common.Dut.IPCamera <TestingInformation> camera_indoor)
        {
            if (!stationVariable.myTesting.IsCheckFirmwareBuildTime)
            {
                return(true);
            }
            bool r = false;

            stationVariable.myTesting.logSystem += "\n+++++++++++++++++++++++++++++++++++++++\n";
            stationVariable.myTesting.logSystem += "KIỂM TRA FIRMWARE BASIC BUILD TIME\n";
            var ex_test_fw = new Common.Excute.exTestFirmwareBuildTime <TestingInformation, SettingInformation>(camera_indoor, stationVariable.myTesting, stationVariable.mySetting, int.Parse(stationVariable.mySetting.RetryTime));

            stationVariable.myTesting.logSystem += string.Format("...Giá trị setting: \"{0}\"\n", ex_test_fw.std_value);
            stationVariable.myTesting.logSystem += string.Format("...Giá trị thực tế trong camera:\n");
            stationVariable.myTesting.logSystem += string.Format("...\n");
            r = ex_test_fw.excuteTelnet();
            stationVariable.myTesting.logSystem += string.Format("\n...\n");
            stationVariable.myTesting.logSystem += string.Format("...Kết quả: {0}\n", r ? "Passed" : "Failed");
            return(r);
        }
Ejemplo n.º 16
0
        //check mac
        private bool _item_test_mac_ethernet(Common.Dut.IPCamera <TestingInformation> camera_indoor)
        {
            if (!stationVariable.myTesting.IsCheckMacEthernet)
            {
                return(true);
            }
            bool r = false;

            stationVariable.myTesting.logSystem += "\n+++++++++++++++++++++++++++++++++++++++\n";
            stationVariable.myTesting.logSystem += "KIỂM TRA TRÙNG KHỚP ĐỊA CHỈ MAC TRÊN TEM VÀ MAC GHI TRONG CAMERA\n";
            var ex_test_mac = new Common.Excute.exTestMacEthernet <TestingInformation>(camera_indoor, stationVariable.myTesting, int.Parse(stationVariable.mySetting.RetryTime));

            stationVariable.myTesting.logSystem += string.Format("...Giá trị mac trên tem: \"{0}\"\n", ex_test_mac.std_value);
            stationVariable.myTesting.logSystem += string.Format("...Giá trị mac ghi trong camera:\n");
            stationVariable.myTesting.logSystem += string.Format("...\n");
            r = ex_test_mac.excuteTelnet();
            stationVariable.myTesting.logSystem += string.Format("\n...\n");
            stationVariable.myTesting.logSystem += string.Format("...Kết quả: {0}\n", r ? "Passed" : "Failed");
            return(r);
        }
Ejemplo n.º 17
0
        //test image sensor
        private bool _item_test_imagesensor(Common.Dut.IPCamera <TestingInformation> camera_indoor)
        {
            if (!stationVariable.myTesting.IsCheckImageSensor)
            {
                return(true);
            }
            bool r = false;

            stationVariable.myTesting.logSystem += "\n+++++++++++++++++++++++++++++++++++++++\n";
            stationVariable.myTesting.logSystem += "KIỂM TRA CẢM BIẾN ẢNH\n";
            var ex_test_imagesensor = new Common.Excute.exTestImageSensor <TestingInformation, SettingInformation>(camera_indoor, stationVariable.myTesting, stationVariable.mySetting, int.Parse(stationVariable.mySetting.RetryTime));

            stationVariable.myTesting.logSystem += string.Format("...Tiêu chuẩn: \"{0}\"\n", ex_test_imagesensor.std_value);
            stationVariable.myTesting.logSystem += string.Format("...Thực tế:\n");
            stationVariable.myTesting.logSystem += string.Format("...\n");
            r = ex_test_imagesensor.excuteUart();
            stationVariable.myTesting.logSystem += string.Format("\n...\n");
            stationVariable.myTesting.logSystem += string.Format("...Kết quả: {0}\n", r ? "Passed" : "Failed");
            return(r);
        }
Ejemplo n.º 18
0
        private bool _change_ip_camera(int index)
        {
            try {
                bool ret   = false;
                int  count = 0;

                //ping to camera
                count = 0;
                int c = 0;
RE_PING:
                count++;
                ret = globalUtility.pingNetwork(stationVariable.mySetting.cameraIP);
                stationVariable.myTesting.logSystem += string.Format("......ping {0} is {1}\n", stationVariable.mySetting.cameraIP, ret);
                if (!ret)
                {
                    if (count < 3)
                    {
                        Thread.Sleep(500); goto RE_PING;
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    c++;
                    if (c < 3)
                    {
                        Thread.Sleep(500); goto RE_PING;
                    }
                }

                //login telnet to camera
                count = 0;
RE_LOGIN:
                count++;
                Common.Dut.IPCamera <TestingInformation> camera_indoor = new Common.Dut.IPCamera <TestingInformation>(stationVariable.myTesting, stationVariable.mySetting.cameraIP, stationVariable.mySetting.cameraTelnetUser, stationVariable.mySetting.cameraTelnetPassword);
                camera_indoor.Login();
                ret = camera_indoor.IsConnected();
                stationVariable.myTesting.logSystem += string.Format("......login to {0} is {1}\n", stationVariable.mySetting.cameraIP, ret);
                if (!ret)
                {
                    if (count < 3)
                    {
                        Thread.Sleep(500); goto RE_LOGIN;
                    }
                    else
                    {
                        return(false);
                    }
                }

                //get camera mac ethernet
                count = 0;
RE_GETMAC:
                count++;
                string mac_ethernet = camera_indoor.getMacEthernet();
                stationVariable.myTesting.logSystem += string.Format("......get mac {0} is {1}\n", stationVariable.mySetting.cameraIP, mac_ethernet);
                ret = !(string.IsNullOrEmpty(mac_ethernet) || string.IsNullOrWhiteSpace(mac_ethernet));
                if (!ret)
                {
                    if (count < 3)
                    {
                        Thread.Sleep(500); goto RE_GETMAC;
                    }
                    else
                    {
                        return(false);
                    }
                }


                //check same mac or not
                bool   macExisted = false;
                string tmpIP      = "";
                Application.Current.Dispatcher.Invoke(new Action(() => {
                    foreach (var item in stationVariable.myUploadFWInfo)
                    {
                        if (item.macEthernet.ToLower().Contains(mac_ethernet.ToLower()))
                        {
                            macExisted = true;
                            tmpIP      = item.ipAddress;
                            break;
                        }
                    }
                }));

                //change ip address
                string new_ip_address = "";
                if (macExisted == false)
                {
                    string[] buffer = stationVariable.mySetting.cameraIPFwBusinessFrom.Split('.');
                    new_ip_address = string.Format("{0}.{1}.{2}.{3}", buffer[0], buffer[1], buffer[2], int.Parse(buffer[3]) + index);
                }
                else
                {
                    new_ip_address = tmpIP;
                }

                stationVariable.myTesting.logSystem += string.Format("......gen new ip {0} is {1}\n", mac_ethernet, new_ip_address);
                camera_indoor.changeIPWithoutSave(new_ip_address);

                //wait after change ip
                count = 0;
RE_WAIT:
                count++;
                ret = globalUtility.pingNetwork(new_ip_address);
                if (!ret)
                {
                    if (count < 30)
                    {
                        Thread.Sleep(500); goto RE_WAIT;
                    }
                    else
                    {
                        stationVariable.myTesting.logSystem += string.Format("......change to new ip {0} is {1}\n", new_ip_address, ret);
                        return(false);
                    }
                }
                stationVariable.myTesting.logSystem += string.Format("......change to new ip {0} is {1}\n", new_ip_address, ret);

                //add camera to collection
                if (macExisted == false && index < int.Parse(stationVariable.myTesting.cameraQuantity))
                {
                    Application.Current.Dispatcher.Invoke(new Action(() => {
                        stationVariable.myUploadFWInfo.Add(new UploadFwItemInfo()
                        {
                            macEthernet = mac_ethernet,
                            ipAddress   = new_ip_address,
                            totalResult = "Waiting..."
                        });
                    }));
                }

                //call thread control upload FW or verify firmware
                UploadFwItemInfo itemInfo = null;
                Application.Current.Dispatcher.Invoke(new Action(() => {
                    foreach (var item in stationVariable.myUploadFWInfo)
                    {
                        if (item.macEthernet.ToLower().Equals(mac_ethernet.ToLower()))
                        {
                            itemInfo = item;
                            break;
                        }
                    }
                }));

                if (itemInfo != null && itemInfo.totalResult.Equals("Waiting..."))
                {
                    if (macExisted == false && stationVariable.mySetting.IsUploadFirmwareBusiness == true)
                    {
                        Thread t = new Thread(new ThreadStart(() => {
                            bool r         = false;
                            var ex_upfw_tm = new exUploadFWBusiness <UploadFwItemInfo, SettingInformation>(itemInfo, stationVariable.mySetting);
                            r = ex_upfw_tm.excuteTelnet();
                            if (!r)
                            {
                                itemInfo.totalResult = "Failed";
                                //save log
                                saveLog(itemInfo);
                            }
                            else
                            {
                                if (!stationVariable.mySetting.isTestFunction())
                                {
                                    itemInfo.totalResult = "Passed";
                                    //save log
                                    saveLog(itemInfo);
                                }
                            }
                        }));
                        t.IsBackground = true;
                        t.Start();
                    }
                    else
                    {
                        Thread t = new Thread(new ThreadStart(() => {
                            bool r             = false;
                            var ex_testfunc_tm = new exTestFunctionBusiness <UploadFwItemInfo, SettingInformation>(itemInfo, stationVariable.mySetting);
                            r = ex_testfunc_tm.excuteTelnet();
                            itemInfo.totalResult = r ? "Passed" : "Failed";
                            //save log
                            saveLog(itemInfo);
                        }));
                        t.IsBackground = true;
                        t.Start();
                    }
                }
                return(true);
            }
            catch { return(false); }
        }
Ejemplo n.º 19
0
        private bool _change_ip_camera(int index)
        {
            try {
                bool ret   = false;
                int  count = 0;

                //ping to camera
                count = 0;
                int c = 0;
RE_PING:
                count++;
                ret = globalUtility.pingNetwork(stationVariable.mySetting.cameraIP);
                stationVariable.myTesting.logSystem += string.Format("......ping {0} is {1}\n", stationVariable.mySetting.cameraIP, ret);
                if (!ret)
                {
                    if (count < 3)
                    {
                        Thread.Sleep(500); goto RE_PING;
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    c++;
                    if (c < 3)
                    {
                        Thread.Sleep(500); goto RE_PING;
                    }
                }
                //login telnet to camera
                count = 0;
RE_LOGIN:
                count++;
                Common.Dut.IPCamera <TestingInformation> camera_indoor = new Common.Dut.IPCamera <TestingInformation>(stationVariable.myTesting, stationVariable.mySetting.cameraIP, stationVariable.mySetting.cameraTelnetUser, stationVariable.mySetting.cameraTelnetPassword);
                camera_indoor.Login();
                ret = camera_indoor.IsConnected();
                stationVariable.myTesting.logSystem += string.Format("......login to {0} is {1}\n", stationVariable.mySetting.cameraIP, ret);
                if (!ret)
                {
                    if (count < 3)
                    {
                        Thread.Sleep(500); goto RE_LOGIN;
                    }
                    else
                    {
                        return(false);
                    }
                }

                //get camera mac ethernet
                string mac_ethernet = camera_indoor.getMacEthernet();
                stationVariable.myTesting.logSystem += string.Format("......get mac {0} is {1}\n", stationVariable.mySetting.cameraIP, mac_ethernet);

                //check same mac or not
                bool   macExisted = false;
                string tmpIP      = "";
                Application.Current.Dispatcher.Invoke(new Action(() => {
                    foreach (var item in stationVariable.myCalibNightVisionInfo)
                    {
                        if (item.macEthernet.ToLower().Contains(mac_ethernet.ToLower()))
                        {
                            macExisted = true;
                            tmpIP      = item.ipAddress;
                            break;
                        }
                    }
                }));

                //change ip address
                string new_ip_address = "";
                if (macExisted == false)
                {
                    string[] buffer = stationVariable.mySetting.cameraIPCalibFrom.Split('.');
                    new_ip_address = string.Format("{0}.{1}.{2}.{3}", buffer[0], buffer[1], buffer[2], int.Parse(buffer[3]) + index);
                }
                else
                {
                    new_ip_address = tmpIP;
                }

                stationVariable.myTesting.logSystem += string.Format("......gen new ip {0} is {1}\n", mac_ethernet, new_ip_address);
                camera_indoor.changeIPWithoutSave(new_ip_address);

                //wait after change ip
                count = 0;
RE_WAIT:
                count++;
                ret = globalUtility.pingNetwork(new_ip_address);
                if (!ret)
                {
                    if (count < 30)
                    {
                        Thread.Sleep(500); goto RE_WAIT;
                    }
                    else
                    {
                        stationVariable.myTesting.logSystem += string.Format("......change to new ip {0} is {1}\n", new_ip_address, ret);
                        return(false);
                    }
                }
                stationVariable.myTesting.logSystem += string.Format("......change to new ip {0} is {1}\n", new_ip_address, ret);

                //add camera to collection
                if (macExisted == false)
                {
                    Application.Current.Dispatcher.Invoke(new Action(() => {
                        stationVariable.myCalibNightVisionInfo.Add(new CalibNightVisionItemInfo()
                        {
                            macEthernet      = mac_ethernet,
                            ipAddress        = new_ip_address,
                            changeIPResult   = "Passed",
                            calibDarkResult  = "-",
                            calibLightResult = "-",
                            verifyResult     = "-",
                            Result           = "Waiting..."
                        });
                    }));
                }

                return(true);
            }
            catch { return(false); }
        }
Ejemplo n.º 20
0
        private bool _test_allitem_asm()
        {
            try {
                bool r   = false;
                bool ret = true;

                //init control
                Common.Dut.IPCamera <TestingInformation> camera_indoor = null;
                stationVariable.myTesting.Ready();
                stationVariable.myTesting.Checking();

                //input barcode reader
                r = _item_input_barcode();
                if (!r)
                {
                    ret = false; goto NG;
                }

                //login to camera
                r = _item_test_login(ref camera_indoor);
                if (!r)
                {
                    ret = false; goto NG;
                }

                //test all item
                foreach (var testItem in listTestItem_ASM)
                {
                    MethodInfo method = this.GetType().GetMethod(testItem, BindingFlags.NonPublic | BindingFlags.Instance);
                    if (method == null)
                    {
                        continue;
                    }

                    var func = (Func <Common.Dut.IPCamera <TestingInformation>, bool>)method.CreateDelegate(typeof(Func <Common.Dut.IPCamera <TestingInformation>, bool>), this);
                    r = func(camera_indoor);
                    if (!r)
                    {
                        ret = false;
                        if (stationVariable.mySetting.FailAndStop == "Yes")
                        {
                            goto NG;
                        }
                    }
                }

                if (ret)
                {
                    goto OK;
                }
                else
                {
                    goto NG;
                }

                //xu ly khi Pass
OK:
                stationVariable.myTesting.Pass();
                goto END;

                //xu ly khi fail
NG:
                stationVariable.myTesting.Fail();
                goto END;

                //xu ly khi ket thuc
END:
                if (camera_indoor != null && camera_indoor.IsConnected() == true)
                {
                    camera_indoor.Close();
                }
                //save log
                return(ret);
            }
            catch {
                return(false);
            }
        }
Ejemplo n.º 21
0
        private bool _get_calib_value(CalibNightVisionItemInfo calibItem)
        {
            try {
                bool ret   = false;
                int  count = 0;

                stationVariable.myTesting.logSystem += string.Format("......camera {0}\n", calibItem.macEthernet);
                calibItem.verifyResult = "...";

                //login telnet to camera
                count = 0;
RE_LOGIN:
                count++;
                Common.Dut.IPCamera <TestingInformation> camera_indoor = new Common.Dut.IPCamera <TestingInformation>(stationVariable.myTesting, calibItem.ipAddress, stationVariable.mySetting.cameraTelnetUser, stationVariable.mySetting.cameraTelnetPassword);
                camera_indoor.Login();
                ret = camera_indoor.IsConnected();
                stationVariable.myTesting.logSystem += string.Format(".........login to {0} is {1}\n", calibItem.ipAddress, ret);
                if (!ret)
                {
                    if (count < 3)
                    {
                        Thread.Sleep(500); goto RE_LOGIN;
                    }
                    else
                    {
                        camera_indoor.Close();
                        calibItem.verifyResult = "null,null";
                        return(false);
                    }
                }

                //verify after calib
                count = 0;
RE_CALIB:
                count++;
                string data = camera_indoor.getCalibNightVisionValue();
                ret = data.Contains("lowthreshold") && data.Contains("highthreshold");
                stationVariable.myTesting.logSystem += string.Format(".........calib value {0}, result {1}\n", data, ret);
                if (!ret)
                {
                    if (count < 3)
                    {
                        Thread.Sleep(500); goto RE_CALIB;
                    }
                    else
                    {
                        camera_indoor.Close();
                        calibItem.verifyResult = "null,null";
                        return(false);
                    }
                }

                camera_indoor.Close();
                string sssssssssssssss = data.Replace("\r", "")
                                         .Replace("\n", "")
                                         .Replace("cat /usr/conf/nightvision.cfg", "")
                                         .Replace("~ #", "")
                                         .Trim();

                string[] buffer = sssssssssssssss.Split(',');
                calibItem.verifyResult = buffer[1].Replace("\"", "").Replace("threshold", "").Trim() + "," + buffer[2].Replace("\"", "").Replace("threshold", "").Trim();

                return(true);
            }
            catch {
                calibItem.verifyResult = "null,null";
                return(false);
            }
        }