using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class HciVsDebugPinTestCmdInfo : PacketInfoBase
{
	public override string Name => "Hci Vs Debug Pin Test Cmd";

	public override string DisplayGroup => "Vendor Specific";

	public HciVsDebugPinTestCmdInfo(HciVsDebugPinTestCmd packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		HciVsDebugPinTestCmd hciVsDebugPinTestCmd = (HciVsDebugPinTestCmd)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("SubOpCode", "HCI_VS_DEBUG_PIN_TEST_CMD", 8, FormatValue(hciVsDebugPinTestCmd.UserFields.Subopcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("InterfaceID", PinConnectivityInterfaceIdInfo.PinConnectivityInterfaceIdToDescription(), 8, FormatValue(hciVsDebugPinTestCmd.UserFields.Interfaceid, 8), PinConnectivityInterfaceIdInfo.PinConnectivityInterfaceIdToString(PinConnectivityInterfaceIdInfo.ValueToPinConnectivityInterfaceId(hciVsDebugPinTestCmd.UserFields.Interfaceid)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		HciVsDebugPinTestCmd hciVsDebugPinTestCmd = (HciVsDebugPinTestCmd)packet;
		int num = -1;
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field Subopcode");
		}
		if (index == ++num)
		{
			hciVsDebugPinTestCmd.UserFields.Interfaceid = Convert.ToUInt32(value, 16);
		}
	}
}
