using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class WriteExtendedPageTimeoutInfo : PacketInfoBase
{
	public override string Name => "Write Extended Page Timeout";

	public override string DisplayGroup => "Host Control and Baseband";

	public WriteExtendedPageTimeoutInfo(WriteExtendedPageTimeout packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		WriteExtendedPageTimeout writeExtendedPageTimeout = (WriteExtendedPageTimeout)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Extended_Page_Timeout", "Extended Page Timeout measured in Number of Baseband slots. Interval Length = N * 0.625 msec (1 Baseband slot), Range for N: 0x0000 (default) - 0xFFFF, Time Range: 0 - 40.9 Seconds. Mandatory Range for Controller: 0x0000 to 0xFFFF", 16, FormatValue(writeExtendedPageTimeout.UserFields.ExtendedPageTimeout, 16), "", "0000", "FFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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