using System;
using QCRPG.Framework;

namespace QCRPG.TSL.ZigBee.Packets;

public class MlmeGetInfo : PacketInfoBase
{
	public override string Name => "Mlme Get";

	public override string DisplayGroup => "MLME Request Packets";

	public MlmeGetInfo(MlmeGet packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		MlmeGet mlmeGet = (MlmeGet)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("PIBAttribute", PibattributeInfo.PibattributeToDescription(), 8, FormatValue(mlmeGet.UserFields.Pibattribute, 8), PibattributeInfo.PibattributeToString(PibattributeInfo.ValueToPibattribute(mlmeGet.UserFields.Pibattribute)), "", "FF", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("PIBAttributeIndex", "", 8, FormatValue(mlmeGet.UserFields.Pibattributeindex, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		MlmeGet mlmeGet = (MlmeGet)packet;
		int num = -1;
		if (index == ++num)
		{
			mlmeGet.UserFields.Pibattribute = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			mlmeGet.UserFields.Pibattributeindex = Convert.ToUInt32(value, 16);
		}
	}
}
