using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeSetDefaultPeroidicAdvertisingSyncTransferParametersInfo : PacketInfoBase
{
	public override string Name => "Le Set Default Peroidic Advertising Sync Transfer Parameters";

	public override string DisplayGroup => "LE Controller";

	public LeSetDefaultPeroidicAdvertisingSyncTransferParametersInfo(LeSetDefaultPeroidicAdvertisingSyncTransferParameters packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeSetDefaultPeroidicAdvertisingSyncTransferParameters leSetDefaultPeroidicAdvertisingSyncTransferParameters = (LeSetDefaultPeroidicAdvertisingSyncTransferParameters)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Mode", LeSetDefaultPeroidicAdvertisingSyncTransferParameters.UserFieldsWrapper.ModeInfo.ModeToDescription(), 8, FormatValue(leSetDefaultPeroidicAdvertisingSyncTransferParameters.UserFields.Mode, 8), LeSetDefaultPeroidicAdvertisingSyncTransferParameters.UserFieldsWrapper.ModeInfo.ModeToString(LeSetDefaultPeroidicAdvertisingSyncTransferParameters.UserFieldsWrapper.ModeInfo.ValueToMode(leSetDefaultPeroidicAdvertisingSyncTransferParameters.UserFields.Mode)), "0", "2", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Skip", "The number of periodic advertising packets that can be skipped after a successful receive.", 16, FormatValue(leSetDefaultPeroidicAdvertisingSyncTransferParameters.UserFields.Skip, 16), "", "0000", "01F3", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Sync_Timeout", "Synchronization timeout for the periodic advertising", 16, FormatValue(leSetDefaultPeroidicAdvertisingSyncTransferParameters.UserFields.SyncTimeout, 16), "", "000A", "0400", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Supplemental_Type", "Sync to periodic advertising with certain types of supplemental.", 8, FormatValue(leSetDefaultPeroidicAdvertisingSyncTransferParameters.UserFields.SupplementalType, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		LeSetDefaultPeroidicAdvertisingSyncTransferParameters leSetDefaultPeroidicAdvertisingSyncTransferParameters = (LeSetDefaultPeroidicAdvertisingSyncTransferParameters)packet;
		int num = -1;
		if (index == ++num)
		{
			leSetDefaultPeroidicAdvertisingSyncTransferParameters.UserFields.Mode = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			leSetDefaultPeroidicAdvertisingSyncTransferParameters.UserFields.Skip = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			leSetDefaultPeroidicAdvertisingSyncTransferParameters.UserFields.SyncTimeout = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			leSetDefaultPeroidicAdvertisingSyncTransferParameters.UserFields.SupplementalType = Convert.ToUInt32(value, 16);
		}
	}
}
