using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeReadChannelMapInfo : PacketInfoBase
{
	public override string Name => "Le Read Channel Map";

	public override string DisplayGroup => "LE Controller";

	public LeReadChannelMapInfo(LeReadChannelMap packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeReadChannelMap leReadChannelMap = (LeReadChannelMap)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Connection_Handle", "The Connection_Handle for the Connection for which the Channel_Map is to be read. Range: 0x0000-0x0EFF. Reserved for future use (0x0F00 - 0x0FFF)", 16, FormatValue(leReadChannelMap.UserFields.ConnectionHandle, 16), "", "0000", "0EFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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