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.
79 lines
2.8 KiB
79 lines
2.8 KiB
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace CoreAgent.Domain.Models.Network
|
|
{
|
|
public class CellConfigurationProvider
|
|
{
|
|
private readonly List<LTECellConfiguration> _lteCellConfigurations;
|
|
private readonly List<NrCellConfiguration> _nrCellConfigurations;
|
|
|
|
public IReadOnlyList<LTECellConfiguration> LTECellConfigurations => _lteCellConfigurations.AsReadOnly();
|
|
public IReadOnlyList<NrCellConfiguration> NrCellConfigurations => _nrCellConfigurations.AsReadOnly();
|
|
|
|
public CellConfigurationProvider()
|
|
{
|
|
_lteCellConfigurations = new List<LTECellConfiguration>();
|
|
_nrCellConfigurations = new List<NrCellConfiguration>();
|
|
}
|
|
|
|
public void AddLTEConfiguration(LTECellConfiguration configuration)
|
|
{
|
|
var existingConfig = _lteCellConfigurations.FirstOrDefault(s => s.CellID == configuration.CellID);
|
|
if (existingConfig != null)
|
|
_lteCellConfigurations.Remove(existingConfig);
|
|
_lteCellConfigurations.Add(configuration);
|
|
}
|
|
|
|
public void AddNrConfiguration(NrCellConfiguration configuration)
|
|
{
|
|
var existingConfig = _nrCellConfigurations.FirstOrDefault(s => s.CellID == configuration.CellID);
|
|
if (existingConfig != null)
|
|
_nrCellConfigurations.Remove(existingConfig);
|
|
_nrCellConfigurations.Add(configuration);
|
|
}
|
|
|
|
private void RemoveLTEConfiguration(int cellId)
|
|
{
|
|
var config = _lteCellConfigurations.FirstOrDefault(s => s.CellID == cellId);
|
|
if (config != null)
|
|
_lteCellConfigurations.Remove(config);
|
|
}
|
|
|
|
private void RemoveNrConfiguration(int cellId)
|
|
{
|
|
var config = _nrCellConfigurations.FirstOrDefault(s => s.CellID == cellId);
|
|
if (config != null)
|
|
_nrCellConfigurations.Remove(config);
|
|
}
|
|
|
|
public LTECellConfiguration? GetLTEConfiguration(int cellId)
|
|
{
|
|
return _lteCellConfigurations.FirstOrDefault(s => s.CellID == cellId);
|
|
}
|
|
|
|
public NrCellConfiguration? GetNrConfiguration(int cellId)
|
|
{
|
|
return _nrCellConfigurations.FirstOrDefault(s => s.CellID == cellId);
|
|
}
|
|
|
|
public Dictionary<int, int> GetCellPortMapping()
|
|
{
|
|
var result = new Dictionary<int, int>();
|
|
|
|
// 添加LTE配置
|
|
foreach (var config in _lteCellConfigurations)
|
|
{
|
|
result[config.CellID] = config.RfPort;
|
|
}
|
|
|
|
// 添加NR配置
|
|
foreach (var config in _nrCellConfigurations)
|
|
{
|
|
result[config.CellID] = config.RfPort;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
}
|
|
|