using System;
using System.Collections.Generic;
using System.Text;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeMultiAdvtSetAdvtParamMulti : PacketBase
{
	public class UserFieldsWrapper
	{
		public enum AdvertisingTypeEnum
		{
			Connectable_undirected_advertising_ADV_IND,
			Connectable_high_duty_cycle_directed_advertising_ADV_DIRECT_IND_high_duty_cycle,
			Scannable_undirected_advertising_ADV_SCAN_IND,
			Non_connectable_undirected_advertising_ADV_NONCONN_IND,
			Connectable_low_duty_cycle_directed_advertising_ADV_DIRECT_IND_low_duty_cycle,
			Reserved_for_future_use,
			InvalidAdvertisingTypeValue
		}

		public static class AdvertisingTypeInfo
		{
			public static AdvertisingTypeEnum ValueToAdvertisingType(uint value)
			{
				switch (value)
				{
				case 0u:
					return AdvertisingTypeEnum.Connectable_undirected_advertising_ADV_IND;
				case 1u:
					return AdvertisingTypeEnum.Connectable_high_duty_cycle_directed_advertising_ADV_DIRECT_IND_high_duty_cycle;
				case 2u:
					return AdvertisingTypeEnum.Scannable_undirected_advertising_ADV_SCAN_IND;
				case 3u:
					return AdvertisingTypeEnum.Non_connectable_undirected_advertising_ADV_NONCONN_IND;
				case 4u:
					return AdvertisingTypeEnum.Connectable_low_duty_cycle_directed_advertising_ADV_DIRECT_IND_low_duty_cycle;
				default:
					if (value >= 5 && value <= 255)
					{
						return AdvertisingTypeEnum.Reserved_for_future_use;
					}
					return AdvertisingTypeEnum.InvalidAdvertisingTypeValue;
				}
			}

			public static uint AdvertisingTypeToValue(AdvertisingTypeEnum enumItem)
			{
				return enumItem switch
				{
					AdvertisingTypeEnum.Connectable_undirected_advertising_ADV_IND => 0u, 
					AdvertisingTypeEnum.Connectable_high_duty_cycle_directed_advertising_ADV_DIRECT_IND_high_duty_cycle => 1u, 
					AdvertisingTypeEnum.Scannable_undirected_advertising_ADV_SCAN_IND => 2u, 
					AdvertisingTypeEnum.Non_connectable_undirected_advertising_ADV_NONCONN_IND => 3u, 
					AdvertisingTypeEnum.Connectable_low_duty_cycle_directed_advertising_ADV_DIRECT_IND_low_duty_cycle => 4u, 
					AdvertisingTypeEnum.Reserved_for_future_use => 5u, 
					_ => uint.MaxValue, 
				};
			}

			public static string AdvertisingTypeToString(AdvertisingTypeEnum enumItem)
			{
				return enumItem switch
				{
					AdvertisingTypeEnum.Connectable_undirected_advertising_ADV_IND => "Connectable undirected advertising (ADV_IND) (default)", 
					AdvertisingTypeEnum.Connectable_high_duty_cycle_directed_advertising_ADV_DIRECT_IND_high_duty_cycle => "Connectable high duty cycle directed advertising (ADV_DIRECT_IND, high duty cycle)", 
					AdvertisingTypeEnum.Scannable_undirected_advertising_ADV_SCAN_IND => "Scannable undirected advertising (ADV_SCAN_IND)", 
					AdvertisingTypeEnum.Non_connectable_undirected_advertising_ADV_NONCONN_IND => "Non connectable undirected advertising (ADV_NONCONN_IND)", 
					AdvertisingTypeEnum.Connectable_low_duty_cycle_directed_advertising_ADV_DIRECT_IND_low_duty_cycle => "Connectable low duty cycle directed advertising (ADV_DIRECT_IND, low duty cycle)", 
					AdvertisingTypeEnum.Reserved_for_future_use => "Reserved for future use", 
					_ => "Invalid AdvertisingType Value", 
				};
			}

			public static string AdvertisingTypeToDescription()
			{
				StringBuilder stringBuilder = new StringBuilder();
				stringBuilder.AppendLine("0x0 = Connectable undirected advertising (ADV_IND) (default)");
				stringBuilder.AppendLine("0x1 = Connectable high duty cycle directed advertising (ADV_DIRECT_IND, high duty cycle)");
				stringBuilder.AppendLine("0x2 = Scannable undirected advertising (ADV_SCAN_IND)");
				stringBuilder.AppendLine("0x3 = Non connectable undirected advertising (ADV_NONCONN_IND)");
				stringBuilder.AppendLine("0x4 = Connectable low duty cycle directed advertising (ADV_DIRECT_IND, low duty cycle)");
				stringBuilder.AppendLine("0x5-0xFF = Reserved for future use");
				return stringBuilder.ToString();
			}
		}

		public enum TxPowerEnum
		{
			Tx_power_0_dBm,
			Tx_power_1_dBm,
			Tx_power_2_dBm,
			Tx_power_3_dBm,
			Tx_power_4_dBm,
			Tx_power_5_dBm,
			Tx_power_6_dBm,
			Tx_power_7_dBm,
			Tx_power_8_dBm,
			Tx_power_9_dBm,
			Tx_power_10_dBm,
			Tx_power_11_dBm,
			Tx_power_12_dBm,
			Tx_power_13_dBm,
			Tx_power_14_dBm,
			Tx_power_15_dBm,
			Tx_power_16_dBm,
			Tx_power_17_dBm,
			Tx_power_18_dBm,
			Tx_power_19_dBm,
			Tx_power_20_dBm,
			Tx_power_MINUS_70_dBm,
			Tx_power_MINUS_69_dBm,
			Tx_power_MINUS_68_dBm,
			Tx_power_MINUS_67_dBm,
			Tx_power_MINUS_66_dBm,
			Tx_power_MINUS_65_dBm,
			Tx_power_MINUS_64_dBm,
			Tx_power_MINUS_63_dBm,
			Tx_power_MINUS_62_dBm,
			Tx_power_MINUS_61_dBm,
			Tx_power_MINUS_60_dBm,
			Tx_power_MINUS_59_dBm,
			Tx_power_MINUS_58_dBm,
			Tx_power_MINUS_57_dBm,
			Tx_power_MINUS_56_dBm,
			Tx_power_MINUS_55_dBm,
			Tx_power_MINUS_54_dBm,
			Tx_power_MINUS_53_dBm,
			Tx_power_MINUS_52_dBm,
			Tx_power_MINUS_51_dBm,
			Tx_power_MINUS_50_dBm,
			Tx_power_MINUS_49_dBm,
			Tx_power_MINUS_48_dBm,
			Tx_power_MINUS_47_dBm,
			Tx_power_MINUS_46_dBm,
			Tx_power_MINUS_45_dBm,
			Tx_power_MINUS_44_dBm,
			Tx_power_MINUS_43_dBm,
			Tx_power_MINUS_42_dBm,
			Tx_power_MINUS_41_dBm,
			Tx_power_MINUS_40_dBm,
			Tx_power_MINUS_39_dBm,
			Tx_power_MINUS_38_dBm,
			Tx_power_MINUS_37_dBm,
			Tx_power_MINUS_36_dBm,
			Tx_power_MINUS_35_dBm,
			Tx_power_MINUS_34_dBm,
			Tx_power_MINUS_33_dBm,
			Tx_power_MINUS_32_dBm,
			Tx_power_MINUS_31_dBm,
			Tx_power_MINUS_30_dBm,
			Tx_power_MINUS_29_dBm,
			Tx_power_MINUS_28_dBm,
			Tx_power_MINUS_27_dBm,
			Tx_power_MINUS_26_dBm,
			Tx_power_MINUS_25_dBm,
			Tx_power_MINUS_24_dBm,
			Tx_power_MINUS_23_dBm,
			Tx_power_MINUS_22_dBm,
			Tx_power_MINUS_21_dBm,
			Tx_power_MINUS_20_dBm,
			Tx_power_MINUS_19_dBm,
			Tx_power_MINUS_18_dBm,
			Tx_power_MINUS_17_dBm,
			Tx_power_MINUS_16_dBm,
			Tx_power_MINUS_15_dBm,
			Tx_power_MINUS_14_dBm,
			Tx_power_MINUS_13_dBm,
			Tx_power_MINUS_12_dBm,
			Tx_power_MINUS_11_dBm,
			Tx_power_MINUS_10_dBm,
			Tx_power_MINUS_9_dBm,
			Tx_power_MINUS_8_dBm,
			Tx_power_MINUS_7_dBm,
			Tx_power_MINUS_6_dBm,
			Tx_power_MINUS_5_dBm,
			Tx_power_MINUS_4_dBm,
			Tx_power_MINUS_3_dBm,
			Tx_power_MINUS_2_dBm,
			Tx_power_MINUS_1_dBm,
			InvalidTxPowerValue
		}

		public static class TxPowerInfo
		{
			public static TxPowerEnum ValueToTxPower(uint value)
			{
				return value switch
				{
					0u => TxPowerEnum.Tx_power_0_dBm, 
					1u => TxPowerEnum.Tx_power_1_dBm, 
					2u => TxPowerEnum.Tx_power_2_dBm, 
					3u => TxPowerEnum.Tx_power_3_dBm, 
					4u => TxPowerEnum.Tx_power_4_dBm, 
					5u => TxPowerEnum.Tx_power_5_dBm, 
					6u => TxPowerEnum.Tx_power_6_dBm, 
					7u => TxPowerEnum.Tx_power_7_dBm, 
					8u => TxPowerEnum.Tx_power_8_dBm, 
					9u => TxPowerEnum.Tx_power_9_dBm, 
					10u => TxPowerEnum.Tx_power_10_dBm, 
					11u => TxPowerEnum.Tx_power_11_dBm, 
					12u => TxPowerEnum.Tx_power_12_dBm, 
					13u => TxPowerEnum.Tx_power_13_dBm, 
					14u => TxPowerEnum.Tx_power_14_dBm, 
					15u => TxPowerEnum.Tx_power_15_dBm, 
					16u => TxPowerEnum.Tx_power_16_dBm, 
					17u => TxPowerEnum.Tx_power_17_dBm, 
					18u => TxPowerEnum.Tx_power_18_dBm, 
					19u => TxPowerEnum.Tx_power_19_dBm, 
					20u => TxPowerEnum.Tx_power_20_dBm, 
					186u => TxPowerEnum.Tx_power_MINUS_70_dBm, 
					187u => TxPowerEnum.Tx_power_MINUS_69_dBm, 
					188u => TxPowerEnum.Tx_power_MINUS_68_dBm, 
					189u => TxPowerEnum.Tx_power_MINUS_67_dBm, 
					190u => TxPowerEnum.Tx_power_MINUS_66_dBm, 
					191u => TxPowerEnum.Tx_power_MINUS_65_dBm, 
					192u => TxPowerEnum.Tx_power_MINUS_64_dBm, 
					193u => TxPowerEnum.Tx_power_MINUS_63_dBm, 
					194u => TxPowerEnum.Tx_power_MINUS_62_dBm, 
					195u => TxPowerEnum.Tx_power_MINUS_61_dBm, 
					196u => TxPowerEnum.Tx_power_MINUS_60_dBm, 
					197u => TxPowerEnum.Tx_power_MINUS_59_dBm, 
					198u => TxPowerEnum.Tx_power_MINUS_58_dBm, 
					199u => TxPowerEnum.Tx_power_MINUS_57_dBm, 
					200u => TxPowerEnum.Tx_power_MINUS_56_dBm, 
					201u => TxPowerEnum.Tx_power_MINUS_55_dBm, 
					202u => TxPowerEnum.Tx_power_MINUS_54_dBm, 
					203u => TxPowerEnum.Tx_power_MINUS_53_dBm, 
					204u => TxPowerEnum.Tx_power_MINUS_52_dBm, 
					205u => TxPowerEnum.Tx_power_MINUS_51_dBm, 
					206u => TxPowerEnum.Tx_power_MINUS_50_dBm, 
					207u => TxPowerEnum.Tx_power_MINUS_49_dBm, 
					208u => TxPowerEnum.Tx_power_MINUS_48_dBm, 
					209u => TxPowerEnum.Tx_power_MINUS_47_dBm, 
					210u => TxPowerEnum.Tx_power_MINUS_46_dBm, 
					211u => TxPowerEnum.Tx_power_MINUS_45_dBm, 
					212u => TxPowerEnum.Tx_power_MINUS_44_dBm, 
					213u => TxPowerEnum.Tx_power_MINUS_43_dBm, 
					214u => TxPowerEnum.Tx_power_MINUS_42_dBm, 
					215u => TxPowerEnum.Tx_power_MINUS_41_dBm, 
					216u => TxPowerEnum.Tx_power_MINUS_40_dBm, 
					217u => TxPowerEnum.Tx_power_MINUS_39_dBm, 
					218u => TxPowerEnum.Tx_power_MINUS_38_dBm, 
					219u => TxPowerEnum.Tx_power_MINUS_37_dBm, 
					220u => TxPowerEnum.Tx_power_MINUS_36_dBm, 
					221u => TxPowerEnum.Tx_power_MINUS_35_dBm, 
					222u => TxPowerEnum.Tx_power_MINUS_34_dBm, 
					223u => TxPowerEnum.Tx_power_MINUS_33_dBm, 
					224u => TxPowerEnum.Tx_power_MINUS_32_dBm, 
					225u => TxPowerEnum.Tx_power_MINUS_31_dBm, 
					226u => TxPowerEnum.Tx_power_MINUS_30_dBm, 
					227u => TxPowerEnum.Tx_power_MINUS_29_dBm, 
					228u => TxPowerEnum.Tx_power_MINUS_28_dBm, 
					229u => TxPowerEnum.Tx_power_MINUS_27_dBm, 
					230u => TxPowerEnum.Tx_power_MINUS_26_dBm, 
					231u => TxPowerEnum.Tx_power_MINUS_25_dBm, 
					232u => TxPowerEnum.Tx_power_MINUS_24_dBm, 
					233u => TxPowerEnum.Tx_power_MINUS_23_dBm, 
					234u => TxPowerEnum.Tx_power_MINUS_22_dBm, 
					235u => TxPowerEnum.Tx_power_MINUS_21_dBm, 
					236u => TxPowerEnum.Tx_power_MINUS_20_dBm, 
					237u => TxPowerEnum.Tx_power_MINUS_19_dBm, 
					238u => TxPowerEnum.Tx_power_MINUS_18_dBm, 
					239u => TxPowerEnum.Tx_power_MINUS_17_dBm, 
					240u => TxPowerEnum.Tx_power_MINUS_16_dBm, 
					241u => TxPowerEnum.Tx_power_MINUS_15_dBm, 
					242u => TxPowerEnum.Tx_power_MINUS_14_dBm, 
					243u => TxPowerEnum.Tx_power_MINUS_13_dBm, 
					244u => TxPowerEnum.Tx_power_MINUS_12_dBm, 
					245u => TxPowerEnum.Tx_power_MINUS_11_dBm, 
					246u => TxPowerEnum.Tx_power_MINUS_10_dBm, 
					247u => TxPowerEnum.Tx_power_MINUS_9_dBm, 
					248u => TxPowerEnum.Tx_power_MINUS_8_dBm, 
					249u => TxPowerEnum.Tx_power_MINUS_7_dBm, 
					250u => TxPowerEnum.Tx_power_MINUS_6_dBm, 
					251u => TxPowerEnum.Tx_power_MINUS_5_dBm, 
					252u => TxPowerEnum.Tx_power_MINUS_4_dBm, 
					253u => TxPowerEnum.Tx_power_MINUS_3_dBm, 
					254u => TxPowerEnum.Tx_power_MINUS_2_dBm, 
					255u => TxPowerEnum.Tx_power_MINUS_1_dBm, 
					_ => TxPowerEnum.InvalidTxPowerValue, 
				};
			}

			public static uint TxPowerToValue(TxPowerEnum enumItem)
			{
				return enumItem switch
				{
					TxPowerEnum.Tx_power_0_dBm => 0u, 
					TxPowerEnum.Tx_power_1_dBm => 1u, 
					TxPowerEnum.Tx_power_2_dBm => 2u, 
					TxPowerEnum.Tx_power_3_dBm => 3u, 
					TxPowerEnum.Tx_power_4_dBm => 4u, 
					TxPowerEnum.Tx_power_5_dBm => 5u, 
					TxPowerEnum.Tx_power_6_dBm => 6u, 
					TxPowerEnum.Tx_power_7_dBm => 7u, 
					TxPowerEnum.Tx_power_8_dBm => 8u, 
					TxPowerEnum.Tx_power_9_dBm => 9u, 
					TxPowerEnum.Tx_power_10_dBm => 10u, 
					TxPowerEnum.Tx_power_11_dBm => 11u, 
					TxPowerEnum.Tx_power_12_dBm => 12u, 
					TxPowerEnum.Tx_power_13_dBm => 13u, 
					TxPowerEnum.Tx_power_14_dBm => 14u, 
					TxPowerEnum.Tx_power_15_dBm => 15u, 
					TxPowerEnum.Tx_power_16_dBm => 16u, 
					TxPowerEnum.Tx_power_17_dBm => 17u, 
					TxPowerEnum.Tx_power_18_dBm => 18u, 
					TxPowerEnum.Tx_power_19_dBm => 19u, 
					TxPowerEnum.Tx_power_20_dBm => 20u, 
					TxPowerEnum.Tx_power_MINUS_70_dBm => 186u, 
					TxPowerEnum.Tx_power_MINUS_69_dBm => 187u, 
					TxPowerEnum.Tx_power_MINUS_68_dBm => 188u, 
					TxPowerEnum.Tx_power_MINUS_67_dBm => 189u, 
					TxPowerEnum.Tx_power_MINUS_66_dBm => 190u, 
					TxPowerEnum.Tx_power_MINUS_65_dBm => 191u, 
					TxPowerEnum.Tx_power_MINUS_64_dBm => 192u, 
					TxPowerEnum.Tx_power_MINUS_63_dBm => 193u, 
					TxPowerEnum.Tx_power_MINUS_62_dBm => 194u, 
					TxPowerEnum.Tx_power_MINUS_61_dBm => 195u, 
					TxPowerEnum.Tx_power_MINUS_60_dBm => 196u, 
					TxPowerEnum.Tx_power_MINUS_59_dBm => 197u, 
					TxPowerEnum.Tx_power_MINUS_58_dBm => 198u, 
					TxPowerEnum.Tx_power_MINUS_57_dBm => 199u, 
					TxPowerEnum.Tx_power_MINUS_56_dBm => 200u, 
					TxPowerEnum.Tx_power_MINUS_55_dBm => 201u, 
					TxPowerEnum.Tx_power_MINUS_54_dBm => 202u, 
					TxPowerEnum.Tx_power_MINUS_53_dBm => 203u, 
					TxPowerEnum.Tx_power_MINUS_52_dBm => 204u, 
					TxPowerEnum.Tx_power_MINUS_51_dBm => 205u, 
					TxPowerEnum.Tx_power_MINUS_50_dBm => 206u, 
					TxPowerEnum.Tx_power_MINUS_49_dBm => 207u, 
					TxPowerEnum.Tx_power_MINUS_48_dBm => 208u, 
					TxPowerEnum.Tx_power_MINUS_47_dBm => 209u, 
					TxPowerEnum.Tx_power_MINUS_46_dBm => 210u, 
					TxPowerEnum.Tx_power_MINUS_45_dBm => 211u, 
					TxPowerEnum.Tx_power_MINUS_44_dBm => 212u, 
					TxPowerEnum.Tx_power_MINUS_43_dBm => 213u, 
					TxPowerEnum.Tx_power_MINUS_42_dBm => 214u, 
					TxPowerEnum.Tx_power_MINUS_41_dBm => 215u, 
					TxPowerEnum.Tx_power_MINUS_40_dBm => 216u, 
					TxPowerEnum.Tx_power_MINUS_39_dBm => 217u, 
					TxPowerEnum.Tx_power_MINUS_38_dBm => 218u, 
					TxPowerEnum.Tx_power_MINUS_37_dBm => 219u, 
					TxPowerEnum.Tx_power_MINUS_36_dBm => 220u, 
					TxPowerEnum.Tx_power_MINUS_35_dBm => 221u, 
					TxPowerEnum.Tx_power_MINUS_34_dBm => 222u, 
					TxPowerEnum.Tx_power_MINUS_33_dBm => 223u, 
					TxPowerEnum.Tx_power_MINUS_32_dBm => 224u, 
					TxPowerEnum.Tx_power_MINUS_31_dBm => 225u, 
					TxPowerEnum.Tx_power_MINUS_30_dBm => 226u, 
					TxPowerEnum.Tx_power_MINUS_29_dBm => 227u, 
					TxPowerEnum.Tx_power_MINUS_28_dBm => 228u, 
					TxPowerEnum.Tx_power_MINUS_27_dBm => 229u, 
					TxPowerEnum.Tx_power_MINUS_26_dBm => 230u, 
					TxPowerEnum.Tx_power_MINUS_25_dBm => 231u, 
					TxPowerEnum.Tx_power_MINUS_24_dBm => 232u, 
					TxPowerEnum.Tx_power_MINUS_23_dBm => 233u, 
					TxPowerEnum.Tx_power_MINUS_22_dBm => 234u, 
					TxPowerEnum.Tx_power_MINUS_21_dBm => 235u, 
					TxPowerEnum.Tx_power_MINUS_20_dBm => 236u, 
					TxPowerEnum.Tx_power_MINUS_19_dBm => 237u, 
					TxPowerEnum.Tx_power_MINUS_18_dBm => 238u, 
					TxPowerEnum.Tx_power_MINUS_17_dBm => 239u, 
					TxPowerEnum.Tx_power_MINUS_16_dBm => 240u, 
					TxPowerEnum.Tx_power_MINUS_15_dBm => 241u, 
					TxPowerEnum.Tx_power_MINUS_14_dBm => 242u, 
					TxPowerEnum.Tx_power_MINUS_13_dBm => 243u, 
					TxPowerEnum.Tx_power_MINUS_12_dBm => 244u, 
					TxPowerEnum.Tx_power_MINUS_11_dBm => 245u, 
					TxPowerEnum.Tx_power_MINUS_10_dBm => 246u, 
					TxPowerEnum.Tx_power_MINUS_9_dBm => 247u, 
					TxPowerEnum.Tx_power_MINUS_8_dBm => 248u, 
					TxPowerEnum.Tx_power_MINUS_7_dBm => 249u, 
					TxPowerEnum.Tx_power_MINUS_6_dBm => 250u, 
					TxPowerEnum.Tx_power_MINUS_5_dBm => 251u, 
					TxPowerEnum.Tx_power_MINUS_4_dBm => 252u, 
					TxPowerEnum.Tx_power_MINUS_3_dBm => 253u, 
					TxPowerEnum.Tx_power_MINUS_2_dBm => 254u, 
					TxPowerEnum.Tx_power_MINUS_1_dBm => 255u, 
					_ => uint.MaxValue, 
				};
			}

			public static string TxPowerToString(TxPowerEnum enumItem)
			{
				return enumItem switch
				{
					TxPowerEnum.Tx_power_0_dBm => "0dBm", 
					TxPowerEnum.Tx_power_1_dBm => "1dBm", 
					TxPowerEnum.Tx_power_2_dBm => "2dBm", 
					TxPowerEnum.Tx_power_3_dBm => "3dBm", 
					TxPowerEnum.Tx_power_4_dBm => "4dBm", 
					TxPowerEnum.Tx_power_5_dBm => "5dBm", 
					TxPowerEnum.Tx_power_6_dBm => "6dBm", 
					TxPowerEnum.Tx_power_7_dBm => "7dBm", 
					TxPowerEnum.Tx_power_8_dBm => "8dBm", 
					TxPowerEnum.Tx_power_9_dBm => "9dBm", 
					TxPowerEnum.Tx_power_10_dBm => "10dBm", 
					TxPowerEnum.Tx_power_11_dBm => "11dBm", 
					TxPowerEnum.Tx_power_12_dBm => "12dBm", 
					TxPowerEnum.Tx_power_13_dBm => "13dBm", 
					TxPowerEnum.Tx_power_14_dBm => "14dBm", 
					TxPowerEnum.Tx_power_15_dBm => "15dBm", 
					TxPowerEnum.Tx_power_16_dBm => "16dBm", 
					TxPowerEnum.Tx_power_17_dBm => "17dBm", 
					TxPowerEnum.Tx_power_18_dBm => "18dBm", 
					TxPowerEnum.Tx_power_19_dBm => "19dBm", 
					TxPowerEnum.Tx_power_20_dBm => "20dBm", 
					TxPowerEnum.Tx_power_MINUS_70_dBm => "-70dBm", 
					TxPowerEnum.Tx_power_MINUS_69_dBm => "-69dBm", 
					TxPowerEnum.Tx_power_MINUS_68_dBm => "-68dBm", 
					TxPowerEnum.Tx_power_MINUS_67_dBm => "-67dBm", 
					TxPowerEnum.Tx_power_MINUS_66_dBm => "-66dBm", 
					TxPowerEnum.Tx_power_MINUS_65_dBm => "-65dBm", 
					TxPowerEnum.Tx_power_MINUS_64_dBm => "-64dBm", 
					TxPowerEnum.Tx_power_MINUS_63_dBm => "-63dBm", 
					TxPowerEnum.Tx_power_MINUS_62_dBm => "-62dBm", 
					TxPowerEnum.Tx_power_MINUS_61_dBm => "-61dBm", 
					TxPowerEnum.Tx_power_MINUS_60_dBm => "-60dBm", 
					TxPowerEnum.Tx_power_MINUS_59_dBm => "-59dBm", 
					TxPowerEnum.Tx_power_MINUS_58_dBm => "-58dBm", 
					TxPowerEnum.Tx_power_MINUS_57_dBm => "-57dBm", 
					TxPowerEnum.Tx_power_MINUS_56_dBm => "-56dBm", 
					TxPowerEnum.Tx_power_MINUS_55_dBm => "-55dBm", 
					TxPowerEnum.Tx_power_MINUS_54_dBm => "-54dBm", 
					TxPowerEnum.Tx_power_MINUS_53_dBm => "-53dBm", 
					TxPowerEnum.Tx_power_MINUS_52_dBm => "-52dBm", 
					TxPowerEnum.Tx_power_MINUS_51_dBm => "-51dBm", 
					TxPowerEnum.Tx_power_MINUS_50_dBm => "-50dBm", 
					TxPowerEnum.Tx_power_MINUS_49_dBm => "-49dBm", 
					TxPowerEnum.Tx_power_MINUS_48_dBm => "-48dBm", 
					TxPowerEnum.Tx_power_MINUS_47_dBm => "-47dBm", 
					TxPowerEnum.Tx_power_MINUS_46_dBm => "-46dBm", 
					TxPowerEnum.Tx_power_MINUS_45_dBm => "-45dBm", 
					TxPowerEnum.Tx_power_MINUS_44_dBm => "-44dBm", 
					TxPowerEnum.Tx_power_MINUS_43_dBm => "-43dBm", 
					TxPowerEnum.Tx_power_MINUS_42_dBm => "-42dBm", 
					TxPowerEnum.Tx_power_MINUS_41_dBm => "-41dBm", 
					TxPowerEnum.Tx_power_MINUS_40_dBm => "-40dBm", 
					TxPowerEnum.Tx_power_MINUS_39_dBm => "-39dBm", 
					TxPowerEnum.Tx_power_MINUS_38_dBm => "-38dBm", 
					TxPowerEnum.Tx_power_MINUS_37_dBm => "-37dBm", 
					TxPowerEnum.Tx_power_MINUS_36_dBm => "-36dBm", 
					TxPowerEnum.Tx_power_MINUS_35_dBm => "-35dBm", 
					TxPowerEnum.Tx_power_MINUS_34_dBm => "-34dBm", 
					TxPowerEnum.Tx_power_MINUS_33_dBm => "-33dBm", 
					TxPowerEnum.Tx_power_MINUS_32_dBm => "-32dBm", 
					TxPowerEnum.Tx_power_MINUS_31_dBm => "-31dBm", 
					TxPowerEnum.Tx_power_MINUS_30_dBm => "-30dBm", 
					TxPowerEnum.Tx_power_MINUS_29_dBm => "-29dBm", 
					TxPowerEnum.Tx_power_MINUS_28_dBm => "-28dBm", 
					TxPowerEnum.Tx_power_MINUS_27_dBm => "-27dBm", 
					TxPowerEnum.Tx_power_MINUS_26_dBm => "-26dBm", 
					TxPowerEnum.Tx_power_MINUS_25_dBm => "-25dBm", 
					TxPowerEnum.Tx_power_MINUS_24_dBm => "-24dBm", 
					TxPowerEnum.Tx_power_MINUS_23_dBm => "-23dBm", 
					TxPowerEnum.Tx_power_MINUS_22_dBm => "-22dBm", 
					TxPowerEnum.Tx_power_MINUS_21_dBm => "-21dBm", 
					TxPowerEnum.Tx_power_MINUS_20_dBm => "-20dBm", 
					TxPowerEnum.Tx_power_MINUS_19_dBm => "-19dBm", 
					TxPowerEnum.Tx_power_MINUS_18_dBm => "-18dBm", 
					TxPowerEnum.Tx_power_MINUS_17_dBm => "-17dBm", 
					TxPowerEnum.Tx_power_MINUS_16_dBm => "-16dBm", 
					TxPowerEnum.Tx_power_MINUS_15_dBm => "-15dBm", 
					TxPowerEnum.Tx_power_MINUS_14_dBm => "-14dBm", 
					TxPowerEnum.Tx_power_MINUS_13_dBm => "-13dBm", 
					TxPowerEnum.Tx_power_MINUS_12_dBm => "-12dBm", 
					TxPowerEnum.Tx_power_MINUS_11_dBm => "-11dBm", 
					TxPowerEnum.Tx_power_MINUS_10_dBm => "-10dBm", 
					TxPowerEnum.Tx_power_MINUS_9_dBm => "-9dBm", 
					TxPowerEnum.Tx_power_MINUS_8_dBm => "-8dBm", 
					TxPowerEnum.Tx_power_MINUS_7_dBm => "-7dBm", 
					TxPowerEnum.Tx_power_MINUS_6_dBm => "-6dBm", 
					TxPowerEnum.Tx_power_MINUS_5_dBm => "-5dBm", 
					TxPowerEnum.Tx_power_MINUS_4_dBm => "-4dBm", 
					TxPowerEnum.Tx_power_MINUS_3_dBm => "-3dBm", 
					TxPowerEnum.Tx_power_MINUS_2_dBm => "-2dBm", 
					TxPowerEnum.Tx_power_MINUS_1_dBm => "-1dBm", 
					_ => "Invalid TxPower Value", 
				};
			}

			public static string TxPowerToDescription()
			{
				StringBuilder stringBuilder = new StringBuilder();
				stringBuilder.AppendLine("0x0 = 0dBm");
				stringBuilder.AppendLine("0x1 = 1dBm");
				stringBuilder.AppendLine("0x2 = 2dBm");
				stringBuilder.AppendLine("0x3 = 3dBm");
				stringBuilder.AppendLine("0x4 = 4dBm");
				stringBuilder.AppendLine("0x5 = 5dBm");
				stringBuilder.AppendLine("0x6 = 6dBm");
				stringBuilder.AppendLine("0x7 = 7dBm");
				stringBuilder.AppendLine("0x8 = 8dBm");
				stringBuilder.AppendLine("0x9 = 9dBm");
				stringBuilder.AppendLine("0xA = 10dBm");
				stringBuilder.AppendLine("0xB = 11dBm");
				stringBuilder.AppendLine("0xC = 12dBm");
				stringBuilder.AppendLine("0xD = 13dBm");
				stringBuilder.AppendLine("0xE = 14dBm");
				stringBuilder.AppendLine("0xF = 15dBm");
				stringBuilder.AppendLine("0x10 = 16dBm");
				stringBuilder.AppendLine("0x11 = 17dBm");
				stringBuilder.AppendLine("0x12 = 18dBm");
				stringBuilder.AppendLine("0x13 = 19dBm");
				stringBuilder.AppendLine("0x14 = 20dBm");
				stringBuilder.AppendLine("0xBA = -70dBm");
				stringBuilder.AppendLine("0xBB = -69dBm");
				stringBuilder.AppendLine("0xBC = -68dBm");
				stringBuilder.AppendLine("0xBD = -67dBm");
				stringBuilder.AppendLine("0xBE = -66dBm");
				stringBuilder.AppendLine("0xBF = -65dBm");
				stringBuilder.AppendLine("0xC0 = -64dBm");
				stringBuilder.AppendLine("0xC1 = -63dBm");
				stringBuilder.AppendLine("0xC2 = -62dBm");
				stringBuilder.AppendLine("0xC3 = -61dBm");
				stringBuilder.AppendLine("0xC4 = -60dBm");
				stringBuilder.AppendLine("0xC5 = -59dBm");
				stringBuilder.AppendLine("0xC6 = -58dBm");
				stringBuilder.AppendLine("0xC7 = -57dBm");
				stringBuilder.AppendLine("0xC8 = -56dBm");
				stringBuilder.AppendLine("0xC9 = -55dBm");
				stringBuilder.AppendLine("0xCA = -54dBm");
				stringBuilder.AppendLine("0xCB = -53dBm");
				stringBuilder.AppendLine("0xCC = -52dBm");
				stringBuilder.AppendLine("0xCD = -51dBm");
				stringBuilder.AppendLine("0xCE = -50dBm");
				stringBuilder.AppendLine("0xCF = -49dBm");
				stringBuilder.AppendLine("0xD0 = -48dBm");
				stringBuilder.AppendLine("0xD1 = -47dBm");
				stringBuilder.AppendLine("0xD2 = -46dBm");
				stringBuilder.AppendLine("0xD3 = -45dBm");
				stringBuilder.AppendLine("0xD4 = -44dBm");
				stringBuilder.AppendLine("0xD5 = -43dBm");
				stringBuilder.AppendLine("0xD6 = -42dBm");
				stringBuilder.AppendLine("0xD7 = -41dBm");
				stringBuilder.AppendLine("0xD8 = -40dBm");
				stringBuilder.AppendLine("0xD9 = -39dBm");
				stringBuilder.AppendLine("0xDA = -38dBm");
				stringBuilder.AppendLine("0xDB = -37dBm");
				stringBuilder.AppendLine("0xDC = -36dBm");
				stringBuilder.AppendLine("0xDD = -35dBm");
				stringBuilder.AppendLine("0xDE = -34dBm");
				stringBuilder.AppendLine("0xDF = -33dBm");
				stringBuilder.AppendLine("0xE0 = -32dBm");
				stringBuilder.AppendLine("0xE1 = -31dBm");
				stringBuilder.AppendLine("0xE2 = -30dBm");
				stringBuilder.AppendLine("0xE3 = -29dBm");
				stringBuilder.AppendLine("0xE4 = -28dBm");
				stringBuilder.AppendLine("0xE5 = -27dBm");
				stringBuilder.AppendLine("0xE6 = -26dBm");
				stringBuilder.AppendLine("0xE7 = -25dBm");
				stringBuilder.AppendLine("0xE8 = -24dBm");
				stringBuilder.AppendLine("0xE9 = -23dBm");
				stringBuilder.AppendLine("0xEA = -22dBm");
				stringBuilder.AppendLine("0xEB = -21dBm");
				stringBuilder.AppendLine("0xEC = -20dBm");
				stringBuilder.AppendLine("0xED = -19dBm");
				stringBuilder.AppendLine("0xEE = -18dBm");
				stringBuilder.AppendLine("0xEF = -17dBm");
				stringBuilder.AppendLine("0xF0 = -16dBm");
				stringBuilder.AppendLine("0xF1 = -15dBm");
				stringBuilder.AppendLine("0xF2 = -14dBm");
				stringBuilder.AppendLine("0xF3 = -13dBm");
				stringBuilder.AppendLine("0xF4 = -12dBm");
				stringBuilder.AppendLine("0xF5 = -11dBm");
				stringBuilder.AppendLine("0xF6 = -10dBm");
				stringBuilder.AppendLine("0xF7 = -9dBm");
				stringBuilder.AppendLine("0xF8 = -8dBm");
				stringBuilder.AppendLine("0xF9 = -7dBm");
				stringBuilder.AppendLine("0xFA = -6dBm");
				stringBuilder.AppendLine("0xFB = -5dBm");
				stringBuilder.AppendLine("0xFC = -4dBm");
				stringBuilder.AppendLine("0xFD = -3dBm");
				stringBuilder.AppendLine("0xFE = -2dBm");
				stringBuilder.AppendLine("0xFF = -1dBm");
				return stringBuilder.ToString();
			}
		}

		private const uint _MultiAdvtOpcode = 1u;

		private uint _AdvertisingIntervalMin = 32u;

		private uint _AdvertisingIntervalMax = 32u;

		private uint _AdvertisingType;

		private uint _OwnAddressType;

		private ulong _OwnAddress;

		private uint _PeerAddressType;

		private ulong _PeerAddress;

		private uint _AdvertisingChannelMap;

		private uint _AdvertisingFilterPolicy;

		private uint _AdvertisingInstance = 1u;

		private uint _TxPower;

		public uint MultiAdvtOpcode => 1u;

		public uint AdvertisingIntervalMin
		{
			get
			{
				return _AdvertisingIntervalMin;
			}
			set
			{
				if (value > 65535)
				{
					throw new Exception("Maximum possible value for AdvertisingIntervalMin is 0xFFFF");
				}
				_AdvertisingIntervalMin = value;
			}
		}

		public uint AdvertisingIntervalMax
		{
			get
			{
				return _AdvertisingIntervalMax;
			}
			set
			{
				if (value > 65535)
				{
					throw new Exception("Maximum possible value for AdvertisingIntervalMax is 0xFFFF");
				}
				_AdvertisingIntervalMax = value;
			}
		}

		public uint AdvertisingType
		{
			get
			{
				return _AdvertisingType;
			}
			set
			{
				if (value > 255)
				{
					throw new Exception("Maximum possible value for AdvertisingType is 0xFF");
				}
				_AdvertisingType = value;
			}
		}

		public uint OwnAddressType
		{
			get
			{
				return _OwnAddressType;
			}
			set
			{
				if (value > 255)
				{
					throw new Exception("Maximum possible value for OwnAddressType is 0xFF");
				}
				_OwnAddressType = value;
			}
		}

		public ulong OwnAddress
		{
			get
			{
				return _OwnAddress;
			}
			set
			{
				_OwnAddress = value;
			}
		}

		public uint PeerAddressType
		{
			get
			{
				return _PeerAddressType;
			}
			set
			{
				if (value > 255)
				{
					throw new Exception("Maximum possible value for PeerAddressType is 0xFF");
				}
				_PeerAddressType = value;
			}
		}

		public ulong PeerAddress
		{
			get
			{
				return _PeerAddress;
			}
			set
			{
				_PeerAddress = value;
			}
		}

		public uint AdvertisingChannelMap
		{
			get
			{
				return _AdvertisingChannelMap;
			}
			set
			{
				if (value > 255)
				{
					throw new Exception("Maximum possible value for AdvertisingChannelMap is 0xFF");
				}
				_AdvertisingChannelMap = value;
			}
		}

		public uint AdvertisingFilterPolicy
		{
			get
			{
				return _AdvertisingFilterPolicy;
			}
			set
			{
				if (value > 255)
				{
					throw new Exception("Maximum possible value for AdvertisingFilterPolicy is 0xFF");
				}
				_AdvertisingFilterPolicy = value;
			}
		}

		public uint AdvertisingInstance
		{
			get
			{
				return _AdvertisingInstance;
			}
			set
			{
				if (value > 255)
				{
					throw new Exception("Maximum possible value for AdvertisingInstance is 0xFF");
				}
				_AdvertisingInstance = value;
			}
		}

		public uint TxPower
		{
			get
			{
				return _TxPower;
			}
			set
			{
				if (value > 255)
				{
					throw new Exception("Maximum possible value for TxPower is 0xFF");
				}
				_TxPower = value;
			}
		}

		public AdvertisingTypeEnum GetAdvertisingTypeAsAdvertisingTypeEnum()
		{
			return AdvertisingTypeInfo.ValueToAdvertisingType(_AdvertisingType);
		}

		public void SetAdvertisingTypeAsAdvertisingTypeEnum(AdvertisingTypeEnum enumItem)
		{
			AdvertisingType = AdvertisingTypeInfo.AdvertisingTypeToValue(enumItem);
		}

		public OwnAddressTypeEnum GetOwnAddressTypeAsOwnAddressTypeEnum()
		{
			return OwnAddressTypeInfo.ValueToOwnAddressType(_OwnAddressType);
		}

		public void SetOwnAddressTypeAsOwnAddressTypeEnum(OwnAddressTypeEnum enumItem)
		{
			OwnAddressType = OwnAddressTypeInfo.OwnAddressTypeToValue(enumItem);
		}

		public PeerAddressTypeEnum GetPeerAddressTypeAsPeerAddressTypeEnum()
		{
			return PeerAddressTypeInfo.ValueToPeerAddressType(_PeerAddressType);
		}

		public void SetPeerAddressTypeAsPeerAddressTypeEnum(PeerAddressTypeEnum enumItem)
		{
			PeerAddressType = PeerAddressTypeInfo.PeerAddressTypeToValue(enumItem);
		}

		public AdvertisingChannelMapEnumCollection GetAdvertisingChannelMapAsAdvertisingChannelMapEnumCollection()
		{
			return AdvertisingChannelMapInfo.ValueToAdvertisingChannelMap(_AdvertisingChannelMap);
		}

		public void SetAdvertisingChannelMapAsAdvertisingChannelMapEnumCollection(AdvertisingChannelMapEnumCollection enumCollection)
		{
			AdvertisingChannelMap = AdvertisingChannelMapInfo.AdvertisingChannelMapToValue(enumCollection);
		}

		public AdvertisingFilterPolicyEnum GetAdvertisingFilterPolicyAsAdvertisingFilterPolicyEnum()
		{
			return AdvertisingFilterPolicyInfo.ValueToAdvertisingFilterPolicy(_AdvertisingFilterPolicy);
		}

		public void SetAdvertisingFilterPolicyAsAdvertisingFilterPolicyEnum(AdvertisingFilterPolicyEnum enumItem)
		{
			AdvertisingFilterPolicy = AdvertisingFilterPolicyInfo.AdvertisingFilterPolicyToValue(enumItem);
		}

		public TxPowerEnum GetTxPowerAsTxPowerEnum()
		{
			return TxPowerInfo.ValueToTxPower(_TxPower);
		}

		public void SetTxPowerAsTxPowerEnum(TxPowerEnum enumItem)
		{
			TxPower = TxPowerInfo.TxPowerToValue(enumItem);
		}
	}

	private const uint _Opcode = 64852u;

	private Type[] expectedResponseTypes = new Type[2]
	{
		typeof(CommandCompleteForLeMultiAdvtSetAdvtParamMulti),
		typeof(CommandCompleteForNop)
	};

	private PacketInfoBase info;

	private uint _PayloadLength;

	public UserFieldsWrapper _UserFields = new UserFieldsWrapper();

	public override PacketType Type => PacketType.Command;

	public override Type[] ExpectedResponseTypes => expectedResponseTypes;

	public override PacketInfoBase Info
	{
		get
		{
			if (info == null)
			{
				info = new LeMultiAdvtSetAdvtParamMultiInfo(this);
			}
			return info;
		}
	}

	public uint Opcode => 64852u;

	public uint PayloadLength
	{
		get
		{
			ToBitString();
			return _PayloadLength;
		}
	}

	public UserFieldsWrapper UserFields => _UserFields;

	public override void SetDefaultValues()
	{
		UserFields.AdvertisingIntervalMin = 2048u;
		UserFields.AdvertisingIntervalMax = 2048u;
		UserFields.AdvertisingChannelMap = 7u;
		UserFields.AdvertisingInstance = 1u;
	}

	protected override bool FromBitBuilder(ref BitBuilder bitBuilder)
	{
		if (bitBuilder.RemoveBitsAsUintLittleEndian(16) != Opcode)
		{
			return false;
		}
		_PayloadLength = bitBuilder.RemoveBitsAsUint(8);
		int numberOfBits = bitBuilder.GetNumberOfBits();
		if (numberOfBits > _PayloadLength * 8 + 7)
		{
			return false;
		}
		if (numberOfBits < _PayloadLength * 8)
		{
			return false;
		}
		if (bitBuilder.RemoveBitsAsUint(8) != UserFields.MultiAdvtOpcode)
		{
			return false;
		}
		UserFields.AdvertisingIntervalMin = bitBuilder.RemoveBitsAsUintLittleEndian(16);
		UserFields.AdvertisingIntervalMax = bitBuilder.RemoveBitsAsUintLittleEndian(16);
		UserFields.AdvertisingType = bitBuilder.RemoveBitsAsUint(8);
		UserFields.OwnAddressType = bitBuilder.RemoveBitsAsUint(8);
		UserFields.OwnAddress = bitBuilder.RemoveBitsAsUlongLittleEndian(48);
		UserFields.PeerAddressType = bitBuilder.RemoveBitsAsUint(8);
		UserFields.PeerAddress = bitBuilder.RemoveBitsAsUlongLittleEndian(48);
		UserFields.AdvertisingChannelMap = bitBuilder.RemoveBitsAsUint(8);
		UserFields.AdvertisingFilterPolicy = bitBuilder.RemoveBitsAsUint(8);
		UserFields.AdvertisingInstance = bitBuilder.RemoveBitsAsUint(8);
		UserFields.TxPower = bitBuilder.RemoveBitsAsUint(8);
		if (bitBuilder.GetNumberOfBits() > 7)
		{
			return false;
		}
		return true;
	}

	public override string ToBitString()
	{
		BitBuilder bitBuilder = new BitBuilder();
		bitBuilder.AddBitsAsUintLittleEndian(Opcode, 16);
		int numberOfBits = bitBuilder.GetNumberOfBits();
		bitBuilder.AddBitsAsUint(0u, 8);
		bitBuilder.AddBitsAsUint(UserFields.MultiAdvtOpcode, 8);
		bitBuilder.AddBitsAsUintLittleEndian(UserFields.AdvertisingIntervalMin, 16);
		bitBuilder.AddBitsAsUintLittleEndian(UserFields.AdvertisingIntervalMax, 16);
		bitBuilder.AddBitsAsUint(UserFields.AdvertisingType, 8);
		bitBuilder.AddBitsAsUint(UserFields.OwnAddressType, 8);
		bitBuilder.AddBitsAsUlongLittleEndian(UserFields.OwnAddress, 48);
		bitBuilder.AddBitsAsUint(UserFields.PeerAddressType, 8);
		bitBuilder.AddBitsAsUlongLittleEndian(UserFields.PeerAddress, 48);
		bitBuilder.AddBitsAsUint(UserFields.AdvertisingChannelMap, 8);
		bitBuilder.AddBitsAsUint(UserFields.AdvertisingFilterPolicy, 8);
		bitBuilder.AddBitsAsUint(UserFields.AdvertisingInstance, 8);
		bitBuilder.AddBitsAsUint(UserFields.TxPower, 8);
		_PayloadLength = (uint)((bitBuilder.GetNumberOfBits() - numberOfBits - 8) / 8);
		if ((bitBuilder.GetNumberOfBits() - numberOfBits - 8) % 8 != 0)
		{
			_PayloadLength++;
		}
		bitBuilder.ChangeBitsAsUint(numberOfBits, _PayloadLength, 8);
		return bitBuilder.ToString();
	}

	public override List<string> GetWarnings()
	{
		List<string> list = new List<string>();
		if (UserFields.AdvertisingIntervalMin < 32)
		{
			list.Add("Minimum allowed value for Advertising_Interval_Min is 0x20");
		}
		if (UserFields.AdvertisingIntervalMin > 16384)
		{
			list.Add("Maximum allowed value for Advertising_Interval_Min is 0x4000");
		}
		if (UserFields.AdvertisingIntervalMax < 32)
		{
			list.Add("Minimum allowed value for Advertising_Interval_Max is 0x20");
		}
		if (UserFields.AdvertisingIntervalMax > 16384)
		{
			list.Add("Maximum allowed value for Advertising_Interval_Max is 0x4000");
		}
		if (UserFields.AdvertisingInstance < 1)
		{
			list.Add("Minimum allowed value for Advertising_Instance is 0x1");
		}
		return list;
	}
}
