From f2054b2a5ac65eccc64c8cfeee728361cd071ade Mon Sep 17 00:00:00 2001 From: "SmallChi(Koike)" <564952747@qq.com> Date: Thu, 26 Dec 2019 21:43:16 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0Gateway=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=202.=E4=BF=AE=E6=94=B9netty=E9=A1=B9?= =?UTF-8?q?=E7=9B=AEurl=E8=BF=9E=E6=8E=A5=E5=87=A0=E5=BA=94=E7=AD=94?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=94=B9=E4=B8=BA=E8=99=9A=E6=96=B9=E6=B3=95?= =?UTF-8?q?=203.=E4=BF=AE=E6=94=B9=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 57 +++- publish.gateway.bat | 13 + .../JT808.DotNetty.Abstractions.csproj | 8 +- .../JT808.DotNetty.Client.csproj | 8 +- .../JT808.DotNetty.Core.csproj | 8 +- .../JT808.DotNetty.Kafka.csproj | 8 +- .../JT808.DotNetty.MsgIdHandler.csproj | 8 +- .../JT808.DotNetty.MsgLogging.csproj | 8 +- .../JT808.DotNetty.ReplyMessage.csproj | 8 +- .../JT808DotNettyReplyMessageService.cs | 16 +- .../JT808.DotNetty.SessionNotice.csproj | 8 +- .../JT808.DotNetty.Traffic.csproj | 8 +- .../JT808.DotNetty.Transmit.csproj | 8 +- .../JT808.DotNetty.Tcp.csproj | 8 +- .../JT808.DotNetty.Udp.csproj | 8 +- .../JT808.DotNetty.WebApi.csproj | 8 +- .../JT808.DotNetty.WebApiClientTool.csproj | 8 +- .../JT808.Gateway.Abstractions.csproj | 9 +- .../JT808.Gateway.Kafka.csproj | 4 +- .../IJT808MsgIdHandler.cs | 14 + .../JT808.Gateway.MsgIdHandler.csproj | 34 +++ .../JT808MsgIdHandlerExtensions.cs | 19 ++ .../JT808MsgIdHandlerHostedService.cs | 34 +++ .../IJT808MsgLogging.cs | 15 ++ .../JT808.Gateway.MsgLogging.csproj | 35 +++ .../JT808MsgDownLoggingHostedService.cs | 36 +++ .../JT808MsgLoggingExtensions.cs | 20 ++ .../JT808MsgLoggingType.cs | 18 ++ .../JT808MsgUpLoggingHostedService.cs | 36 +++ .../JT808.Gateway.ReplyMessage.csproj | 34 +++ .../JT808ReplyMessageExtensions.cs | 59 +++++ .../JT808ReplyMessageHostedService.cs | 34 +++ .../JT808ReplyMessageService.cs | 250 ++++++++++++++++++ .../JT808.Gateway.SessionNotice.csproj | 35 +++ .../JT808SessionNoticeExtensions.cs | 62 +++++ .../JT808SessionNoticeHostedService.cs | 35 +++ .../JT808SessionNoticeService.cs | 24 ++ .../JT808.Gateway.Traffic.csproj | 35 +++ .../JT808TrafficService.cs | 32 +++ .../JT808TrafficServiceExtensions.cs | 34 +++ .../JT808TrafficServiceHostedService.cs | 38 +++ .../TrafficRedisClient.cs | 9 + .../Configs/DataTransferOptions.cs | 13 + .../Configs/RemoteServerOptions.cs | 11 + .../Handlers/ClientConnectionHandler.cs | 76 ++++++ .../JT808.Gateway.Transmit.csproj | 39 +++ .../JT808TransmitExtensions.cs | 40 +++ .../JT808TransmitHostedService.cs | 33 +++ .../JT808TransmitService.cs | 236 +++++++++++++++++ src/JT808.Gateway.sln | 46 ++++ src/JT808.Gateway/JT808.Gateway.csproj | 4 +- src/JT808.Gateway/JT808TcpServer.cs | 6 +- src/Version.props | 1 + 53 files changed, 1575 insertions(+), 83 deletions(-) create mode 100644 publish.gateway.bat create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/IJT808MsgIdHandler.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808.Gateway.MsgIdHandler.csproj create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808MsgIdHandlerExtensions.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808MsgIdHandlerHostedService.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/IJT808MsgLogging.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808.Gateway.MsgLogging.csproj create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808MsgDownLoggingHostedService.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808MsgLoggingExtensions.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808MsgLoggingType.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808MsgUpLoggingHostedService.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808.Gateway.ReplyMessage.csproj create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808ReplyMessageExtensions.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808ReplyMessageHostedService.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808ReplyMessageService.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808.Gateway.SessionNotice.csproj create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808SessionNoticeExtensions.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808SessionNoticeHostedService.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808SessionNoticeService.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.Traffic/JT808.Gateway.Traffic.csproj create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.Traffic/JT808TrafficService.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.Traffic/JT808TrafficServiceExtensions.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.Traffic/JT808TrafficServiceHostedService.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.Traffic/TrafficRedisClient.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.Transmit/Configs/DataTransferOptions.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.Transmit/Configs/RemoteServerOptions.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.Transmit/Handlers/ClientConnectionHandler.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808.Gateway.Transmit.csproj create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808TransmitExtensions.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808TransmitHostedService.cs create mode 100644 src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808TransmitService.cs diff --git a/README.md b/README.md index e7a5fcb..ca5946d 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,6 @@ ![design_model](https://github.com/SmallChi/JT808DotNetty/blob/master/doc/img/design_model.png) -## 基于WebApi的消息业务处理程序(JT808.DotNetty.WebApi) - -通过继承JT808.DotNetty.Core.Handlers.JT808MsgIdHttpHandlerBase去实现自定义的WebApi接口服务。 - -[WebApi公共接口服务](https://github.com/SmallChi/JT808DotNetty/blob/master/api/README.md) - ## 集成接口功能(JT808.DotNetty.Abstractions) |接口名称|接口说明|使用场景| @@ -57,6 +51,14 @@ |Traffic|流量统计服务 |由于运营商sim卡查询流量滞后,通过流量统计服务可以实时准确的统计设备流量,可以最优配置设备的流量大小,以节省成本 |Transmit| 原包转发服务|该服务可以将设备上报原始数据转发到第三方,支持全部转发,指定终端号转发| +## 基于WebApi的消息业务处理程序(JT808.DotNetty.WebApi) + +通过继承JT808.DotNetty.Core.Handlers.JT808MsgIdHttpHandlerBase去实现自定义的WebApi接口服务。 + +## 基于GRPC的消息业务处理程序 + +[GRPC协议](https://github.com/SmallChi/JT808Gateway/blob/master/src/JT808.Gateway.Abstractions/Protos/JT808Gateway.proto) + ## 基于DotNetty的NuGet安装 | Package Name | Version | Downloads | @@ -77,13 +79,19 @@ | Install-Package JT808.DotNetty.Kafka | ![JT808](https://img.shields.io/nuget/v/JT808.DotNetty.Kafka.svg) | ![JT808](https://img.shields.io/nuget/dt/JT808.DotNetty.Kafka.svg) | | Install-Package JT808.DotNetty.RabbitMQ | ![JT808](https://img.shields.io/nuget/v/JT808.DotNetty.RabbitMQ.svg) | ![JT808](https://img.shields.io/nuget/dt/JT808.DotNetty.RabbitMQ.svg) | -## 基于Pipeline的NuGet安装 +## 基于core 3.1 Pipeline的NuGet安装 | Package Name | Version | Downloads | | --------------------- | -------------------------------------------------- | --------------------------------------------------- | | Install-Package JT808.Gateway.Abstractions| ![JT808.Gateway.Abstractions](https://img.shields.io/nuget/v/JT808.Gateway.Abstractions.svg) | ![JT808.Gateway.Abstractions](https://img.shields.io/nuget/dt/JT808.Gateway.Abstractions.svg) | | Install-Package JT808.Gateway | ![JT808.Gateway](https://img.shields.io/nuget/v/JT808.Gateway.svg) | ![JT808.Gateway](https://img.shields.io/nuget/dt/JT808.Gateway.svg) | | Install-Package JT808.Gateway.Kafka| ![JT808.Gateway.Kafka](https://img.shields.io/nuget/v/JT808.Gateway.Kafka.svg) | ![JT808.Gateway.Kafka](https://img.shields.io/nuget/dt/JT808.Gateway.Kafka.svg) | +| Install-Package JT808.Gateway.Transmit | ![JT808](https://img.shields.io/nuget/v/JT808.Gateway.Transmit.svg) | ![JT808](https://img.shields.io/nuget/dt/JT808.Gateway.Transmit.svg) | +| Install-Package JT808.Gateway.Traffic | ![JT808](https://img.shields.io/nuget/v/JT808.Gateway.Traffic.svg) | ![JT808](https://img.shields.io/nuget/dt/JT808.Gateway.Traffic.svg)| +| Install-Package JT808.Gateway.SessionNotice | ![JT808](https://img.shields.io/nuget/v/JT808.Gateway.SessionNotice.svg) | ![JT808](https://img.shields.io/nuget/dt/JT808.Gateway.SessionNotice.svg)| +| Install-Package JT808.Gateway.ReplyMessage | ![JT808](https://img.shields.io/nuget/v/JT808.Gateway.ReplyMessage.svg) | ![JT808](https://img.shields.io/nuget/dt/JT808.Gateway.ReplyMessage.svg)| +| Install-Package JT808.Gateway.MsgLogging | ![JT808](https://img.shields.io/nuget/v/JT808.Gateway.MsgLogging.svg) | ![JT808](https://img.shields.io/nuget/dt/JT808.Gateway.MsgLogging.svg)| +| Install-Package JT808.Gateway.MsgIdHandler | ![JT808](https://img.shields.io/nuget/v/JT808.Gateway.MsgIdHandler.svg) | ![JT808](https://img.shields.io/nuget/dt/JT808.Gateway.MsgIdHandler.svg)| ## 举个栗子1 @@ -138,6 +146,41 @@ static async Task Main(string[] args) ## 举个栗子2 +``` 1 +static async Task Main(string[] args) +{ + var serverHostBuilder = new HostBuilder() + .ConfigureAppConfiguration((hostingContext, config) => + { + config.SetBasePath(AppDomain.CurrentDomain.BaseDirectory) + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) + .AddJsonFile($"appsettings.{ hostingContext.HostingEnvironment.EnvironmentName}.json", optional: true, reloadOnChange: true); + }) + .ConfigureLogging((context, logging) => + { + Console.WriteLine($"Environment.OSVersion.Platform:{Environment.OSVersion.Platform.ToString()}"); + NLog.LogManager.LoadConfiguration($"Configs/nlog.{Environment.OSVersion.Platform.ToString()}.config"); + logging.AddNLog(new NLogProviderOptions { CaptureMessageTemplates = true, CaptureMessageProperties = true }); + logging.SetMinimumLevel(LogLevel.Trace); + }) + .ConfigureServices((hostContext, services) => + { + services.AddSingleton(); + services.AddSingleton(typeof(ILogger<>), typeof(Logger<>)); + services.AddJT808Configure() + .AddJT808Gateway() + .AddTcp() + .AddUdp() + .AddGrpc(); + //services.AddHostedService(); + }); + + await serverHostBuilder.RunConsoleAsync(); +} +``` + +## 举个栗子3 + 1.打开项目进行还原编译生成 2.进入JT808.DotNetty.SimpleServer项目下的Debug目录运行服务端 diff --git a/publish.gateway.bat b/publish.gateway.bat new file mode 100644 index 0000000..90791b2 --- /dev/null +++ b/publish.gateway.bat @@ -0,0 +1,13 @@ +dotnet pack .\src\JT808.Gateway\JT808.Gateway.csproj --no-build --output ../../nupkgs +dotnet pack .\src\JT808.Gateway.Kafka\JT808.Gateway.Kafka.csproj --no-build --output ../../nupkgs +dotnet pack .\src\JT808.Gateway.Abstractions\JT808.Gateway.Abstractions.csproj --no-build --output ../../nupkgs + +echo 'push service pacakge...' +dotnet pack .\src\JT808.Gateway.Services\JT808.Gateway.MsgIdHandler\JT808.Gateway.MsgIdHandler.csproj --no-build --output ../../nupkgs +dotnet pack .\src\JT808.Gateway.Services\JT808.Gateway.MsgLogging\JT808.Gateway.MsgLogging.csproj --no-build --output ../../nupkgs +dotnet pack .\src\JT808.Gateway.Services\JT808.Gateway.ReplyMessage\JT808.Gateway.ReplyMessage.csproj --no-build --output ../../nupkgs +dotnet pack .\src\JT808.Gateway.Services\JT808.Gateway.SessionNotice\JT808.Gateway.SessionNotice.csproj --no-build --output ../../nupkgs +dotnet pack .\src\JT808.Gateway.Services\JT808.Gateway.Traffic\JT808.Gateway.Traffic.csproj --no-build --output ../../nupkgs +dotnet pack .\src\JT808.Gateway.Services\JT808.Gateway.Transmit\JT808.Gateway.Transmit.csproj --no-build --output ../../nupkgs + +pause \ No newline at end of file diff --git a/src/JT808.DotNetty.Abstractions/JT808.DotNetty.Abstractions.csproj b/src/JT808.DotNetty.Abstractions/JT808.DotNetty.Abstractions.csproj index 9051146..43981b7 100644 --- a/src/JT808.DotNetty.Abstractions/JT808.DotNetty.Abstractions.csproj +++ b/src/JT808.DotNetty.Abstractions/JT808.DotNetty.Abstractions.csproj @@ -5,10 +5,10 @@ 7.3 Copyright 2018. SmallChi(Koike) - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE false $(JT808DotNettyPackageVersion) false diff --git a/src/JT808.DotNetty.Client/JT808.DotNetty.Client.csproj b/src/JT808.DotNetty.Client/JT808.DotNetty.Client.csproj index 0bfb406..d2c783c 100644 --- a/src/JT808.DotNetty.Client/JT808.DotNetty.Client.csproj +++ b/src/JT808.DotNetty.Client/JT808.DotNetty.Client.csproj @@ -5,10 +5,10 @@ 7.3 Copyright 2018. SmallChi(Koike) - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE false $(JT808DotNettyPackageVersion) false diff --git a/src/JT808.DotNetty.Core/JT808.DotNetty.Core.csproj b/src/JT808.DotNetty.Core/JT808.DotNetty.Core.csproj index 5434585..75c1b35 100644 --- a/src/JT808.DotNetty.Core/JT808.DotNetty.Core.csproj +++ b/src/JT808.DotNetty.Core/JT808.DotNetty.Core.csproj @@ -5,10 +5,10 @@ 7.3 Copyright 2018. SmallChi(Koike) - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE false $(JT808DotNettyPackageVersion) false diff --git a/src/JT808.DotNetty.Kafka/JT808.DotNetty.Kafka.csproj b/src/JT808.DotNetty.Kafka/JT808.DotNetty.Kafka.csproj index 88d5739..80b2ab7 100644 --- a/src/JT808.DotNetty.Kafka/JT808.DotNetty.Kafka.csproj +++ b/src/JT808.DotNetty.Kafka/JT808.DotNetty.Kafka.csproj @@ -5,10 +5,10 @@ 7.3 Copyright 2018. SmallChi(Koike) - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE false $(JT808DotNettyPackageVersion) false diff --git a/src/JT808.DotNetty.Services/JT808.DotNetty.MsgIdHandler/JT808.DotNetty.MsgIdHandler.csproj b/src/JT808.DotNetty.Services/JT808.DotNetty.MsgIdHandler/JT808.DotNetty.MsgIdHandler.csproj index 395ef6c..0d9ae38 100644 --- a/src/JT808.DotNetty.Services/JT808.DotNetty.MsgIdHandler/JT808.DotNetty.MsgIdHandler.csproj +++ b/src/JT808.DotNetty.Services/JT808.DotNetty.MsgIdHandler/JT808.DotNetty.MsgIdHandler.csproj @@ -6,10 +6,10 @@ 7.3 Copyright 2018. SmallChi(Koike) - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE false $(JT808DotNettyPackageVersion) false diff --git a/src/JT808.DotNetty.Services/JT808.DotNetty.MsgLogging/JT808.DotNetty.MsgLogging.csproj b/src/JT808.DotNetty.Services/JT808.DotNetty.MsgLogging/JT808.DotNetty.MsgLogging.csproj index 9710260..3cfffb1 100644 --- a/src/JT808.DotNetty.Services/JT808.DotNetty.MsgLogging/JT808.DotNetty.MsgLogging.csproj +++ b/src/JT808.DotNetty.Services/JT808.DotNetty.MsgLogging/JT808.DotNetty.MsgLogging.csproj @@ -6,10 +6,10 @@ 7.3 Copyright 2018. SmallChi(Koike) - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE false $(JT808DotNettyPackageVersion) false diff --git a/src/JT808.DotNetty.Services/JT808.DotNetty.ReplyMessage/JT808.DotNetty.ReplyMessage.csproj b/src/JT808.DotNetty.Services/JT808.DotNetty.ReplyMessage/JT808.DotNetty.ReplyMessage.csproj index 27ab52d..d14599e 100644 --- a/src/JT808.DotNetty.Services/JT808.DotNetty.ReplyMessage/JT808.DotNetty.ReplyMessage.csproj +++ b/src/JT808.DotNetty.Services/JT808.DotNetty.ReplyMessage/JT808.DotNetty.ReplyMessage.csproj @@ -5,10 +5,10 @@ 7.3 Copyright 2018. SmallChi(Koike) - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE false $(JT808DotNettyPackageVersion) false diff --git a/src/JT808.DotNetty.Services/JT808.DotNetty.ReplyMessage/JT808DotNettyReplyMessageService.cs b/src/JT808.DotNetty.Services/JT808.DotNetty.ReplyMessage/JT808DotNettyReplyMessageService.cs index df281f8..4a0bad4 100644 --- a/src/JT808.DotNetty.Services/JT808.DotNetty.ReplyMessage/JT808DotNettyReplyMessageService.cs +++ b/src/JT808.DotNetty.Services/JT808.DotNetty.ReplyMessage/JT808DotNettyReplyMessageService.cs @@ -60,7 +60,7 @@ namespace JT808.DotNetty.ReplyMessage /// /// /// - public byte[] Msg0x0001(JT808HeaderPackage request) + public virtual byte[] Msg0x0001(JT808HeaderPackage request) { return null; } @@ -69,7 +69,7 @@ namespace JT808.DotNetty.ReplyMessage /// /// /// - public byte[] Msg0x0002(JT808HeaderPackage request) + public virtual byte[] Msg0x0002(JT808HeaderPackage request) { if (request.Version == JT808Version.JTT2019) { @@ -95,7 +95,7 @@ namespace JT808.DotNetty.ReplyMessage /// /// /// - public byte[] Msg0x0003(JT808HeaderPackage request) + public virtual byte[] Msg0x0003(JT808HeaderPackage request) { if (request.Version == JT808Version.JTT2019) { @@ -121,7 +121,7 @@ namespace JT808.DotNetty.ReplyMessage /// /// /// - public byte[] Msg0x0100(JT808HeaderPackage request) + public virtual byte[] Msg0x0100(JT808HeaderPackage request) { if (request.Version == JT808Version.JTT2019) { @@ -147,7 +147,7 @@ namespace JT808.DotNetty.ReplyMessage /// /// /// - public byte[] Msg0x0102(JT808HeaderPackage request) + public virtual byte[] Msg0x0102(JT808HeaderPackage request) { if (request.Version == JT808Version.JTT2019) { @@ -173,7 +173,7 @@ namespace JT808.DotNetty.ReplyMessage /// /// /// - public byte[] Msg0x0200(JT808HeaderPackage request) + public virtual byte[] Msg0x0200(JT808HeaderPackage request) { if (request.Version == JT808Version.JTT2019) { @@ -199,7 +199,7 @@ namespace JT808.DotNetty.ReplyMessage /// /// /// - public byte[] Msg0x0704(JT808HeaderPackage request) + public virtual byte[] Msg0x0704(JT808HeaderPackage request) { if (request.Version == JT808Version.JTT2019) { @@ -225,7 +225,7 @@ namespace JT808.DotNetty.ReplyMessage /// /// /// - public byte[] Msg0x0900(JT808HeaderPackage request) + public virtual byte[] Msg0x0900(JT808HeaderPackage request) { if (request.Version == JT808Version.JTT2019) { diff --git a/src/JT808.DotNetty.Services/JT808.DotNetty.SessionNotice/JT808.DotNetty.SessionNotice.csproj b/src/JT808.DotNetty.Services/JT808.DotNetty.SessionNotice/JT808.DotNetty.SessionNotice.csproj index 28ef6f5..38df830 100644 --- a/src/JT808.DotNetty.Services/JT808.DotNetty.SessionNotice/JT808.DotNetty.SessionNotice.csproj +++ b/src/JT808.DotNetty.Services/JT808.DotNetty.SessionNotice/JT808.DotNetty.SessionNotice.csproj @@ -6,10 +6,10 @@ 7.3 Copyright 2018. SmallChi(Koike) - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE false $(JT808DotNettyPackageVersion) false diff --git a/src/JT808.DotNetty.Services/JT808.DotNetty.Traffic/JT808.DotNetty.Traffic.csproj b/src/JT808.DotNetty.Services/JT808.DotNetty.Traffic/JT808.DotNetty.Traffic.csproj index ee1e567..8a01867 100644 --- a/src/JT808.DotNetty.Services/JT808.DotNetty.Traffic/JT808.DotNetty.Traffic.csproj +++ b/src/JT808.DotNetty.Services/JT808.DotNetty.Traffic/JT808.DotNetty.Traffic.csproj @@ -5,10 +5,10 @@ 7.3 Copyright 2018. SmallChi(Koike) - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE false $(JT808DotNettyPackageVersion) false diff --git a/src/JT808.DotNetty.Services/JT808.DotNetty.Transmit/JT808.DotNetty.Transmit.csproj b/src/JT808.DotNetty.Services/JT808.DotNetty.Transmit/JT808.DotNetty.Transmit.csproj index ea0e41c..e193276 100644 --- a/src/JT808.DotNetty.Services/JT808.DotNetty.Transmit/JT808.DotNetty.Transmit.csproj +++ b/src/JT808.DotNetty.Services/JT808.DotNetty.Transmit/JT808.DotNetty.Transmit.csproj @@ -6,10 +6,10 @@ 7.3 Copyright 2018. SmallChi(Koike) - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE false $(JT808DotNettyPackageVersion) false diff --git a/src/JT808.DotNetty.Tcp/JT808.DotNetty.Tcp.csproj b/src/JT808.DotNetty.Tcp/JT808.DotNetty.Tcp.csproj index 678326a..b04beef 100644 --- a/src/JT808.DotNetty.Tcp/JT808.DotNetty.Tcp.csproj +++ b/src/JT808.DotNetty.Tcp/JT808.DotNetty.Tcp.csproj @@ -5,10 +5,10 @@ 7.3 Copyright 2018. SmallChi(Koike) - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE false $(JT808DotNettyPackageVersion) false diff --git a/src/JT808.DotNetty.Udp/JT808.DotNetty.Udp.csproj b/src/JT808.DotNetty.Udp/JT808.DotNetty.Udp.csproj index 7d7d263..2342de3 100644 --- a/src/JT808.DotNetty.Udp/JT808.DotNetty.Udp.csproj +++ b/src/JT808.DotNetty.Udp/JT808.DotNetty.Udp.csproj @@ -5,10 +5,10 @@ 7.3 Copyright 2018. SmallChi(Koike) - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE false $(JT808DotNettyPackageVersion) false diff --git a/src/JT808.DotNetty.WebApi/JT808.DotNetty.WebApi.csproj b/src/JT808.DotNetty.WebApi/JT808.DotNetty.WebApi.csproj index 32ae470..16c3fc1 100644 --- a/src/JT808.DotNetty.WebApi/JT808.DotNetty.WebApi.csproj +++ b/src/JT808.DotNetty.WebApi/JT808.DotNetty.WebApi.csproj @@ -5,10 +5,10 @@ 7.3 Copyright 2018. SmallChi(Koike) - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE false $(JT808DotNettyPackageVersion) false diff --git a/src/JT808.DotNetty.WebApiClientTool/JT808.DotNetty.WebApiClientTool.csproj b/src/JT808.DotNetty.WebApiClientTool/JT808.DotNetty.WebApiClientTool.csproj index 28c20bd..e2d0abc 100644 --- a/src/JT808.DotNetty.WebApiClientTool/JT808.DotNetty.WebApiClientTool.csproj +++ b/src/JT808.DotNetty.WebApiClientTool/JT808.DotNetty.WebApiClientTool.csproj @@ -5,10 +5,10 @@ 7.3 Copyright 2018. SmallChi(Koike) - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE - https://github.com/SmallChi/JT808DotNetty/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE false $(JT808DotNettyPackageVersion) false diff --git a/src/JT808.Gateway.Abstractions/JT808.Gateway.Abstractions.csproj b/src/JT808.Gateway.Abstractions/JT808.Gateway.Abstractions.csproj index 4774af9..dec02b2 100644 --- a/src/JT808.Gateway.Abstractions/JT808.Gateway.Abstractions.csproj +++ b/src/JT808.Gateway.Abstractions/JT808.Gateway.Abstractions.csproj @@ -1,4 +1,5 @@  + netstandard2.1 8.0 @@ -16,19 +17,19 @@ 基于Pipeline实现的JT808Gateway的抽象库 JT808.Gateway.Abstractions JT808.Gateway.Abstractions - 1.0.0-preview2 + $(JT808GatewayPackageVersion) - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/JT808.Gateway.Kafka/JT808.Gateway.Kafka.csproj b/src/JT808.Gateway.Kafka/JT808.Gateway.Kafka.csproj index da06104..fc29cfc 100644 --- a/src/JT808.Gateway.Kafka/JT808.Gateway.Kafka.csproj +++ b/src/JT808.Gateway.Kafka/JT808.Gateway.Kafka.csproj @@ -1,5 +1,5 @@  - + netstandard2.1 8.0 @@ -10,7 +10,6 @@ https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE false - 1.0.0-preview2 false LICENSE true @@ -18,6 +17,7 @@ JT808.Gateway.Kafka 基于Kafka的JT808消息发布与订阅 基于Kafka的JT808消息发布与订阅 + $(JT808GatewayPackageVersion) diff --git a/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/IJT808MsgIdHandler.cs b/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/IJT808MsgIdHandler.cs new file mode 100644 index 0000000..a6bcd6e --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/IJT808MsgIdHandler.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace JT808.Gateway.MsgIdHandler +{ + /// + /// JT808消息Id处理程序 + /// + public interface IJT808MsgIdHandler + { + void Processor((string TerminalNo, byte[] Data) parameter); + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808.Gateway.MsgIdHandler.csproj b/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808.Gateway.MsgIdHandler.csproj new file mode 100644 index 0000000..65cddcf --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808.Gateway.MsgIdHandler.csproj @@ -0,0 +1,34 @@ + + + + + netstandard2.1 + 8.0 + Copyright 2019. + SmallChi(Koike) + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + false + $(JT808GatewayPackageVersion) + false + LICENSE + true + JT808.Gateway.MsgIdHandler + JT808.Gateway.MsgIdHandler + 基于JT808消息业务处理程序服务 + 基于JT808消息业务处理程序服务 + LICENSE + + + + + + + + + + + + diff --git a/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808MsgIdHandlerExtensions.cs b/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808MsgIdHandlerExtensions.cs new file mode 100644 index 0000000..46d2417 --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808MsgIdHandlerExtensions.cs @@ -0,0 +1,19 @@ +using JT808.Gateway.Abstractions; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Text; + +namespace JT808.Gateway.MsgIdHandler +{ + public static class JT808MsgIdHandlerExtensions + { + public static IJT808ClientBuilder AddJT808MsgIdHandler(this IJT808ClientBuilder jT808ClientBuilder) + where TJT808DotNettyMsgIdHandler: IJT808MsgIdHandler + { + jT808ClientBuilder.JT808Builder.Services.AddSingleton(typeof(IJT808MsgIdHandler),typeof(TJT808DotNettyMsgIdHandler)); + jT808ClientBuilder.JT808Builder.Services.AddHostedService(); + return jT808ClientBuilder; + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808MsgIdHandlerHostedService.cs b/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808MsgIdHandlerHostedService.cs new file mode 100644 index 0000000..db2a100 --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.MsgIdHandler/JT808MsgIdHandlerHostedService.cs @@ -0,0 +1,34 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using System.Threading; +using JT808.Gateway.Abstractions; + +namespace JT808.Gateway.MsgIdHandler +{ + public class JT808MsgIdHandlerHostedService : IHostedService + { + private readonly IJT808MsgConsumer jT808MsgConsumer; + + private readonly IJT808MsgIdHandler jT808MsgIdHandler; + public JT808MsgIdHandlerHostedService( + IJT808MsgIdHandler jT808MsgIdHandler, + IJT808MsgConsumer jT808MsgConsumer) + { + this.jT808MsgIdHandler = jT808MsgIdHandler; + this.jT808MsgConsumer = jT808MsgConsumer; + } + + public Task StartAsync(CancellationToken cancellationToken) + { + jT808MsgConsumer.Subscribe(); + jT808MsgConsumer.OnMessage(jT808MsgIdHandler.Processor); + return Task.CompletedTask; + } + + public Task StopAsync(CancellationToken cancellationToken) + { + jT808MsgConsumer.Unsubscribe(); + return Task.CompletedTask; + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/IJT808MsgLogging.cs b/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/IJT808MsgLogging.cs new file mode 100644 index 0000000..6f2d5e9 --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/IJT808MsgLogging.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace JT808.Gateway.MsgLogging +{ + /// + /// 808数据上下行日志接口 + /// + public interface IJT808MsgLogging + { + void Processor((string TerminalNo, byte[] Data) parameter, JT808MsgLoggingType jT808MsgLoggingType); + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808.Gateway.MsgLogging.csproj b/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808.Gateway.MsgLogging.csproj new file mode 100644 index 0000000..c520ffb --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808.Gateway.MsgLogging.csproj @@ -0,0 +1,35 @@ + + + + + netstandard2.1 + 8.0 + Copyright 2019. + SmallChi(Koike) + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + false + $(JT808GatewayPackageVersion) + false + LICENSE + true + JT808.Gateway.MsgLogging + JT808.Gateway.MsgLogging + 基于JT808消息上下行日志服务 + 基于JT808消息上下行日志服务 + LICENSE + + + + + + + + + + + + + diff --git a/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808MsgDownLoggingHostedService.cs b/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808MsgDownLoggingHostedService.cs new file mode 100644 index 0000000..c32b51a --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808MsgDownLoggingHostedService.cs @@ -0,0 +1,36 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using System.Threading; +using JT808.Gateway.Abstractions; + +namespace JT808.Gateway.MsgLogging +{ + public class JT808MsgDownLoggingHostedService : IHostedService + { + private readonly IJT808MsgReplyConsumer jT808MsgReplyConsumer; + private readonly IJT808MsgLogging jT808MsgLogging; + public JT808MsgDownLoggingHostedService( + IJT808MsgLogging jT808MsgLogging, + IJT808MsgReplyConsumer jT808MsgReplyConsumer) + { + this.jT808MsgReplyConsumer = jT808MsgReplyConsumer; + this.jT808MsgLogging = jT808MsgLogging; + } + + public Task StartAsync(CancellationToken cancellationToken) + { + jT808MsgReplyConsumer.Subscribe(); + jT808MsgReplyConsumer.OnMessage(item=> + { + jT808MsgLogging.Processor(item, JT808MsgLoggingType.down); + }); + return Task.CompletedTask; + } + + public Task StopAsync(CancellationToken cancellationToken) + { + jT808MsgReplyConsumer.Unsubscribe(); + return Task.CompletedTask; + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808MsgLoggingExtensions.cs b/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808MsgLoggingExtensions.cs new file mode 100644 index 0000000..3bb00b6 --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808MsgLoggingExtensions.cs @@ -0,0 +1,20 @@ +using JT808.Gateway.Abstractions; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Text; + +namespace JT808.Gateway.MsgLogging +{ + public static class JT808MsgLoggingExtensions + { + public static IJT808ClientBuilder AddJT808MsgLogging(this IJT808ClientBuilder jT808ClientBuilder) + where TJT808MsgLogging: IJT808MsgLogging + { + jT808ClientBuilder.JT808Builder.Services.AddSingleton(typeof(IJT808MsgLogging),typeof(TJT808MsgLogging)); + jT808ClientBuilder.JT808Builder.Services.AddHostedService(); + jT808ClientBuilder.JT808Builder.Services.AddHostedService(); + return jT808ClientBuilder; + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808MsgLoggingType.cs b/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808MsgLoggingType.cs new file mode 100644 index 0000000..9c2ad11 --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808MsgLoggingType.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace JT808.Gateway.MsgLogging +{ + public enum JT808MsgLoggingType + { + /// + /// 数据上行 + /// + up, + /// + /// 数据下行 + /// + down + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808MsgUpLoggingHostedService.cs b/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808MsgUpLoggingHostedService.cs new file mode 100644 index 0000000..ec75324 --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808MsgUpLoggingHostedService.cs @@ -0,0 +1,36 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using System.Threading; +using JT808.Gateway.Abstractions; + +namespace JT808.Gateway.MsgLogging +{ + public class JT808MsgUpLoggingHostedService : IHostedService + { + private readonly IJT808MsgConsumer jT808MsgConsumer; + private readonly IJT808MsgLogging jT808MsgLogging; + public JT808MsgUpLoggingHostedService( + IJT808MsgLogging jT808MsgLogging, + IJT808MsgConsumer jT808MsgConsumer) + { + this.jT808MsgConsumer = jT808MsgConsumer; + this.jT808MsgLogging = jT808MsgLogging; + } + + public Task StartAsync(CancellationToken cancellationToken) + { + jT808MsgConsumer.Subscribe(); + jT808MsgConsumer.OnMessage(item=> + { + jT808MsgLogging.Processor(item, JT808MsgLoggingType.up); + }); + return Task.CompletedTask; + } + + public Task StopAsync(CancellationToken cancellationToken) + { + jT808MsgConsumer.Unsubscribe(); + return Task.CompletedTask; + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808.Gateway.ReplyMessage.csproj b/src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808.Gateway.ReplyMessage.csproj new file mode 100644 index 0000000..2798ad3 --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808.Gateway.ReplyMessage.csproj @@ -0,0 +1,34 @@ + + + + netstandard2.1 + 8.0 + Copyright 2019. + SmallChi(Koike) + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + false + $(JT808GatewayPackageVersion) + false + LICENSE + true + JT808.Gateway.ReplyMessage + JT808.Gateway.ReplyMessage + 基于JT808消息业务处理程序服务 + 基于JT808消息业务处理程序服务 + LICENSE + + + + + + + + + + + + + diff --git a/src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808ReplyMessageExtensions.cs b/src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808ReplyMessageExtensions.cs new file mode 100644 index 0000000..88ac45e --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808ReplyMessageExtensions.cs @@ -0,0 +1,59 @@ + +using JT808.Gateway.Abstractions; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Text; + +namespace JT808.Gateway.ReplyMessage +{ + public static class JT808ReplyMessageExtensions + { + /// + /// 独享消息应答服务(不同的消费者实例) + /// + /// + /// + public static IJT808ClientBuilder AddInprocJT808ReplyMessage(this IJT808ClientBuilder jT808ClientBuilder) + { + jT808ClientBuilder.JT808Builder.Services.AddSingleton(); + jT808ClientBuilder.JT808Builder.Services.AddHostedService(); + return jT808ClientBuilder; + } + /// + /// 独享消息应答服务(不同的消费者实例) + /// + /// 自定义消息回复服务 + /// + /// + public static IJT808ClientBuilder AddInprocJT808ReplyMessage(this IJT808ClientBuilder jT808ClientBuilder) + where TReplyMessageService : JT808ReplyMessageService + { + jT808ClientBuilder.JT808Builder.Services.AddSingleton(); + jT808ClientBuilder.JT808Builder.Services.AddHostedService(); + return jT808ClientBuilder; + } + /// + /// 共享消息应答服务(消费者单实例) + /// + /// 自定义消息回复服务 + /// + /// + public static IJT808ClientBuilder AddShareJT808ReplyMessage(this IJT808ClientBuilder jT808ClientBuilder) + where TReplyMessageService : JT808ReplyMessageService + { + jT808ClientBuilder.JT808Builder.Services.AddSingleton(); + return jT808ClientBuilder; + } + /// + /// 共享消息应答服务(消费者单实例) + /// + /// + /// + public static IJT808ClientBuilder AddShareJT808ReplyMessage(this IJT808ClientBuilder jT808ClientBuilder) + { + jT808ClientBuilder.JT808Builder.Services.AddSingleton(); + return jT808ClientBuilder; + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808ReplyMessageHostedService.cs b/src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808ReplyMessageHostedService.cs new file mode 100644 index 0000000..07e26eb --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808ReplyMessageHostedService.cs @@ -0,0 +1,34 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using System.Threading; +using JT808.Gateway.Abstractions; + +namespace JT808.Gateway.ReplyMessage +{ + public class JT808ReplyMessageHostedService : IHostedService + { + private readonly IJT808MsgConsumer jT808MsgConsumer; + private readonly JT808ReplyMessageService jT808ReplyMessageService; + + public JT808ReplyMessageHostedService( + JT808ReplyMessageService jT808ReplyMessageService, + IJT808MsgConsumer jT808MsgConsumer) + { + this.jT808MsgConsumer = jT808MsgConsumer; + this.jT808ReplyMessageService = jT808ReplyMessageService; + } + + public Task StartAsync(CancellationToken cancellationToken) + { + jT808MsgConsumer.Subscribe(); + jT808MsgConsumer.OnMessage(jT808ReplyMessageService.Processor); + return Task.CompletedTask; + } + + public Task StopAsync(CancellationToken cancellationToken) + { + jT808MsgConsumer.Unsubscribe(); + return Task.CompletedTask; + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808ReplyMessageService.cs b/src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808ReplyMessageService.cs new file mode 100644 index 0000000..b86ed57 --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808ReplyMessageService.cs @@ -0,0 +1,250 @@ +using JT808.Gateway.Abstractions; +using JT808.Protocol; +using JT808.Protocol.Enums; +using JT808.Protocol.Extensions; +using JT808.Protocol.MessageBody; +using System; +using System.Collections.Generic; +using System.Text; + +namespace JT808.Gateway.ReplyMessage +{ + public class JT808ReplyMessageService + { + protected Dictionary HandlerDict { get; } + + protected delegate byte[] MsgIdMethodDelegate(JT808HeaderPackage package); + protected JT808Serializer JT808Serializer { get; } + protected IJT808MsgReplyProducer JT808MsgReplyProducer { get; } + public JT808ReplyMessageService( + IJT808Config jT808Config, + IJT808MsgReplyProducer jT808MsgReplyProducer) + { + this.JT808Serializer = jT808Config.GetSerializer(); + this.JT808MsgReplyProducer = jT808MsgReplyProducer; + HandlerDict = new Dictionary { + {JT808MsgId.终端通用应答.ToUInt16Value(), Msg0x0001}, + {JT808MsgId.终端鉴权.ToUInt16Value(), Msg0x0102}, + {JT808MsgId.终端心跳.ToUInt16Value(), Msg0x0002}, + {JT808MsgId.终端注销.ToUInt16Value(), Msg0x0003}, + {JT808MsgId.终端注册.ToUInt16Value(), Msg0x0100}, + {JT808MsgId.位置信息汇报.ToUInt16Value(),Msg0x0200 }, + {JT808MsgId.定位数据批量上传.ToUInt16Value(),Msg0x0704 }, + {JT808MsgId.数据上行透传.ToUInt16Value(),Msg0x0900 } + }; + } + + public virtual void Processor((string TerminalNo, byte[] Data) parameter) + { + try + { + var request = JT808Serializer.HeaderDeserialize(parameter.Data); + if (HandlerDict.TryGetValue(request.Header.MsgId, out var func)) + { + var buffer = func(request); + if (buffer != null) + { + JT808MsgReplyProducer.ProduceAsync(parameter.TerminalNo, buffer); + } + } + } + catch + { + } + } + + /// + /// 终端通用应答 + /// 平台无需回复 + /// 实现自己的业务 + /// + /// + /// + public virtual byte[] Msg0x0001(JT808HeaderPackage request) + { + return null; + } + /// + /// 终端心跳 + /// + /// + /// + public virtual byte[] Msg0x0002(JT808HeaderPackage request) + { + if (request.Version == JT808Version.JTT2019) + { + return JT808Serializer.Serialize(JT808MsgId.平台通用应答.Create_平台通用应答_2019(request.Header.TerminalPhoneNo, new JT808_0x8001() + { + AckMsgId = request.Header.MsgId, + JT808PlatformResult = JT808PlatformResult.成功, + MsgNum = request.Header.MsgNum + })); + } + else + { + return JT808Serializer.Serialize(JT808MsgId.平台通用应答.Create(request.Header.TerminalPhoneNo, new JT808_0x8001() + { + AckMsgId = request.Header.MsgId, + JT808PlatformResult = JT808PlatformResult.成功, + MsgNum = request.Header.MsgNum + })); + } + } + /// + /// 终端注销 + /// + /// + /// + public virtual byte[] Msg0x0003(JT808HeaderPackage request) + { + if (request.Version == JT808Version.JTT2019) + { + return JT808Serializer.Serialize(JT808MsgId.平台通用应答.Create_平台通用应答_2019(request.Header.TerminalPhoneNo, new JT808_0x8001() + { + AckMsgId = request.Header.MsgId, + JT808PlatformResult = JT808PlatformResult.成功, + MsgNum = request.Header.MsgNum + })); + } + else + { + return JT808Serializer.Serialize(JT808MsgId.平台通用应答.Create(request.Header.TerminalPhoneNo, new JT808_0x8001() + { + AckMsgId = request.Header.MsgId, + JT808PlatformResult = JT808PlatformResult.成功, + MsgNum = request.Header.MsgNum + })); + } + } + /// + /// 终端注册 + /// + /// + /// + public virtual byte[] Msg0x0100(JT808HeaderPackage request) + { + if (request.Version == JT808Version.JTT2019) + { + return JT808Serializer.Serialize(JT808MsgId.终端注册应答.Create_终端注册应答_2019(request.Header.TerminalPhoneNo, new JT808_0x8100() + { + Code = "J" + request.Header.TerminalPhoneNo, + JT808TerminalRegisterResult = JT808TerminalRegisterResult.成功, + AckMsgNum = request.Header.MsgNum + })); + } + else + { + return JT808Serializer.Serialize(JT808MsgId.终端注册应答.Create(request.Header.TerminalPhoneNo, new JT808_0x8100() + { + Code = "J" + request.Header.TerminalPhoneNo, + JT808TerminalRegisterResult = JT808TerminalRegisterResult.成功, + AckMsgNum = request.Header.MsgNum + })); + } + } + /// + /// 终端鉴权 + /// + /// + /// + public virtual byte[] Msg0x0102(JT808HeaderPackage request) + { + if (request.Version == JT808Version.JTT2019) + { + return JT808Serializer.Serialize(JT808MsgId.平台通用应答.Create_平台通用应答_2019(request.Header.TerminalPhoneNo, new JT808_0x8001() + { + AckMsgId = request.Header.MsgId, + JT808PlatformResult = JT808PlatformResult.成功, + MsgNum = request.Header.MsgNum + })); + } + else + { + return JT808Serializer.Serialize(JT808MsgId.平台通用应答.Create(request.Header.TerminalPhoneNo, new JT808_0x8001() + { + AckMsgId = request.Header.MsgId, + JT808PlatformResult = JT808PlatformResult.成功, + MsgNum = request.Header.MsgNum + })); + } + } + /// + /// 位置信息汇报 + /// + /// + /// + public virtual byte[] Msg0x0200(JT808HeaderPackage request) + { + if (request.Version == JT808Version.JTT2019) + { + return JT808Serializer.Serialize(JT808MsgId.平台通用应答.Create_平台通用应答_2019(request.Header.TerminalPhoneNo, new JT808_0x8001() + { + AckMsgId = request.Header.MsgId, + JT808PlatformResult = JT808PlatformResult.成功, + MsgNum = request.Header.MsgNum + })); + } + else + { + return JT808Serializer.Serialize(JT808MsgId.平台通用应答.Create(request.Header.TerminalPhoneNo, new JT808_0x8001() + { + AckMsgId = request.Header.MsgId, + JT808PlatformResult = JT808PlatformResult.成功, + MsgNum = request.Header.MsgNum + })); + } + } + /// + /// 定位数据批量上传 + /// + /// + /// + public virtual byte[] Msg0x0704(JT808HeaderPackage request) + { + if (request.Version == JT808Version.JTT2019) + { + return JT808Serializer.Serialize(JT808MsgId.平台通用应答.Create_平台通用应答_2019(request.Header.TerminalPhoneNo, new JT808_0x8001() + { + AckMsgId = request.Header.MsgId, + JT808PlatformResult = JT808PlatformResult.成功, + MsgNum = request.Header.MsgNum + })); + } + else + { + return JT808Serializer.Serialize(JT808MsgId.平台通用应答.Create(request.Header.TerminalPhoneNo, new JT808_0x8001() + { + AckMsgId = request.Header.MsgId, + JT808PlatformResult = JT808PlatformResult.成功, + MsgNum = request.Header.MsgNum + })); + } + } + /// + /// 数据上行透传 + /// + /// + /// + public virtual byte[] Msg0x0900(JT808HeaderPackage request) + { + if (request.Version == JT808Version.JTT2019) + { + return JT808Serializer.Serialize(JT808MsgId.平台通用应答.Create_平台通用应答_2019(request.Header.TerminalPhoneNo, new JT808_0x8001() + { + AckMsgId = request.Header.MsgId, + JT808PlatformResult = JT808PlatformResult.成功, + MsgNum = request.Header.MsgNum + })); + } + else + { + return JT808Serializer.Serialize(JT808MsgId.平台通用应答.Create(request.Header.TerminalPhoneNo, new JT808_0x8001() + { + AckMsgId = request.Header.MsgId, + JT808PlatformResult = JT808PlatformResult.成功, + MsgNum = request.Header.MsgNum + })); + } + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808.Gateway.SessionNotice.csproj b/src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808.Gateway.SessionNotice.csproj new file mode 100644 index 0000000..3c560ca --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808.Gateway.SessionNotice.csproj @@ -0,0 +1,35 @@ + + + + + netstandard2.1 + 8.0 + Copyright 2019. + SmallChi(Koike) + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + false + $(JT808GatewayPackageVersion) + false + LICENSE + true + JT808.Gateway.SessionNotice + JT808.Gateway.SessionNotice + 基于JT808会话通知服务 + 基于JT808会话通知服务 + LICENSE + + + + + + + + + + + + + diff --git a/src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808SessionNoticeExtensions.cs b/src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808SessionNoticeExtensions.cs new file mode 100644 index 0000000..201187e --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808SessionNoticeExtensions.cs @@ -0,0 +1,62 @@ + +using JT808.Gateway.Abstractions; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Text; + +namespace JT808.Gateway.SessionNotice +{ + public static class JT808SessionNoticeExtensions + { + /// + /// 独享消息会话通知服务(不同的消费者实例) + /// + /// + /// + public static IJT808ClientBuilder AddInprocJT808SessionNotice(this IJT808ClientBuilder jT808ClientBuilder) + { + jT808ClientBuilder.JT808Builder.Services.AddSingleton(); + jT808ClientBuilder.JT808Builder.Services.AddHostedService(); + return jT808ClientBuilder; + } + + /// + /// 独享消息会话通知服务(不同的消费者实例) + /// + /// 自定义会话通知服务 + /// + /// + public static IJT808ClientBuilder AddInprocJT808SessionNotice(this IJT808ClientBuilder jT808ClientBuilder) + where TSessionNoticeService : JT808SessionNoticeService + { + jT808ClientBuilder.JT808Builder.Services.AddSingleton(); + jT808ClientBuilder.JT808Builder.Services.AddHostedService(); + return jT808ClientBuilder; + } + + /// + /// 共享消息会话通知服务(消费者单实例) + /// + /// 自定义会话通知服务 + /// + /// + public static IJT808ClientBuilder AddShareJT808SessionNotice(this IJT808ClientBuilder jT808ClientBuilder) + where TSessionNoticeService : JT808SessionNoticeService + { + jT808ClientBuilder.JT808Builder.Services.AddSingleton(); + return jT808ClientBuilder; + } + + /// + /// 共享消息会话通知服务(消费者单实例) + /// + /// + /// + public static IJT808ClientBuilder AddShareJT808SessionNotice(this IJT808ClientBuilder jT808ClientBuilder) + { + jT808ClientBuilder.JT808Builder.Services.AddSingleton(); + return jT808ClientBuilder; + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808SessionNoticeHostedService.cs b/src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808SessionNoticeHostedService.cs new file mode 100644 index 0000000..44b83db --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808SessionNoticeHostedService.cs @@ -0,0 +1,35 @@ +using System.Threading.Tasks; +using JT808.Protocol; +using JT808.Protocol.Interfaces; +using Microsoft.Extensions.Hosting; +using System.Threading; +using JT808.Gateway.Abstractions; + +namespace JT808.Gateway.SessionNotice +{ + public class JT808SessionNoticeHostedService : IHostedService + { + private readonly JT808SessionNoticeService jT808SessionNoticeService; + private readonly IJT808SessionConsumer jT808SessionConsumer; + public JT808SessionNoticeHostedService( + IJT808SessionConsumer jT808SessionConsumer, + JT808SessionNoticeService jT808SessionNoticeService) + { + this.jT808SessionNoticeService = jT808SessionNoticeService; + this.jT808SessionConsumer = jT808SessionConsumer; + } + + public Task StartAsync(CancellationToken cancellationToken) + { + jT808SessionConsumer.Subscribe(); + jT808SessionConsumer.OnMessage(jT808SessionNoticeService.Processor); + return Task.CompletedTask; + } + + public Task StopAsync(CancellationToken cancellationToken) + { + jT808SessionConsumer.Unsubscribe(); + return Task.CompletedTask; + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808SessionNoticeService.cs b/src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808SessionNoticeService.cs new file mode 100644 index 0000000..6ce04bd --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808SessionNoticeService.cs @@ -0,0 +1,24 @@ +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Text; + +namespace JT808.Gateway.SessionNotice +{ + public class JT808SessionNoticeService + { + protected ILogger logger { get; } + public JT808SessionNoticeService(ILoggerFactory loggerFactory) + { + logger = loggerFactory.CreateLogger("JT808SessionNoticeService"); + } + public virtual void Processor((string Notice, string TerminalNo) parameter) + { + if (logger.IsEnabled(LogLevel.Debug)) + { + logger.LogDebug($"{parameter.Notice}-{parameter.TerminalNo}"); + } + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.Traffic/JT808.Gateway.Traffic.csproj b/src/JT808.Gateway.Services/JT808.Gateway.Traffic/JT808.Gateway.Traffic.csproj new file mode 100644 index 0000000..643a756 --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.Traffic/JT808.Gateway.Traffic.csproj @@ -0,0 +1,35 @@ + + + + netstandard2.1 + 8.0 + Copyright 2019. + SmallChi(Koike) + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + false + $(JT808GatewayPackageVersion) + false + LICENSE + true + JT808.Gateway.Traffic + JT808.Gateway.Traffic + 基于JT808设备流量统计服务 + 基于JT808设备流量统计服务 + LICENSE + + + + + + + + + + + + + + diff --git a/src/JT808.Gateway.Services/JT808.Gateway.Traffic/JT808TrafficService.cs b/src/JT808.Gateway.Services/JT808.Gateway.Traffic/JT808TrafficService.cs new file mode 100644 index 0000000..c13c38f --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.Traffic/JT808TrafficService.cs @@ -0,0 +1,32 @@ +using Microsoft.Extensions.Configuration; +using System; +using System.Collections.Generic; +using System.Text; + +namespace JT808.Gateway.Traffic +{ + public class JT808TrafficService:IDisposable + { + private readonly CSRedis.CSRedisClient redisClien; + public JT808TrafficService(IConfiguration configuration) + { + redisClien = new CSRedis.CSRedisClient(configuration.GetConnectionString("TrafficRedisHost")); + TrafficRedisClient.Initialization(redisClien); + } + + public void Dispose() + { + redisClien.Dispose(); + } + + /// + /// 按设备每天统计sim卡流量 + /// + /// + /// + public void Processor(string terminalNo,int len) + { + TrafficRedisClient.HIncrBy(terminalNo, DateTime.Now.ToString("yyyyMMdd"), len); + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.Traffic/JT808TrafficServiceExtensions.cs b/src/JT808.Gateway.Services/JT808.Gateway.Traffic/JT808TrafficServiceExtensions.cs new file mode 100644 index 0000000..fc8878e --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.Traffic/JT808TrafficServiceExtensions.cs @@ -0,0 +1,34 @@ +using JT808.Gateway.Abstractions; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Text; + +namespace JT808.Gateway.Traffic +{ + public static class JT808TrafficServiceExtensions + { + /// + /// 独享消息流量统计服务(不同的消费者实例) + /// + /// + /// + public static IJT808ClientBuilder AddInprocJT808Traffic(this IJT808ClientBuilder jT808ClientBuilder) + { + jT808ClientBuilder.JT808Builder.Services.AddSingleton(); + jT808ClientBuilder.JT808Builder.Services.AddHostedService(); + return jT808ClientBuilder; + } + /// + /// 共享消息流量统计服务(消费者单实例) + /// + /// + /// + /// + public static IJT808ClientBuilder AddShareJT808Traffic(this IJT808ClientBuilder jT808ClientBuilder) + { + jT808ClientBuilder.JT808Builder.Services.AddSingleton(); + return jT808ClientBuilder; + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.Traffic/JT808TrafficServiceHostedService.cs b/src/JT808.Gateway.Services/JT808.Gateway.Traffic/JT808TrafficServiceHostedService.cs new file mode 100644 index 0000000..ce0e70f --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.Traffic/JT808TrafficServiceHostedService.cs @@ -0,0 +1,38 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using System.Threading; +using JT808.Protocol.Extensions; +using JT808.Gateway.Abstractions; + +namespace JT808.Gateway.Traffic +{ + public class JT808TrafficServiceHostedService : IHostedService + { + private readonly IJT808MsgConsumer jT808MsgConsumer; + private readonly JT808TrafficService jT808TrafficService; + + public JT808TrafficServiceHostedService( + JT808TrafficService jT808TrafficService, + IJT808MsgConsumer jT808MsgConsumer) + { + this.jT808MsgConsumer = jT808MsgConsumer; + this.jT808TrafficService = jT808TrafficService; + } + + public Task StartAsync(CancellationToken cancellationToken) + { + jT808MsgConsumer.Subscribe(); + jT808MsgConsumer.OnMessage((item)=> { + string str = item.Data.ToHexString(); + jT808TrafficService.Processor(item.TerminalNo, item.Data.Length); + }); + return Task.CompletedTask; + } + + public Task StopAsync(CancellationToken cancellationToken) + { + jT808MsgConsumer.Unsubscribe(); + return Task.CompletedTask; + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.Traffic/TrafficRedisClient.cs b/src/JT808.Gateway.Services/JT808.Gateway.Traffic/TrafficRedisClient.cs new file mode 100644 index 0000000..872e675 --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.Traffic/TrafficRedisClient.cs @@ -0,0 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace JT808.Gateway.Traffic +{ + class TrafficRedisClient: RedisHelper + { } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.Transmit/Configs/DataTransferOptions.cs b/src/JT808.Gateway.Services/JT808.Gateway.Transmit/Configs/DataTransferOptions.cs new file mode 100644 index 0000000..a591f66 --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.Transmit/Configs/DataTransferOptions.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace JT808.Gateway.Transmit.Configs +{ + public class DataTransferOptions + { + public string Host { get; set; } + + public List TerminalNos { get; set; } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.Transmit/Configs/RemoteServerOptions.cs b/src/JT808.Gateway.Services/JT808.Gateway.Transmit/Configs/RemoteServerOptions.cs new file mode 100644 index 0000000..2d4541a --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.Transmit/Configs/RemoteServerOptions.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace JT808.Gateway.Transmit.Configs +{ + public class RemoteServerOptions + { + public List DataTransfer { get; set; } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.Transmit/Handlers/ClientConnectionHandler.cs b/src/JT808.Gateway.Services/JT808.Gateway.Transmit/Handlers/ClientConnectionHandler.cs new file mode 100644 index 0000000..b5007c2 --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.Transmit/Handlers/ClientConnectionHandler.cs @@ -0,0 +1,76 @@ +using DotNetty.Transport.Bootstrapping; +using DotNetty.Transport.Channels; +using DotNetty.Transport.Channels.Sockets; +using Polly; +using System; +using System.Linq; +using System.Collections.Generic; +using System.Net; +using System.Text; +using Microsoft.Extensions.Logging; + +namespace JT808.Gateway.Transmit.Handlers +{ + public class ClientConnectionHandler : ChannelHandlerAdapter + { + private readonly Bootstrap bootstrap; + public Dictionary channeldic; + private readonly ILogger logger; + public ClientConnectionHandler(Bootstrap bootstrap, + Dictionary channeldic, + ILoggerFactory loggerFactory) + { + this.bootstrap = bootstrap; + this.channeldic = channeldic; + logger = loggerFactory.CreateLogger(); + } + public override void ChannelInactive(IChannelHandlerContext context) + { + Policy.HandleResult(context.Channel.Open) + .WaitAndRetryForeverAsync(retryAttempt => + { + return retryAttempt > 20 ? TimeSpan.FromSeconds(Math.Pow(2, 50)) : TimeSpan.FromSeconds(Math.Pow(2, retryAttempt));//超过重试20次,之后重试都是接近12个小时重试一次 + }, + (exception, timespan, ctx) => + { + logger.LogError($"服务端断开{context.Channel.RemoteAddress},重试结果{exception.Result},重试次数{timespan},下次重试间隔(s){ctx.TotalSeconds}"); + }) + .ExecuteAsync(async () => + { + try + { + var oldChannel = channeldic.FirstOrDefault(m => m.Value == context.Channel); + if (default(KeyValuePair).Equals(oldChannel)) + { + if(logger.IsEnabled( LogLevel.Debug)) + logger.LogDebug($"服务器已经删除了{oldChannel.Key}远程服务器配置"); + return true; + } + var channel = await bootstrap.ConnectAsync(context.Channel.RemoteAddress); + channeldic.Remove(oldChannel.Key); + channeldic.Add(oldChannel.Key, channel); + return channel.Open; + } + catch (Exception ex) + { + logger.LogError($"服务端断开后{context.Channel.RemoteAddress},重连异常:{ex}"); + return false; + } + }); + } + + public override void ChannelRead(IChannelHandlerContext context, object message) + { + if (logger.IsEnabled(LogLevel.Debug)) + { + logger.LogError($"服务端返回消息{message}"); + } + } + + public override void ExceptionCaught(IChannelHandlerContext context, Exception exception) + { + logger.LogError($"服务端Exception: {exception}"); + context.CloseAsync(); + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808.Gateway.Transmit.csproj b/src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808.Gateway.Transmit.csproj new file mode 100644 index 0000000..6d706d4 --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808.Gateway.Transmit.csproj @@ -0,0 +1,39 @@ + + + + + netstandard2.1 + 8.0 + Copyright 2019. + SmallChi(Koike) + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + https://github.com/SmallChi/JT808Gateway/blob/master/LICENSE + false + $(JT808GatewayPackageVersion) + false + LICENSE + true + JT808.Gateway.Transmit + JT808.Gateway.Transmit + 基于DotNetty实现的JT808数据转发服务 + 基于DotNetty实现的JT808数据转发服务 + LICENSE + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808TransmitExtensions.cs b/src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808TransmitExtensions.cs new file mode 100644 index 0000000..5667ea2 --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808TransmitExtensions.cs @@ -0,0 +1,40 @@ +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Text; +using JT808.Protocol; +using Microsoft.Extensions.Configuration; +using JT808.Gateway.Abstractions; +using JT808.Gateway.Transmit.Configs; + +namespace JT808.Gateway.Transmit +{ + public static class JT808TransmitExtensions + { + /// + /// 独享转发服务(不同的消费者实例) + /// + /// + /// + /// + public static IJT808ClientBuilder AddInprocJT808Transmit(this IJT808ClientBuilder jT808ClientBuilder,IConfiguration configuration) + { + jT808ClientBuilder.JT808Builder.Services.Configure(configuration.GetSection("RemoteServerOptions")); + jT808ClientBuilder.JT808Builder.Services.AddSingleton(); + jT808ClientBuilder.JT808Builder.Services.AddHostedService(); + return jT808ClientBuilder; + } + /// + /// 共享转发服务(消费者单实例) + /// + /// + /// + /// + public static IJT808ClientBuilder AddShareJT808Transmit(this IJT808ClientBuilder jT808ClientBuilder, IConfiguration configuration) + { + jT808ClientBuilder.JT808Builder.Services.Configure(configuration.GetSection("RemoteServerOptions")); + jT808ClientBuilder.JT808Builder.Services.AddSingleton(); + return jT808ClientBuilder; + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808TransmitHostedService.cs b/src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808TransmitHostedService.cs new file mode 100644 index 0000000..087a905 --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808TransmitHostedService.cs @@ -0,0 +1,33 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using System.Threading; +using JT808.Gateway.Abstractions; + +namespace JT808.Gateway.Transmit +{ + public class JT808TransmitHostedService:IHostedService + { + private readonly JT808TransmitService jT808TransmitService; + private readonly IJT808MsgConsumer jT808MsgConsumer; + public JT808TransmitHostedService( + IJT808MsgConsumer jT808MsgConsumer, + JT808TransmitService jT808TransmitService) + { + this.jT808TransmitService = jT808TransmitService; + this.jT808MsgConsumer = jT808MsgConsumer; + } + + public Task StartAsync(CancellationToken cancellationToken) + { + jT808MsgConsumer.Subscribe(); + jT808MsgConsumer.OnMessage(jT808TransmitService.Send); + return Task.CompletedTask; + } + + public Task StopAsync(CancellationToken cancellationToken) + { + jT808MsgConsumer.Unsubscribe(); + return Task.CompletedTask; + } + } +} diff --git a/src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808TransmitService.cs b/src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808TransmitService.cs new file mode 100644 index 0000000..d0847f6 --- /dev/null +++ b/src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808TransmitService.cs @@ -0,0 +1,236 @@ +using DotNetty.Buffers; +using DotNetty.Transport.Bootstrapping; +using DotNetty.Transport.Channels; +using DotNetty.Transport.Channels.Sockets; +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using System.Linq; +using JT808.Gateway.Transmit.Configs; +using JT808.Gateway.Transmit.Handlers; + +namespace JT808.Gateway.Transmit +{ + public class JT808TransmitService + { + private readonly ILogger logger; + private readonly ILoggerFactory loggerFactory; + private IOptionsMonitor optionsMonitor; + public Dictionary channeldic = new Dictionary(); + public JT808TransmitService(ILoggerFactory loggerFactory, + IOptionsMonitor optionsMonitor) + { + this.loggerFactory = loggerFactory; + logger = loggerFactory.CreateLogger("JT808TransmitService"); + this.optionsMonitor = optionsMonitor; + InitialDispatcherClient(); + } + public void Send((string TerminalNo, byte[] Data) parameter) + { + if (optionsMonitor.CurrentValue.DataTransfer != null) + { + foreach (var item in optionsMonitor.CurrentValue.DataTransfer) + { + if (channeldic.TryGetValue($"all_{item.Host}", out var allClientChannel)) + { + try + { + if (allClientChannel.Open) + { + if (logger.IsEnabled(LogLevel.Debug)) + { + logger.LogDebug($"转发所有数据到该网关{item.Host}"); + } + allClientChannel.WriteAndFlushAsync(Unpooled.WrappedBuffer(parameter.Data)); + } + else + { + logger.LogError($"{item.Host}链接已关闭"); + } + } + catch (Exception ex) + { + logger.LogError($"{item.Host}发送数据出现异常:{ex}"); + } + } + else + { + if (item.TerminalNos.Contains(parameter.TerminalNo) && channeldic.TryGetValue($"{parameter.TerminalNo}_{item.Host}", out var clientChannel)) + { + try + { + if (clientChannel.Open) + { + if (logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug)) + logger.LogDebug($"转发{parameter.TerminalNo}到该网关{item.Host}"); + clientChannel.WriteAndFlushAsync(Unpooled.WrappedBuffer(parameter.Data)); + } + else + { + logger.LogError($"{item.Host},{parameter.TerminalNo}链接已关闭"); + } + } + catch (Exception ex) + { + logger.LogError($"{item.Host},{parameter.TerminalNo}发送数据出现异常:{ex}"); + } + } + } + } + } + } + + public void InitialDispatcherClient() + { + Task.Run(async () => + { + var group = new MultithreadEventLoopGroup(); + var bootstrap = new Bootstrap(); + bootstrap.Group(group) + .Channel() + .Option(ChannelOption.TcpNodelay, true) + .Handler(new ActionChannelInitializer(channel => + { + IChannelPipeline pipeline = channel.Pipeline; + pipeline.AddLast(new ClientConnectionHandler(bootstrap, channeldic, loggerFactory)); + })); + optionsMonitor.OnChange(options => + { + List lastRemoteServers = new List(); + if (options.DataTransfer != null) + { + if (options.DataTransfer.Any()) + { + foreach (var item in options.DataTransfer) + { + if (item.TerminalNos != null) + { + if (item.TerminalNos.Any()) + { + foreach (var terminal in item.TerminalNos) + { + lastRemoteServers.Add($"{terminal}_{item.Host}"); + } + } + else + { + lastRemoteServers.Add($"all_{item.Host}"); + } + } + else + { + lastRemoteServers.Add($"all_{item.Host}"); + } + } + } + } + DelRemoteServsers(lastRemoteServers); + AddRemoteServsers(bootstrap, lastRemoteServers); + }); + await InitRemoteServsers(bootstrap); + }); + } + /// + /// 初始化远程服务器 + /// + /// + /// + /// + private async Task InitRemoteServsers(Bootstrap bootstrap) + { + List remoteServers = new List(); + if (optionsMonitor.CurrentValue.DataTransfer != null) + { + if (optionsMonitor.CurrentValue.DataTransfer.Any()) + { + foreach (var item in optionsMonitor.CurrentValue.DataTransfer) + { + if (item.TerminalNos != null) + { + if (item.TerminalNos.Any()) + { + foreach (var terminal in item.TerminalNos) + { + remoteServers.Add($"{terminal}_{item.Host}"); + } + } + else + { + remoteServers.Add($"all_{item.Host}"); + } + } + else + { + remoteServers.Add($"all_{item.Host}"); + } + } + } + } + foreach (var item in remoteServers) + { + try + { + string ip_port = item.Split('_')[1]; + IChannel clientChannel = await bootstrap.ConnectAsync(new IPEndPoint(IPAddress.Parse(ip_port.Split(':')[0]), int.Parse(ip_port.Split(':')[1]))); + channeldic.Add(item, clientChannel); + if (clientChannel.Open) + { + if (logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug)) + { + logger.LogDebug($"该终端{item.Replace("_", "已连接上该服务器")}"); + } + } + } + catch (Exception ex) + { + logger.LogError($"初始化配置链接远程服务端{item},链接异常:{ex}"); + } + } + await Task.CompletedTask; + } + /// + /// 动态删除远程服务器 + /// + /// + private void DelRemoteServsers(List lastRemoteServers) + { + var delChannels = channeldic.Keys.Except(lastRemoteServers).ToList(); + foreach (var item in delChannels) + { + channeldic[item].CloseAsync(); + channeldic.Remove(item); + } + } + /// + /// 动态添加远程服务器 + /// + /// + /// + private void AddRemoteServsers(Bootstrap bootstrap, List lastRemoteServers) + { + var addChannels = lastRemoteServers.Except(channeldic.Keys).ToList(); + foreach (var item in addChannels) + { + try + { + var ip_port = item.Split('_')[1]; + IChannel clientChannel = bootstrap.ConnectAsync(new IPEndPoint(IPAddress.Parse(ip_port.Split(':')[0]), int.Parse(ip_port.Split(':')[1]))).Result; + channeldic.Add(item, clientChannel); + if (clientChannel.Open) { + if (logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug)) + { + logger.LogDebug($"该终端{item.Replace("_", "已连接上该服务器")}"); + } + } + } + catch (Exception ex) + { + logger.LogError($"变更配置后链接远程服务端{item},重连异常:{ex}"); + } + } + } + } +} diff --git a/src/JT808.Gateway.sln b/src/JT808.Gateway.sln index e171f8b..dc20363 100644 --- a/src/JT808.Gateway.sln +++ b/src/JT808.Gateway.sln @@ -13,6 +13,20 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT808.Gateway.Abstractions" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT808.Gateway.Kafka", "JT808.Gateway.Kafka\JT808.Gateway.Kafka.csproj", "{274C048E-A8E3-4422-A578-A10A97DF36F2}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Services", "Services", "{3EF8490D-C993-49D8-8A3D-493B7F259D70}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT808.Gateway.MsgIdHandler", "JT808.Gateway.Services\JT808.Gateway.MsgIdHandler\JT808.Gateway.MsgIdHandler.csproj", "{D62E3054-6924-4F1A-9BEF-E52B191F16B6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT808.Gateway.MsgLogging", "JT808.Gateway.Services\JT808.Gateway.MsgLogging\JT808.Gateway.MsgLogging.csproj", "{A242A839-4F00-4434-A7E8-7E3BEBA5B75C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT808.Gateway.SessionNotice", "JT808.Gateway.Services\JT808.Gateway.SessionNotice\JT808.Gateway.SessionNotice.csproj", "{1CB84599-5F56-4461-A451-DF16E3854AB9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT808.Gateway.ReplyMessage", "JT808.Gateway.Services\JT808.Gateway.ReplyMessage\JT808.Gateway.ReplyMessage.csproj", "{604BB5CF-9ED1-4D78-9328-59436E2B4EB4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT808.Gateway.Transmit", "JT808.Gateway.Services\JT808.Gateway.Transmit\JT808.Gateway.Transmit.csproj", "{598E445A-AF2E-42F0-98F4-18EC22E473FC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT808.Gateway.Traffic", "JT808.Gateway.Services\JT808.Gateway.Traffic\JT808.Gateway.Traffic.csproj", "{8FCC6D65-8A49-4AE7-8B19-F255100849D6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,10 +53,42 @@ Global {274C048E-A8E3-4422-A578-A10A97DF36F2}.Debug|Any CPU.Build.0 = Debug|Any CPU {274C048E-A8E3-4422-A578-A10A97DF36F2}.Release|Any CPU.ActiveCfg = Release|Any CPU {274C048E-A8E3-4422-A578-A10A97DF36F2}.Release|Any CPU.Build.0 = Release|Any CPU + {D62E3054-6924-4F1A-9BEF-E52B191F16B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D62E3054-6924-4F1A-9BEF-E52B191F16B6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D62E3054-6924-4F1A-9BEF-E52B191F16B6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D62E3054-6924-4F1A-9BEF-E52B191F16B6}.Release|Any CPU.Build.0 = Release|Any CPU + {A242A839-4F00-4434-A7E8-7E3BEBA5B75C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A242A839-4F00-4434-A7E8-7E3BEBA5B75C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A242A839-4F00-4434-A7E8-7E3BEBA5B75C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A242A839-4F00-4434-A7E8-7E3BEBA5B75C}.Release|Any CPU.Build.0 = Release|Any CPU + {1CB84599-5F56-4461-A451-DF16E3854AB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1CB84599-5F56-4461-A451-DF16E3854AB9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1CB84599-5F56-4461-A451-DF16E3854AB9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1CB84599-5F56-4461-A451-DF16E3854AB9}.Release|Any CPU.Build.0 = Release|Any CPU + {604BB5CF-9ED1-4D78-9328-59436E2B4EB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {604BB5CF-9ED1-4D78-9328-59436E2B4EB4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {604BB5CF-9ED1-4D78-9328-59436E2B4EB4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {604BB5CF-9ED1-4D78-9328-59436E2B4EB4}.Release|Any CPU.Build.0 = Release|Any CPU + {598E445A-AF2E-42F0-98F4-18EC22E473FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {598E445A-AF2E-42F0-98F4-18EC22E473FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {598E445A-AF2E-42F0-98F4-18EC22E473FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {598E445A-AF2E-42F0-98F4-18EC22E473FC}.Release|Any CPU.Build.0 = Release|Any CPU + {8FCC6D65-8A49-4AE7-8B19-F255100849D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8FCC6D65-8A49-4AE7-8B19-F255100849D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8FCC6D65-8A49-4AE7-8B19-F255100849D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8FCC6D65-8A49-4AE7-8B19-F255100849D6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {D62E3054-6924-4F1A-9BEF-E52B191F16B6} = {3EF8490D-C993-49D8-8A3D-493B7F259D70} + {A242A839-4F00-4434-A7E8-7E3BEBA5B75C} = {3EF8490D-C993-49D8-8A3D-493B7F259D70} + {1CB84599-5F56-4461-A451-DF16E3854AB9} = {3EF8490D-C993-49D8-8A3D-493B7F259D70} + {604BB5CF-9ED1-4D78-9328-59436E2B4EB4} = {3EF8490D-C993-49D8-8A3D-493B7F259D70} + {598E445A-AF2E-42F0-98F4-18EC22E473FC} = {3EF8490D-C993-49D8-8A3D-493B7F259D70} + {8FCC6D65-8A49-4AE7-8B19-F255100849D6} = {3EF8490D-C993-49D8-8A3D-493B7F259D70} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {AA9303A7-6FB3-4572-88AA-3302E85330D1} EndGlobalSection diff --git a/src/JT808.Gateway/JT808.Gateway.csproj b/src/JT808.Gateway/JT808.Gateway.csproj index ff072a0..ae6c5df 100644 --- a/src/JT808.Gateway/JT808.Gateway.csproj +++ b/src/JT808.Gateway/JT808.Gateway.csproj @@ -1,5 +1,5 @@  - + netstandard2.1 8.0 @@ -17,7 +17,7 @@ 基于Pipeline实现的JT808Gateway的网络库 JT808.Gateway JT808.Gateway - 1.0.0-preview2 + $(JT808GatewayPackageVersion) diff --git a/src/JT808.Gateway/JT808TcpServer.cs b/src/JT808.Gateway/JT808TcpServer.cs index 969cab8..5d0d1e6 100644 --- a/src/JT808.Gateway/JT808TcpServer.cs +++ b/src/JT808.Gateway/JT808TcpServer.cs @@ -25,8 +25,6 @@ namespace JT808.Gateway { private Socket server; - private const byte beginAndEndMark = 0x7e; - private readonly ILogger Logger; private readonly JT808SessionManager SessionManager; @@ -160,13 +158,13 @@ namespace JT808.Gateway SequenceReader seqReader = new SequenceReader(buffer); if (seqReader.TryPeek(out byte beginMark)) { - if (beginMark != beginAndEndMark) throw new ArgumentException("Not JT808 Packages."); + if (beginMark != JT808Package.BeginFlag) throw new ArgumentException("Not JT808 Packages."); } byte mark = 0; long totalConsumed = 0; while (!seqReader.End) { - if (seqReader.IsNext(beginAndEndMark, advancePast: true)) + if (seqReader.IsNext(JT808Package.BeginFlag, advancePast: true)) { if (mark == 1) { diff --git a/src/Version.props b/src/Version.props index 8f15eb1..d66faca 100644 --- a/src/Version.props +++ b/src/Version.props @@ -1,5 +1,6 @@  2.3.1 + 1.0.0-preview3 \ No newline at end of file