Пример #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            IniFiles fop = new IniFiles("Settings.ini");
            QWriteAllForm.TestList.Clear(); // clear old data

            if (checkBoxTest.Checked)
                QWriteAllForm.TestList.Add("TestBoard");          
            if (checkBoxSN.Checked)
                QWriteAllForm.TestList.Add("SN");
            if (checkBoxBTMAC.Checked) 
                QWriteAllForm.TestList.Add("BTMAC");
            if (checkBoxWIFIMAC.Checked)
                QWriteAllForm.TestList.Add("WIFIMAC");
            if (checkBoxNv453.Checked)
                QWriteAllForm.TestList.Add("NV453");
            
            /*save configuration to file*/
            fop.WriteBool("TEST", "TestBoard", checkBoxTest.Checked);
            fop.WriteBool("TEST", "SN", checkBoxSN.Checked);
            fop.WriteBool("TEST", "BTMAC", checkBoxBTMAC.Checked);
            fop.WriteBool("TEST", "WIFIMAC", checkBoxWIFIMAC.Checked);
            fop.WriteBool("TEST", "NV453", checkBoxNv453.Checked);
            fop.WriteString("TEST", "WLANADDR", WlantextBox.Text);
            fop.WriteString("TEST", "BTADDR", BttextBox.Text);
            fop.WriteString("TEST", "SNHEADER", snHeaderBox.Text);
            // check test item count 
            if (QWriteAllForm.TestList.Count < 1)
            {
                MessageBox.Show("Please Add test Item!");
                return;
            }
            this.DialogResult = DialogResult.OK;//DialogResult
            this.Close();            
        }
Пример #2
0
 private void LoadSettingFromFile()
 {
     IniFiles fop = new IniFiles("Settings.ini");
     saveTonvCheckBox.Checked = fop.ReadBool("FACTORY", "SAVETOSN", false);
     forbidUbscheckBox.Checked = fop.ReadBool("FACTORY", "FORBIDUSB", false);
     restorecheckBox.Checked = fop.ReadBool("FACTORY", "RESTOREFACTORY", false);
 }
Пример #3
0
 private void pcbapowersaveBtn_Click(object sender, EventArgs e)
 {
     /*save to file*/
     IniFiles fop = new IniFiles("Settings.ini");
     fop.WriteString("PCBAPOWER", "LEAKCURRENT", pcbaleakBox.Text);
     fop.WriteString("PCBAPOWER", "SLEEPCURRENT",pcbasleepBox.Text);
     this.Close();
 }
Пример #4
0
 private void loadSettingFromFile()
 {
     IniFiles fop = new IniFiles("Settings.ini");
     leakcurBox.Text = fop.ReadString("DEVICEPOWER", "LEAKCURRENT", "");
     sleepcurBox.Text = fop.ReadString("DEVICEPOWER", "SLEEPCURRENT", "");
     stablecurBox.Text = fop.ReadString("DEVICEPOWER", "STABLECURRENT", "");
     entermmicheckBox.Checked = fop.ReadBool("DEVICEPOWER", "MMI", false);
 }
Пример #5
0
 private void button1_Click(object sender, EventArgs e)
 {
     IniFiles fop = new IniFiles("Settings.ini");
     fop.WriteBool("FACTORY", "SAVETOSN", saveTonvCheckBox.Checked);
     fop.WriteBool("FACTORY", "FORBIDUSB", forbidUbscheckBox.Checked);
     fop.WriteBool("FACTORY", "RESTOREFACTORY", restorecheckBox.Checked);
     this.Close();
 }
Пример #6
0
 private void wholepowersaveBtn_Click(object sender, EventArgs e)
 {
     IniFiles fop = new IniFiles("Settings.ini");
     fop.WriteString("DEVICEPOWER", "LEAKCURRENT", leakcurBox.Text);
     fop.WriteString("DEVICEPOWER", "SLEEPCURRENT", sleepcurBox.Text);
     fop.WriteString("DEVICEPOWER", "STABLECURRENT", stablecurBox.Text);
     fop.WriteBool("DEVICEPOWER", "MMI", entermmicheckBox.Checked);
     this.Close();
 }
Пример #7
0
        private void ReadParameterFormFile()
        {
            IniFiles Fop = new IniFiles("Settings.ini");

            QWriteAllForm.TestList.Clear();
            if (Fop.ReadBool("TEST", "TestBoard", false))
                QWriteAllForm.TestList.Add("TestBoard");
            if (Fop.ReadBool("TEST", "SN", false))
                QWriteAllForm.TestList.Add("SN");
            if (Fop.ReadBool("TEST", "BTMAC", false))
                QWriteAllForm.TestList.Add("BTMAC");
            if (Fop.ReadBool("TEST", "WIFIMAC", false))
                QWriteAllForm.TestList.Add("WIFIMAC");
            if (Fop.ReadBool("TEST", "NV453", false))
                QWriteAllForm.TestList.Add("NV453");
        }
Пример #8
0
 private void mmiTestBtn_Click(object sender, EventArgs e)
 {
     SetResult(1);
     /*read file from phone*/
     IniFiles fop = new IniFiles("Settings.ini");
     if (fop.ReadBool("FACTORY", "SAVETOSN", false))
     {
         MessageBox.Show("SAVETOSN");
     }
     if (fop.ReadBool("FACTORY", "FORBIDUSB", false))
     {
         MessageBox.Show("FORBIDUSB");
     }
     if (fop.ReadBool("FACTORY", "RESTOREFACTORY", false))
     {
         MessageBox.Show("RESTOREFACTORY");
     }
     SetResult(2);
 }
Пример #9
0
        private void LoadCfg()
        {
            IniFiles fop = new IniFiles("Settings.ini");

            if (fop.ReadBool("TEST", "TestBoard", false))
                checkBoxTest.Checked = true;
            if (fop.ReadBool("TEST", "SN", false))
                checkBoxSN.Checked = true;
            if (fop.ReadBool("TEST", "BTMAC", false))
                checkBoxBTMAC.Checked = true;
            if (fop.ReadBool("TEST", "WIFIMAC", false))
                checkBoxWIFIMAC.Checked = true;
            if (fop.ReadBool("TEST", "NV453", false))
                checkBoxNv453.Checked = true;

            WlantextBox.Text = fop.ReadString("TEST", "WLANADDR", "");
            BttextBox.Text = fop.ReadString("TEST", "BTADDR", "");
            snHeaderBox.Text = fop.ReadString("TEST", "SNHEADER", ""); 
        }
Пример #10
0
 private void loadSettingFromFile()
 {
     IniFiles fop = new IniFiles("Settings.ini");
     pcbaleakBox.Text = fop.ReadString("PCBAPOWER", "LEAKCURRENT", "");
     pcbasleepBox.Text = fop.ReadString("PCBAPOWER", "SLEEPCURRENT", "");
 }
Пример #11
0
 private void ReadParamererFromFile()
 {
     IniFiles Fop = new IniFiles("Settings.ini");
     QSWDownloadForm.swInfo.ProName = Fop.ReadString("DOWNLOAD", "Chip", "");
     QSWDownloadForm.swInfo.SwType = Fop.ReadString("DOWNLOAD", "Mode", "");
     QSWDownloadForm.swInfo.ProgramPath = Fop.ReadString("DOWNLOAD", "Path", "");
     QSWDownloadForm.swInfo.MbnName = Fop.ReadString("DOWNLOAD", "Programmer", "");
     QSWDownloadForm.swInfo.RawProName = Fop.ReadString("DOWNLOAD", "RawName", "");
     QSWDownloadForm.swInfo.PathName = Fop.ReadString("DOWNLOAD", "Patch0", "");
 }
Пример #12
0
 private void SaveParameterToFile()
 {
     IniFiles Fop = new IniFiles("Settings.ini");
     Fop.WriteString("DOWNLOAD", "Chip", QSWDownloadForm.swInfo.ProName);
     Fop.WriteString("DOWNLOAD", "Mode", QSWDownloadForm.swInfo.SwType);
     Fop.WriteString("DOWNLOAD", "Path", QSWDownloadForm.swInfo.ProgramPath);
     Fop.WriteString("DOWNLOAD", "Programmer", QSWDownloadForm.swInfo.MbnName);
     Fop.WriteString("DOWNLOAD", "RawName", QSWDownloadForm.swInfo.RawProName);
     Fop.WriteString("DOWNLOAD", "Patch0", QSWDownloadForm.swInfo.PathName);
 }
Пример #13
0
        /// <summary>
        /// Writes Blue tooth Address from APQ space using HCI commands
        /// </summary>
        /// <param name="BDADD_location"></param>                   // APQ location ot write BT Address
        /// <param name="Retry_Count_For_HCI_RESET_CMD"></param>    // # retries allowed
        /// <returns></returns>

        public bool WriteBDA_ADV()
        {
            byte[] bdaBytes = new byte[6];
            byte[] addrtemp = new byte[2];
            string addr;
            bool bdaExists = false;
            util = new Utilities();
            writeOnce = false;
            validate = false;
            Random ro = new Random();
            IniFiles fop = new IniFiles("Settings.ini");

            if (!phone.IsPhoneConnected())
            {
                DebugMessage.Write("Error", "Phone not connected", System.Diagnostics.TraceLevel.Verbose);
                return false;
            }
            /*MAC ADRESS HEADER*/
            BDAIn = fop.ReadString("TEST", "BTADDR", "");
            BDAIn = BDAIn.ToUpper();

            ReadBDA_ADV(BDADD_Location.QCN_NV447, 3);

            if (BDA != "000000000000")
                bdaExists = true;

            if (BDA == BDAIn)
            {
                this.SetText("BDA already exists");
                this.SetText("and matches desired value.  Skipping write.");
                return true;
            }

            if (bdaExists && writeOnce)
            {
                this.SetText("BDA already exists");
                this.SetText("and does NOT match desired value.");
                return false;
            }

            if (!writeOnce)
            {
                addrtemp = util.ConvertStringToByteArray(BDAIn, BDAIn.Length);
                bdaBytes[5] = (byte)((addrtemp[0] & 0x0f) << 4);
                bdaBytes[5] += (byte)(addrtemp[1] & 0x0f);
                /*generate random num for mac addr*/
                for (int i = 0; i < bdaBytes.Length - 1; i++)
                { 
                    bdaBytes[i] = (byte)ro.Next(0, 255);                
                }
                /*MAC ADRESS MUST NOT THE SAME*/
                // example of how writes should look
                //nv_write_item 447 0 0x38 0x02 0x13 0x2B 0x24 0x00   ["00242B130238"]

                if (!phone.IsPhoneConnected())
                {
                    this.SetText("Phone not connected");
                    return false;
                }

                try
                {
                    util.ConvertByteArrayToHexString(bdaBytes, bdaBytes.Length, out addr);
                    this.SetText("set bluetooth mac:" + addr + "to glass......");
                    phone.NVWrite(nv_items_enum_type.NV_BD_ADDR_I, bdaBytes, 128);
                }
                catch (Exception ex)
                {
                    this.SetText(ex.Message);
                    BDA = "";
                    return false;
                }
                this.SetText("Bluetooth addr write success!");
            }
            return true;
        }
Пример #14
0
        /// <summary>
        /// Writes WLAN MAC Address to either NV or to APQ space using FTM commands
        /// </summary>
        /// <returns></returns>
        public bool WriteMAC_ADV()
        {
            byte[] macBytes = new byte[6];
            byte[] mac = new byte[6];
            byte[] tmp = new byte[2];
            bool macExists = false;
            string addr;
            util = new Utilities();
            writeOnce = false;
            validate = false;
            Random ro = new Random();
            IniFiles fop = new IniFiles("Settings.ini");
            if (!phone.IsPhoneConnected())
            {
                this.SetText("Phone not connected");
                return false;
            }
            MACIn = fop.ReadString("TEST", "WLANADDR", "");
            MACIn = MACIn.ToUpper();

            // Read to see if MAC already written
            ReadMAC_ADV();
            string temp = "";
            if (MAC != "000000000000")
            {
                //temp= ReverseA(MAC);
                macExists = true;
            }

            if (MAC == MACIn)
            {
                this.SetText("WLAN MAC already exists");
                this.SetText("and matches desired value.  Skipping write.");
                return true;
            }

            if (macExists && writeOnce)
            {
                this.SetText("WLAN MAC already exists");
                this.SetText("and does NOT match desired value.");
                return false;
            }

            if (!writeOnce)
            {
                tmp = util.ConvertStringToByteArray(MACIn, MACIn.Length);
                macBytes[0] = (byte)((tmp[0] & 0x0f) << 4);
                macBytes[0] += (byte)(tmp[1] & 0x0f);
                for (int i = 1; i < macBytes.Length; i++)
                {
                    macBytes[i] = (byte)ro.Next(0, 255);
                }
                /*MAC MUST NOT THE SAME*/
                // example of how writes should look
                //nv_write_item 4678 0 0x38 0x02 0x13 0x2B 0x24 0x00   ["00242B130238"]
                if (!phone.IsPhoneConnected())
                {
                    this.SetText("Phone not connected");
                    return false;
                }

                try
                {
                    macLoc = MACADD_Location.NV4678;
                    // Write WLAN MAC address in persist partition
                    if (macLoc == MACADD_Location.AP_PERSIST)
                    {
                        phone.FTM_WLAN_GEN6_SET_MAC_ADDRESS(macBytes);
                    }
                    // Write WLAN MAC address in NV 4678
                    else if (macLoc == MACADD_Location.NV4678)
                    {
                        util.ConvertByteArrayToHexString(macBytes, macBytes.Length, out addr);
                        this.SetText("Write WIFI MAC address :" + addr + "to glass...");
                        phone.NVWrite(nv_items_enum_type.NV_WLAN_MAC_ADDRESS_I, macBytes, 128);
                    }
                    else
                    {
                        this.SetText("Please select WLAN MAC address location(Persist or NV) first!");
                    }
                }
                catch (Exception ex)
                {
                    this.SetText(ex.Message);
                    MAC = "";
                    return false;
                }

                if (validate)
                {
                    // if failed to read NV, return
                    if (!ReadMAC_ADV())
                        return false;

                    temp = ReverseA(MAC);
                    if (temp != MACIn)
                    {
                        this.SetText("Desired WLAN MAC to be written does not match what is in the phone");
                        return false;
                    }
                }
                else
                {
                    //temp = MACIn;
                    this.SetText("Write WIFI MAC address successfully...");
                }
            }
            return true;

        }
Пример #15
0
 /*write SN NUM to nv2497*/
 public bool WriteSN()
 {
     IniFiles fop = new IniFiles("Settings.ini");
     string sWSN = txtNumber.Text;
     string snHeader = fop.ReadString("TEST", "SNHEADER", "");
     if (snHeader != sWSN.Substring(0, 2))
     {
         this.SetText("SN header do not match!");
         return false;
     }
     this.SetText("Write SN number" + sWSN + " to phone...");
     phone.WriteSN(sWSN);
     string r_SN = "";
     this.SetText("Write SN number to phone finished...");
     phone.ReadSN(out r_SN);
     this.SetText("Read SN Number from Phone:" + r_SN + "...");
     if (String.Compare(r_SN, 0, sWSN, 0, sWSN.Length) != 0)
     {
         this.SetText("Error Read SN Number Mismatch Write Number");
         phone.DisconnectServer();
         return false;
     }
     this.SetText("Write SN Number successfully...");
     return true;
 }
Пример #16
0
        /*read mmi test result & prase result*/
        public bool PcbaTest()
        {
            ushort errcode = 0;
            if (!phone.IsPhoneConnected())
            {
                this.SetText("Phone not connected");
                return false;
            }
            /*clear last test result*/
            //phone.FTM_AP_ClearTestResult(ref errcode);
            /*get pcba test result from glass*/
            phone.FTM_AP_ReadFile(ref errcode, "mmi.res", "mmi.res");
            if (errcode != 0)
                return false;

            IniFiles Fop = new IniFiles("mmi.res");
            this.SetText("BATTERY : " + Fop.ReadString("BATTERY", "Result", ""));
            if (Fop.ReadString("BATTERY", "Result", "") == "Fail")
                return false;
            this.SetText("GYROSCOPE :" + Fop.ReadString("GYROSCOPE", "Result", ""));
            if (Fop.ReadString("GYROSCOPE", "Result", "") == "Fail")
                return false;
            this.SetText("GSENSOR :" + Fop.ReadString("GSENSOR", "Result", ""));
            if (Fop.ReadString("GSENSOR", "Result", "") == "Fail")
                return false;
            this.SetText("MSENSOR :" + Fop.ReadString("MSENSOR", "Result", ""));
            if (Fop.ReadString("MSENSOR", "Result", "") == "Fail")
                return false;
            this.SetText("PRESSURE :" + Fop.ReadString("PRESSURE", "Result", ""));
            if (Fop.ReadString("PRESSURE", "Result", "") == "Fail")
                return false;
            this.SetText("BRIDGE :" + Fop.ReadString("BRIDGE", "Result", ""));
            if (Fop.ReadString("BRIDGE", "Result", "") == "Fail")
                return false;
            this.SetText("WIFI :" + Fop.ReadString("WIFI", "Result", ""));
            if (Fop.ReadString("WIFI", "Result", "") == "Fail")
                return false;
            this.SetText("BLUETOOTH :" + Fop.ReadString("BLUETOOTH", "Result", ""));
            if (Fop.ReadString("BLUETOOTH", "Result", "") == "Fail")
                return false;
            //this.SetText("GPS :" + Fop.ReadString("GPS", "Result", ""));
            //if (Fop.ReadString("GPS", "Result", "") == "Fail")
            //   return false;
            this.SetText("BOARD TEST SUCCESS!");
            /*all chip success*/
            return true;
        }