using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeIsoReceiveTestInfo : PacketInfoBase
{
	public override string Name => "Le Iso Receive Test";

	public override string DisplayGroup => "LE Controller";

	public LeIsoReceiveTestInfo(LeIsoReceiveTest packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeIsoReceiveTest leIsoReceiveTest = (LeIsoReceiveTest)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Connection_Handle", "", 16, FormatValue(leIsoReceiveTest.UserFields.ConnectionHandle, 16), "", "0000", "0EFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("PayloadType", IsoPayloadtypeInfo.IsoPayloadtypeToDescription(), 8, FormatValue(leIsoReceiveTest.UserFields.Payloadtype, 8), IsoPayloadtypeInfo.IsoPayloadtypeToString(IsoPayloadtypeInfo.ValueToIsoPayloadtype(leIsoReceiveTest.UserFields.Payloadtype)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		LeIsoReceiveTest leIsoReceiveTest = (LeIsoReceiveTest)packet;
		int num = -1;
		if (index == ++num)
		{
			leIsoReceiveTest.UserFields.ConnectionHandle = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			leIsoReceiveTest.UserFields.Payloadtype = Convert.ToUInt32(value, 16);
		}
	}
}
