using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class WriteClassOfDeviceInfo : PacketInfoBase
{
	public override string Name => "Write Class Of Device";

	public override string DisplayGroup => "Host Control and Baseband";

	public WriteClassOfDeviceInfo(WriteClassOfDevice packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		WriteClassOfDevice writeClassOfDevice = (WriteClassOfDevice)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Class of Device", "", 24, FormatValue(writeClassOfDevice.UserFields.ClassOfDevice, 24), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		WriteClassOfDevice writeClassOfDevice = (WriteClassOfDevice)packet;
		int num = -1;
		if (index == ++num)
		{
			writeClassOfDevice.UserFields.ClassOfDevice = Convert.ToUInt32(value, 16);
		}
	}
}
