You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
3.1 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CoreAgent.ProtocolClient.Models
{
/// <summary>
/// LTE协议能力信息模型
/// 用于存储用户设备(UE)的LTE协议栈能力信息,包括频段支持、UE类别等
/// </summary>
public class ProtocolCaps
{
/// <summary>
/// 用户设备唯一标识符
/// </summary>
public int UeId { get; set; }
/// <summary>
/// 支持的LTE频段列表
/// </summary>
public List<int> Bands { get; set; } = new List<int>();
/// <summary>
/// UE类别(可选)
/// </summary>
public int? Category { get; set; }
/// <summary>
/// 下行UE类别(可选)
/// </summary>
public int? CategoryDl { get; set; }
/// <summary>
/// 上行UE类别(可选)
/// </summary>
public int? CategoryUl { get; set; }
/// <summary>
/// 协议能力数据列表
/// </summary>
public List<object> Data { get; set; } = new List<object>();
/// <summary>
/// 数据项计数
/// </summary>
public int Count { get; set; } = 0;
/// <summary>
/// 频段组合列表
/// </summary>
public List<object> BandComb { get; set; } = new List<object>();
/// <summary>
/// ASN.1编码数据列表
/// </summary>
public List<object> Asn1 { get; set; } = new List<object>();
}
/// <summary>
/// ProtocolCaps扩展方法类
/// 提供ProtocolCaps相关的工具方法和扩展功能
/// </summary>
public static class ProtocolCapsExtensions
{
/// <summary>
/// UE能力MIMO层数映射字典
/// 定义不同MIMO配置对应的层数
/// </summary>
private static readonly Dictionary<string, int> UE_CAPS_MIMO = new Dictionary<string, int>
{
{ "twoLayers", 2 },
{ "fourLayers", 4 },
{ "eightLayers", 8 }
};
/// <summary>
/// 获取UE类别信息的字符串表示
/// 优先返回DL/UL类别组合,如果没有则返回通用类别
/// </summary>
/// <param name="caps">协议能力信息对象</param>
/// <returns>格式化的类别信息字符串</returns>
public static string GetCategory(this ProtocolCaps caps)
{
List<string> categories = new List<string>();
if (caps.CategoryDl.HasValue)
{
categories.Add($"DL={caps.CategoryDl.Value}");
}
if (caps.CategoryUl.HasValue)
{
categories.Add($"UL={caps.CategoryUl.Value}");
}
if (categories.Count > 0)
{
return string.Join(",", categories);
}
if (caps.Category.HasValue)
{
return caps.Category.Value.ToString();
}
return string.Empty;
}
}
}