Main_Form.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. //Add code
  11. using System.IO;
  12. using System.IO.Ports;
  13. namespace RF_TRIO_PLL_ZIG
  14. {
  15. public partial class Main_Form : Form
  16. {
  17. Serial serial = new Serial(); // Uart Open
  18. Bluecell_BootProtocol bluecell_BootProtocol = new Bluecell_BootProtocol();
  19. Update_Serial file = new Update_Serial();
  20. public Main_Form()
  21. {
  22. InitializeComponent();
  23. serial.Serial_Initialize(ref comboBox_Port);
  24. }
  25. private void Firmware_Update_Click(object sender, EventArgs e)
  26. {
  27. OpenFileDialog ofd = new OpenFileDialog();
  28. //FileDownload file = new FileDownload();
  29. if (Ascii_checkBox.Checked == true)
  30. Ascii_checkBox.Checked = false;
  31. file.ShowFileOpenDialog(ref serial, ofd);
  32. }
  33. private void Crc16_Check_Click(object sender, EventArgs e)
  34. {
  35. #if false
  36. Crc16 crc16 = new Crc16();
  37. byte[] tempdata = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,0x0A };
  38. label1.Text = crc16.CRC16_Generate(tempdata, 11).ToString();
  39. #endif
  40. this.serial.Test_Serial();
  41. }
  42. private void Button_PortOpen_Click(object sender, EventArgs e)
  43. {
  44. bool ret = false;
  45. ret = Serial_connectiondisable(serial.Serial_PortOpen(ref button_PortOpen, ref comboBox_Port));
  46. if (ret == true && timer.Enabled == false)
  47. {
  48. timer.Start(); //타이머를 발동시킨다.
  49. }
  50. else if (timer.Enabled == true)
  51. {
  52. timer.Stop(); //타이머를 멈춘다.
  53. }
  54. else
  55. {
  56. /*NOP*/
  57. }
  58. }
  59. private void ComboBox_Port_SelectedIndexChanged(object sender, EventArgs e)
  60. {
  61. serial.Serial_Name = comboBox_Port.SelectedItem.ToString();
  62. }
  63. private void Button_terminal_Click(object sender, EventArgs e)
  64. {
  65. serial.Serial_TerminalOpen(serial);
  66. }
  67. public bool Serial_connectiondisable(Boolean on_off)
  68. {
  69. comboBox_Port.Enabled = on_off;
  70. comboBox_baudrate.Enabled = on_off;
  71. return on_off;
  72. }
  73. private void timer_Tick(object sender, EventArgs e)
  74. {
  75. }
  76. private void button_Set_Click(object sender, EventArgs e)
  77. {
  78. bluecell_BootProtocol.Bluecell_BtnSet(this.serial,this);
  79. }
  80. private void Main_Form_Load(object sender, EventArgs e)
  81. {
  82. pictureBox_PATH_1_8G_DL_ON.Visible = false;
  83. pictureBox_PATH_1_8G_UL_ON.Visible = false;
  84. pictureBox_PATH_2_1G_DL_ON.Visible = false;
  85. pictureBox_PATH_2_1G_UL_ON.Visible = false;
  86. pictureBox_PATH_3_5G_L_ON.Visible = false;
  87. pictureBox_PATH_3_5G_H_ON.Visible = false;
  88. pictureBox_PLL_ON_OFF_3_5G_L_ON.Visible = false;
  89. pictureBox_PLL_ON_OFF_3_5G_H_ON.Visible = false;
  90. pictureBox_PATH_3_5G_UL_ON.Visible = false;
  91. pictureBox_PATH_3_5G_DL_ON.Visible = false;
  92. /* public System.Windows.Forms.PictureBox pictureBox_PATH_3_5G_L_OFF;
  93. public System.Windows.Forms.PictureBox pictureBox_PATH_3_5G_H_OFF;
  94. public System.Windows.Forms.PictureBox pictureBox_PLL_ON_OFF_3_5G_L_OFF;
  95. public System.Windows.Forms.PictureBox pictureBox_PLL_ON_OFF_3_5G_H_OFF;
  96. public System.Windows.Forms.PictureBox pictureBox_PATH_3_5G_UL_OFF;
  97. public System.Windows.Forms.PictureBox pictureBox_PATH_3_5G_DL_OFF;
  98. public System.Windows.Forms.PictureBox pictureBox_PATH_2_1G_UL_OFF;
  99. public System.Windows.Forms.PictureBox pictureBox_PATH_2_1G_DL_OFF;
  100. public System.Windows.Forms.PictureBox pictureBox_PATH_1_8G_UL_OFF;
  101. public System.Windows.Forms.PictureBox pictureBox_PATH_1_8G_DL_OFF;
  102. public System.Windows.Forms.PictureBox pictureBox_PATH_3_5G_L_ON;
  103. public System.Windows.Forms.PictureBox pictureBox_PATH_3_5G_H_ON;
  104. public System.Windows.Forms.PictureBox pictureBox_PLL_ON_OFF_3_5G_L_ON;
  105. public System.Windows.Forms.PictureBox pictureBox_PLL_ON_OFF_3_5G_H_ON;
  106. public System.Windows.Forms.PictureBox pictureBox_PATH_3_5G_UL_ON;
  107. public System.Windows.Forms.PictureBox pictureBox_PATH_3_5G_DL_ON;
  108. public System.Windows.Forms.PictureBox pictureBox_PATH_2_1G_UL_ON;
  109. public System.Windows.Forms.PictureBox pictureBox_PATH_2_1G_DL_ON;
  110. public System.Windows.Forms.PictureBox pictureBox_PATH_1_8G_UL_ON;;*/
  111. }
  112. }
  113. }