using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; //Add code using System.IO; using System.IO.Ports; namespace RF_TRIO_PLL_ZIG { public partial class Main_Form : Form { Serial serial = new Serial(); // Uart Open Bluecell_BootProtocol bluecell_BootProtocol = new Bluecell_BootProtocol(); Update_Serial file = new Update_Serial(); public byte Tdd_T_Sync = 0; public Main_Form() { InitializeComponent(); serial.Serial_Initialize(ref comboBox_Port); } private void Firmware_Update_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); //FileDownload file = new FileDownload(); if (Ascii_checkBox.Checked == true) Ascii_checkBox.Checked = false; file.ShowFileOpenDialog(ref serial, ofd); } private void Crc16_Check_Click(object sender, EventArgs e) { #if false Crc16 crc16 = new Crc16(); byte[] tempdata = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,0x0A }; label1.Text = crc16.CRC16_Generate(tempdata, 11).ToString(); #endif this.serial.Test_Serial(); } private void Button_PortOpen_Click(object sender, EventArgs e) { bool ret = false; ret = Serial_connectiondisable(serial.Serial_PortOpen(ref button_PortOpen, ref comboBox_Port)); if (ret == false && timer.Enabled == false) { timer.Start(); //타이머를 발동시킨다. } else if (timer.Enabled == true) { timer.Stop(); //타이머를 멈춘다. } else { /*NOP*/ } serial.Serial_Main_Form_Get(this); } private void ComboBox_Port_SelectedIndexChanged(object sender, EventArgs e) { serial.Serial_Name = comboBox_Port.SelectedItem.ToString(); } private void Button_terminal_Click(object sender, EventArgs e) { serial.Serial_TerminalOpen(serial); } public bool Serial_connectiondisable(Boolean on_off) { comboBox_Port.Enabled = on_off; comboBox_baudrate.Enabled = on_off; return on_off; } private delegate void BoolSet(); public void TX_Light_ON() { this.pictureBox_G_TX.Visible = true; this.pictureBox_R_TX.Visible = false; } public void TX_Light_OFF() { this.pictureBox_R_TX.Visible = true; this.pictureBox_G_TX.Visible = false; } public void RX_Light_ON() { this.pictureBox_G_RX.Visible = true; this.pictureBox_R_RX.Visible = false; } public void RX_Light_OFF() { this.pictureBox_R_RX.Visible = true; this.pictureBox_G_RX.Visible = false; } Int64 Timer_Cnt = 0; Int32 ReqTimer_Cnt = 0; public bool TX_RX_Light = false; private void timer_Tick(object sender, EventArgs e) { Update_Serial update_Serial = null; bool req_set = false; if(update_Serial == null) { update_Serial = (Update_Serial)serial.FileDownloadClass_Get(); if (update_Serial == null) req_set = true; else if(update_Serial.Update_ready == false) req_set = true; } if (req_set) { ReqTimer_Cnt++; } if (TX_RX_Light == true) { Timer_Cnt++; } if (Timer_Cnt < 1000) { if (this.pictureBox_G_TX.Visible == true) { TX_Light_OFF(); } if (this.pictureBox_G_RX.Visible == true) { RX_Light_OFF(); } Timer_Cnt = 0; TX_RX_Light = false; } if(ReqTimer_Cnt > 6) { bluecell_BootProtocol.Bluecell_RF_Status_Req(serial); ReqTimer_Cnt = 0; } } private void Main_Form_Load(object sender, EventArgs e) { pictureBox_PATH_1_8G_DL_ON.Visible = false; pictureBox_PATH_1_8G_UL_ON.Visible = false; pictureBox_PATH_2_1G_DL_ON.Visible = false; pictureBox_PATH_2_1G_UL_ON.Visible = false; pictureBox_PATH_3_5G_L_ON.Visible = false; pictureBox_PATH_3_5G_H_ON.Visible = false; pictureBox_PLL_ON_OFF_3_5G_L_ON.Visible = false; pictureBox_PLL_ON_OFF_3_5G_H_ON.Visible = false; pictureBox_PATH_3_5G_UL_ON.Visible = false; pictureBox_PATH_3_5G_DL_ON.Visible = false; pictureBox_PATH_1_8G_DL_OFF.Visible = !false; pictureBox_PATH_1_8G_UL_OFF.Visible = !false; pictureBox_PATH_2_1G_DL_OFF.Visible = !false; pictureBox_PATH_2_1G_UL_OFF.Visible = !false; pictureBox_PATH_3_5G_L_OFF.Visible = !false; pictureBox_PATH_3_5G_H_OFF.Visible = !false; pictureBox_PLL_ON_OFF_3_5G_L_OFF.Visible = !false; pictureBox_PLL_ON_OFF_3_5G_H_OFF.Visible = !false; pictureBox_PATH_3_5G_UL_OFF.Visible = !false; pictureBox_PATH_3_5G_DL_OFF.Visible = !false; pictureBox_G_RX.Visible = !false; pictureBox_G_TX.Visible = !false; } private delegate void StringSend(object label, String str); public void ADC_Voltage_Value_Set(byte[] data) { int temp_val = 0; double Volt_Calc_val = 3.3 / 4095; double ret = 0; try { temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_1_8G_DL_IN_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_1_8G_DL_IN_L]); ret = temp_val * Volt_Calc_val; this.Invoke(new StringSend(Label_Text_Set), label1_8GHz_DL_IN, ret.ToString("N2") + "V"); temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_1_8G_DL_OUT_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_1_8G_DL_OUT_L]); ret = temp_val * Volt_Calc_val; this.Invoke(new StringSend(Label_Text_Set), label1_8GHz_DL_OUT, ret.ToString("N2") + "V"); temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_1_8G_UL_IN_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_1_8G_UL_IN_L]); ret = temp_val * Volt_Calc_val; this.Invoke(new StringSend(Label_Text_Set), label1_8GHz_UL_IN, ret.ToString("N2") + "V"); temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_1_8G_UL_OUT_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_1_8G_UL_OUT_L]); ret = temp_val * Volt_Calc_val; this.Invoke(new StringSend(Label_Text_Set), label1_8GHz_UL_OUT, ret.ToString("N2") + "V"); temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_2_1G_DL_OUT_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_2_1G_DL_IN_L]); ret = temp_val * Volt_Calc_val; this.Invoke(new StringSend(Label_Text_Set), label2_1GHz_DL_IN, ret.ToString("N2") + "V"); temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_2_1G_DL_OUT_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_2_1G_DL_OUT_L]); ret = temp_val * Volt_Calc_val; this.Invoke(new StringSend(Label_Text_Set), label2_1GHz_DL_OUT, ret.ToString("N2") + "V"); temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_2_1G_UL_IN_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_2_1G_UL_IN_L]); ret = temp_val * Volt_Calc_val; this.Invoke(new StringSend(Label_Text_Set), label2_1GHz_UL_IN, ret.ToString("N2") + "V"); temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_2_1G_UL_OUT_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_2_1G_UL_OUT_L]); ret = temp_val * Volt_Calc_val; this.Invoke(new StringSend(Label_Text_Set), label2_1GHz_UL_OUT, ret.ToString("N2") + "V"); temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_3_5G_DL_IN_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_3_5G_DL_IN_L]); ret = temp_val * Volt_Calc_val; this.Invoke(new StringSend(Label_Text_Set), label3_5GHz_DL_IN, ret.ToString("N2") + "V"); temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_3_5G_DL_OUT_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_3_5G_DL_OUT_L]); ret = temp_val * Volt_Calc_val; this.Invoke(new StringSend(Label_Text_Set), label3_5GHz_DL_OUT, ret.ToString("N2") + "V"); temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_3_5G_UL_IN_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_3_5G_UL_IN_L]); ret = temp_val * Volt_Calc_val; this.Invoke(new StringSend(Label_Text_Set), label3_5GHz_UL_IN, ret.ToString("N2") + "V"); temp_val = (int)(data[(int)Bluecell_TypeIndex_t.DET_3_5G_UL_OUT_H] << 8) | (data[(int)Bluecell_TypeIndex_t.DET_3_5G_UL_OUT_L]); ret = temp_val * Volt_Calc_val; this.Invoke(new StringSend(Label_Text_Set), label3_5GHz_UL_OUT, ret.ToString("N2") + "V"); temp_val = (int)(data[(int)Bluecell_TypeIndex_t.RFU_TEMP_H] << 8) | (data[(int)Bluecell_TypeIndex_t.RFU_TEMP_L]); ret = temp_val * Volt_Calc_val; this.Invoke(new StringSend(Label_Text_Set), label_RFU_Temp, ret.ToString("N2") + "V"); temp_val = (int)(data[(int)Bluecell_TypeIndex_t._28V_DET_H] << 8) | (data[(int)Bluecell_TypeIndex_t._28V_DET_L]); ret = temp_val * Volt_Calc_val; this.Invoke(new StringSend(Label_Text_Set), label_28V_Det, ret.ToString("N2") + "V"); if (IamSetting_Get() == false) { temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL1]; ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL2]; ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL2, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_UL1]; ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL1, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_UL2]; ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL2, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_UL3]; ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL3, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.ATT_1_8G_UL4]; ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL4, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.ATT_2_1G_DL1]; ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_DL1, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.ATT_2_1G_DL2]; ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_DL2, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.ATT_2_1G_UL1]; ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL1, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.ATT_2_1G_UL2]; ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL2, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.ATT_2_1G_UL3]; ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL3, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.ATT_2_1G_UL4]; ret = bluecell_BootProtocol.Bluecell_Reverse_BDA4601_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL4, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.ATT_3_5G_DL]; ret = bluecell_BootProtocol.Bluecell_ReversePE43711_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_DL, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.ATT_3_5G_UL]; ret = bluecell_BootProtocol.Bluecell_ReversePE43711_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_UL, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.ATT_3_5G_COM1]; ret = bluecell_BootProtocol.Bluecell_ReversePE43711_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_COM1, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.ATT_3_5G_COM2]; ret = bluecell_BootProtocol.Bluecell_ReversePE43711_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_COM2, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.ATT_3_5G_COM3]; ret = bluecell_BootProtocol.Bluecell_ReversePE43711_Calc(temp_val); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_COM3, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.PLL_1_8G_DL_H] << 8; temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_1_8G_DL_L]) / 10); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_1_8G_DL, temp_val.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.PLL_1_8G_UL_H] << 8; temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_1_8G_UL_L]) / 10); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_1_8G_UL, temp_val.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.PLL_2_1G_DL_H] << 8; temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_2_1G_DL_L]) / 10); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_2_1G_DL, temp_val.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.PLL_2_1G_UL_H] << 8; temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_2_1G_UL_L]) / 10); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_2_1G_UL, temp_val.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.PLL_3_5G_DL_H] << 8; temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_3_5G_DL_L]) / 10); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_3_5G_DL, temp_val.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.PLL_3_5G_UL_H] << 8; temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.PLL_3_5G_UL_L]) / 10); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_PLL_3_5G_UL, temp_val.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_A_H] << 8; temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_A_L]) ); ret = (temp_val & 0x0FFF) * 4; ret = ret / 4095; ret = Math.Round(Convert.ToDouble(ret), 1); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_A, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_B_H] << 8; temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_B_L]) ); ret = (temp_val & 0x0FFF) * 4; ret = ret / 4095; ret = Math.Round(Convert.ToDouble(ret), 1); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_B, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_C_H] << 8; temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_C_L]) ); ret = (temp_val & 0x0FFF) * 4; ret = ret / 4095; ret = Math.Round(Convert.ToDouble(ret ), 1); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_C, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_D_H] << 8; temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_D_L]) ); ret = (temp_val & 0x0FFF) * 4; ret = ret / 4095; ret = Math.Round(Convert.ToDouble(ret), 1); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_D, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_E_H] << 8; temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_E_L]) ); ret = (temp_val & 0x0FFF) * 4; ret = ret / 4095; ret = Math.Round(Convert.ToDouble(ret), 1); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_E, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_F_H] << 8; temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_F_L]) ); ret = (temp_val & 0x0FFF) * 4; ret = ret / 4095; ret = Math.Round(Convert.ToDouble(ret), 1); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_F, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_G_H] << 8; temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_G_L]) ); ret = (temp_val & 0x0FFF) * 4; ret = ret / 4095; ret = Math.Round(Convert.ToDouble(ret), 1); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_G, ret.ToString()); temp_val = data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_H_H] << 8; temp_val = ((temp_val | data[(int)Bluecell_TypeIndex_t.DAC_VCtrl_H_L]) ); ret = (temp_val & 0x0FFF) * 4; ret = ret / 4095; ret = Math.Round(Convert.ToDouble(ret), 1); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_DAC_VoltCtrl_H, ret.ToString()); PictureBox pic_on; PictureBox pic_off; pic_on = pictureBox_PATH_1_8G_DL_ON; pic_off = pictureBox_PATH_1_8G_DL_OFF; if (data[(int)Bluecell_TypeIndex_t.PATH_EN_1_8G_DL] > 0) { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true); } else { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false); } pic_on = pictureBox_PATH_1_8G_UL_ON; pic_off = pictureBox_PATH_1_8G_UL_OFF; if (data[(int)Bluecell_TypeIndex_t.PATH_EN_1_8G_UL] > 0) { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true); } else { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false); } pic_on = pictureBox_PATH_2_1G_DL_ON; pic_off = pictureBox_PATH_2_1G_DL_OFF; if (data[(int)Bluecell_TypeIndex_t.PATH_EN_2_1G_DL] > 0) { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true); } else { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false); } pic_on = pictureBox_PATH_2_1G_UL_ON; pic_off = pictureBox_PATH_2_1G_UL_OFF; if (data[(int)Bluecell_TypeIndex_t.PATH_EN_2_1G_UL] > 0) { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true); } else { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false); } pic_on = pictureBox_PATH_3_5G_DL_ON; pic_off = pictureBox_PATH_3_5G_DL_OFF; if (data[(int)Bluecell_TypeIndex_t.PATH_EN_3_5G_DL] > 0) { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true); } else { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false); } pic_on = pictureBox_PATH_3_5G_UL_ON; pic_off = pictureBox_PATH_3_5G_UL_OFF; if (data[(int)Bluecell_TypeIndex_t.PATH_EN_3_5G_UL] > 0) { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true); } else { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false); } pic_on = pictureBox_PATH_3_5G_H_ON; pic_off = pictureBox_PATH_3_5G_H_OFF; if (data[(int)Bluecell_TypeIndex_t.PATH_EN_3_5G_H] > 0) { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true); } else { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false); } pic_on = pictureBox_PATH_3_5G_L_ON; pic_off = pictureBox_PATH_3_5G_L_OFF; if (data[(int)Bluecell_TypeIndex_t.PATH_EN_3_5G_L] > 0) { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true); } else { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false); } pic_on = pictureBox_PLL_ON_OFF_3_5G_H_ON; pic_off = pictureBox_PLL_ON_OFF_3_5G_H_OFF; if (data[(int)Bluecell_TypeIndex_t.PLL_ON_OFF_3_5G_H] > 0) { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true); } else { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false); } pic_on = pictureBox_PLL_ON_OFF_3_5G_L_ON; pic_off = pictureBox_PLL_ON_OFF_3_5G_L_OFF; if (data[(int)Bluecell_TypeIndex_t.PLL_ON_OFF_3_5G_L] > 0) { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true); } else { this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false); } if (data[(int)Bluecell_TypeIndex_t.T_SYNC_DL] > 0) { TDD_T_SYNC_Get(); //this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, true); } else { //this.Invoke(new PictureBoxSend(PictureBox_On_OFF_Set), pic_on, pic_off, false); } // this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL2, data[(int)Bluecell_TypeIndex_t.ATT_1_8G_DL2]); } } catch { /*MessageBox.Show("What is this?");*/ } } private delegate void PictureBoxSend(object picon, object picoff, bool set); private void PictureBox_On_OFF_Set(object pic_on,object pic_off,bool set) { PictureBox picture_on = (PictureBox)pic_on; PictureBox picture_off = (PictureBox)pic_off; picture_on.Visible = set; picture_off.Visible =!set; } public void ReSetting_Values(byte[] temp_buf) { this.numericUpDown_ATT_1_8G_DL1.Text = temp_buf[(byte)Bluecell_TypeIndex_t.ATT_1_8G_DL1].ToString(); /*this.numericUpDown_ATT_1_8G_DL2.Text; this.numericUpDown_ATT_1_8G_UL1.Text; this.numericUpDown_ATT_1_8G_UL2.Text; this.numericUpDown_ATT_1_8G_UL3.Text; this.numericUpDown_ATT_1_8G_UL4.Text; this.numericUpDown_ATT_2_1G_DL1.Text; this.numericUpDown_ATT_2_1G_DL2.Text; this.numericUpDown_ATT_2_1G_UL1.Text; this.numericUpDown_ATT_2_1G_UL2.Text; this.numericUpDown_ATT_2_1G_UL3.Text; this.numericUpDown_ATT_2_1G_UL4.Text; this.numericUpDown_ATT_3_5G_DL.Text; this.numericUpDown_ATT_3_5G_UL.Text; this.numericUpDown_ATT_3_5G_COM1.Text; this.numericUpDown_ATT_3_5G_COM2.Text; this.numericUpDown_ATT_3_5G_COM3.Text;*/ } private void Label_Text_Set(object label, String str) { Label Temp_label = (Label)label; Temp_label.Text = str; } private void numeric_Text_Set(object numeric, String str) { NumericUpDown Temp_numeric = (NumericUpDown)numeric; Temp_numeric.Text = str; } private void ATT_Enter(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { Button_Set_Click(sender, e); //to do } else { return; } } private void TDD_T_SYNC_Click(object sender, EventArgs e) { PictureBox pictureBox = (PictureBox)sender; Tdd_T_Sync = Convert.ToByte(pictureBox.Tag); bluecell_BootProtocol.Bluecell_BtnSet(this.serial, this); pictureBox_TDD_T_SYNC_UL_ON.Visible = !pictureBox_TDD_T_SYNC_UL_ON.Visible; pictureBox_TDD_T_SYNC_DL_OFF.Visible = !pictureBox_TDD_T_SYNC_DL_OFF.Visible; } private void TDD_T_SYNC_Get() { } const byte PATH_1_8G_DL_ON = 1; const byte PATH_1_8G_DL_OFF = 2; const byte PATH_1_8G_UL_ON = 3; const byte PATH_1_8G_UL_OFF = 4; const byte PATH_2_1G_DL_ON = 5; const byte PATH_2_1G_DL_OFF = 6; const byte PATH_2_1G_UL_ON = 7; const byte PATH_2_1G_UL_OFF = 8; const byte PATH_3_5G_DL_ON = 9; const byte PATH_3_5G_DL_OFF = 10; const byte PATH_3_5G_UL_ON = 11; const byte PATH_3_5G_UL_OFF = 12; const byte PATH_3_5G_H_ON = 13; const byte PATH_3_5G_H_OFF = 14; const byte PATH_3_5G_L_ON = 15; const byte PATH_3_5G_L_OFF = 16; const byte PLL_POWER_ONOFF_3_5G_H_ON = 17; const byte PLL_POWER_ONOFF_3_5G_H_OFF = 18; const byte PLL_POWER_ONOFF_3_5G_L_ON = 19; const byte PLL_POWER_ONOFF_3_5G_L_OFF = 20; private void Power_OnOff_Set(object sender, EventArgs e) { byte temp_tag = 0; PictureBox pictureBox = (PictureBox)sender; temp_tag = Convert.ToByte(pictureBox.Tag); switch (temp_tag) { case PATH_1_8G_DL_OFF: pictureBox_PATH_1_8G_DL_ON.Visible = true; break; case PATH_1_8G_DL_ON: pictureBox_PATH_1_8G_DL_OFF.Visible = true; break; case PATH_1_8G_UL_OFF: pictureBox_PATH_1_8G_UL_ON.Visible = true; break; case PATH_1_8G_UL_ON: pictureBox_PATH_1_8G_UL_OFF.Visible = true; break; case PATH_2_1G_DL_OFF: pictureBox_PATH_2_1G_DL_ON.Visible = true; break; case PATH_2_1G_DL_ON: pictureBox_PATH_2_1G_DL_OFF.Visible = true; break; case PATH_2_1G_UL_OFF: pictureBox_PATH_2_1G_UL_ON.Visible = true; break; case PATH_2_1G_UL_ON: pictureBox_PATH_2_1G_UL_OFF.Visible = true; break; case PATH_3_5G_DL_OFF: pictureBox_PATH_3_5G_DL_ON.Visible = true; break; case PATH_3_5G_DL_ON: pictureBox_PATH_3_5G_DL_OFF.Visible = true; break; case PATH_3_5G_UL_OFF: pictureBox_PATH_3_5G_UL_ON.Visible = true; break; case PATH_3_5G_UL_ON: pictureBox_PATH_3_5G_UL_OFF.Visible = true; break; case PATH_3_5G_H_OFF: pictureBox_PATH_3_5G_H_ON.Visible = true; break; case PATH_3_5G_H_ON: pictureBox_PATH_3_5G_H_OFF.Visible = true; break; case PATH_3_5G_L_OFF: pictureBox_PATH_3_5G_L_ON.Visible = true; break; case PATH_3_5G_L_ON: pictureBox_PATH_3_5G_L_OFF.Visible = true; break; case PLL_POWER_ONOFF_3_5G_H_ON: pictureBox_PLL_ON_OFF_3_5G_H_OFF.Visible = true; break; case PLL_POWER_ONOFF_3_5G_H_OFF: pictureBox_PLL_ON_OFF_3_5G_H_ON.Visible = true; break; case PLL_POWER_ONOFF_3_5G_L_ON: pictureBox_PLL_ON_OFF_3_5G_L_OFF.Visible = true; break; case PLL_POWER_ONOFF_3_5G_L_OFF: pictureBox_PLL_ON_OFF_3_5G_L_ON.Visible = true; break; } pictureBox.Visible = !pictureBox.Visible; bluecell_BootProtocol.Bluecell_BtnSet(this.serial, this); } private void button1_Click(object sender, EventArgs e) { this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL1, "0.0"); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_DL2, "0.0"); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL1, "0.0"); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL2, "0.0"); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL3, "0.0"); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_1_8G_UL4, "0.0"); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_DL1, "0.0"); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_DL2, "0.0"); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL1, "0.0"); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL2, "0.0"); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL3, "0.0"); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_2_1G_UL4, "0.0"); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_DL, "0.0"); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_UL, "0.0"); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_COM1, "0.0"); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_COM2, "0.0"); this.Invoke(new StringSend(numeric_Text_Set), numericUpDown_ATT_3_5G_COM3, "0.0"); Button_Set_Click(sender, e); /*Crc16 crc16 = new Crc16(); byte[] temp_buf = new byte[6]; temp_buf[0] = 0xbe; temp_buf[1] = 2; temp_buf[2] = 4; temp_buf[3] = 5; temp_buf[4] = crc16.STH30_CreateCrc(temp_buf, temp_buf[2]); temp_buf[5] = 0xeb; serial.Serial_DataSend(temp_buf, temp_buf[2] + 2);*/ } private void Button_Set_Click(object sender, EventArgs e) { bluecell_BootProtocol.Bluecell_BtnSet(this.serial, this); } private bool IamSetting = false; private void Activi_Change__Setting(object sender, EventArgs e) { IamSetting = true; } private void Activi_Change__SettingComplete(object sender, EventArgs e) { IamSetting = false; } public bool IamSetting_Get() { return IamSetting; } private void Cusor_DeFocus(object sender, EventArgs e) { GroupBox grp = (GroupBox)sender; grp.Focus(); } private void button_Save_Click(object sender, EventArgs e) { Crc16 crc16 = new Crc16(); byte[] temp_buf = new byte[6]; temp_buf[0] = 0xbe; temp_buf[1] = 3; temp_buf[2] = 3; temp_buf[3] = 4; temp_buf[4] = crc16.STH30_CreateCrc(temp_buf, temp_buf[2]); temp_buf[5] = 0xeb; serial.Serial_DataSend(temp_buf, temp_buf[2] + 3); } } }