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); }
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", ""); }
private void loadSettingFromFile() { IniFiles fop = new IniFiles("Settings.ini"); pcbaleakBox.Text = fop.ReadString("PCBAPOWER", "LEAKCURRENT", ""); pcbasleepBox.Text = fop.ReadString("PCBAPOWER", "SLEEPCURRENT", ""); }
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", ""); }
/// <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; }
/// <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; }
/*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; }
/*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; }