using System;
using QCRPG.Framework;

namespace QCRPG.TSL.ZigBee.Packets;

public class VsDutCcaScanInfo : PacketInfoBase
{
	public override string Name => "Vs Dut Cca Scan";

	public override string DisplayGroup => "Vendor Specific Packets";

	public VsDutCcaScanInfo(VsDutCcaScan packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		VsDutCcaScan vsDutCcaScan = (VsDutCcaScan)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Channel", "Range (0B(11)-0x1A/26(Decimal))", 8, FormatValue(vsDutCcaScan.UserFields.Channel, 8), "", "0B", "1A", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.DecimalInteger));
		fieldInfoList.Add(new PacketFieldInfo("Page", "Page that for the test", 8, FormatValue(vsDutCcaScan.UserFields.Page, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		VsDutCcaScan vsDutCcaScan = (VsDutCcaScan)packet;
		int num = -1;
		if (index == ++num)
		{
			vsDutCcaScan.UserFields.Channel = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			vsDutCcaScan.UserFields.Page = Convert.ToUInt32(value, 16);
		}
	}
}
