/// <summary> /// 统一的一套注入 /// </summary> /// <param name="jT808TcpAtomicCounterService"></param> /// <param name="jT808UdpAtomicCounterService"></param> public JT808MsgIdDefaultWebApiHandler( JT808SimpleSystemCollectService jT808SimpleSystemCollectService, JT808TrafficServiceFactory jT808TrafficServiceFactory, IJT808UnificationTcpSendService jT808UnificationTcpSendService, IJT808UnificationUdpSendService jT808UnificationUdpSendService, IJT808TcpSessionService jT808TcpSessionService, IJT808UdpSessionService jT808UdpSessionService, JT808TransmitAddressFilterService jT808TransmitAddressFilterService, JT808AtomicCounterServiceFactory jT808AtomicCounterServiceFactory ) { this.jT808SimpleSystemCollectService = jT808SimpleSystemCollectService; this.jT808TcpTrafficService = jT808TrafficServiceFactory.Create(JT808ModeType.Tcp); this.jT808UdpTrafficService = jT808TrafficServiceFactory.Create(JT808ModeType.Udp); this.jT808UdpSessionService = jT808UdpSessionService; this.jT808UnificationTcpSendService = jT808UnificationTcpSendService; this.jT808UnificationUdpSendService = jT808UnificationUdpSendService; this.jT808TcpSessionService = jT808TcpSessionService; this.jT808TransmitAddressFilterService = jT808TransmitAddressFilterService; this.jT808TcpAtomicCounterService = jT808AtomicCounterServiceFactory.Create(JT808ModeType.Tcp); this.jT808UdpAtomicCounterService = jT808AtomicCounterServiceFactory.Create(JT808ModeType.Udp); InitCommonRoute(); InitTcpRoute(); InitUdpRoute(); }
public JT808ServerHandler( ILoggerFactory loggerFactory, JT808TransmitAddressFilterService jT808TransmitAddressFilterService, IJT808SourcePackageDispatcher jT808SourcePackageDispatcher, JT808MsgIdHandlerBase handler, JT808AtomicCounterService jT808AtomicCounterService, JT808SessionManager jT808SessionManager) { this.jT808TransmitAddressFilterService = jT808TransmitAddressFilterService; this.handler = handler; this.jT808SessionManager = jT808SessionManager; this.jT808SourcePackageDispatcher = jT808SourcePackageDispatcher; this.jT808AtomicCounterService = jT808AtomicCounterService; logger = loggerFactory.CreateLogger <JT808ServerHandler>(); }
public JT808TcpServerHandler( JT808TrafficServiceFactory jT808TrafficServiceFactory, ILoggerFactory loggerFactory, JT808TransmitAddressFilterService jT808TransmitAddressFilterService, IJT808SourcePackageDispatcher jT808SourcePackageDispatcher, JT808MsgIdTcpHandlerBase handler, JT808AtomicCounterServiceFactory jT808AtomicCounterServiceFactory, JT808TcpSessionManager jT808SessionManager) { this.jT808TrafficService = jT808TrafficServiceFactory.Create(Core.Enums.JT808ModeType.Tcp); this.jT808TransmitAddressFilterService = jT808TransmitAddressFilterService; this.handler = handler; this.jT808SessionManager = jT808SessionManager; this.jT808SourcePackageDispatcher = jT808SourcePackageDispatcher; this.jT808AtomicCounterService = jT808AtomicCounterServiceFactory.Create(Core.Enums.JT808ModeType.Tcp); logger = loggerFactory.CreateLogger <JT808TcpServerHandler>(); }
/// <summary> /// TCP一套注入 /// </summary> /// <param name="jT808TcpAtomicCounterService"></param> public JT808MsgIdDefaultWebApiHandler( JT808SimpleSystemCollectService jT808SimpleSystemCollectService, JT808TcpTrafficService jT808TcpTrafficService, IJT808UnificationTcpSendService jT808UnificationTcpSendService, IJT808TcpSessionService jT808TcpSessionService, JT808TransmitAddressFilterService jT808TransmitAddressFilterService, JT808TcpAtomicCounterService jT808TcpAtomicCounterService ) { this.jT808SimpleSystemCollectService = jT808SimpleSystemCollectService; this.jT808TcpTrafficService = jT808TcpTrafficService; this.jT808UnificationTcpSendService = jT808UnificationTcpSendService; this.jT808TcpSessionService = jT808TcpSessionService; this.jT808TransmitAddressFilterService = jT808TransmitAddressFilterService; this.jT808TcpAtomicCounterService = jT808TcpAtomicCounterService; InitCommonRoute(); InitTcpRoute(); }
public JT808TransmitAddressFilterServiceTest() { var serverHostBuilder = new HostBuilder() .ConfigureAppConfiguration((hostingContext, config) => { config.SetBasePath(AppDomain.CurrentDomain.BaseDirectory); config.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); }) .ConfigureServices((hostContext, services) => { services.AddSingleton <ILoggerFactory, LoggerFactory>(); services.AddSingleton(typeof(ILogger <>), typeof(Logger <>)); services.Configure <JT808Configuration>(hostContext.Configuration.GetSection("JT808Configuration")); services.AddSingleton <JT808TransmitAddressFilterService>(); }); var serviceProvider = serverHostBuilder.Build().Services; jT808TransmitAddressFilterService = serviceProvider.GetService <JT808TransmitAddressFilterService>(); jT808TransmitAddressFilterService.Add("127.0.0.1"); }
public JT808TcpServerHandler( JT808TrafficServiceFactory jT808TrafficServiceFactory, ILoggerFactory loggerFactory, JT808TransmitAddressFilterService jT808TransmitAddressFilterService, IJT808SourcePackageDispatcher jT808SourcePackageDispatcher, IJT808UplinkPacket jT808UplinkPacket, JT808MsgIdTcpHandlerBase handler, JT808AtomicCounterServiceFactory jT808AtomicCounterServiceFactory, JT808TcpSessionManager jT808SessionManager) { this.jT808TrafficService = jT808TrafficServiceFactory.Create(JT808TransportProtocolType.tcp); this.jT808TransmitAddressFilterService = jT808TransmitAddressFilterService; this.handler = handler; this.jT808SessionManager = jT808SessionManager; this.jT808SourcePackageDispatcher = jT808SourcePackageDispatcher; this.jT808UplinkPacket = jT808UplinkPacket; this.jT808AtomicCounterService = jT808AtomicCounterServiceFactory.Create(JT808TransportProtocolType.tcp); logger = loggerFactory.CreateLogger <JT808TcpServerHandler>(); unknownLogger = loggerFactory.CreateLogger("tcp_unknown_msgid"); }