private void OneWireEEpromValuesSelect_comboBox_SelectedIndexChanged(object sender, EventArgs e) { string str = OneWireEEpromValuesSelect_comboBox.Items[OneWireEEpromValuesSelect_comboBox.SelectedIndex].ToString(); LEV_ST_G2_OneWireDataResolution.DetailOfItem item = g_Owdr.GetItemInfor(typeof(LEV_ST_G2_OneWireDataResolution.ItemNameOfEepromData), str); if (LEV_ST_G2_OneWireDataResolution.ItemNameOfEepromData.MANUFACTURE_DATE_Var_uint_offset_106.ToString().Contains(item.Name)) { OneWireEEpromValues_textBox.Text = (item.Name.PadRight(58) + "= " + item.Values.ToString().PadRight(10) + "(type = " + item.Type + ")(" + MassUtilities.LEV_TransformLevDate((short)item.Values) + ")" + Environment.NewLine); } else { OneWireEEpromValues_textBox.Text = (item.Name.PadRight(58) + "= " + item.Values.ToString().PadRight(10) + "(type = " + item.Type + ")" + Environment.NewLine); } }
private void B2B_Packet_Unpack_button_Click(object sender, EventArgs e) { B2BReceivedDataDetector receiver = new B2BReceivedDataDetector(); List <B2BReceivedDataDetector.ReceivedPacket> packet = receiver.DataDetector(MassUtilities.HexStringToByteArray(B2B_Packet_textBox.Text)); Unpack_textBox.Text = ("=============================" + Environment.NewLine); foreach (B2BReceivedDataDetector.ReceivedPacket p in packet) { Unpack_textBox.AppendText("RX Cmd : " + String.Format("0x{0:X}", p.Cmd) + Environment.NewLine); string data = MassUtilities.ByteArrayToHexString(p.Data, true); Unpack_textBox.AppendText("RX data : " + data + Environment.NewLine); Unpack_textBox.AppendText("RX data type : " + p.Type + Environment.NewLine); Unpack_textBox.AppendText("=============================" + Environment.NewLine); } // }
private void OneWire_eepromData_Set_button_Click(object sender, EventArgs e) { //detection packet string str = MassUtilities.StringTrim_Replace_EnterAndTab_CombineMultiSpaceToOne(OneWire_EEpromData_textBox.Text); LEVBPReceivedDataDetector receiver = new LEVBPReceivedDataDetector(); List <LEVBPReceivedDataDetector.ReceivedPacket> packets = receiver.DataDetector(MassUtilities.HexStringToByteArray(str)); bool find_data_flag = false; byte[] find_data = new byte[0]; foreach (LEVBPReceivedDataDetector.ReceivedPacket packet in packets) { if (packet.Type == LEVBPReceivedDataDetector.RespondedDataType.LEV_ST_G2_OneWire_EEPROM) { find_data = packet.Data; find_data_flag = true; break; } } if (!find_data_flag) { OneWire_eeprom_infor_textBox.Text = ("Cannot find EEprom Data packet (structure)." + Environment.NewLine); return; } g_Owdr.SetData(LEV_ST_G2_OneWireDataResolution.DataGroup.EepromData, find_data); LEV_ST_G2_OneWireDataResolution.DetailOfItem[] items; items = g_Owdr.GetAllItemInfor(typeof(LEV_ST_G2_OneWireDataResolution.ItemNameOfEepromData)); OneWire_eeprom_infor_textBox.Text = ("==============================================" + Environment.NewLine); foreach (LEV_ST_G2_OneWireDataResolution.DetailOfItem item in items) { OneWire_eeprom_infor_textBox.AppendText(item.Name.PadRight(58) + "= " + item.Values.ToString().PadRight(10) + "(type = " + item.Type + ")" + Environment.NewLine); } OneWire_eeprom_infor_textBox.AppendText("==============================================" + Environment.NewLine); }
private void TransB2BKitCmd_button_Click(object sender, EventArgs e) { byte[] packet = B2BCommandProvider.CmdToB2BToolKit(Convert.ToByte(B2B_Cmd_textBox.Text, 16), MassUtilities.HexStringToByteArray(Parameter_textBox.Text)); B2B_Packet_textBox.Text = MassUtilities.ByteArrayToHexString(packet, true); }
private void TransLEVBPviaB2BKit_button_Click(object sender, EventArgs e) { byte[] packet = B2BCommandProvider.CmdToLevBatteryViaB2BToolKit(Convert.ToByte(LEV_Cmd_textBox.Text, 16), MassUtilities.HexStringToByteArray(LEV_Parameter_textBox.Text)); LEV_Packet_via_B2B_textBox.Text = MassUtilities.ByteArrayToHexString(packet, true); }
private void Trans_LEVBPPacket_button_Click(object sender, EventArgs e) { byte[] packet = LEVBPCommandProvider.CmdToLEVBP(Convert.ToByte(LEV_Cmd_textBox.Text, 16), MassUtilities.HexStringToByteArray(LEV_Parameter_textBox.Text)); LEVBP_Packet_textBox.Text = MassUtilities.ByteArrayToHexString(packet, true); }