|
|
|
@ -31,7 +31,6 @@ namespace CoreAgent.Infrastructure.Services.Network |
|
|
|
private readonly IWebSocketTransport _webSocketTransport; |
|
|
|
private readonly IProtocolWsClientManager _protocolWsClientManager; |
|
|
|
private readonly IServiceScopeManager _serviceScopeManager; |
|
|
|
private readonly IRanAPICommandHandlerFactory _ranAPICommandHandlerFactory; |
|
|
|
private static readonly SemaphoreSlim _startLock = new(1, 1); |
|
|
|
private const int LockTimeoutSeconds = 60; |
|
|
|
|
|
|
|
@ -48,8 +47,7 @@ namespace CoreAgent.Infrastructure.Services.Network |
|
|
|
IWebSocketTransport webSocketTransport, |
|
|
|
IProtocolLogObserver protocolLogObserver, |
|
|
|
IProtocolWsClientManager protocolWsClientManager, |
|
|
|
IServiceScopeManager serviceScopeManager, |
|
|
|
IRanAPICommandHandlerFactory ranAPICommandHandlerFactory) |
|
|
|
IServiceScopeManager serviceScopeManager) |
|
|
|
{ |
|
|
|
_logger = logger ?? throw new ArgumentNullException(nameof(logger)); |
|
|
|
_loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory)); |
|
|
|
@ -60,7 +58,6 @@ namespace CoreAgent.Infrastructure.Services.Network |
|
|
|
_webSocketTransport = webSocketTransport ?? throw new ArgumentNullException(nameof(webSocketTransport)); |
|
|
|
_protocolWsClientManager = protocolWsClientManager ?? throw new ArgumentNullException(nameof(protocolWsClientManager)); |
|
|
|
_serviceScopeManager = serviceScopeManager ?? throw new ArgumentNullException(nameof(serviceScopeManager)); |
|
|
|
_ranAPICommandHandlerFactory = ranAPICommandHandlerFactory ?? throw new ArgumentNullException(nameof(ranAPICommandHandlerFactory)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -388,9 +385,6 @@ namespace CoreAgent.Infrastructure.Services.Network |
|
|
|
var step12Duration = (DateTime.UtcNow - step12Start).TotalMilliseconds; |
|
|
|
_logger.LogDebug("步骤12完成:启动所有协议客户端,耗时: {Duration}ms", step12Duration.ToString("F2")); |
|
|
|
|
|
|
|
await SetBcchLogStatusAsync(); |
|
|
|
_logger.LogInformation("BCCH日志状态设置完成"); |
|
|
|
|
|
|
|
var endTime = DateTime.UtcNow; |
|
|
|
var duration = endTime - startTime; |
|
|
|
_logger.LogInformation("蜂窝网络配置 {ConfigKey} 启动成功,当前状态: {Status},总耗时: {Duration}ms", |
|
|
|
@ -519,52 +513,5 @@ namespace CoreAgent.Infrastructure.Services.Network |
|
|
|
return CellularNetworkOperationResult.Failure($"启动协议客户端失败: {ex.Message}"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 设置BCCH日志状态
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>任务</returns>
|
|
|
|
private async Task SetBcchLogStatusAsync() |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
// 使用工厂创建处理器实例
|
|
|
|
var ranApiCommandHandler = _ranAPICommandHandlerFactory.CreateHandler(); |
|
|
|
|
|
|
|
// 设置BCCH日志状态为true
|
|
|
|
_logger.LogInformation("开始设置BCCH日志状态为true"); |
|
|
|
var setTrueResult = await ranApiCommandHandler.SetBcchLogStatusAsync(true); |
|
|
|
|
|
|
|
if (setTrueResult) |
|
|
|
{ |
|
|
|
_logger.LogInformation("BCCH日志状态设置为true成功"); |
|
|
|
|
|
|
|
// 等待200秒
|
|
|
|
_logger.LogInformation("等待200秒后设置BCCH日志状态为false"); |
|
|
|
await Task.Delay(TimeSpan.FromSeconds(200)); |
|
|
|
|
|
|
|
// 设置BCCH日志状态为false
|
|
|
|
_logger.LogInformation("200秒后开始设置BCCH日志状态为false"); |
|
|
|
var setFalseResult = await ranApiCommandHandler.SetBcchLogStatusAsync(false); |
|
|
|
|
|
|
|
if (setFalseResult) |
|
|
|
{ |
|
|
|
_logger.LogInformation("BCCH日志状态设置为false成功"); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
_logger.LogWarning("BCCH日志状态设置为false失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
_logger.LogWarning("BCCH日志状态设置为true失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
_logger.LogError(ex, "设置BCCH日志状态时发生异常"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|