public void GetComList(ref string[] ComList, ref int ComLength) { // throw new System.NotImplementedException(); ushort NumPorts, NumIgnorePorts; ushort[] PortList = new ushort[10]; ushort[] IgnorePortList = new ushort[2]; IgnorePortList[0] = 1; IgnorePortList[1] = 2; NumIgnorePorts = 2; NumPorts = 5; // CppDLL.QLIB_GetAvailablePhonesPortList() if (CppDLL.QLIB_GetAvailablePhonesPortList(ref NumPorts, ref PortList[0], NumIgnorePorts, ref IgnorePortList[0]) != 0) { if (NumPorts > 0) { ComLength = NumPorts; for (int i = 0; i < NumPorts; i++) { ComList[i] = "COM" + Convert.ToString((int)PortList[i]); } } } }
public string GetSN() { // throw new System.NotImplementedException(); byte[] SN = new byte[14]; ushort status = 0; ushort result = 0; result = CppDLL.QLIB_DIAG_NV_READ_F(QLIB_COM, 2824, SN, 14, ref status); string s2 = System.Text.Encoding.Default.GetString(SN); SerialNumber = s2; byte ConnectStatus; ConnectStatus = CppDLL.QLIB_IsPhoneConnected(QLIB_COM); if (ConnectStatus == 0) { return("Fail"); } else { // MessageBox.Show("Success Open port"); return(s2); } }
private void button3_Click(object sender, EventArgs e) { // CppDLL.SetForegroundWindow(); label4.Visible = false; this.timer1.Enabled = false; // SN_Number = Test1.Dut1.GetSN(); bool testOK; testOK = Test1.StartTest(); IntPtr hwnd = CppDLL.FindWindow(null, "LT602 BLE Test"); CppDLL.SetForegroundWindow(hwnd); //Show logs richTextBox1.AppendText("Begin SN Reading..." + "\n"); richTextBox1.AppendText("SN Number is " + Test1.TestResult1.SN + "\n"); richTextBox1.AppendText(" channel Power is " + Test1.TestResult1.ChPwr_2402 + ", " + Test1.TestResult1.ChPwr_2442 + ", " + Test1.TestResult1.ChPwr_2480 + "\n"); richTextBox1.AppendText("Test time finished at " + Test1.TestResult1.TestTime + "\n"); if (testOK) { label4.Text = "PASS"; label4.ForeColor = Color.FromName("Green"); this.timer1.Enabled = true; Test1.SaveToLog(); } else { label4.Text = "Fail"; label4.ForeColor = Color.FromName("RED"); this.timer1.Enabled = true; } CppDLL.Delay(5000); label4.Visible = true; timer2.Enabled = true; // Test1.TestResult1.SN = null; }
public void endTx() { // throw new System.NotImplementedException(); int x = get_current_x(tx_stop_x); int y = get_current_y(tx_stop_y); IntPtr lParam = (IntPtr)((y << 16) | x); // The coordinates IntPtr wParam = IntPtr.Zero; // Additional parameters for the click (e.g. Ctrl) CppDLL.PostMessage(ControlHwd, CppDLL.WM_LBUTTONDOWN, wParam, lParam); CppDLL.PostMessage(ControlHwd, CppDLL.WM_LBUTTONUP, wParam, lParam); }
public void InitApp() { // throw new System.NotImplementedException(); CppDLL.ShowWindowCommands x_mode = CppDLL.ShowWindowCommands.SW_SHOWNORMAL; string app = @"C:\Program Files\Texas Instruments\SmartRF Tools\SmartRF Studio 7\bin\startup_window.exe"; string app_path = @"C:\Program Files\Texas Instruments\SmartRF Tools\SmartRF Studio 7\bin\"; //run app CppDLL.ShellExecute(IntPtr.Zero, "open", app, null, app_path, x_mode); CppDLL.Delay(1000); IntPtr hwnd = CppDLL.FindWindow(null, "SmartRF Studio 7 - Texas Instruments"); MainHwd = hwnd; }
public void StartControl() { // throw new System.NotImplementedException(); CppDLL.Delay(2000); //Set_CC_ID(CC_ID); IntPtr hwnd = MainHwd; int x = get_current_x(cc_control_x); int y = get_current_y(cc_control_y); IntPtr lParam = (IntPtr)((y << 16) | x); // The coordinates IntPtr wParam = IntPtr.Zero; // Additional parameters for the click (e.g. Ctrl) CppDLL.PostMessage(hwnd, CppDLL.WM_LBUTTONDOWN, wParam, lParam); CppDLL.PostMessage(hwnd, CppDLL.WM_LBUTTONUP, wParam, lParam); CppDLL.PostMessage(hwnd, CppDLL.WM_LBUTTONDBLCLK, wParam, lParam); CppDLL.PostMessage(hwnd, CppDLL.WM_LBUTTONUP, wParam, lParam); CppDLL.Delay(6000); hwnd = CppDLL.FindWindow(null, USB_ID_CC + " - CC2540 - Device Control Panel"); ControlHwd = hwnd; x = get_current_x(continue_tx_x); y = get_current_y(continue_tx_y); lParam = (IntPtr)((y << 16) | x); // The coordinates wParam = IntPtr.Zero; // Additional parameters for the click (e.g. Ctrl) CppDLL.PostMessage(hwnd, CppDLL.WM_LBUTTONDOWN, wParam, lParam); CppDLL.PostMessage(hwnd, CppDLL.WM_LBUTTONUP, wParam, lParam); //maxim control window CppDLL.PostMessage(ControlHwd, CppDLL.WM_Command, (IntPtr)0xf030, (IntPtr)0); }
public void ResetFreqComb() { //throw new System.NotImplementedException(); endTx(); for (int count = 0; count < ((CurrentFreq - 2402) / 2); count++) { int x = get_current_x(combo_line_x); int y = get_current_y(combo_line_y); IntPtr wParam = (IntPtr)(120 << 16); IntPtr lParam = (IntPtr)((y << 16) | x); CppDLL.PostMessage(FreqCombHwd, CppDLL.WM_MouseWheel, wParam, lParam); CppDLL.Delay(100); } // CurrentFreq = 2402; }
public void SetFreq(int freq) { // throw new System.NotImplementedException(); CppDLL.Delay(100); int deltafreq = (freq - CurrentFreq) / 2; if (deltafreq > 0) { for (int count = 0; count < (deltafreq); count++) { int x = get_current_x(combo_line_x); int y = get_current_y(combo_line_y); IntPtr wParam = (IntPtr)((-120 << 16) | 0x00); IntPtr lParam = (IntPtr)((y << 16) | x); CppDLL.PostMessage(FreqCombHwd, CppDLL.WM_MouseWheel, wParam, lParam); CppDLL.Delay(100); } } else { for (int count = 0; count < (-1 * deltafreq); count++) { int x = get_current_x(combo_line_x); int y = get_current_y(combo_line_y); IntPtr wParam = (IntPtr)((120 << 16) | 0x00); IntPtr lParam = (IntPtr)((y << 16) | x); CppDLL.PostMessage(FreqCombHwd, CppDLL.WM_MouseWheel, wParam, lParam); CppDLL.Delay(100); } } CurrentFreq = freq; }
public bool StartTest() { //throw new System.NotImplementedException(); //1. Get SN number from DUT Dut1.OpenCom(); TestResult1.SN = Dut1.GetSN(); //2. Set Spectrum analyzer para Inst1.SetCentreq(2402); Inst1.SetBW(1); Inst1.SetLev(10); //3.DUT send TX Dut1.Init_TX_Env(); Dut1.FTM_BLE_TX(2402, 5000); CppDLL.Delay(1000); TestResult1.ChPwr_2402 = Inst1.ReadChPower() + InsertLoss - 3;// 3 is delta value between continue tx with burst tx Inst1.SetCentreq(2442); Inst1.SetBW(1); Inst1.SetLev(10); Dut1.FTM_BLE_TX(2442, 5000); CppDLL.Delay(1000); TestResult1.ChPwr_2442 = Inst1.ReadChPower() + InsertLoss - 3; // 3 is delta value between continue tx with burst tx Inst1.SetCentreq(2480); Inst1.SetBW(1); Inst1.SetLev(10); Dut1.FTM_BLE_TX(2480, 5000); CppDLL.Delay(1000); TestResult1.ChPwr_2480 = Inst1.ReadChPower() + InsertLoss - 3; // 3 is delta value between continue tx with burst tx Dut1.End_BLE_TX(); //4. Spectrum Read Dut1.testFinished = true; TestResult1.TestTime = System.DateTime.Now.ToString(); if ((TestResult1.ChPwr_2402 < 3.8 && TestResult1.ChPwr_2402 > 0) && (TestResult1.ChPwr_2442 < 3.8 && TestResult1.ChPwr_2442 > 0) && (TestResult1.ChPwr_2480 < 3.8 && TestResult1.ChPwr_2480 > 0) && (TestResult1.SN != "Fail")) { return(true); } else { return(false); } }
public void endControl() { //throw new System.NotImplementedException(); CppDLL.PostMessage(ControlHwd, CppDLL.WM_Close, IntPtr.Zero, IntPtr.Zero); // CppDLL.PostMessage(ControlHwd, CppDLL.WM_Command, (IntPtr)0xf030, (IntPtr)0); }
public void FocusFreqComb() { // throw new System.NotImplementedException(); int x = get_current_x(freq_combo_x);//int((float) freq_combo_x*(float)(float)current_screen_x_pixels/(float)screen_x_base); int y = get_current_y(freq_combo_y); IntPtr lParam = (IntPtr)((y << 16) | x); // The coordinates IntPtr wParam = IntPtr.Zero; // Additional parameters for the click (e.g. Ctrl) CppDLL.PostMessage(ControlHwd, CppDLL.WM_LBUTTONDOWN, wParam, lParam); CppDLL.PostMessage(ControlHwd, CppDLL.WM_LBUTTONUP, wParam, lParam); CppDLL.Delay(1000); //x = 482; //y = 122; //lParam = (IntPtr)((y << 16) | x); // The coordinates //wParam = IntPtr.Zero; // Additional parameters for the click (e.g. Ctrl) // CppDLL.PostMessage(ControlHwd,CppDLL. WM_LBUTTONDOWN, wParam, lParam); // CppDLL.PostMessage(ControlHwd, CppDLL.WM_LBUTTONUP, wParam, lParam); IntPtr control_window, freq_window, second_hw, third_hw; control_window = ControlHwd; freq_window = CppDLL.FindWindowEx(control_window, IntPtr.Zero, null, ""); second_hw = CppDLL.FindWindowEx(control_window, freq_window, null, ""); third_hw = CppDLL.FindWindowEx(control_window, second_hw, null, ""); freq_window = CppDLL.FindWindowEx(third_hw, IntPtr.Zero, null, "qt_scrollarea_viewport"); second_hw = CppDLL.FindWindowEx(freq_window, IntPtr.Zero, null, "centralWidgetMain"); freq_window = CppDLL.FindWindowEx(second_hw, IntPtr.Zero, null, ""); third_hw = CppDLL.FindWindowEx(freq_window, IntPtr.Zero, null, "RFParameters"); second_hw = third_hw; third_hw = IntPtr.Zero; for (int count = 0; count < 9; count++) { freq_window = CppDLL.FindWindowEx(second_hw, third_hw, "QWidget", null);//RF Parameters third_hw = freq_window; } FreqCombHwd = freq_window; // x = 463; // y = 115; // lParam = (IntPtr)((y << 16) | x); // The coordinates // wParam = IntPtr.Zero; // Additional parameters for the click (e.g. Ctrl) // CppDLL.PostMessage(ControlHwd, CppDLL.WM_LBUTTONDOWN, wParam, lParam); // CppDLL.PostMessage(ControlHwd, CppDLL.WM_LBUTTONUP, wParam, lParam); }
public void exitApp() { CppDLL.PostMessage(MainHwd, CppDLL.WM_Close, IntPtr.Zero, IntPtr.Zero); }
public void OpenCom() { // throw new System.NotImplementedException(); QLIB_COM = CppDLL.QLIB_ConnectServerWithWait((uint)this.ComNum, 2000); }