using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class WriteInquiryScanActivityInfo : PacketInfoBase
{
	public override string Name => "Write Inquiry Scan Activity";

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

	public WriteInquiryScanActivityInfo(WriteInquiryScanActivity packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		WriteInquiryScanActivity writeInquiryScanActivity = (WriteInquiryScanActivity)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Inquiry Scan Interval", "The Inquiry_Scan_Interval configuration parameter defines the amount of time between consecutive inquiry scans.", 16, FormatValue(writeInquiryScanActivity.UserFields.InquiryScanInterval, 16), "", "0012", "1000", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Inquiry Scan Window", "The Inquiry_Scan_Window configuration parameter defines the amount of time for the duration of the inquiry scan.", 16, FormatValue(writeInquiryScanActivity.UserFields.InquiryScanWindow, 16), "", "0011", "1000", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		WriteInquiryScanActivity writeInquiryScanActivity = (WriteInquiryScanActivity)packet;
		int num = -1;
		if (index == ++num)
		{
			writeInquiryScanActivity.UserFields.InquiryScanInterval = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			writeInquiryScanActivity.UserFields.InquiryScanWindow = Convert.ToUInt32(value, 16);
		}
	}
}
