using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeReadRemoteTransmitPowerLevelInfo : PacketInfoBase
{
	public override string Name => "Le Read Remote Transmit Power Level";

	public override string DisplayGroup => "LE Controller";

	public LeReadRemoteTransmitPowerLevelInfo(LeReadRemoteTransmitPowerLevel packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeReadRemoteTransmitPowerLevel leReadRemoteTransmitPowerLevel = (LeReadRemoteTransmitPowerLevel)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Connection Handle", "Connection handle for the LE connection.", 16, FormatValue(leReadRemoteTransmitPowerLevel.UserFields.ConnectionHandle, 16), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("phy", "Phy parameter for the connection.\r\n\r\n" + LeReadRemoteTransmitPowerLevel.UserFieldsWrapper.PhyInfo.PhyToDescription(), 8, FormatValue(leReadRemoteTransmitPowerLevel.UserFields.Phy, 8), LeReadRemoteTransmitPowerLevel.UserFieldsWrapper.PhyInfo.PhyToString(LeReadRemoteTransmitPowerLevel.UserFieldsWrapper.PhyInfo.ValueToPhy(leReadRemoteTransmitPowerLevel.UserFields.Phy)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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