using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LePeroidicAdvertisingSetInfoTransferInfo : PacketInfoBase
{
	public override string Name => "Le Peroidic Advertising Set Info Transfer";

	public override string DisplayGroup => "LE Controller";

	public LePeroidicAdvertisingSetInfoTransferInfo(LePeroidicAdvertisingSetInfoTransfer packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LePeroidicAdvertisingSetInfoTransfer lePeroidicAdvertisingSetInfoTransfer = (LePeroidicAdvertisingSetInfoTransfer)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Connection_Handle", "Connection Handle is the handle of the LE connection initializing this PAST procedure.", 16, FormatValue(lePeroidicAdvertisingSetInfoTransfer.UserFields.ConnectionHandle, 16), "", "00", "EF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Service_Data", "Host Specific Data.", 16, FormatValue(lePeroidicAdvertisingSetInfoTransfer.UserFields.ServiceData, 16), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Advertising_Handle", "Advertising Handle is the handle of the peroidic advertiser.", 8, FormatValue(lePeroidicAdvertisingSetInfoTransfer.UserFields.AdvertisingHandle, 8), "", "0000", "0EFF", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		LePeroidicAdvertisingSetInfoTransfer lePeroidicAdvertisingSetInfoTransfer = (LePeroidicAdvertisingSetInfoTransfer)packet;
		int num = -1;
		if (index == ++num)
		{
			lePeroidicAdvertisingSetInfoTransfer.UserFields.ConnectionHandle = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			lePeroidicAdvertisingSetInfoTransfer.UserFields.ServiceData = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			lePeroidicAdvertisingSetInfoTransfer.UserFields.AdvertisingHandle = Convert.ToUInt32(value, 16);
		}
	}
}
