示例#1
0
        //Calib Quang------------------------------//
        public override bool loginToONT(testinginfo _testinfo)
        {
            _testinfo.SYSTEMLOG += string.Format("Verifying type of ONT...\r\n...{0}\r\n", GlobalData.initSetting.ONTTYPE);
            bool   _result  = false;
            string _message = "";

            _testinfo.SYSTEMLOG += "Open comport of ONT...\r\n";
            if (!base.Open(out _message))
            {
                _testinfo.ERRORCODE  = "(Mã Lỗi: COT-LI-0001)";
                _testinfo.SYSTEMLOG += string.Format("...{0}, {1}\r\n", _testinfo.ERRORCODE, _message);
                return(false);
            }
            _testinfo.SYSTEMLOG += "...PASS\r\n";

            _testinfo.SYSTEMLOG += "Login to ONT...\r\n";
            _result              = this.Login(out _message);

            if (_result == false)
            {
                _testinfo.ERRORCODE = "(Mã Lỗi: COT-LI-0002)";
            }
            _testinfo.SYSTEMLOG += string.Format("...{0}, {1}\r\n", _testinfo.ERRORCODE, _message);
            _testinfo.SYSTEMLOG += _result == true ? "PASS\r\n" : "FAIL\r\n";

            return(_result);
        }
示例#2
0
        public override bool txDDMI(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var)
        {
            try {
                bool _result = false;
                _testinfo.TXDDMIRESULT = Parameters.testStatus.Wait.ToString();
                _testinfo.SYSTEMLOG   += "--------------------------------------------------------------\r\n";
                _testinfo.SYSTEMLOG   += "STEP 3: TX DDMI\r\n";

                _var.Pwr_temp        = Convert.ToDouble(GlobalData.powerDevice.getPower_dBm(Port));
                _testinfo.SYSTEMLOG += "Pwr_temp = " + _var.Pwr_temp + "\r\n";
                base.WriteLine("echo set_flash_register_default >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);
                base.WriteLine("echo set_flash_register_Tx_data >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);
                string RR;
                string RR_DAC;
                RR = (Math.Round(Math.Pow(10, (_var.Pwr_temp / 10)) * 100)).ToString();

                RR_DAC = int.Parse(RR).ToString("X");
                base.WriteLine("echo set_flash_register_DDMI_TxPower 0x00" + RR_DAC + " 0x40 >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);
                string str = base.Read();
                base.WriteLine("echo DDMI_check_8472 >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);

                str = base.Read();
                for (int n = 0; n < str.Split('\n').Length; n++)
                {
                    if (str.Split('\n')[n].Contains("Tx power"))
                    {
                        _var.TX_Power_DDMI   = str.Split('\n')[n].Split('=')[1].TrimEnd();
                        _var.TX_Power_DDMI   = (10 * Math.Log10(Convert.ToDouble(_var.TX_Power_DDMI) / 10000)).ToString("0.##");
                        _testinfo.SYSTEMLOG += "TX_Power_DDMI = " + _var.TX_Power_DDMI.ToString() + " dBm\r\n";

                        if (Convert.ToDouble(_var.TX_Power_DDMI) > (_var.Pwr_temp - 0.5) && Convert.ToDouble(_var.TX_Power_DDMI) < (_var.Pwr_temp + 0.5))
                        {
                            _result = true;
                        }
                        else
                        {
                            _result = false;
                        }
                    }
                }
                if (_result == false)
                {
                    _testinfo.ERRORCODE = "(Mã Lỗi: COT-MI-0001)";
                }
                _testinfo.SYSTEMLOG   += _result == true ? "Check Power DDMI: PASS.\r\n" : string.Format("Check Power DDMI: FAIL. {0}\r\n", _testinfo.ERRORCODE);
                _testinfo.TXDDMIRESULT = _result == true?Parameters.testStatus.PASS.ToString() : Parameters.testStatus.FAIL.ToString();

                return(_result);
            }
            catch (Exception ex) {
                _testinfo.ERRORCODE    = "(Mã Lỗi: COT-MI-0002)";
                _testinfo.SYSTEMLOG   += string.Format("{0}, {1}\r\n", _testinfo.ERRORCODE, ex.ToString());
                _testinfo.TXDDMIRESULT = Parameters.testStatus.FAIL.ToString();
                return(false);
            }
        }
示例#3
0
        bool _waitForTurn(testinginfo _testinfo)
        {
            bool _flag   = false;
            int  timeout = 900; //timeout =90s
            int  count   = 0;

            _testinfo.SYSTEMLOG += "Wait for turning ER...\r\n";
            while (!_flag)
            {
                string _tmp = "";
                lock (thisLock) { _tmp = GlobalData.listSequenceTestER[0]; }
                if (_tmp == _testinfo.ONTINDEX)
                {
                    _flag = true;
                }
                Thread.Sleep(100);
                count++;
                if (count > timeout)
                {
                    break;
                }
            }
            _testinfo.SYSTEMLOG += string.Format("...Waited time:{0} ms\r\n", count * 100);
            if (count > timeout)
            {
                return(false);                 //Request time out
            }
            return(true);
        }
        public static bool Save(testinginfo _testinfo)
        {
            lock (lockthis) {
                try {
                    string _dir   = GlobalData.initSetting.ONTTYPE == "GW040H" ? _dir_040H_logpath : _dir_020BoB_logpath;
                    string _file  = DateTime.Now.ToString("yyyyMMdd");
                    string _title = GlobalData.initSetting.ONTTYPE == "GW040H" ? "DATETIME,MAC-ADDRESS,BOSA-SERIAL,TUNINGPOWER-RESULT,TUNINGER-RESULT,TXDDMI-RESULT,SIGNALOFF-RESULT,WRITEFLASH-RESULT,VERIFYSIGNAL-RESULT,WRITEMAC-RESULT,ERROR-CODE,TOTAL-RESULT,TOTAL-TIME" : "DATETIME,MAC-ADDRESS,BOSA-SERIAL,WRITEAPD-RESULT,TUNINGPOWER-RESULT,TUNINGER-RESULT,TUNING-CROSSING,TXDDMI-RESULT,ERROR-CODE,TOTAL-RESULT,TOTAL-TIME";

                    string _content = "";
                    _content += DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + ",";
                    _content += _testinfo.MACADDRESS + ",";
                    _content += _testinfo.BOSASERIAL + ",";
                    if (GlobalData.initSetting.ONTTYPE != "GW040H")
                    {
                        _content += _testinfo.WRITEAPDRESULT + ",";
                    }
                    _content += _testinfo.TUNINGPOWERRESULT + ",";
                    _content += _testinfo.TUNINGERRESULT + ",";
                    if (GlobalData.initSetting.ONTTYPE != "GW040H")
                    {
                        _content += _testinfo.TUNINGCROSSINGRESULT + ",";
                    }
                    _content += _testinfo.TXDDMIRESULT + ",";
                    if (GlobalData.initSetting.ONTTYPE == "GW040H")
                    {
                        _content += _testinfo.SIGNALOFFRESULT + ",";
                        _content += _testinfo.WRITEFLASHRESULT + ",";
                        _content += _testinfo.VERIFYSIGNALRESULT + ",";
                        _content += _testinfo.WRITEMACRESULT + ",";
                    }
                    _content += _testinfo.ERRORCODE.Replace("Mã Lỗi", "") + ",";
                    _content += _testinfo.TOTALRESULT + ",";
                    _content += _testinfo.TOTALTIME;

                    if (File.Exists(string.Format("{0}\\{1}.csv", _dir, _file)) == false)
                    {
                        StreamWriter st = new StreamWriter(string.Format("{0}\\{1}.csv", _dir, _file), true);
                        st.WriteLine(_title);
                        st.WriteLine(_content);
                        st.Dispose();
                    }
                    else
                    {
                        StreamWriter st = new StreamWriter(string.Format("{0}\\{1}.csv", _dir, _file), true);
                        st.WriteLine(_content);
                        st.Dispose();
                    }
                    return(true);
                }
                catch {
                    return(false);
                }
            }
        }
示例#5
0
 bool _addToListSequenceTestER(testinginfo _testinfo)
 {
     lock (thisLock) {
         _testinfo.SYSTEMLOG += string.Format("Add index {0} to list sequence test ER...\r\n", _testinfo.ONTINDEX);
         GlobalData.listSequenceTestER.Add(_testinfo.ONTINDEX);
         string data = "";
         foreach (var item in GlobalData.listSequenceTestER)
         {
             data += item + ",";
         }
         _testinfo.SYSTEMLOG += string.Format("...{0}\r\n", data);
         return(true);
     }
 }
        public static bool Save(testinginfo _testinfo)
        {
            lock (lockthis) {
                try {
                    string _dir  = GlobalData.initSetting.ONTTYPE == "GW040H" ? _dir_040H_logpath : _dir_020BoB_logpath;
                    string _file = DateTime.Now.ToString("yyyyMMdd");

                    StreamWriter st = new StreamWriter(string.Format("{0}\\{1}.txt", _dir, _file), true);
                    st.WriteLine(_testinfo.SYSTEMLOG);
                    st.Dispose();
                    return(true);
                }
                catch {
                    return(false);
                }
            }
        }
示例#7
0
 public override string getMACAddress(testinginfo _testinfo)
 {
     try {
         _testinfo.SYSTEMLOG += string.Format("Get mac address...\r\n");
         base.Write("ifconfig\n");
         Thread.Sleep(300);
         string _tmpStr = base.Read();
         _tmpStr = _tmpStr.Replace("\r", "").Replace("\n", "").Trim();
         string[] buffer = _tmpStr.Split(new string[] { "HWaddr" }, StringSplitOptions.None);
         _tmpStr = buffer[1].Trim();
         string mac = _tmpStr.Substring(0, 17).Replace(":", "");
         _testinfo.SYSTEMLOG += string.Format("...PASS. {0}\r\n", mac);
         return(mac);
     }
     catch (Exception ex) {
         _testinfo.ERRORCODE  = "(Mã Lỗi: COT-GM-0001)";
         _testinfo.SYSTEMLOG += string.Format("...FAIL. {0}. {1}\r\n", _testinfo.ERRORCODE, ex.ToString());
         return(string.Empty);
     }
 }
示例#8
0
        public override bool verifySignal(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var)
        {
            try {
                bool _result = false;
                _testinfo.VERIFYSIGNALRESULT = Parameters.testStatus.Wait.ToString();
                _testinfo.SYSTEMLOG         += "--------------------------------------------------------------\r\n";
                _testinfo.SYSTEMLOG         += "STEP 6: VERIFY SIGNAL\r\n";

                base.WriteLine("echo GPON_pattern >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);

                _var.Pwr_temp        = Convert.ToDouble(GlobalData.powerDevice.getPower_dBm(Port));
                _var.ER_temp         = Convert.ToDouble(GlobalData.erDevice.getER(Port));
                _testinfo.SYSTEMLOG += "ER_temp = " + _var.ER_temp + "\r\n";
                _testinfo.SYSTEMLOG += "Power_temp = " + _var.Pwr_temp + "\r\n";

                if (_var.Pwr_temp > 2 && _var.Pwr_temp < 3 && _var.ER_temp > 11.5 && _var.ER_temp < 13.5)
                {
                    _result = true;
                }
                else
                {
                    _result = false;
                }
                if (_result == false)
                {
                    _testinfo.ERRORCODE = "(Mã Lỗi: COT-VS-0001)";
                }
                _testinfo.SYSTEMLOG         += _result == true ? "Verify Signal: PASS.\r\n" : string.Format("Verify Signal: FAIL. {0}\r\n", _testinfo.ERRORCODE);
                _testinfo.VERIFYSIGNALRESULT = _result == true?Parameters.testStatus.PASS.ToString() : Parameters.testStatus.FAIL.ToString();

                return(_result);
            }
            catch (Exception ex) {
                _testinfo.ERRORCODE          = "(Mã Lỗi: COT-VS-0002)";
                _testinfo.SYSTEMLOG         += string.Format("{0}, {1}\r\n", _testinfo.ERRORCODE, ex.ToString());
                _testinfo.VERIFYSIGNALRESULT = Parameters.testStatus.FAIL.ToString();
                return(false);
            }
        }
示例#9
0
        public override bool signalOff(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var)
        {
            try {
                bool _result = false;
                _testinfo.SIGNALOFFRESULT = Parameters.testStatus.Wait.ToString();
                _testinfo.SYSTEMLOG      += "--------------------------------------------------------------\r\n";
                _testinfo.SYSTEMLOG      += "STEP 4: TEST OFF SIGNAL\r\n";
                string str = base.Read();
                base.WriteLine("echo dis_pattern >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);
                str                  = base.Read();
                _var.Pwr_temp        = Convert.ToDouble(GlobalData.powerDevice.getPower_dBm(Port));
                _testinfo.SYSTEMLOG += "Power_Off = " + _var.Pwr_temp + "\r\n";
                if (_var.Pwr_temp < -25)
                {
                    _result = true;
                }
                else
                {
                    _result = false;
                }
                if (_result == false)
                {
                    _testinfo.ERRORCODE = "(Mã Lỗi: COT-SO-0001)";
                }
                _testinfo.SYSTEMLOG      += _result == true ? "TxPower Off: PASS\r\n" : string.Format("TxPower Off: FAIL. {0}\r\n", _testinfo.ERRORCODE);
                _testinfo.SIGNALOFFRESULT = _result == true?Parameters.testStatus.PASS.ToString() : Parameters.testStatus.FAIL.ToString();

                return(_result);
            }
            catch (Exception ex) {
                _testinfo.ERRORCODE       = "(Mã Lỗi: COT-SO-0002)";
                _testinfo.SYSTEMLOG      += string.Format("{0}, {1}\r\n", _testinfo.ERRORCODE, ex.ToString());
                _testinfo.SIGNALOFFRESULT = Parameters.testStatus.FAIL.ToString();
                return(false);
            }
        }
示例#10
0
        public override bool calibER(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var)
        {
            try {
                bool _result = false;
                _testinfo.TUNINGERRESULT = Parameters.testStatus.Wait.ToString();
                _testinfo.SYSTEMLOG     += "--------------------------------------------------------------\r\n";
                _testinfo.SYSTEMLOG     += "STEP 2: TUNING ER\r\n";

                _var.Imod = ((_var.Pwr_temp + 3) / _var.Slope) + _var.Iav - _var.Ith - 1;

                for (int k = 0; k < 12; k++)
                {
                    _var.Imod_DAC     = (Math.Round(_var.Imod * 4096 / 90)).ToString();
                    _var.Imod_DAC_Hex = int.Parse(_var.Imod_DAC).ToString("X");
                    base.WriteLine("echo IMOD 0x" + _var.Imod_DAC_Hex + " >/proc/pon_phy/debug");
                    Thread.Sleep(Delay_modem);

                    try {
                        string _kq = GlobalData.erDevice.getER(Port).Replace("\r", "").Replace("\n", "");
                        _testinfo.SYSTEMLOG += string.Format("ER String read from instrument: {0}", _kq);
                        //_var.ER_temp = Convert.ToDouble(_kq);
                        _var.ER_temp = double.Parse(_kq);
                    }
                    catch (Exception ex) {
                        _testinfo.SYSTEMLOG += ex.ToString() + "\r\n";
                        _var.ER_temp         = double.MaxValue;
                    }

                    _testinfo.SYSTEMLOG += string.Format("ER_temp = {0}\r\n", _var.ER_temp);
                    _testinfo.SYSTEMLOG += string.Format("Imod = {0}\r\n", _var.Imod);

                    if (!_var.ER_temp.ToString().Contains("E+"))
                    {
                        if (_var.ER_temp < 12 || _var.ER_temp > 13)
                        {
                            double ER_err = _var.ER_temp - 12.5;
                            if (ER_err <= -5)
                            {
                                _testinfo.SYSTEMLOG += "Cần tăng Imod thêm +12.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod + 12;
                            }
                            else if (ER_err > -5 && ER_err <= -4)
                            {
                                _testinfo.SYSTEMLOG += "Cần tăng Imod thêm +10.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod + 10;
                            }
                            else if (ER_err > -4 && ER_err <= -3)
                            {
                                _testinfo.SYSTEMLOG += "Cần tăng Imod thêm +7.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod + 7;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err > -3 && ER_err <= -2.5)
                            {
                                _testinfo.SYSTEMLOG += "Cần tăng Imod thêm +5.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod + 5;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err > -2.5 && ER_err <= -2)
                            {
                                _testinfo.SYSTEMLOG += "Cần tăng Imod thêm +3.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod + 3;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err > -2 && ER_err <= -1.5)
                            {
                                _testinfo.SYSTEMLOG += "Cần tăng Imod thêm +2.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod + 2;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err > -1.5 && ER_err <= -1)
                            {
                                _testinfo.SYSTEMLOG += "Cần tăng Imod thêm +1.5.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod + 1.5;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err > -1 && ER_err <= -0.5)
                            {
                                _testinfo.SYSTEMLOG += "Cần tăng Imod thêm +1.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod + 1;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            //else if (ER_err >= 0.5)
                            //{
                            //    SetText(Tx_rtbAll, "Cần tăng Imod.");
                            //    Imod = Imod + 0.5;
                            //    SetText(Tx_rtbAll, "Imod mới = " + Imod);
                            //}

                            //------------------------------------------
                            if (ER_err >= 5)
                            {
                                _testinfo.SYSTEMLOG += "Cần giảm Imod -4.5.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod - 4.5;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err >= 4 && ER_err < 5)
                            {
                                _testinfo.SYSTEMLOG += "Cần giảm Imod -4.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod - 4;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err >= 3 && ER_err < 4)
                            {
                                _testinfo.SYSTEMLOG += "Cần giảm Imod -3.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod - 3;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err >= 2.5 && ER_err < 3)
                            {
                                _testinfo.SYSTEMLOG += "Cần giảm Imod -2.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod - 2;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err >= 2 && ER_err < 2.5)
                            {
                                _testinfo.SYSTEMLOG += "Cần giảm Imod -1.5.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod - 1.5;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err >= 1.5 && ER_err < 2)
                            {
                                _testinfo.SYSTEMLOG += "Cần giảm Imod -1.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod - 1;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err >= 1 && ER_err < 1.5)
                            {
                                _testinfo.SYSTEMLOG += "Cần giảm Imod -1.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod - 1;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err >= 0.5 && ER_err < 1)
                            {
                                _testinfo.SYSTEMLOG += "Cần giảm Imod -0.5.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod - 0.5;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                        }
                        else if (_var.ER_temp >= 12 && _var.ER_temp <= 13)
                        {
                            base.WriteLine("echo set_flash_register 0x00060023 0x64 >/proc/pon_phy/debug"); //Bù ER ở nhiệt độ 45*C
                            Thread.Sleep(Delay_modem);
                            _result = true;
                            break;
                        }
                    }
                    else if (_var.ER_temp.ToString().Contains("E+"))
                    {
                        //_result = false;
                        //break;
                    }
                }

                if (_result == false)
                {
                    _testinfo.ERRORCODE = "(Mã Lỗi: COT-ER-0001)";
                }
                _testinfo.SYSTEMLOG     += _result == true ? "Tuning ER: PASS\r\n" : string.Format("Tuning ER: FAIL. {0}\r\n", _testinfo.ERRORCODE);
                _testinfo.TUNINGERRESULT = _result == true?Parameters.testStatus.PASS.ToString() : Parameters.testStatus.FAIL.ToString();

                return(_result);
            }
            catch (Exception ex) {
                _testinfo.ERRORCODE      = "(Mã Lỗi: COT-ER-0002)";
                _testinfo.SYSTEMLOG     += string.Format("{0}, {1}\r\n", _testinfo.ERRORCODE, ex.ToString());
                _testinfo.TUNINGERRESULT = Parameters.testStatus.FAIL.ToString();
                return(false);
            }
        }
示例#11
0
        public override bool calibPower(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var)
        {
            try {
                bool _result = false;
                _testinfo.TUNINGPOWERRESULT = Parameters.testStatus.Wait.ToString();
                _testinfo.SYSTEMLOG        += "Bắt Đầu Thực Hiện Calib TX...\r\n";
                _testinfo.SYSTEMLOG        += string.Format("BOSA Serial Number: {0}\r\n", _testinfo.BOSASERIAL);
                _testinfo.SYSTEMLOG        += string.Format("Ith = {0}\r\n", _bosainfo.Ith);
                _testinfo.SYSTEMLOG        += "--------------------------------------------------------------\r\n";
                _testinfo.SYSTEMLOG        += "STEP 1: TUNING POWER\r\n";

                base.WriteLine("echo set_flash_register_default >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);
                base.WriteLine("echo flash_dump >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);
                base.WriteLine("echo GPON_Tx_cal_init >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);

                _var.Ith           = double.Parse(_bosainfo.Ith);
                _var.Iav_1         = _var.Ith + 10;
                _var.Iav_1_dac     = Math.Round(_var.Iav_1 * 4096 / 90);
                _var.Iav_1_dac_hex = int.Parse(_var.Iav_1_dac.ToString()).ToString("X");

                _testinfo.SYSTEMLOG += string.Format("echo IAV 0x{0} >/proc/pon_phy/debug\r\n", _var.Iav_1_dac_hex);
                base.WriteLine("echo IAV 0x" + _var.Iav_1_dac_hex + " >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);

                _var.Pwr_1           = Convert.ToDouble(GlobalData.powerDevice.getPower_dBm(Port));
                _testinfo.SYSTEMLOG += string.Format("Pwr_1 = {0}\r\n", _var.Pwr_1);

                if (_var.Pwr_1 <= -8)
                {
                    _testinfo.ERRORCODE         = "(Mã Lỗi: COT-PW-0001)";
                    _testinfo.SYSTEMLOG        += string.Format("Tuning Power: FAIL. {0}\r\n", _testinfo.ERRORCODE);
                    _testinfo.TUNINGPOWERRESULT = Parameters.testStatus.FAIL.ToString();
                    return(false);
                }

                _var.Iav_2         = _var.Ith + 15;
                _var.Iav_2_dac     = Math.Round(_var.Iav_2 * 4096 / 90);
                _var.Iav_2_dac_hex = int.Parse(_var.Iav_2_dac.ToString()).ToString("X");

                _testinfo.SYSTEMLOG += string.Format("echo IAV 0x{0} >/proc/pon_phy/debug\r\n", _var.Iav_2_dac_hex);
                base.WriteLine("echo IAV 0x" + _var.Iav_2_dac_hex + " >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);

                _var.Pwr_2           = Convert.ToDouble(GlobalData.powerDevice.getPower_dBm(Port));
                _testinfo.SYSTEMLOG += string.Format("Pwr_2 = {0}\r\n", _var.Pwr_2);

                _var.Slope    = (_var.Pwr_2 - _var.Pwr_1) / (_var.Iav_2 - _var.Iav_1);
                _var.Pwr_temp = Convert.ToDouble(GlobalData.powerDevice.getPower_dBm(Port));
                _var.Iav      = ((2.5 - _var.Pwr_1) / _var.Slope) + _var.Iav_1;

                for (int i = 0; i < 15; i++)
                {
                    _var.Iav_DAC     = (Math.Round(_var.Iav * 4096 / 90)).ToString();
                    _var.Iav_DAC_Hex = int.Parse(_var.Iav_DAC).ToString("X");

                    base.WriteLine("echo IAV 0x" + _var.Iav_DAC_Hex + " >/proc/pon_phy/debug");
                    Thread.Sleep(Delay_modem);
                    _var.Pwr_temp        = Convert.ToDouble(GlobalData.powerDevice.getPower_dBm(Port));
                    _testinfo.SYSTEMLOG += string.Format("Pwr_temp = {0}\r\n", _var.Pwr_temp.ToString());

                    if (_var.Pwr_temp >= 2.5 && _var.Pwr_temp <= 3)
                    {
                        _result = true;
                        break;
                    }
                    else
                    {
                        _var.Iav = ((2.8 - _var.Pwr_temp) / _var.Slope) + _var.Iav;
                    }
                }

                if (_result == false)
                {
                    _testinfo.ERRORCODE = "(Mã Lỗi: COT-PW-0001)";
                }
                _testinfo.SYSTEMLOG        += _result == true ? "Tuning Power: PASS.\r\n" : string.Format("Tuning Power: FAIL. {0}\r\n", _testinfo.ERRORCODE);
                _testinfo.TUNINGPOWERRESULT = _result == true?Parameters.testStatus.PASS.ToString() : Parameters.testStatus.FAIL.ToString();

                return(_result);
            }
            catch (Exception ex) {
                _testinfo.ERRORCODE         = "(Mã Lỗi: COT-PW-0002)";
                _testinfo.SYSTEMLOG        += string.Format("{0}, {1}\r\n", _testinfo.ERRORCODE, ex.ToString());
                _testinfo.TUNINGPOWERRESULT = Parameters.testStatus.FAIL.ToString();
                return(false);
            }
        }
示例#12
0
 public abstract bool signalOff(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var);
示例#13
0
 public override bool calibCrossing(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var)
 {
     throw new NotImplementedException();
 }
示例#14
0
        public override bool writeFlash(bosainfo _bosainfo, testinginfo _testinfo)
        {
            bool _result = false;

            _testinfo.WRITEFLASHRESULT = Parameters.testStatus.Wait.ToString();
            _testinfo.SYSTEMLOG       += "--------------------------------------------------------------\r\n";
            _testinfo.SYSTEMLOG       += "STEP 5: WRITE INTO FLASH\r\n";
            string tempdata = "";

            try {
                //Luu FLASH
                bool _isOK = false;
                _isOK = base.WriteLineAndWaitComplete("echo set_flash_register_Tx_data >/proc/pon_phy/debug", ref tempdata);
                _testinfo.SYSTEMLOG += tempdata + "\r\n";
                if (_isOK == false)
                {
                    goto NG;
                }

                _isOK = base.WriteLineAndWaitComplete("echo set_flash_register 0x07050701 0x94 >/proc/pon_phy/debug", ref tempdata);
                _testinfo.SYSTEMLOG += tempdata + "\r\n";
                if (_isOK == false)
                {
                    goto NG;
                }

                _isOK = base.WriteLineAndWaitComplete("echo save_flash_matrix >/proc/pon_phy/debug", ref tempdata);
                _testinfo.SYSTEMLOG += tempdata + "\r\n";
                if (_isOK == false)
                {
                    goto NG;
                }

                _isOK = base.WriteLineAndWaitComplete("mtd writeflash /tmp/7570_bob.conf 160 656896 reservearea", ref tempdata);//dual band
                _testinfo.SYSTEMLOG += tempdata + "\r\n";
                if (_isOK == false)
                {
                    goto NG;
                }

                //Show gia tri thanh ghi quang TX
                int count = 0;
REPEAT:
                count++;
                base.WriteLineAndWaitComplete("echo flash_dump >/proc/pon_phy/debug", ref tempdata);
                _testinfo.SYSTEMLOG += tempdata + "\r\n";
                if (tempdata.Contains("0x07050701"))
                {
                    _result = true;
                }
                else
                {
                    _result = false;
                    if (count < 3)
                    {
                        goto REPEAT;
                    }
                }

                _testinfo.SYSTEMLOG += "Hoàn thành quá trình Calibration.\r\n";
                if (_result == false)
                {
                    _testinfo.ERRORCODE = "(Mã Lỗi: COT-WF-0001)";
                    goto NG;
                }

                goto OK;
            }
            catch (Exception ex) {
                _testinfo.ERRORCODE  = "(Mã Lỗi: COT-WF-0002)";
                _testinfo.SYSTEMLOG += string.Format("{0}, {1}\r\n", _testinfo.ERRORCODE, ex.ToString());
                goto NG;
            }

OK:
            _testinfo.SYSTEMLOG       += "Write flash thành công.\r\n";
            _testinfo.WRITEFLASHRESULT = Parameters.testStatus.PASS.ToString();
            return(true);

NG:
            _testinfo.SYSTEMLOG       += string.Format("Write flash thất bại. {0}\r\n", _testinfo.ERRORCODE);
            _testinfo.WRITEFLASHRESULT = Parameters.testStatus.FAIL.ToString();
            return(false);
        }
示例#15
0
 public abstract bool writeAPD(bosainfo _bosainfo, testinginfo _testinfo);
示例#16
0
 public abstract bool calibCrossing(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var);
示例#17
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button b          = sender as Button;
            string buttonName = b.Name;
            string _index     = buttonName.Substring(buttonName.Length - 1, 1);

            this._resetDisplay(_index); //manual

            if (GlobalData.initSetting.ONTTYPE == "GW040H" || (GlobalData.initSetting.ONTTYPE == "GW020BoB" && GlobalData.initSetting.ENABLEWRITEAPD == true))
            {
                this.Opacity = 0.3;
                wBosaSerialNumber wb = new wBosaSerialNumber(_index);
                wb.ShowDialog();
                this.Opacity = 1;
            }

            //Kiểm tra trạng thái calib của máy đo ER
            try {
                double _temp = 0, _hours;
                string _time;
                bool   ret;
                ret = Function.IO.CalibrationModuleTime.Read(out _time);
                //ret = GlobalData.erDevice.getTemperature(out _temp);
                ret = BaseFunctions.last_Time_Calibrate_Module_DCAX86100D_To_Hours(_time, out _hours);
                if (_hours > 5 || _temp > 5)
                {
                    CalibModuleWarning cm = new CalibModuleWarning(_time.ToString(), _temp.ToString());
                    cm.ShowDialog();
                }
            }
            catch { }

            //***BEGIN -----------------------------------------//
            System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(() => {
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
                //Start count time
                System.Diagnostics.Stopwatch st = new System.Diagnostics.Stopwatch();
                st.Start();

                string _name        = buttonName;
                testinginfo testtmp = null;
                BaseFunctions.get_Testing_Info_By_Name(_name, ref testtmp);
                variables vari = new variables();

                string _BosaSN = "";
                if (GlobalData.initSetting.ONTTYPE == "GW040H" || (GlobalData.initSetting.ONTTYPE == "GW020BoB" && GlobalData.initSetting.ENABLEWRITEAPD == true))
                {
                    testtmp.SYSTEMLOG += string.Format("Input Bosa Serial...\r\n...{0}\r\n", testtmp.BOSASERIAL);
                    _BosaSN            = testtmp.BOSASERIAL;
                    if (_BosaSN == "--")
                    {
                        return;
                    }
                }

                if (GlobalData.initSetting.ENABLEWRITEMAC)
                {
                    if (testtmp.MACADDRESS == "--")
                    {
                        return;
                    }
                }

                //Get Bosa Information from Bosa Serial
                bosainfo bosaInfo = new bosainfo();

                if (GlobalData.initSetting.ONTTYPE == "GW040H" || (GlobalData.initSetting.ONTTYPE == "GW020BoB" && GlobalData.initSetting.ENABLEWRITEAPD == true))
                {
                    testtmp.SYSTEMLOG += string.Format("Get Bosa information...\r\n");
                    bosaInfo           = this._getDataByBosaSN(_BosaSN);
                    if (bosaInfo == null)
                    {
                        testtmp.ERRORCODE   = "(Mã Lỗi: COT-BS-0001)";
                        testtmp.SYSTEMLOG  += string.Format("...FAIL. {0}. Bosa SN is not existed\r\n", testtmp.ERRORCODE);
                        testtmp.TOTALRESULT = Parameters.testStatus.FAIL.ToString();
                        goto END;
                    }
                    testtmp.SYSTEMLOG += string.Format("...Ith= {0}mA\r\n", bosaInfo.Ith);
                    testtmp.SYSTEMLOG += string.Format("...Vbr= {0}V\r\n", bosaInfo.Vbr);
                    testtmp.SYSTEMLOG += string.Format("...PASS\r\n");
                }

                //Calib
                testtmp.TOTALRESULT   = Parameters.testStatus.Wait.ToString();
                testtmp.BUTTONCONTENT = "STOP"; testtmp.BUTTONENABLE = false;
                bool _result          = RunAll(testtmp, bosaInfo, vari);

                testtmp.TOTALRESULT = _result == false ? Parameters.testStatus.FAIL.ToString() : Parameters.testStatus.PASS.ToString();

                END:
                testtmp.SYSTEMLOG    += string.Format("\r\n----------------------------\r\nTotal Judged={0}\r\n", testtmp.TOTALRESULT);
                testtmp.BUTTONCONTENT = "START"; testtmp.BUTTONENABLE = true;

                //Stop count time
                st.Stop();
                testtmp.SYSTEMLOG += string.Format("Total time = {0} seconds\r\n", st.ElapsedMilliseconds / 1000);
                testtmp.TOTALTIME += (st.ElapsedMilliseconds / 1000).ToString();

                //save log
                Function.IO.LogDetail.Save(testtmp);
                Function.IO.LogTest.Save(testtmp);
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
            }));
            t.IsBackground = true;
            t.Start();
            //***END -------------------------------------------//
        }
示例#18
0
        //****************************************************************************************************
        //****************************************************************************************************
        //****************************************************************************************************
        bool RunAll(testinginfo _testtemp, bosainfo _bosainfo, variables _vari)
        {
            System.Diagnostics.Stopwatch pt = new System.Diagnostics.Stopwatch();
            pt.Start();
            string _apdTime = "", _pwTime = "", _erTime = "", _ddmiTime = "";


            if (!(GlobalData.initSetting.ONTTYPE == "GW020BoB" && GlobalData.initSetting.ONTAPD == "Only Write APD LUT"))
            {
                //Kiem tra ket noi toi may do Power
                _testtemp.SYSTEMLOG += string.Format("Kiểm tra kết nối tới máy đo EXFO IQS610P {0}...\r\n", GlobalData.initSetting.EXFOIP);
                if (Network.PingNetwork(GlobalData.initSetting.EXFOIP) == false)
                {
                    _testtemp.SYSTEMLOG += "...Kết quả = FAIL\r\n";
                    GlobalData.connectionManagement.IQS1700STATUS  = false;
                    GlobalData.connectionManagement.IQS9100BSTATUS = false;
                    return(false);
                }
                _testtemp.SYSTEMLOG += "...Kết quả = PASS\r\n";
            }


            //login to ONT
            bool _result   = false;
            GW   ontDevice = null;

            switch (GlobalData.initSetting.ONTTYPE)
            {
            case "GW040H": {
                ontDevice = new GW040H(_testtemp.COMPORT);
                break;
            }

            case "GW020BoB": {
                ontDevice = new GW020BoB(_testtemp.COMPORT);
                break;
            }

            default: return(false);
            }
            if (ontDevice.loginToONT(_testtemp) == false)
            {
                goto END;
            }


            //Get MAC Address
            if (!GlobalData.initSetting.ENABLEWRITEMAC)
            {
                _testtemp.MACADDRESS = ontDevice.getMACAddress(_testtemp);
                if (_testtemp.MACADDRESS == string.Empty)
                {
                    _testtemp.ERRORCODE = "(Mã Lỗi: COT-GM-0001)"; goto END;
                }
            }

            //Write APD LUT
            if (GlobalData.initSetting.ENABLEWRITEAPD == true)
            {
                if (ontDevice.writeAPD(_bosainfo, _testtemp) == false)
                {
                    goto END;
                }
            }
            pt.Stop();
            _apdTime = string.Format("PW time = {0} ms\r\n", pt.ElapsedMilliseconds);
            pt.Reset(); pt.Restart();

            //Calib Power
            if (GlobalData.initSetting.ENABLETUNINGPOWER)
            {
                if (ontDevice.calibPower(int.Parse(_testtemp.ONTINDEX), _bosainfo, _testtemp, _vari) == false)
                {
                    goto END;
                }
            }

            pt.Stop();
            _pwTime = string.Format("PW time = {0} ms\r\n", pt.ElapsedMilliseconds);

            //Calib ER
            if (GlobalData.initSetting.ENABLETUNINGER || GlobalData.initSetting.ENABLETUNINGCROSSING)
            {
                pt.Reset();
                pt.Restart();

                //Đăng kí thứ tự Calib ER
                if (this._addToListSequenceTestER(_testtemp) == false)
                {
                    goto END;
                }

                //Chờ đến lượt timeout 90s
                if (this._waitForTurn(_testtemp) == false)
                {
                    goto END;
                }

                //Kiem tra ket noi toi may do DCA
                _testtemp.SYSTEMLOG += string.Format("Kiểm tra kết nối tới máy đo DCA X86100D {0}...\r\n", GlobalData.initSetting.ERINSTRGPIB);
                if (GlobalData.erDevice.isConnected() == false)
                {
                    _testtemp.SYSTEMLOG += "...Kết quả = FAIL\r\n";
                    GlobalData.connectionManagement.DCAX86100DSTATUS = false;
                    return(false);
                }
                _testtemp.SYSTEMLOG += "...Kết quả = PASS\r\n";

                //Calib Dark level
                _testtemp.SYSTEMLOG += string.Format("Switching port...{0} OFF\r\n", _testtemp.ONTINDEX);
                GlobalData.switchDevice.switchOff();
                Thread.Sleep(500);
                GlobalData.erDevice.Calibrate();
                Thread.Sleep(500);

                //Switch Port check ER
                _testtemp.SYSTEMLOG += string.Format("Switching port...{0} ON\r\n", _testtemp.ONTINDEX);
                if (GlobalData.switchDevice.switchToPort(int.Parse(_testtemp.ONTINDEX)) == false)
                {
                    goto END;
                }

                //Calib ER
                if (GlobalData.initSetting.ENABLETUNINGER)
                {
                    if (ontDevice.calibER(int.Parse(_testtemp.ONTINDEX), _bosainfo, _testtemp, _vari) == false)
                    {
                        goto END;
                    }
                }

                //Calib Crossing
                if (GlobalData.initSetting.ENABLETUNINGCROSSING && GlobalData.initSetting.ONTTYPE == "GW020BoB")
                {
                    if (ontDevice.calibCrossing(int.Parse(_testtemp.ONTINDEX), _bosainfo, _testtemp, _vari) == false)
                    {
                        goto END;
                    }
                }

                //Xóa thứ tự đăng kí Calib ER (để Thread # có thể sử dụng)
                this._removeFromListSequenceTestER(_testtemp);

                pt.Stop();
                _erTime = string.Format("ER time = {0} ms\r\n", pt.ElapsedMilliseconds);
            }

            //TX DDMI
            pt.Reset(); pt.Restart();
            if (GlobalData.initSetting.ENABLETXDDMI)
            {
                if (ontDevice.txDDMI(int.Parse(_testtemp.ONTINDEX), _bosainfo, _testtemp, _vari) == false)
                {
                    goto END;
                }
            }

            //Signal Off
            if (GlobalData.initSetting.ENABLESIGNALOFF && GlobalData.initSetting.ONTTYPE == "GW040H")
            {
                if (ontDevice.signalOff(int.Parse(_testtemp.ONTINDEX), _bosainfo, _testtemp, _vari) == false)
                {
                    goto END;
                }
            }

            //Write flash
            if (GlobalData.initSetting.ENABLEWRITEFLASH && GlobalData.initSetting.ONTTYPE == "GW040H")
            {
                if (ontDevice.writeFlash(_bosainfo, _testtemp) == false)
                {
                    goto END;
                }
            }

            //Verify Signal
            if (GlobalData.initSetting.ENABLEVERIFYSIGNAL && GlobalData.initSetting.ONTTYPE == "GW040H")
            {
                if (ontDevice.verifySignal(int.Parse(_testtemp.ONTINDEX), _bosainfo, _testtemp, _vari) == false)
                {
                    goto END;
                }
            }

            //Write MAC
            if (GlobalData.initSetting.ENABLEWRITEMAC)
            {
                if (ontDevice.writeMAC(_testtemp) == false)
                {
                    goto END;
                }
            }

            pt.Stop();
            _ddmiTime = string.Format("DDMI,SIGOFF,WRITE FLASH time = {0} ms\r\n", pt.ElapsedMilliseconds);

            _result = true;

END:
            _testtemp.SYSTEMLOG += _pwTime;
            _testtemp.SYSTEMLOG += _erTime;
            _testtemp.SYSTEMLOG += _ddmiTime;
            this._removeFromListSequenceTestER(_testtemp);
            try { ontDevice.Close(); } catch { }
            return(_result);
        }
示例#19
0
 public abstract bool writeMAC(testinginfo _testinfo);
示例#20
0
 public abstract bool verifySignal(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var);
示例#21
0
 public abstract bool writeFlash(bosainfo _bosainfo, testinginfo _testinfo);
示例#22
0
 //Calib Quang------------------------------//
 public abstract bool loginToONT(testinginfo _testinfo);
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button b          = sender as Button;
            string buttonName = b.Name;
            string _index     = buttonName.Substring(buttonName.Length - 1, 1);

            this._resetDisplay(_index); //manual

            if (globalData.initSetting.ONTTYPE == "GW040H")
            {
                this.Opacity = 0.3;
                inputBosaWindow wb = new inputBosaWindow(_index);
                wb.ShowDialog();
                this.Opacity = 1;
            }


            //***BEGIN -----------------------------------------//
            System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(() => {
                //Start count time
                System.Diagnostics.Stopwatch st = new System.Diagnostics.Stopwatch();
                st.Start();

                string _name        = buttonName;
                testinginfo testtmp = null;
                baseFunction.get_Testing_Info_By_Name(_name, ref testtmp);

                //Get Bosa Information from Bosa Serial ??? GW040H // GW020BoB
                bosainfo bosaInfo = new bosainfo();
                //Variables ??? GW040H//GW020BoB
                variables vari = new variables();

                if (globalData.initSetting.ONTTYPE == "GW040H")
                {
                    string _BosaSN     = "";
                    testtmp.SYSTEMLOG += string.Format("Input Bosa Serial...\r\n...{0}\r\n", testtmp.BOSASERIAL);
                    _BosaSN            = testtmp.BOSASERIAL;
                    if (_BosaSN == "--")
                    {
                        return;
                    }

                    testtmp.SYSTEMLOG += string.Format("Get Bosa information...\r\n");
                    bosaInfo           = this._getDataByBosaSN(_BosaSN);
                    if (bosaInfo == null)
                    {
                        testtmp.ERRORCODE   = "(Mã Lỗi: COT-BS-0001)";
                        testtmp.SYSTEMLOG  += string.Format("...FAIL. {0}. Bosa SN is not existed\r\n", testtmp.ERRORCODE);
                        testtmp.TOTALRESULT = Parameters.testStatus.FAIL.ToString();
                        goto END;
                    }
                    testtmp.SYSTEMLOG += string.Format("...Ith = {0} mA\r\n", bosaInfo.Ith);
                    testtmp.SYSTEMLOG += string.Format("...Vbr = {0} V\r\n", bosaInfo.Vbr);
                    testtmp.SYSTEMLOG += string.Format("...PASS\r\n");

                    vari.Vbr = double.Parse(bosaInfo.Vbr);
                }

                vari.OLT_Power = _getOltPower(_index);

                //Calib RX
                testtmp.TOTALRESULT   = Parameters.testStatus.Wait.ToString();
                testtmp.BUTTONCONTENT = "STOP"; testtmp.BUTTONENABLE = false;
                bool _result          = RunAll(testtmp, bosaInfo, vari);
                testtmp.TOTALRESULT   = _result == false ? Parameters.testStatus.FAIL.ToString() : Parameters.testStatus.PASS.ToString();

                END:
                testtmp.SYSTEMLOG    += string.Format("\r\n----------------------------\r\nTotal Judged={0}\r\n", testtmp.TOTALRESULT);
                testtmp.BUTTONCONTENT = "START"; testtmp.BUTTONENABLE = true;

                //Stop count time
                st.Stop();
                testtmp.SYSTEMLOG += string.Format("Total time = {0} seconds\r\n", st.ElapsedMilliseconds / 1000);
                testtmp.TOTALTIME += (st.ElapsedMilliseconds / 1000).ToString();

                //save log
                LogFile.Savelogtest(testtmp);
                LogFile.Savelogdetail(testtmp);
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
            }));
            t.IsBackground = true;
            t.Start();
            //***END -------------------------------------------//
        }
        //----RUN ALL
        //****************************************************************************************************
        //****************************************************************************************************
        //****************************************************************************************************
        bool RunAll(testinginfo _testtemp, bosainfo _bosainfo, variables _vari)
        {
            System.Diagnostics.Stopwatch pt = new System.Diagnostics.Stopwatch();
            pt.Start();
            bool   _result  = false;
            string _message = "";

            GW      ontDevice  = null;
            FVA3150 instrument = null;

            switch (globalData.initSetting.ONTTYPE)
            {
            case "GW040H": {
                ontDevice = new GW040H(_testtemp.COMPORT);
                break;
            }

            case "GW020BoB": {
                ontDevice = new GW020BoB(_testtemp.COMPORT);
                break;
            }

            default: return(false);
            }

            //Connect to Instrument
            _testtemp.SYSTEMLOG += string.Format("Connect to FVA3150 {0}...\r\n", _testtemp.GPIB);
            instrument           = new FVA3150(_testtemp.GPIB);
            if (instrument.Open(out _message) == false)
            {
                _testtemp.SYSTEMLOG += "...FAIL" + "\r\n";
                _testtemp.SYSTEMLOG += _message + "\r\n";
                goto END;
            }
            _testtemp.SYSTEMLOG += "...PASS" + "\r\n";

            //login to ONT
            if (ontDevice.loginToONT(_testtemp) == false)
            {
                goto END;
            }


            //Get MAC Address
            _testtemp.MACADDRESS = ontDevice.getMACAddress(_testtemp);
            if (_testtemp.MACADDRESS == string.Empty)
            {
                _testtemp.ERRORCODE = "(Mã Lỗi: COT-GM-0001)"; goto END;
            }


            //Set Vapd + Slope
            if (globalData.initSetting.ONTTYPE == "GW040H")
            {
                if (ontDevice.setVapdAndSlope(_bosainfo, _testtemp, instrument, _vari) == false)
                {
                    goto END;
                }
                pt.Stop();
                _testtemp.SYSTEMLOG += string.Format("Set Vadp + Slope time = {0} ms\r\n", pt.ElapsedMilliseconds);
            }


            //Overload + Sensitivity
            if (globalData.initSetting.ONTTYPE == "GW040H")
            {
                if (ontDevice.overloadSensitivity(_bosainfo, _testtemp, instrument, _vari) == false)
                {
                    goto END;
                }
                pt.Stop();
                _testtemp.SYSTEMLOG += string.Format("Overload + Sensitivity time = {0} ms\r\n", pt.ElapsedMilliseconds);
            }


            //RX DDMI Calibration
            if (ontDevice.calibDDMI(_bosainfo, _testtemp, instrument, _vari) == false)
            {
                goto END;
            }
            pt.Stop();
            _testtemp.SYSTEMLOG += string.Format("RX DDMI Calibration time = {0} ms\r\n", pt.ElapsedMilliseconds);

            //RX DDMI Curve
            if (globalData.initSetting.ONTTYPE == "GW040H")
            {
                if (ontDevice.curveDDMI(_bosainfo, _testtemp, instrument, _vari) == false)
                {
                    goto END;
                }
                pt.Stop();
                _testtemp.SYSTEMLOG += string.Format("RX DDMI Curve time = {0} ms\r\n", pt.ElapsedMilliseconds);
            }

            //LOS Calibration
            bool _flag = false;

            if (ontDevice.calibLOS(_bosainfo, _testtemp, instrument, _vari, ref _flag) == false)
            {
                goto END;
            }
            pt.Stop();
            _testtemp.SYSTEMLOG += string.Format("LOS Calibration time = {0} ms\r\n", pt.ElapsedMilliseconds);

            //LOS Check
            if (globalData.initSetting.ONTTYPE == "GW040H")
            {
                if (ontDevice.checkLOS(_flag, _bosainfo, _testtemp, instrument, _vari) == false)
                {
                    goto END;
                }
                pt.Stop();
                _testtemp.SYSTEMLOG += string.Format("LOS check time = {0} ms\r\n", pt.ElapsedMilliseconds);
            }

            //Write Flash
            if (globalData.initSetting.ONTTYPE == "GW040H")
            {
                if (ontDevice.writeFlash(_bosainfo, _testtemp) == false)
                {
                    goto END;
                }
                pt.Stop();
                _testtemp.SYSTEMLOG += string.Format("Write flash time = {0} ms\r\n", pt.ElapsedMilliseconds);
            }

            _result = true;

END:
            try { ontDevice.Close(); } catch { }
            return(_result);
        }
示例#25
0
        //public override bool writeFlash(bosainfo _bosainfo, testinginfo _testinfo) {
        //    try {
        //        bool _result = false;
        //        _testinfo.WRITEFLASHRESULT = Parameters.testStatus.Wait.ToString();
        //        _testinfo.SYSTEMLOG += "--------------------------------------------------------------\r\n";
        //        _testinfo.SYSTEMLOG += "STEP 5: WRITE INTO FLASH\r\n";

        //        base.WriteLine("echo set_flash_register_Tx_data >/proc/pon_phy/debug");
        //        Thread.Sleep(Delay_modem);
        //        base.WriteLine("echo set_flash_register 0x07050701 0x94 >/proc/pon_phy/debug");
        //        Thread.Sleep(Delay_modem);
        //        base.WriteLine("echo save_flash_matrix >/proc/pon_phy/debug");
        //        Thread.Sleep(Delay_modem);
        //        //P.WriteLine("mtd writeflash /tmp/7570_bob.conf 160 198144 reservearea");//single band
        //        base.WriteLine("mtd writeflash /tmp/7570_bob.conf 160 656896 reservearea");//dual band
        //        Thread.Sleep(Delay_modem + 1000);

        //        for (int m = 0; m < 3; m++) {
        //            string str = base.Read();
        //            base.WriteLine("echo flash_dump >/proc/pon_phy/debug");
        //            Thread.Sleep(Delay_modem * 5);
        //            str = base.Read();
        //            _testinfo.SYSTEMLOG += str + "\r\n";
        //            if (!str.Contains("0x07050701")) {
        //                _result = false;
        //            }
        //            else {
        //                _result = true;
        //                break;
        //            }
        //        }
        //        if (_result == false) _testinfo.ERRORCODE = "(Mã Lỗi: COT-WF-0001)";
        //        _testinfo.SYSTEMLOG += _result == true ? "Write flash thành công.\r\n" : string.Format("Write flash thất bại. {0}\r\n", _testinfo.ERRORCODE);
        //        _testinfo.SYSTEMLOG += "Hoàn thành quá trình Calibration.\r\n";
        //        _testinfo.WRITEFLASHRESULT = _result == true ? Parameters.testStatus.PASS.ToString() : Parameters.testStatus.FAIL.ToString();
        //        return _result;
        //    }
        //    catch (Exception ex) {
        //        _testinfo.ERRORCODE = "(Mã Lỗi: COT-WF-0002)";
        //        _testinfo.SYSTEMLOG += string.Format("{0}, {1}\r\n", _testinfo.ERRORCODE, ex.ToString());
        //        _testinfo.WRITEFLASHRESULT = Parameters.testStatus.FAIL.ToString();
        //        return false;
        //    }
        //}


        public override bool writeMAC(testinginfo _testinfo)
        {
            try {
                //Write GPON
                base.Write(string.Format("prolinecmd gponsn set {0}\n", _testinfo.GPON));
                string st = string.Format("writeflash: total write");
                string _data = ""; int index = 0;

                while (!_data.Contains(st))
                {
                    Thread.Sleep(500);
                    if (index >= 6)
                    {
                        break;
                    }
                    else
                    {
                        index++;
                    }
                    _data += base.Read();
                }
                if (index >= 6)
                {
                    _testinfo.ERRORCODE  = "(Mã Lỗi: COT-WM-0001)";
                    _testinfo.SYSTEMLOG += string.Format("{0}\r\n", _testinfo.ERRORCODE);
                    return(false);
                }
                //Write WPS

                //Write MAC
                _data = ""; index = 0;
                base.Write(string.Format("sys mac {0}\n", _testinfo.MACADDRESS));
                st = string.Format("new mac addr = {0}:{1}:{2}:{3}:{4}:{5}",
                                   _testinfo.MACADDRESS.Substring(0, 2).ToLower(),
                                   _testinfo.MACADDRESS.Substring(2, 2).ToLower(),
                                   _testinfo.MACADDRESS.Substring(4, 2).ToLower(),
                                   _testinfo.MACADDRESS.Substring(6, 2).ToLower(),
                                   _testinfo.MACADDRESS.Substring(8, 2).ToLower(),
                                   _testinfo.MACADDRESS.Substring(10, 2).ToLower()
                                   );
                while (!_data.Contains(st))
                {
                    Thread.Sleep(500);
                    if (index >= 6)
                    {
                        break;
                    }
                    else
                    {
                        index++;
                    }
                    _data += base.Read();
                }
                if (index >= 6)
                {
                    _testinfo.ERRORCODE  = "(Mã Lỗi: COT-WM-0003)";
                    _testinfo.SYSTEMLOG += string.Format("{0}\r\n", _testinfo.ERRORCODE);
                    return(false);
                }
                return(true);
            }
            catch (Exception ex) {
                _testinfo.ERRORCODE  = "(Mã Lỗi: COT-WM-0004)";
                _testinfo.SYSTEMLOG += string.Format("{0}, {1}\r\n", _testinfo.ERRORCODE, ex.ToString());
                return(false);
            }
        }
示例#26
0
 public abstract string getMACAddress(testinginfo _testinfo);
示例#27
0
 public override bool writeAPD(bosainfo _bosainfo, testinginfo _testinfo)
 {
     throw new NotImplementedException();
 }
示例#28
0
 public abstract bool txDDMI(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var);