123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace RF_TRIO_PLL_ZIG
- {
- public enum Bluepro_t
- {
- bluecell_header0 = 0,
- bluecell_header1,
- bluecell_header2,
- bluecell_header3,
- bluecell_type,
- bluecell_length_h,
- bluecell_length_l,
- bluecell_updatecnt_h,
- bluecell_updatecnt_l,
- bluecell_data,
- };
- public enum Updateseq
- {
- Bluecell_Reset = 0,
- Bluecell_Firmupdate_start,
- Bluecell_Firmupdate_sending,
- Bluecell_Firmupdate_end,
- };
- enum Bluecell_ProtIndex_p
- {
- Bluecell_Header = 0,
- Bluecell_Type,
- Bluecell_Length,
- Bluecell_CrcIndex,
- Bluecell_data,
- }
- enum Bluecell_Prot_t{
- TYPE_BLUECELL_RESET = 0,
- TYPE_BLUECELL_SET = 1,
- TYPE_BLUECELL_GET = 2,
- };
- enum Bluecell_TypeIndex_t
- {
- ATT_1_8G_DL1 = 0,
- ATT_1_8G_DL2,
- ATT_1_8G_UL1,
- ATT_1_8G_UL2,
- ATT_1_8G_UL3,
- ATT_1_8G_UL4,
- ATT_2_1G_DL1,
- ATT_2_1G_DL2,
- ATT_2_1G_UL1,
- ATT_2_1G_UL2,
- ATT_2_1G_UL3,
- ATT_2_1G_UL4,
- ATT_3_5G_DL,
- ATT_3_5G_UL,
- ATT_3_5G_COM1,
- ATT_3_5G_COM2,
- ATT_3_5G_COM3,
- PLL_1_8G_DL_H,
- PLL_1_8G_DL_L,
- PLL_1_8G_UL_H,
- PLL_1_8G_UL_L,
- PLL_2_1G_DL_H,
- PLL_2_1G_DL_L,
- PLL_2_1G_UL_H,
- PLL_2_1G_UL_L,
- PLL_3_5G_DL_H,
- PLL_3_5G_DL_L,
- PLL_3_5G_UL_H,
- PLL_3_5G_UL_L,
- PLL_LD_6_BIT,
- DET_1_8G_DL_IN_H,
- DET_1_8G_DL_IN_L,
- DET_1_8G_DL_OUT_H,
- DET_1_8G_DL_OUT_L,
- DET_1_8G_UL_IN_H,
- DET_1_8G_UL_IN_L,
- DET_1_8G_UL_OUT_H,
- DET_1_8G_UL_OUT_L,
- DET_2_1G_DL_IN_H,
- DET_2_1G_DL_IN_L,
- DET_2_1G_DL_OUT_H,
- DET_2_1G_DL_OUT_L,
- DET_2_1G_UL_IN_H,
- DET_2_1G_UL_IN_L,
- DET_2_1G_UL_OUT_H,
- DET_2_1G_UL_OUT_L,
- DET_3_5G_DL_IN_H,
- DET_3_5G_DL_IN_L,
- DET_3_5G_DL_OUT_L,
- DET_3_5G_DL_OUT_H,
- DET_3_5G_UL_IN_H,
- DET_3_5G_UL_IN_L,
- DET_3_5G_UL_OUT_H,
- DET_3_5G_UL_OUT_L,
- RFU_TEMP_H,
- RFU_TEMP_L,
- _28V_DET_H,
- _28V_DET_L,
- ALARM_AC,
- ALARM_DC,
- PATH_EN_1_8G_DL,
- PATH_EN_1_8G_UL,
- PATH_EN_2_1G_DL,
- PATH_EN_2_1G_UL,
- PATH_EN_3_5G_L,
- PATH_EN_3_5G_H,
- PATH_EN_3_5G_DL,
- PATH_EN_3_5G_UL,
- PLL_ON_OFF_3_5G_H,
- PLL_ON_OFF_3_5G_L,
- T_SYNC_DL,
- _T_SYNC_DL,
- T_SYNC_UL,
- _T_SYNC_UL,
- };
- class Bluecell_BootProtocol
- {
- Serial serial;
- /*bluecell Header*/
- public const byte Bluecell_Header0 = 0x42;//ASCII : B
- public const byte Bluecell_Header1 = 0x4C;//ASCII : L
- public const byte Bluecell_Header2 = 0x55;//ASCII : U
- public const byte Bluecell_Header3 = 0x45;//ASCII : E
- /*bluecell type*/
- public const int bluecell_Firmupdate_sendlength = 1024;
-
- Crc16 crc16 = new Crc16();
- public const byte BLUECELL_HEADER = 0xBE;
- public const byte BLUECELL_TAILER = 0xEB;
- const byte BLUECELL_RESET_LENGTH = 6;
- const byte BLUECELL_FIX_DATA_LENGTH = 3;
- public void Bluecell_Reset(object serial)
- {
- this.serial = (Serial)serial;
- byte[] temp_buf = new byte[BLUECELL_RESET_LENGTH];
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (byte)Bluecell_Prot_t.TYPE_BLUECELL_RESET;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length] = BLUECELL_RESET_LENGTH - BLUECELL_FIX_DATA_LENGTH;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = (byte)Bluecell_ProtIndex_p.Bluecell_data;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = crc16.STH30_CreateCrc(temp_buf, BLUECELL_RESET_LENGTH - 3);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = BLUECELL_TAILER;
- this.serial.Serial_DataSend(temp_buf, temp_buf.Length);
- }
- private byte Bluecell_BDA4601_Calc(double data)
- {
- byte ret = 0;
-
- if (data == 31.5)
- ret = 0x3F;
- if (data >= 16) {
- ret |= 0x01;
- data -= 16;
- }
- if (data >= 8)
- {
- ret |= 0x02;
- data -= 8;
- }
- if (data >= 4)
- {
- ret |= 0x04;
- data -= 4;
- }
- if (data >= 2)
- {
- ret |= 0x08;
- data -= 2;
- }
- if (data >= 1)
- {
- ret |= 0x10;
- data -= 1;
- }
- if (data >= 0.5)
- {
- ret |= 0x20;
- data -= 0.5;
- }
- return ret;
- }
- private byte Bluecell_PE43711_Calc(double data)
- {
- byte ret = 0;
- if (data == 31.75)
- ret = 0x7F;
- if (data >= 16)
- {
- ret |= 0x40;
- data -= 16;
- }
- if (data >= 8)
- {
- ret |= 0x20;
- data -= 8;
- }
- if (data >= 4)
- {
- ret |= 0x10;
- data -= 4;
- }
- if (data >= 2)
- {
- ret |= 0x08;
- data -= 2;
- }
- if (data >= 1)
- {
- ret |= 0x04;
- data -= 1;
- }
- if (data >= 0.5)
- {
- ret |= 0x02;
- data -= 0.5;
- }
- if (data >= 0.25)
- {
- ret |= 0x01;
- data -= 0.25;
- }
- return ret;
- }
- const byte BLUECELL_DATA_SET_LENGTH = 80;
- Main_Form main_Form;
- public void Bluecell_BtnSet(object serial, object main_form)
- {
- this.main_Form = (Main_Form)main_form;
- this.serial = (Serial)serial;
- byte[] temp_buf = new byte[BLUECELL_DATA_SET_LENGTH];
- UInt32 temp_val = 0;
- /* * * * * * FIX DATA * * * * * */
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (byte)Bluecell_Prot_t.TYPE_BLUECELL_SET;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length] = BLUECELL_DATA_SET_LENGTH - BLUECELL_FIX_DATA_LENGTH;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = (byte)BLUECELL_DATA_SET_LENGTH - 2;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_DL1] = Bluecell_BDA4601_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_1_8G_DL1.Text));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_DL2] = Bluecell_BDA4601_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_1_8G_DL2.Text));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_UL1] = Bluecell_BDA4601_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_1_8G_UL1.Text));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_UL2] = Bluecell_BDA4601_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_1_8G_UL2.Text));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_UL3] = Bluecell_BDA4601_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_1_8G_UL3.Text));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_1_8G_UL4] = Bluecell_BDA4601_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_1_8G_UL4.Text));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_DL1] = Bluecell_BDA4601_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_2_1G_DL1.Text));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_DL2] = Bluecell_BDA4601_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_2_1G_DL2.Text));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_UL1] = Bluecell_BDA4601_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_2_1G_UL1.Text));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_UL2] = Bluecell_BDA4601_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_2_1G_UL2.Text));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_UL3] = Bluecell_BDA4601_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_2_1G_UL3.Text));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_2_1G_UL4] = Bluecell_BDA4601_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_2_1G_UL4.Text));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_3_5G_DL] = Bluecell_PE43711_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_3_5G_DL.Text));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_3_5G_UL] = Bluecell_PE43711_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_3_5G_UL.Text));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_3_5G_COM1] = Bluecell_PE43711_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_3_5G_COM1.Text));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_3_5G_COM2] = Bluecell_PE43711_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_3_5G_COM2.Text));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ATT_3_5G_COM3] = Bluecell_PE43711_Calc(Convert.ToDouble(main_Form.numericUpDown_ATT_3_5G_COM3.Text));
- temp_val = Convert.ToUInt32(Convert.ToDouble(main_Form.numericUpDown_PLL_1_8G_DL.Text) * 10);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_1_8G_DL_H] = Convert.ToByte((temp_val & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_1_8G_DL_L] = Convert.ToByte((temp_val & 0x00FF));
- temp_val = Convert.ToUInt32(Convert.ToDouble(main_Form.numericUpDown_PLL_1_8G_UL.Text) * 10);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_1_8G_UL_H] = Convert.ToByte((temp_val & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_1_8G_UL_L] = Convert.ToByte((temp_val & 0x00FF));
- temp_val = Convert.ToUInt32(Convert.ToDouble(main_Form.numericUpDown_PLL_2_1G_DL.Text) * 10);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_2_1G_DL_H] = Convert.ToByte((temp_val & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_2_1G_DL_L] = Convert.ToByte((temp_val & 0x00FF));
- temp_val = Convert.ToUInt32(Convert.ToDouble(main_Form.numericUpDown_PLL_2_1G_UL.Text) * 10);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_2_1G_UL_H] = Convert.ToByte((temp_val & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_2_1G_UL_L] = Convert.ToByte((temp_val & 0x00FF));
- temp_val = Convert.ToUInt32(Convert.ToDouble(main_Form.numericUpDown_PLL_3_5G_DL.Text) * 10);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_3_5G_DL_H] = Convert.ToByte((temp_val & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_3_5G_DL_L] = Convert.ToByte((temp_val & 0x00FF));
- temp_val = Convert.ToUInt32(Convert.ToDouble(main_Form.numericUpDown_PLL_3_5G_UL.Text) * 10);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_3_5G_UL_H] = Convert.ToByte((temp_val & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.PLL_3_5G_UL_L] = Convert.ToByte((temp_val & 0x00FF));
- 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);
- 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);
- 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);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_DL_OUT_H] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_DL_OUT_L] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_UL_IN_H] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_UL_IN_L] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_UL_OUT_H] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_1_8G_UL_OUT_L] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_DL_IN_H] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_DL_IN_L] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_DL_OUT_H] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_DL_OUT_L] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_UL_IN_H] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_UL_IN_L] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_UL_OUT_H] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_2_1G_UL_OUT_L] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_DL_IN_H] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_DL_IN_L] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_DL_OUT_L] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_DL_OUT_H] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_UL_IN_H] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_UL_IN_L] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_UL_OUT_H] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.DET_3_5G_UL_OUT_L] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.RFU_TEMP_H] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.RFU_TEMP_L] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t._28V_DET_H] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t._28V_DET_L] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ALARM_AC] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.ALARM_DC] = 0;
- 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());
- 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());
- 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());
- 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());
- 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());
- 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());
- 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());
- 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());
- 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());
- 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());
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.T_SYNC_DL] = main_Form.Tdd_T_Sync;//Convert.ToByte(PATH_3_5G_DL_Get_Func());
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t._T_SYNC_DL] = main_Form.Tdd_T_Sync;//Convert.ToByte(PATH_3_5G_DL_Get_Func());
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t.T_SYNC_UL] = main_Form.Tdd_T_Sync;//Convert.ToByte(PLL_ON_OFF_3_5G_H_Get_Func());
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t._T_SYNC_UL] = main_Form.Tdd_T_Sync;//Convert.ToByte(PLL_ON_OFF_3_5G_L_Get_Func());
- /* * * * * * FIX DATA * * * * * */
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t._T_SYNC_UL + 1] = crc16.STH30_CreateCrc(temp_buf, BLUECELL_DATA_SET_LENGTH - 3);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + (int)Bluecell_TypeIndex_t._T_SYNC_UL + 2] = BLUECELL_TAILER;
- this.serial.Serial_DataSend(temp_buf, temp_buf.Length);
- }
- bool PATH_1_8G_UL_Get_Func()
- {
- bool ret = false;
- if (this.main_Form.pictureBox_PATH_1_8G_UL_OFF.Visible == true)
- ret = false;
- else
- ret = true;
- return ret;
- }
- bool PATH_1_8G_DL_Get_Func()
- {
- bool ret = false;
- if (this.main_Form.pictureBox_PATH_1_8G_DL_OFF.Visible == true)
- ret = false;
- else
- ret = true;
- return ret;
- }
- bool PATH_2_1G_UL_Get_Func()
- {
- bool ret = false;
- if (this.main_Form.pictureBox_PATH_2_1G_UL_OFF.Visible == true)
- ret = false;
- else
- ret = true;
- return ret;
- }
- bool PATH_2_1G_DL_Get_Func()
- {
- bool ret = false;
- if (this.main_Form.pictureBox_PATH_2_1G_DL_OFF.Visible == true)
- ret = false;
- else
- ret = true;
- return ret;
- }
- bool Path_3_5G_L_Get_Func()
- {
- bool ret = false;
- if (this.main_Form.pictureBox_PATH_3_5G_L_OFF.Visible == true)
- ret = false;
- else
- ret = true;
- return ret;
- }
- bool Path_3_5G_H_Get_Func()
- {
- bool ret = false;
- if (this.main_Form.pictureBox_PATH_3_5G_H_OFF.Visible == true)
- ret = false;
- else
- ret = true;
- return ret;
- }
- bool PLL_ON_OFF_3_5G_L_Get_Func()
- {
- bool ret = false;
- if (this.main_Form.pictureBox_PLL_ON_OFF_3_5G_L_OFF.Visible == true)
- ret = false;
- else
- ret = true;
- return ret;
- }
- bool PLL_ON_OFF_3_5G_H_Get_Func()
- {
- bool ret = false;
- if (this.main_Form.pictureBox_PLL_ON_OFF_3_5G_H_OFF.Visible == true)
- ret = false;
- else
- ret = true;
- return ret;
- }
- bool PATH_3_5G_UL_Get_Func()
- {
- bool ret = false;
- if (this.main_Form.pictureBox_PATH_3_5G_UL_OFF.Visible == true)
- ret = false;
- else
- ret = true;
- return ret;
- }
- bool PATH_3_5G_DL_Get_Func()
- {
- bool ret = false;
- if (this.main_Form.pictureBox_PATH_3_5G_DL_OFF.Visible == true)
- ret = false;
- else
- ret = true;
- return ret;
- }
-
- /* public System.Windows.Forms.PictureBox pictureBox_PATH_3_5G_L_OFF;
- public System.Windows.Forms.PictureBox pictureBox_PATH_3_5G_H_OFF;
- public System.Windows.Forms.PictureBox pictureBox_PLL_ON_OFF_3_5G_L_OFF;
- public System.Windows.Forms.PictureBox pictureBox_PLL_ON_OFF_3_5G_H_OFF;
- public System.Windows.Forms.PictureBox pictureBox_PATH_3_5G_UL_OFF;
- public System.Windows.Forms.PictureBox pictureBox_PATH_3_5G_DL_OFF;
- public System.Windows.Forms.PictureBox pictureBox_PATH_2_1G_UL_OFF;
- public System.Windows.Forms.PictureBox pictureBox_PATH_2_1G_DL_OFF;
- public System.Windows.Forms.PictureBox pictureBox_PATH_1_8G_UL_OFF;
- public System.Windows.Forms.PictureBox pictureBox_PATH_1_8G_DL_OFF;
- */
- #if false
- public int Bluecell_Firmupdate_sendlength() {
- return bluecell_Firmupdate_sendlength;
- }
- private void BootHeaderput(ref byte[] fix_data)
- {
- fix_data[(int)Bluepro_t.bluecell_header0] = Bluecell_Header0;
- fix_data[(int)Bluepro_t.bluecell_header1] = Bluecell_Header1;
- fix_data[(int)Bluepro_t.bluecell_header2] = Bluecell_Header2;
- fix_data[(int)Bluepro_t.bluecell_header3] = Bluecell_Header3;
- }
- public byte[] Boot_Reset(object serial,byte[] Updatedata)
- {
- this.serial = (Serial)serial;
- byte[] fix_data = new byte[11];
- //Array.Clear(data, 0, data.Length);
- BootHeaderput(ref fix_data);
- fix_data[(int)Bluepro_t.bluecell_type] = (byte)Updateseq.Bluecell_Reset;
- fix_data[(int)Bluepro_t.bluecell_length_h] = 0;
- fix_data[(int)Bluepro_t.bluecell_length_l] = 5;
- fix_data[(int)Bluepro_t.bluecell_updatecnt_h] = Convert.ToByte((Updatedata.Length & 0xFF00) >> 8);
- fix_data[(int)Bluepro_t.bluecell_updatecnt_l] = Convert.ToByte((Updatedata.Length & 0x00FF));
- fix_data[(int)Bluepro_t.bluecell_data + 0] = Convert.ToByte((crc16.CRC16_Generate(fix_data, fix_data.Length - 4) & 0xFF00) >> 8);
- fix_data[(int)Bluepro_t.bluecell_data + 1] = Convert.ToByte((crc16.CRC16_Generate(fix_data, fix_data.Length - 4) & 0x00FF));
- this.serial.Serial_DataSend(fix_data, fix_data.Length);
- return fix_data;
- }
-
- public byte[] Boot_DataSending(byte[] update_data,UInt16 length, UInt16 updatacnt)
- {
- //Array.Clear(data, 0, data.Length);
- byte[] fix_data = new byte[bluecell_Firmupdate_sendlength];
- //BootHeaderput(ref fix_data);
- //length += 5;
- Array.Copy(update_data, (int)Bluepro_t.bluecell_data, fix_data, (int)Bluepro_t.bluecell_data, length);
- BootHeaderput(ref fix_data);
- fix_data[(int)Bluepro_t.bluecell_type] = (byte)Updateseq.Bluecell_Firmupdate_sending;
- fix_data[(int)Bluepro_t.bluecell_length_h] = Convert.ToByte((length & 0xFF00) >> 8);
- fix_data[(int)Bluepro_t.bluecell_length_l] = Convert.ToByte((length & 0x00FF));
- fix_data[(int)Bluepro_t.bluecell_updatecnt_h] = Convert.ToByte((updatacnt & 0xFF00) >> 8);
- fix_data[(int)Bluepro_t.bluecell_updatecnt_l] = Convert.ToByte((updatacnt & 0x00FF));
- //Array.Copy(update_data, 0, fix_data, (int)Bluepro_t.bluecell_data, length-3);
- fix_data[length + 9] = Convert.ToByte((crc16.CRC16_Generate(fix_data, length + 5) & 0xFF00) >> 8);
- fix_data[length + 10] = Convert.ToByte(crc16.CRC16_Generate(fix_data, length + 5) & 0x00FF);
- return fix_data;
- }
- public byte[] Boot_DataEnd(byte[] update_data, int length)
- {
- //Array.Clear(data, 0, data.Length);
- byte[] fix_data = new byte[11];
- Array.Copy(update_data, (int)Bluepro_t.bluecell_data, fix_data, (int)Bluepro_t.bluecell_data, length);
- BootHeaderput(ref fix_data);
- fix_data[(int)Bluepro_t.bluecell_type] = (byte)Updateseq.Bluecell_Firmupdate_end;
- fix_data[(int)Bluepro_t.bluecell_length_h] = Convert.ToByte((length & 0xFF00) >> 8);
- fix_data[(int)Bluepro_t.bluecell_length_l] = Convert.ToByte((length & 0x00FF));
- fix_data[(int)Bluepro_t.bluecell_updatecnt_h] = 0;
- fix_data[(int)Bluepro_t.bluecell_updatecnt_l] = 0;
- //Array.Copy(update_data, 0, fix_data, (int)Bluepro_t.bluecell_data, length-3);
- fix_data[length + 9] = Convert.ToByte((crc16.CRC16_Generate(fix_data, length + 5) & 0xFF00) >> 8);
- fix_data[length + 10] = Convert.ToByte(crc16.CRC16_Generate(fix_data, length + 5) & 0x00FF);
- return fix_data;
- }
- #endif
- }
- }
|