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.
83 lines
2.7 KiB
83 lines
2.7 KiB
using CoreAgent.Domain.Helpers;
|
|
using CoreAgent.Domain.Interfaces.ProtocolLogHandlers;
|
|
using CoreAgent.Domain.Models.Protocol;
|
|
using Microsoft.Extensions.Logging;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text.RegularExpressions;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace CoreAgent.Infrastructure.Services.ProtocolLogHandlers
|
|
{
|
|
|
|
|
|
|
|
public class ProtocolLogsParesRanHandle : ProtocolParesHandleLogs
|
|
{
|
|
private readonly ILogger logger;
|
|
private readonly IProtocolLogsProviderObserver observer;
|
|
public ProtocolLogsParesRanHandle(IProtocolLogsProviderObserver observer, ILogger logger)
|
|
{
|
|
this.observer = observer;
|
|
this.logger = logger;
|
|
}
|
|
|
|
public override async Task GetTryParesLogDataHandle(ProtocolLog model)
|
|
{
|
|
try
|
|
{
|
|
if (model is { Logs: null })
|
|
{
|
|
logger.LogError($"logs is null =====>GetTryParesLogDataHandle Data {model?.ObjToJson()}");
|
|
return;
|
|
}
|
|
var ParseJsonData = model.Logs.ToString().JsonToObj<ProtocolLogDetail[]>();
|
|
var parseResultData = LogParsedResultHandle(ParseJsonData, (model.MessageId ?? 0));
|
|
//if (parseResultData.Any())
|
|
//{
|
|
// var MsgData = new { data = parseResultData, MessageType = CSCIMessageType.ProtocolLogsRAN }.ObjToJson();
|
|
// logger.LogInformation($"OnData:{MsgData}");
|
|
// observer.OnData(MsgData);
|
|
//}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.LogError($"GetTryParesLogDataHandle Data {model?.ObjToJson()}");
|
|
logger.LogError(ex.ToString());
|
|
}
|
|
}
|
|
|
|
public ProtocolLogParsedResult[] LogParsedResultHandle(ProtocolLogDetail[] logDetails, int MessageId)
|
|
{
|
|
List<ProtocolLogParsedResult> parsedResults = new List<ProtocolLogParsedResult>();
|
|
|
|
return parsedResults.ToArray();
|
|
}
|
|
|
|
public void LogListParse(ProtocolLogDetail[] list)
|
|
{
|
|
int length = list.Length;
|
|
for (int i = 0; i < length; i++)
|
|
{
|
|
var log= list[i];
|
|
switch (log.Layer)
|
|
{
|
|
case "PHY":
|
|
break;
|
|
case "MAC":
|
|
break;
|
|
case "RRC":
|
|
break;
|
|
case "NAS":
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|