using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class CommandCompleteForLeGetVendorCapabilitiesInfo : PacketInfoBase
{
	public override string Name => "Command Complete For Le Get Vendor Capabilities";

	public override string DisplayGroup => "Vendor Specific";

	public CommandCompleteForLeGetVendorCapabilitiesInfo(CommandCompleteForLeGetVendorCapabilities packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		CommandCompleteForLeGetVendorCapabilities commandCompleteForLeGetVendorCapabilities = (CommandCompleteForLeGetVendorCapabilities)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Num HCI Command Packets", "", 8, FormatValue(commandCompleteForLeGetVendorCapabilities.UserFields.NumHciCommandPackets, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Command OpCode", CommandOpcodeInfo.CommandOpcodeToDescription(), 16, FormatValue(commandCompleteForLeGetVendorCapabilities.UserFields.CommandOpcode, 16), CommandOpcodeInfo.CommandOpcodeToString(CommandOpcodeInfo.ValueToCommandOpcode(commandCompleteForLeGetVendorCapabilities.UserFields.CommandOpcode)), "", "", settable: false, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Status", ErrorCodeInfo.ErrorCodeToDescription(), 8, FormatValue(commandCompleteForLeGetVendorCapabilities.UserFields.Status, 8), ErrorCodeInfo.ErrorCodeToString(ErrorCodeInfo.ValueToErrorCode(commandCompleteForLeGetVendorCapabilities.UserFields.Status)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("max_advt_instances", "Num of advertisement instances supported", 8, FormatValue(commandCompleteForLeGetVendorCapabilities.UserFields.MaxAdvtInstances, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("offloaded resolution of private address", CommandCompleteForLeGetVendorCapabilities.UserFieldsWrapper.OffloadedResolutionOfPrivateAddressInfo.OffloadedResolutionOfPrivateAddressToDescription(), 8, FormatValue(commandCompleteForLeGetVendorCapabilities.UserFields.OffloadedResolutionOfPrivateAddress, 8), CommandCompleteForLeGetVendorCapabilities.UserFieldsWrapper.OffloadedResolutionOfPrivateAddressInfo.OffloadedResolutionOfPrivateAddressToString(CommandCompleteForLeGetVendorCapabilities.UserFieldsWrapper.OffloadedResolutionOfPrivateAddressInfo.ValueToOffloadedResolutionOfPrivateAddress(commandCompleteForLeGetVendorCapabilities.UserFields.OffloadedResolutionOfPrivateAddress)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("total_scan_results_storage", "Storage for scan results in bytes", 16, FormatValue(commandCompleteForLeGetVendorCapabilities.UserFields.TotalScanResultsStorage, 16), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("max_irk_list_sz", "Num of IRK entries supported in f/w", 8, FormatValue(commandCompleteForLeGetVendorCapabilities.UserFields.MaxIrkListSz, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Filtering support", CommandCompleteForLeGetVendorCapabilities.UserFieldsWrapper.FilteringSupportInfo.FilteringSupportToDescription(), 8, FormatValue(commandCompleteForLeGetVendorCapabilities.UserFields.FilteringSupport, 8), CommandCompleteForLeGetVendorCapabilities.UserFieldsWrapper.FilteringSupportInfo.FilteringSupportToString(CommandCompleteForLeGetVendorCapabilities.UserFieldsWrapper.FilteringSupportInfo.ValueToFilteringSupport(commandCompleteForLeGetVendorCapabilities.UserFields.FilteringSupport)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("max_filter", "Number of filters supported", 8, FormatValue(commandCompleteForLeGetVendorCapabilities.UserFields.MaxFilter, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("activity_energy_info_support", CommandCompleteForLeGetVendorCapabilities.UserFieldsWrapper.ActivityEnergyInfoSupportInfo.ActivityEnergyInfoSupportToDescription(), 8, FormatValue(commandCompleteForLeGetVendorCapabilities.UserFields.ActivityEnergyInfoSupport, 8), CommandCompleteForLeGetVendorCapabilities.UserFieldsWrapper.ActivityEnergyInfoSupportInfo.ActivityEnergyInfoSupportToString(CommandCompleteForLeGetVendorCapabilities.UserFieldsWrapper.ActivityEnergyInfoSupportInfo.ValueToActivityEnergyInfoSupport(commandCompleteForLeGetVendorCapabilities.UserFields.ActivityEnergyInfoSupport)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("version_supported", "Specifies the version of the google feature spec supported, byte[0] = major number, byte[1] = minor number", 16, FormatValue(commandCompleteForLeGetVendorCapabilities.UserFields.VersionSupported, 16), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("total_num_of_advt_tracked", "Total number of advertisers tracked for onlost/onfound purposes", 16, FormatValue(commandCompleteForLeGetVendorCapabilities.UserFields.TotalNumOfAdvtTracked, 16), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("extended_scan_support", CommandCompleteForLeGetVendorCapabilities.UserFieldsWrapper.ExtendedScanSupportInfo.ExtendedScanSupportToDescription(), 8, FormatValue(commandCompleteForLeGetVendorCapabilities.UserFields.ExtendedScanSupport, 8), CommandCompleteForLeGetVendorCapabilities.UserFieldsWrapper.ExtendedScanSupportInfo.ExtendedScanSupportToString(CommandCompleteForLeGetVendorCapabilities.UserFieldsWrapper.ExtendedScanSupportInfo.ValueToExtendedScanSupport(commandCompleteForLeGetVendorCapabilities.UserFields.ExtendedScanSupport)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("debug_logging_supported", CommandCompleteForLeGetVendorCapabilities.UserFieldsWrapper.DebugLoggingSupportedInfo.DebugLoggingSupportedToDescription(), 8, FormatValue(commandCompleteForLeGetVendorCapabilities.UserFields.DebugLoggingSupported, 8), CommandCompleteForLeGetVendorCapabilities.UserFieldsWrapper.DebugLoggingSupportedInfo.DebugLoggingSupportedToString(CommandCompleteForLeGetVendorCapabilities.UserFieldsWrapper.DebugLoggingSupportedInfo.ValueToDebugLoggingSupported(commandCompleteForLeGetVendorCapabilities.UserFields.DebugLoggingSupported)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		CommandCompleteForLeGetVendorCapabilities commandCompleteForLeGetVendorCapabilities = (CommandCompleteForLeGetVendorCapabilities)packet;
		int num = -1;
		if (index == ++num)
		{
			commandCompleteForLeGetVendorCapabilities.UserFields.NumHciCommandPackets = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field CommandOpcode");
		}
		if (index == ++num)
		{
			commandCompleteForLeGetVendorCapabilities.UserFields.Status = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForLeGetVendorCapabilities.UserFields.MaxAdvtInstances = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForLeGetVendorCapabilities.UserFields.OffloadedResolutionOfPrivateAddress = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForLeGetVendorCapabilities.UserFields.TotalScanResultsStorage = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForLeGetVendorCapabilities.UserFields.MaxIrkListSz = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForLeGetVendorCapabilities.UserFields.FilteringSupport = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForLeGetVendorCapabilities.UserFields.MaxFilter = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForLeGetVendorCapabilities.UserFields.ActivityEnergyInfoSupport = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForLeGetVendorCapabilities.UserFields.VersionSupported = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForLeGetVendorCapabilities.UserFields.TotalNumOfAdvtTracked = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForLeGetVendorCapabilities.UserFields.ExtendedScanSupport = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForLeGetVendorCapabilities.UserFields.DebugLoggingSupported = Convert.ToUInt32(value, 16);
		}
	}
}
