using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeSetPeroidicAdvertisingReceiveEnableInfo : PacketInfoBase
{
	public override string Name => "Le Set Peroidic Advertising Receive Enable";

	public override string DisplayGroup => "LE Controller";

	public LeSetPeroidicAdvertisingReceiveEnableInfo(LeSetPeroidicAdvertisingReceiveEnable packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeSetPeroidicAdvertisingReceiveEnable leSetPeroidicAdvertisingReceiveEnable = (LeSetPeroidicAdvertisingReceiveEnable)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Sync_Handle", "Sync Handle is the handle of the sync connection.", 16, FormatValue(leSetPeroidicAdvertisingReceiveEnable.UserFields.SyncHandle, 16), "", "0000", "0EFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Enable", LeSetPeroidicAdvertisingReceiveEnable.UserFieldsWrapper.EnableInfo.EnableToDescription(), 8, FormatValue(leSetPeroidicAdvertisingReceiveEnable.UserFields.Enable, 8), LeSetPeroidicAdvertisingReceiveEnable.UserFieldsWrapper.EnableInfo.EnableToString(LeSetPeroidicAdvertisingReceiveEnable.UserFieldsWrapper.EnableInfo.ValueToEnable(leSetPeroidicAdvertisingReceiveEnable.UserFields.Enable)), "0", "1", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		LeSetPeroidicAdvertisingReceiveEnable leSetPeroidicAdvertisingReceiveEnable = (LeSetPeroidicAdvertisingReceiveEnable)packet;
		int num = -1;
		if (index == ++num)
		{
			leSetPeroidicAdvertisingReceiveEnable.UserFields.SyncHandle = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			leSetPeroidicAdvertisingReceiveEnable.UserFields.Enable = Convert.ToUInt32(value, 16);
		}
	}
}
