Bluecell_BootProtocol.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace RF_TRIO_PLL_ZIG
  7. {
  8. public enum Bluepro_t
  9. {
  10. bluecell_header0 = 0,
  11. bluecell_header1,
  12. bluecell_header2,
  13. bluecell_header3,
  14. bluecell_type,
  15. bluecell_length_h,
  16. bluecell_length_l,
  17. bluecell_updatecnt_h,
  18. bluecell_updatecnt_l,
  19. bluecell_data,
  20. };
  21. public enum Updateseq
  22. {
  23. Bluecell_Reset = 0,
  24. Bluecell_Firmupdate_start,
  25. Bluecell_Firmupdate_sending,
  26. Bluecell_Firmupdate_end,
  27. };
  28. enum Bluecell_ProtIndex_p
  29. {
  30. Bluecell_Header = 0,
  31. Bluecell_Type,
  32. Bluecell_Length,
  33. Bluecell_CrcIndex,
  34. Bluecell_data,
  35. }
  36. enum Bluecell_Prot_t{
  37. TYPE_BLUECELL_RESET = 0,
  38. TYPE_BLUECELL_SET = 1,
  39. TYPE_BLUECELL_GET = 2,
  40. };
  41. enum Bluecell_TypeIndex_t
  42. {
  43. ATT_1_8G_DL1 = 0,
  44. ATT_1_8G_DL2,
  45. ATT_1_8G_UL1,
  46. ATT_1_8G_UL2,
  47. ATT_1_8G_UL3,
  48. ATT_1_8G_UL4,
  49. ATT_2_1G_DL1,
  50. ATT_2_1G_DL2,
  51. ATT_2_1G_UL1,
  52. ATT_2_1G_UL2,
  53. ATT_2_1G_UL3,
  54. ATT_2_1G_UL4,
  55. ATT_3_5G_DL,
  56. ATT_3_5G_UL,
  57. ATT_3_5G_COM1,
  58. ATT_3_5G_COM2,
  59. ATT_3_5G_COM3,
  60. PLL_1_8G_DL1_H,
  61. PLL_1_8G_DL1_L,
  62. PLL_1_8G_DL2_H,
  63. PLL_1_8G_DL2_L,
  64. PLL_2_1G_DL1_H,
  65. PLL_2_1G_DL1_L,
  66. PLL_2_1G_DL2_H,
  67. PLL_2_1G_DL2_L,
  68. PLL_3_5G_DL_H,
  69. PLL_3_5G_DL_L,
  70. PLL_3_5G_UL_H,
  71. PLL_3_5G_UL_L,
  72. PLL_LD_6_BIT,
  73. DET_1_8G_DL_IN_H,
  74. DET_1_8G_DL_IN_L,
  75. DET_1_8G_DL_OUT_H,
  76. DET_1_8G_DL_OUT_L,
  77. DET_1_8G_UL_IN_H,
  78. DET_1_8G_UL_IN_L,
  79. DET_1_8G_UL_OUT_H,
  80. DET_1_8G_UL_OUT_L,
  81. DET_2_1G_DL_IN_H,
  82. DET_2_1G_DL_IN_L,
  83. DET_2_1G_DL_OUT_H,
  84. DET_2_1G_DL_OUT_L,
  85. DET_2_1G_UL_IN_H,
  86. DET_2_1G_UL_IN_L,
  87. DET_2_1G_UL_OUT_H,
  88. DET_2_1G_UL_OUT_L,
  89. DET_3_5G_DL_IN_H,
  90. DET_3_5G_DL_IN_L,
  91. DET_3_5G_DL_OUT_L,
  92. DET_3_5G_DL_OUT_H,
  93. DET_3_5G_UL_IN_H,
  94. DET_3_5G_UL_IN_L,
  95. DET_3_5G_UL_OUT_H,
  96. DET_3_5G_UL_OUT_L,
  97. RFU_TEMP_H,
  98. RFU_TEMP_L,
  99. _28V_DET_H,
  100. _28V_DET_L,
  101. ALARM_AC,
  102. ALARM_DC,
  103. PATH_EN_1_8G_DL,
  104. PATH_EN_1_8G_UL,
  105. PATH_EN_2_1G_DL,
  106. PATH_EN_2_1G_UL,
  107. PATH_EN_3_5G_L,
  108. PATH_EN_3_5G_H,
  109. PATH_EN_3_5G_DL,
  110. PATH_EN_3_5G_UL,
  111. PLL_ON_OFF_3_5G_H,
  112. PLL_ON_OFF_3_5G_L,
  113. };
  114. class Bluecell_BootProtocol
  115. {
  116. Serial serial;
  117. /*bluecell Header*/
  118. public const byte Bluecell_Header0 = 0x42;//ASCII : B
  119. public const byte Bluecell_Header1 = 0x4C;//ASCII : L
  120. public const byte Bluecell_Header2 = 0x55;//ASCII : U
  121. public const byte Bluecell_Header3 = 0x45;//ASCII : E
  122. /*bluecell type*/
  123. public const int bluecell_Firmupdate_sendlength = 1024;
  124. Crc16 crc16 = new Crc16();
  125. public const byte BLUECELL_HEADER = 0xBE;
  126. public const byte BLUECELL_TAILER = 0xEB;
  127. const byte BLUECELL_RESET_LENGTH = 6;
  128. const byte BLUECELL_FIX_DATA_LENGTH = 3;
  129. public void Bluecell_Reset(object serial)
  130. {
  131. this.serial = (Serial)serial;
  132. byte[] temp_buf = new byte[BLUECELL_RESET_LENGTH];
  133. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
  134. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (byte)Bluecell_Prot_t.TYPE_BLUECELL_RESET;
  135. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length] = BLUECELL_RESET_LENGTH - BLUECELL_FIX_DATA_LENGTH;
  136. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = (byte)Bluecell_ProtIndex_p.Bluecell_data;
  137. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = crc16.STH30_CreateCrc(temp_buf, BLUECELL_RESET_LENGTH - 3);
  138. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = BLUECELL_TAILER;
  139. this.serial.Serial_DataSend(temp_buf, temp_buf.Length);
  140. }
  141. const byte BLUECELL_DATA_SET_LENGTH = 76;
  142. Main_Form main_Form;
  143. public void Bluecell_BtnSet(object serial, object main_form)
  144. {
  145. this.main_Form = (Main_Form)main_form;
  146. this.serial = (Serial)serial;
  147. byte[] temp_buf = new byte[BLUECELL_DATA_SET_LENGTH];
  148. /* * * * * * FIX DATA * * * * * */
  149. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
  150. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (byte)Bluecell_Prot_t.TYPE_BLUECELL_SET;
  151. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length] = BLUECELL_DATA_SET_LENGTH - BLUECELL_FIX_DATA_LENGTH;
  152. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = (byte)BLUECELL_DATA_SET_LENGTH - 2;
  153. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_DL1] = Convert.ToByte(main_Form.numericUpDown_ATT_1_8G_DL1.Text);
  154. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_DL2] = Convert.ToByte(main_Form.numericUpDown_ATT_1_8G_DL2.Text);
  155. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_UL1] = Convert.ToByte(main_Form.numericUpDown_ATT_1_8G_UL1.Text);
  156. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_UL2] = Convert.ToByte(main_Form.numericUpDown_ATT_1_8G_UL2.Text);
  157. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_UL3] = Convert.ToByte(main_Form.numericUpDown_ATT_1_8G_UL3.Text);
  158. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_UL4] = Convert.ToByte(main_Form.numericUpDown_ATT_1_8G_UL4.Text);
  159. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_DL1] = Convert.ToByte(main_Form.numericUpDown_ATT_2_1G_DL1.Text);
  160. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_DL2] = Convert.ToByte(main_Form.numericUpDown_ATT_2_1G_DL2.Text);
  161. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_UL1] = Convert.ToByte(main_Form.numericUpDown_ATT_2_1G_UL1.Text);
  162. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_UL2] = Convert.ToByte(main_Form.numericUpDown_ATT_2_1G_UL2.Text);
  163. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_UL3] = Convert.ToByte(main_Form.numericUpDown_ATT_2_1G_UL3.Text);
  164. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_UL4] = Convert.ToByte(main_Form.numericUpDown_ATT_2_1G_UL4.Text);
  165. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_3_5G_DL] = Convert.ToByte(main_Form.numericUpDown_ATT_3_5G_DL.Text);
  166. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_3_5G_UL] = Convert.ToByte(main_Form.numericUpDown_ATT_3_5G_UL.Text);
  167. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_3_5G_COM1] = Convert.ToByte(main_Form.numericUpDown_ATT_3_5G_COM1.Text);
  168. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_3_5G_COM2] = Convert.ToByte(main_Form.numericUpDown_ATT_3_5G_COM2.Text);
  169. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_3_5G_COM3] = Convert.ToByte(main_Form.numericUpDown_ATT_3_5G_COM3.Text);
  170. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_1_8G_DL1_H] = Convert.ToByte((Convert.ToUInt16(main_Form.numericUpDown_PLL_1_8G_DL1.Text) & 0xFF00) >> 8);
  171. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_1_8G_DL1_L] = Convert.ToByte((Convert.ToUInt16(main_Form.numericUpDown_PLL_1_8G_DL1.Text) & 0x00FF));
  172. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_1_8G_DL2_H] = Convert.ToByte((Convert.ToUInt16(main_Form.numericUpDown_PLL_1_8G_DL2.Text) & 0xFF00) >> 8);
  173. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_1_8G_DL2_L] = Convert.ToByte((Convert.ToUInt16(main_Form.numericUpDown_PLL_1_8G_DL2.Text) & 0x00FF));
  174. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_2_1G_DL1_H] = Convert.ToByte((Convert.ToUInt16(main_Form.numericUpDown_PLL_2_1G_DL1.Text) & 0xFF00) >> 8);
  175. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_2_1G_DL1_L] = Convert.ToByte((Convert.ToUInt16(main_Form.numericUpDown_PLL_2_1G_DL1.Text) & 0x00FF));
  176. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_2_1G_DL2_H] = Convert.ToByte((Convert.ToUInt16(main_Form.numericUpDown_PLL_2_1G_DL2.Text) & 0xFF00) >> 8);
  177. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_2_1G_DL2_L] = Convert.ToByte((Convert.ToUInt16(main_Form.numericUpDown_PLL_2_1G_DL2.Text) & 0x00FF));
  178. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_3_5G_DL_H] = Convert.ToByte((Convert.ToUInt16(main_Form.numericUpDown_PLL_3_5G_DL.Text) & 0xFF00) >> 8);
  179. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_3_5G_DL_L] = Convert.ToByte((Convert.ToUInt16(main_Form.numericUpDown_PLL_3_5G_DL.Text) & 0x00FF));
  180. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_3_5G_UL_H] = Convert.ToByte((Convert.ToUInt16(main_Form.numericUpDown_PLL_3_5G_UL.Text) & 0xFF00) >> 8);
  181. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_3_5G_UL_L] = Convert.ToByte((Convert.ToUInt16(main_Form.numericUpDown_PLL_3_5G_UL.Text) & 0x00FF));
  182. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_LD_6_BIT] = 0;//Convert.ToByte(main_Form.numericUpDown_ATT_3_5G_COM1.Text);
  183. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_DL_IN_H] = 0;// Convert.ToByte(main_Form.numericUpDown_ATT_3_5G_COM1.Text);
  184. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_DL_IN_L] = 0;// Convert.ToByte(main_Form.numericUpDown_ATT_3_5G_COM1.Text);
  185. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_DL_OUT_H] = 0;
  186. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_DL_OUT_L] = 0;
  187. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_UL_IN_H] = 0;
  188. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_UL_IN_L] = 0;
  189. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_UL_OUT_H] = 0;
  190. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_UL_OUT_L] = 0;
  191. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_DL_IN_H] = 0;
  192. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_DL_IN_L] = 0;
  193. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_DL_OUT_H] = 0;
  194. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_DL_OUT_L] = 0;
  195. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_UL_IN_H] = 0;
  196. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_UL_IN_L] = 0;
  197. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_UL_OUT_H] = 0;
  198. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_UL_OUT_L] = 0;
  199. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_DL_IN_H] = 0;
  200. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_DL_IN_L] = 0;
  201. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_DL_OUT_L] = 0;
  202. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_DL_OUT_H] = 0;
  203. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_UL_IN_H] = 0;
  204. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_UL_IN_L] = 0;
  205. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_UL_OUT_H] = 0;
  206. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_UL_OUT_L] = 0;
  207. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.RFU_TEMP_H] = 0;
  208. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.RFU_TEMP_L] = 0;
  209. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t._28V_DET_H] = 0;
  210. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t._28V_DET_L] = 0;
  211. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ALARM_AC] = 0;
  212. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ALARM_DC] = 0;
  213. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PATH_EN_1_8G_DL] = Convert.ToByte(PATH_1_8G_DL_Get_Func());
  214. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PATH_EN_1_8G_UL] = Convert.ToByte(PATH_1_8G_UL_Get_Func());
  215. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PATH_EN_2_1G_DL] = Convert.ToByte(PATH_2_1G_DL_Get_Func());
  216. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PATH_EN_2_1G_UL] = Convert.ToByte(PATH_2_1G_UL_Get_Func());
  217. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PATH_EN_3_5G_L] = Convert.ToByte(Path_3_5G_L_Get_Func());
  218. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PATH_EN_3_5G_H] = Convert.ToByte(Path_3_5G_H_Get_Func());
  219. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PATH_EN_3_5G_DL] = Convert.ToByte(PATH_3_5G_DL_Get_Func());
  220. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PATH_EN_3_5G_UL] = Convert.ToByte(PATH_3_5G_DL_Get_Func());
  221. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_ON_OFF_3_5G_H] = Convert.ToByte(PLL_ON_OFF_3_5G_H_Get_Func());
  222. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_ON_OFF_3_5G_L] = Convert.ToByte(PLL_ON_OFF_3_5G_L_Get_Func());
  223. /* * * * * * FIX DATA * * * * * */
  224. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_ON_OFF_3_5G_L + 1] = crc16.STH30_CreateCrc(temp_buf, BLUECELL_DATA_SET_LENGTH - 3);
  225. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_ON_OFF_3_5G_L + 2] = BLUECELL_TAILER;
  226. this.serial.Serial_DataSend(temp_buf, temp_buf.Length);
  227. }
  228. bool PATH_1_8G_UL_Get_Func()
  229. {
  230. bool ret = false;
  231. if (this.main_Form.pictureBox_PATH_1_8G_UL_OFF.Visible == true)
  232. ret = false;
  233. else
  234. ret = true;
  235. return ret;
  236. }
  237. bool PATH_1_8G_DL_Get_Func()
  238. {
  239. bool ret = false;
  240. if (this.main_Form.pictureBox_PATH_1_8G_DL_OFF.Visible == true)
  241. ret = false;
  242. else
  243. ret = true;
  244. return ret;
  245. }
  246. bool PATH_2_1G_UL_Get_Func()
  247. {
  248. bool ret = false;
  249. if (this.main_Form.pictureBox_PATH_2_1G_UL_OFF.Visible == true)
  250. ret = false;
  251. else
  252. ret = true;
  253. return ret;
  254. }
  255. bool PATH_2_1G_DL_Get_Func()
  256. {
  257. bool ret = false;
  258. if (this.main_Form.pictureBox_PATH_2_1G_DL_OFF.Visible == true)
  259. ret = false;
  260. else
  261. ret = true;
  262. return ret;
  263. }
  264. bool Path_3_5G_L_Get_Func()
  265. {
  266. bool ret = false;
  267. if (this.main_Form.pictureBox_PATH_3_5G_L_OFF.Visible == true)
  268. ret = false;
  269. else
  270. ret = true;
  271. return ret;
  272. }
  273. bool Path_3_5G_H_Get_Func()
  274. {
  275. bool ret = false;
  276. if (this.main_Form.pictureBox_PATH_3_5G_H_OFF.Visible == true)
  277. ret = false;
  278. else
  279. ret = true;
  280. return ret;
  281. }
  282. bool PLL_ON_OFF_3_5G_L_Get_Func()
  283. {
  284. bool ret = false;
  285. if (this.main_Form.pictureBox_PLL_ON_OFF_3_5G_L_OFF.Visible == true)
  286. ret = false;
  287. else
  288. ret = true;
  289. return ret;
  290. }
  291. bool PLL_ON_OFF_3_5G_H_Get_Func()
  292. {
  293. bool ret = false;
  294. if (this.main_Form.pictureBox_PLL_ON_OFF_3_5G_H_OFF.Visible == true)
  295. ret = false;
  296. else
  297. ret = true;
  298. return ret;
  299. }
  300. bool PATH_3_5G_UL_Get_Func()
  301. {
  302. bool ret = false;
  303. if (this.main_Form.pictureBox_PATH_3_5G_UL_OFF.Visible == true)
  304. ret = false;
  305. else
  306. ret = true;
  307. return ret;
  308. }
  309. bool PATH_3_5G_DL_Get_Func()
  310. {
  311. bool ret = false;
  312. if (this.main_Form.pictureBox_PATH_3_5G_DL_OFF.Visible == true)
  313. ret = false;
  314. else
  315. ret = true;
  316. return ret;
  317. }
  318. /* public System.Windows.Forms.PictureBox pictureBox_PATH_3_5G_L_OFF;
  319. public System.Windows.Forms.PictureBox pictureBox_PATH_3_5G_H_OFF;
  320. public System.Windows.Forms.PictureBox pictureBox_PLL_ON_OFF_3_5G_L_OFF;
  321. public System.Windows.Forms.PictureBox pictureBox_PLL_ON_OFF_3_5G_H_OFF;
  322. public System.Windows.Forms.PictureBox pictureBox_PATH_3_5G_UL_OFF;
  323. public System.Windows.Forms.PictureBox pictureBox_PATH_3_5G_DL_OFF;
  324. public System.Windows.Forms.PictureBox pictureBox_PATH_2_1G_UL_OFF;
  325. public System.Windows.Forms.PictureBox pictureBox_PATH_2_1G_DL_OFF;
  326. public System.Windows.Forms.PictureBox pictureBox_PATH_1_8G_UL_OFF;
  327. public System.Windows.Forms.PictureBox pictureBox_PATH_1_8G_DL_OFF;
  328. */
  329. #if false
  330. public int Bluecell_Firmupdate_sendlength() {
  331. return bluecell_Firmupdate_sendlength;
  332. }
  333. private void BootHeaderput(ref byte[] fix_data)
  334. {
  335. fix_data[(int)Bluepro_t.bluecell_header0] = Bluecell_Header0;
  336. fix_data[(int)Bluepro_t.bluecell_header1] = Bluecell_Header1;
  337. fix_data[(int)Bluepro_t.bluecell_header2] = Bluecell_Header2;
  338. fix_data[(int)Bluepro_t.bluecell_header3] = Bluecell_Header3;
  339. }
  340. public byte[] Boot_Reset(object serial,byte[] Updatedata)
  341. {
  342. this.serial = (Serial)serial;
  343. byte[] fix_data = new byte[11];
  344. //Array.Clear(data, 0, data.Length);
  345. BootHeaderput(ref fix_data);
  346. fix_data[(int)Bluepro_t.bluecell_type] = (byte)Updateseq.Bluecell_Reset;
  347. fix_data[(int)Bluepro_t.bluecell_length_h] = 0;
  348. fix_data[(int)Bluepro_t.bluecell_length_l] = 5;
  349. fix_data[(int)Bluepro_t.bluecell_updatecnt_h] = Convert.ToByte((Updatedata.Length & 0xFF00) >> 8);
  350. fix_data[(int)Bluepro_t.bluecell_updatecnt_l] = Convert.ToByte((Updatedata.Length & 0x00FF));
  351. fix_data[(int)Bluepro_t.bluecell_data + 0] = Convert.ToByte((crc16.CRC16_Generate(fix_data, fix_data.Length - 4) & 0xFF00) >> 8);
  352. fix_data[(int)Bluepro_t.bluecell_data + 1] = Convert.ToByte((crc16.CRC16_Generate(fix_data, fix_data.Length - 4) & 0x00FF));
  353. this.serial.Serial_DataSend(fix_data, fix_data.Length);
  354. return fix_data;
  355. }
  356. public byte[] Boot_DataSending(byte[] update_data,UInt16 length, UInt16 updatacnt)
  357. {
  358. //Array.Clear(data, 0, data.Length);
  359. byte[] fix_data = new byte[bluecell_Firmupdate_sendlength];
  360. //BootHeaderput(ref fix_data);
  361. //length += 5;
  362. Array.Copy(update_data, (int)Bluepro_t.bluecell_data, fix_data, (int)Bluepro_t.bluecell_data, length);
  363. BootHeaderput(ref fix_data);
  364. fix_data[(int)Bluepro_t.bluecell_type] = (byte)Updateseq.Bluecell_Firmupdate_sending;
  365. fix_data[(int)Bluepro_t.bluecell_length_h] = Convert.ToByte((length & 0xFF00) >> 8);
  366. fix_data[(int)Bluepro_t.bluecell_length_l] = Convert.ToByte((length & 0x00FF));
  367. fix_data[(int)Bluepro_t.bluecell_updatecnt_h] = Convert.ToByte((updatacnt & 0xFF00) >> 8);
  368. fix_data[(int)Bluepro_t.bluecell_updatecnt_l] = Convert.ToByte((updatacnt & 0x00FF));
  369. //Array.Copy(update_data, 0, fix_data, (int)Bluepro_t.bluecell_data, length-3);
  370. fix_data[length + 9] = Convert.ToByte((crc16.CRC16_Generate(fix_data, length + 5) & 0xFF00) >> 8);
  371. fix_data[length + 10] = Convert.ToByte(crc16.CRC16_Generate(fix_data, length + 5) & 0x00FF);
  372. return fix_data;
  373. }
  374. public byte[] Boot_DataEnd(byte[] update_data, int length)
  375. {
  376. //Array.Clear(data, 0, data.Length);
  377. byte[] fix_data = new byte[11];
  378. Array.Copy(update_data, (int)Bluepro_t.bluecell_data, fix_data, (int)Bluepro_t.bluecell_data, length);
  379. BootHeaderput(ref fix_data);
  380. fix_data[(int)Bluepro_t.bluecell_type] = (byte)Updateseq.Bluecell_Firmupdate_end;
  381. fix_data[(int)Bluepro_t.bluecell_length_h] = Convert.ToByte((length & 0xFF00) >> 8);
  382. fix_data[(int)Bluepro_t.bluecell_length_l] = Convert.ToByte((length & 0x00FF));
  383. fix_data[(int)Bluepro_t.bluecell_updatecnt_h] = 0;
  384. fix_data[(int)Bluepro_t.bluecell_updatecnt_l] = 0;
  385. //Array.Copy(update_data, 0, fix_data, (int)Bluepro_t.bluecell_data, length-3);
  386. fix_data[length + 9] = Convert.ToByte((crc16.CRC16_Generate(fix_data, length + 5) & 0xFF00) >> 8);
  387. fix_data[length + 10] = Convert.ToByte(crc16.CRC16_Generate(fix_data, length + 5) & 0x00FF);
  388. return fix_data;
  389. }
  390. #endif
  391. }
  392. }