using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class CommandCompleteForHciVsRdbConnStatsInfo : PacketInfoBase
{
	public override string Name => "Command Complete For Hci Vs Rdb Conn Stats";

	public override string DisplayGroup => "Vendor Specific";

	public CommandCompleteForHciVsRdbConnStatsInfo(CommandCompleteForHciVsRdbConnStats packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		CommandCompleteForHciVsRdbConnStats commandCompleteForHciVsRdbConnStats = (CommandCompleteForHciVsRdbConnStats)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Num HCI Command Packets", "", 8, FormatValue(commandCompleteForHciVsRdbConnStats.UserFields.NumHciCommandPackets, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Command OpCode", CommandOpcodeInfo.CommandOpcodeToDescription(), 16, FormatValue(commandCompleteForHciVsRdbConnStats.UserFields.CommandOpcode, 16), CommandOpcodeInfo.CommandOpcodeToString(CommandOpcodeInfo.ValueToCommandOpcode(commandCompleteForHciVsRdbConnStats.UserFields.CommandOpcode)), "", "", settable: false, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Status", ErrorCodeInfo.ErrorCodeToDescription(), 8, FormatValue(commandCompleteForHciVsRdbConnStats.UserFields.Status, 8), ErrorCodeInfo.ErrorCodeToString(ErrorCodeInfo.ValueToErrorCode(commandCompleteForHciVsRdbConnStats.UserFields.Status)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Sub_OpCode", "", 8, FormatValue(commandCompleteForHciVsRdbConnStats.UserFields.SubOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Data_Length", "", 8, FormatValue(commandCompleteForHciVsRdbConnStats.UserFields.DataLength, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Pkt_TxCount", "", 32, FormatValue(commandCompleteForHciVsRdbConnStats.UserFields.PktTxcount, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Pkt_TxFlush", "", 16, FormatValue(commandCompleteForHciVsRdbConnStats.UserFields.PktTxflush, 16), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Pkt_TxRetrans", "", 16, FormatValue(commandCompleteForHciVsRdbConnStats.UserFields.PktTxretrans, 16), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Pkt_RxCount", "", 32, FormatValue(commandCompleteForHciVsRdbConnStats.UserFields.PktRxcount, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Pkt_RxFlush", "", 16, FormatValue(commandCompleteForHciVsRdbConnStats.UserFields.PktRxflush, 16), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Pkt_RxMiss", "", 16, FormatValue(commandCompleteForHciVsRdbConnStats.UserFields.PktRxmiss, 16), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Pkt_RxAbort", "", 16, FormatValue(commandCompleteForHciVsRdbConnStats.UserFields.PktRxabort, 16), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Pkt_CrcBad", "", 16, FormatValue(commandCompleteForHciVsRdbConnStats.UserFields.PktCrcbad, 16), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Pkt_CxmDenials", "", 8, FormatValue(commandCompleteForHciVsRdbConnStats.UserFields.PktCxmdenials, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Pkt_Reserved", "", 24, FormatValue(commandCompleteForHciVsRdbConnStats.UserFields.PktReserved, 24), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		CommandCompleteForHciVsRdbConnStats commandCompleteForHciVsRdbConnStats = (CommandCompleteForHciVsRdbConnStats)packet;
		int num = -1;
		if (index == ++num)
		{
			commandCompleteForHciVsRdbConnStats.UserFields.NumHciCommandPackets = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field CommandOpcode");
		}
		if (index == ++num)
		{
			commandCompleteForHciVsRdbConnStats.UserFields.Status = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field SubOpcode");
		}
		if (index == ++num)
		{
			commandCompleteForHciVsRdbConnStats.UserFields.DataLength = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForHciVsRdbConnStats.UserFields.PktTxcount = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForHciVsRdbConnStats.UserFields.PktTxflush = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForHciVsRdbConnStats.UserFields.PktTxretrans = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForHciVsRdbConnStats.UserFields.PktRxcount = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForHciVsRdbConnStats.UserFields.PktRxflush = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForHciVsRdbConnStats.UserFields.PktRxmiss = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForHciVsRdbConnStats.UserFields.PktRxabort = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForHciVsRdbConnStats.UserFields.PktCrcbad = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForHciVsRdbConnStats.UserFields.PktCxmdenials = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForHciVsRdbConnStats.UserFields.PktReserved = Convert.ToUInt32(value, 16);
		}
	}
}
