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 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); }