using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeReceiverTestInfo : PacketInfoBase
{
	public override string Name => "Le Receiver Test";

	public override string DisplayGroup => "LE Controller";

	public LeReceiverTestInfo(LeReceiverTest packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeReceiverTest leReceiverTest = (LeReceiverTest)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("RX Frequency", "N = (F - 2402) / 2; 0x00 = 2402MHz; 0x27 = 2480MHz", 8, FormatValue(leReceiverTest.UserFields.RxFrequency, 8), "", "", "27", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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