From b0934f58ccc30307477cedd267a2318ef2bf1301 Mon Sep 17 00:00:00 2001 From: "SmallChi(Koike)" <564952747@qq.com> Date: Wed, 30 Jun 2021 17:36:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=861078=E6=89=A9=E5=B1=95=E7=9A=84809?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=88=B0809=E6=89=A9=E5=B1=95=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=B8=AD=E8=BF=9B=E8=A1=8C=E7=BB=9F=E4=B8=80=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dotnetcore.yml | 4 - README.md | 54 -- src/JT1078.sln | 29 - ...809.Protocol.Extensions.JT1078.Test.csproj | 21 - .../JT809_JT1078_0x1700Test.cs | 88 -- .../JT809_JT1078_0x1800Test.cs | 85 -- .../JT809_JT1078_0x1900Test.cs | 174 ---- .../JT809_JT1078_0x1A00Test.cs | 97 --- .../JT809_JT1078_0x1B00Test.cs | 135 ---- .../JT809_JT1078_0x9700Test.cs | 50 -- .../JT809_JT1078_0x9800Test.cs | 93 --- .../JT809_JT1078_0x9900Test.cs | 114 --- .../JT809_JT1078_0x9A00Test.cs | 116 --- .../JT809_JT1078_0x9B00Test.cs | 145 ---- .../JT809_JT1078_AnalyzeTest.cs | 101 --- .../DependencyInjectionExtensions.cs | 20 - .../Enums/ControlType.cs | 20 - .../Enums/FastTime.cs | 16 - .../JT809_JT1078_0x1800_0x1801_Result.cs | 16 - .../JT809_JT1078_0x1800_0x1802_Result.cs | 14 - .../JT809_JT1078_0x1900_0x1902_Result.cs | 16 - .../JT809_JT1078_0x1A00_0x1A01_Result.cs | 16 - .../JT809_JT1078_0x1A00_0x1A02_Result.cs | 14 - .../JT809_JT1078_0x1B00_0x1B01_Result.cs | 16 - .../JT809_JT1078_0x1B00_0x1B02_Result.cs | 12 - .../JT809_JT1078_0x1B00_0x1B03_Result.cs | 14 - .../JT809_JT1078_0x9900_0x9901_Result.cs | 14 - .../JT809_JT1078_0x9B00_0x9B02_Result.cs | 14 - .../Enums/JT809_JT1078_0x9B00_0x9B03_Type.cs | 13 - .../Enums/JT809_JT1078_BusinessType.cs | 93 --- .../Enums/JT809_JT1078_SubBusinessType.cs | 181 ----- .../JT809MessagePackReaderExtentsion.cs | 12 - .../JT809_JT1078_0x9B00_0x9B03_Formatter.cs | 27 - .../JT809.Protocol.Extensions.JT1078.csproj | 34 - .../JT809.Protocol.Extensions.JT1078.xml | 751 ------------------ .../MessageBody/JT809_JT1078_0x1700.cs | 114 --- .../MessageBody/JT809_JT1078_0x1700_0x1701.cs | 64 -- .../MessageBody/JT809_JT1078_0x1700_0x1702.cs | 19 - .../MessageBody/JT809_JT1078_0x1800.cs | 113 --- .../MessageBody/JT809_JT1078_0x1800_0x1801.cs | 63 -- .../MessageBody/JT809_JT1078_0x1800_0x1802.cs | 45 -- .../MessageBody/JT809_JT1078_0x1900.cs | 114 --- .../MessageBody/JT809_JT1078_0x1900_0x1901.cs | 78 -- .../MessageBody/JT809_JT1078_0x1900_0x1902.cs | 89 --- .../MessageBody/JT809_JT1078_0x1900_Record.cs | 175 ---- .../MessageBody/JT809_JT1078_0x1A00.cs | 111 --- .../MessageBody/JT809_JT1078_0x1A00_0x1A01.cs | 63 -- .../MessageBody/JT809_JT1078_0x1A00_0x1A02.cs | 42 - .../MessageBody/JT809_JT1078_0x1B00.cs | 111 --- .../MessageBody/JT809_JT1078_0x1B00_0x1B01.cs | 53 -- .../MessageBody/JT809_JT1078_0x1B00_0x1B02.cs | 97 --- .../MessageBody/JT809_JT1078_0x1B00_0x1B03.cs | 42 - .../MessageBody/JT809_JT1078_0x9700.cs | 111 --- .../MessageBody/JT809_JT1078_0x9700_0x9702.cs | 16 - .../MessageBody/JT809_JT1078_0x9800.cs | 111 --- .../MessageBody/JT809_JT1078_0x9800_0x9801.cs | 121 --- .../MessageBody/JT809_JT1078_0x9800_0x9802.cs | 103 --- .../MessageBody/JT809_JT1078_0x9900.cs | 111 --- .../MessageBody/JT809_JT1078_0x9900_0x9901.cs | 50 -- .../MessageBody/JT809_JT1078_0x9900_0x9902.cs | 190 ----- .../MessageBody/JT809_JT1078_0x9A00.cs | 111 --- .../MessageBody/JT809_JT1078_0x9A00_0x9A01.cs | 182 ----- .../MessageBody/JT809_JT1078_0x9A00_0x9A02.cs | 60 -- .../MessageBody/JT809_JT1078_0x9B00.cs | 114 --- .../MessageBody/JT809_JT1078_0x9B00_0x9B01.cs | 202 ----- .../MessageBody/JT809_JT1078_0x9B00_0x9B02.cs | 50 -- .../MessageBody/JT809_JT1078_0x9B00_0x9B03.cs | 53 -- 67 files changed, 5597 deletions(-) delete mode 100644 src/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj delete mode 100644 src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1700Test.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1800Test.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1900Test.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1A00Test.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1B00Test.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9700Test.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9800Test.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9900Test.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9A00Test.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9B00Test.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_AnalyzeTest.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/DependencyInjectionExtensions.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Enums/ControlType.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Enums/FastTime.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1800_0x1801_Result.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1800_0x1802_Result.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1900_0x1902_Result.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1A00_0x1A01_Result.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1A00_0x1A02_Result.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B01_Result.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B02_Result.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B03_Result.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9900_0x9901_Result.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9B00_0x9B02_Result.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9B00_0x9B03_Type.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_BusinessType.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_SubBusinessType.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Extensions/JT809MessagePackReaderExtentsion.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9B00_0x9B03_Formatter.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj delete mode 100644 src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.xml delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1701.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1702.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1801.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1802.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1901.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1902.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_Record.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A01.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A02.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B01.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B02.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B03.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700_0x9702.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9801.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9802.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9901.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9902.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A01.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A02.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B01.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B02.cs delete mode 100644 src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B03.cs diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index b8dbcb4..16bd507 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -17,7 +17,3 @@ jobs: run: dotnet --info - name: dotnet restore run: dotnet restore ./src/JT1078.sln - - name: dotnet JT809.Protocol.Extensions.JT1078.Test build - run: dotnet build ./src/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj - - name: dotnet JT809.Protocol.Extensions.JT1078.Test test - run: dotnet test ./src/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj diff --git a/README.md b/README.md index f1e5844..26b9087 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ | Install-Package JT1078.Flv | ![JT1078.Flv](https://img.shields.io/nuget/v/JT1078.Flv.svg) | ![JT1078.Flv](https://img.shields.io/nuget/dt/JT1078.Flv.svg) | | Install-Package JT1078.Hls | ![JT1078.Hls](https://img.shields.io/nuget/v/JT1078.Hls.svg) | ![JT1078.Hls](https://img.shields.io/nuget/dt/JT1078.Hls.svg) | | Install-Package JT1078.FMp4 | ![JT1078.FMp4](https://img.shields.io/nuget/v/JT1078.FMp4.svg) | ![JT1078.FMp4](https://img.shields.io/nuget/dt/JT1078.FMp4.svg) | -| Install-Package JT809.Protocol.Extensions.JT1078 | ![JT809.Protocol.Extensions.JT1078](https://img.shields.io/nuget/v/JT809.Protocol.Extensions.JT1078.svg) | ![JT809](https://img.shields.io/nuget/dt/JT809.Protocol.Extensions.JT1078.svg) | ## 基于JT1078音视频流数据的RTP协议 @@ -213,56 +212,3 @@ Platform=AnyCpu Server=False Toolchain=.NET Core 3.1 | **EXPGolombReader** | **100000** | **11,687.72 us** | **162.828 us** | **152.309 us** | **1515.6250** | **-** | **-** | **9375 KB** | | H264Decoder | 100000 | 1,192,549.87 us | 7,656.632 us | 7,162.018 us | 128000.0000 | 3000.0000 | - | 786718.75 KB | | FlvEncoder | 100000 | 216,951.31 us | 3,513.653 us | 2,934.059 us | 249333.3333 | - | - | 1528906.66 KB | - -## 基于JT809扩展的JT1078消息协议 - -### JT809扩展协议消息对照表 - -#### 主链路动态信息交换消息 - -| 序号 | 消息ID | 完成情况 | 测试情况 | 消息体名称 | -| :---: | :-----------: | :------: | :------: | :----------------------------: | -| 1 | 0x1700 | √ | √ | 主链路时效口令交互消息 | -| 2 | 0x1700_0x1701 | √ | √ | 时效口令上报消息(有疑问:数据体有问题) | -| 3 | 0x1700_0x1702 | √ | √ | 时效口令请求消息 | -| 4 | 0x1800 | √ | √ | 主链路实时音视频交互消息 | -| 5 | 0x1800_0x1801 | √ | √ | 实时音视频请求应答消息 | -| 6 | 0x1800_0x1802 | √ | √ | 主动请求停止实时音视频传输应答消息 | -| 7 | 0x1900 | √ | √ | 主链路远程录像检索 | -| 8 | 0x1900_0x1901 | √ | √ | 主动上传音视频资源目录信息消息 | -| 9 | 0x1900_0x1902 | √ | √ | 查询音视频资源目录应答消息 | -| 10 | 0x1A00 | √ | √ | 主链路远程录像回放交互消息 | -| 11 | 0x1A00_0x1A01 | √ | √ | 远程录像回放请求应答消息 | -| 12 | 0x1A00_0x1A02 | √ | √ | 远程录像回放控制应答消息 | -| 13 | 0x1B00 | √ | √ | 主链路远程录像下载交互消息 | -| 14 | 0x1B00_0x1B01 | √ | √ | 远程录像下载请求应答消息 | -| 15 | 0x1B00_0x1B02 | √ | √ | 远程录像下载通知消息 | -| 16 | 0x1B00_0x1B03 | √ | √ | 远程录像下载控制应答消息 | - -#### 从链路动态信息交换消息 - -| 序号 | 消息ID | 完成情况 | 测试情况 | 消息体名称 | -| :---: | :-----------: | :------: | :------: | :----------------------------: | -| 17 | 0x9700 | √ | √ | 从链路时效口令交互消息 | -| 18 | 0x9700_0x9702 | √ | √ | 时效口令请求应答消息(有疑问:应该有应答结果) | -| 19 | 0x9800 | √ | √ | 从链路实时音视频交互信息 | -| 20 | 0x9800_0x9801 | √ | √ | 实时音视频请求消息 | -| 21 | 0x9800_0x9802 | √ | √ | 主动请求停止实时音视频传输消息 | -| 22 | 0x9900 | √ | √ | 从链路远程录像检索交互消息 | -| 23 | 0x9900_0x9901 | √ | √ | 主动上传音视频资源目录信息应答消息 | -| 24 | 0x9900_0x9902 | √ | √ | 查询音视频资源目录请求消息 | -| 25 | 0x9A00 | √ | √ | 从链路远程录像回放交互消息 | -| 26 | 0x9A00_0x9A01 | √ | √ | 远程录像回放请求消息 | -| 27 | 0x9A00_0x9A02 | √ | √ | 远程录像回放控制消息 | -| 28 | 0x9B00 | √ | √ | 从链路远程录像下载交互消息 | -| 29 | 0x9B00_0x9B01 | √ | √ | 远程录像下载请求消息 | -| 30 | 0x9B00_0x9B02 | √ | √ | 远程录像下载完成通知应答消息 | -| 31 | 0x9B00_0x9B03 | √ | √ | 远程录像下载控制消息 | - -### 使用方法 - -```dotnet -IServiceCollection serviceDescriptors1 = new ServiceCollection(); -serviceDescriptors1.AddJT809Configure() - .AddJT1078Configure(); -``` diff --git a/src/JT1078.sln b/src/JT1078.sln index 82f27ac..128d3ef 100644 --- a/src/JT1078.sln +++ b/src/JT1078.sln @@ -3,12 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29020.237 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT809.Protocol.Extensions.JT1078", "JT809.Protocol.Extensions.JT1078\JT809.Protocol.Extensions.JT1078.csproj", "{2F987285-EB7A-4934-909E-50E42A2D1140}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT1078.Protocol", "JT1078.Protocol\JT1078.Protocol.csproj", "{60CAC24B-7317-48BF-9DBF-7F3ECA3689A4}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT809.Protocol.Extensions.JT1078.Test", "JT809.Protocol.Extensions.JT1078.Test\JT809.Protocol.Extensions.JT1078.Test.csproj", "{E9FF2716-EF30-4180-879B-E8AB979ACFF3}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT1078.Protocol.Test", "JT1078.Protocol.Test\JT1078.Protocol.Test.csproj", "{9ADD82F9-E0B2-4263-8573-151F673BB33F}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{0655AF84-E578-409F-AB0E-B47E0D2F6814}" @@ -48,18 +44,6 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2F987285-EB7A-4934-909E-50E42A2D1140}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2F987285-EB7A-4934-909E-50E42A2D1140}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2F987285-EB7A-4934-909E-50E42A2D1140}.Debug|x64.ActiveCfg = Debug|Any CPU - {2F987285-EB7A-4934-909E-50E42A2D1140}.Debug|x64.Build.0 = Debug|Any CPU - {2F987285-EB7A-4934-909E-50E42A2D1140}.Debug|x86.ActiveCfg = Debug|Any CPU - {2F987285-EB7A-4934-909E-50E42A2D1140}.Debug|x86.Build.0 = Debug|Any CPU - {2F987285-EB7A-4934-909E-50E42A2D1140}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2F987285-EB7A-4934-909E-50E42A2D1140}.Release|Any CPU.Build.0 = Release|Any CPU - {2F987285-EB7A-4934-909E-50E42A2D1140}.Release|x64.ActiveCfg = Release|Any CPU - {2F987285-EB7A-4934-909E-50E42A2D1140}.Release|x64.Build.0 = Release|Any CPU - {2F987285-EB7A-4934-909E-50E42A2D1140}.Release|x86.ActiveCfg = Release|Any CPU - {2F987285-EB7A-4934-909E-50E42A2D1140}.Release|x86.Build.0 = Release|Any CPU {60CAC24B-7317-48BF-9DBF-7F3ECA3689A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {60CAC24B-7317-48BF-9DBF-7F3ECA3689A4}.Debug|Any CPU.Build.0 = Debug|Any CPU {60CAC24B-7317-48BF-9DBF-7F3ECA3689A4}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -72,18 +56,6 @@ Global {60CAC24B-7317-48BF-9DBF-7F3ECA3689A4}.Release|x64.Build.0 = Release|Any CPU {60CAC24B-7317-48BF-9DBF-7F3ECA3689A4}.Release|x86.ActiveCfg = Release|Any CPU {60CAC24B-7317-48BF-9DBF-7F3ECA3689A4}.Release|x86.Build.0 = Release|Any CPU - {E9FF2716-EF30-4180-879B-E8AB979ACFF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E9FF2716-EF30-4180-879B-E8AB979ACFF3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E9FF2716-EF30-4180-879B-E8AB979ACFF3}.Debug|x64.ActiveCfg = Debug|Any CPU - {E9FF2716-EF30-4180-879B-E8AB979ACFF3}.Debug|x64.Build.0 = Debug|Any CPU - {E9FF2716-EF30-4180-879B-E8AB979ACFF3}.Debug|x86.ActiveCfg = Debug|Any CPU - {E9FF2716-EF30-4180-879B-E8AB979ACFF3}.Debug|x86.Build.0 = Debug|Any CPU - {E9FF2716-EF30-4180-879B-E8AB979ACFF3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E9FF2716-EF30-4180-879B-E8AB979ACFF3}.Release|Any CPU.Build.0 = Release|Any CPU - {E9FF2716-EF30-4180-879B-E8AB979ACFF3}.Release|x64.ActiveCfg = Release|Any CPU - {E9FF2716-EF30-4180-879B-E8AB979ACFF3}.Release|x64.Build.0 = Release|Any CPU - {E9FF2716-EF30-4180-879B-E8AB979ACFF3}.Release|x86.ActiveCfg = Release|Any CPU - {E9FF2716-EF30-4180-879B-E8AB979ACFF3}.Release|x86.Build.0 = Release|Any CPU {9ADD82F9-E0B2-4263-8573-151F673BB33F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9ADD82F9-E0B2-4263-8573-151F673BB33F}.Debug|Any CPU.Build.0 = Debug|Any CPU {9ADD82F9-E0B2-4263-8573-151F673BB33F}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -209,7 +181,6 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {E9FF2716-EF30-4180-879B-E8AB979ACFF3} = {0655AF84-E578-409F-AB0E-B47E0D2F6814} {9ADD82F9-E0B2-4263-8573-151F673BB33F} = {0655AF84-E578-409F-AB0E-B47E0D2F6814} {77402142-54E5-4E64-8F9E-BCAAC2CD0E8D} = {807ADB1F-FED4-4A56-82D2-F08F1FB7C886} {D13FE092-1D11-4545-A322-9F06BCDAC0FD} = {0655AF84-E578-409F-AB0E-B47E0D2F6814} diff --git a/src/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj b/src/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj deleted file mode 100644 index 2330ad2..0000000 --- a/src/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - net5.0 - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - diff --git a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1700Test.cs b/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1700Test.cs deleted file mode 100644 index ebe9144..0000000 --- a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1700Test.cs +++ /dev/null @@ -1,88 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Extensions.JT1078.MessageBody; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Linq; -using System.Collections.Generic; -using Xunit; - -namespace JT809.Protocol.Extensions.JT1078.Test -{ - public class JT809_JT1078_0x1700Test - { - JT809Serializer JT809Serializer; - public JT809_JT1078_0x1700Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT809Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT809Serializer = defaultConfig.GetSerializer(); - } - - - - [Fact] - public void Test1() - { - var PlateFormIds = "01234567890"; - var AuthorizeCode1s = "0123456789012345678901234567890123456789012345678901234567890123"; - var AuthorizeCode2s = "0123456789012345678901234567890123456789012345678901234567890123"; - - JT809_JT1078_0x1700 jT809_JT1078_0x1700 = new JT809_JT1078_0x1700() - { - VehicleNo="粤B12345", - VehicleColor= Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType= (ushort)JT809_JT1078_SubBusinessType.时效口令上报消息, - SubBodies= new JT809_JT1078_0x1700_0x1701() { - PlateFormId= PlateFormIds, - AuthorizeCode1= AuthorizeCode1s, - AuthorizeCode2= AuthorizeCode2s - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x1700).ToHexString(); - Assert.Equal("D4C1423132333435000000000000000000000000000217010000008B30313233343536373839303031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323330313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233", hex); - } - - [Fact] - public void Test2() - { - var PlateFormIds = "01234567890"; - var AuthorizeCode1s = "0123456789012345678901234567890123456789012345678901234567890123"; - var AuthorizeCode2s = "0123456789012345678901234567890123456789012345678901234567890123"; - var jT809_JT1078_0x1700 = JT809Serializer.Deserialize("D4C1423132333435000000000000000000000000000217010000008B30313233343536373839303031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323330313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x1700.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x1700.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.时效口令上报消息, jT809_JT1078_0x1700.SubBusinessType); - var jT809_JT1078_0x1700_0x1701 = jT809_JT1078_0x1700.SubBodies as JT809_JT1078_0x1700_0x1701; - Assert.Equal(PlateFormIds, jT809_JT1078_0x1700_0x1701.PlateFormId); - Assert.Equal(AuthorizeCode1s, jT809_JT1078_0x1700_0x1701.AuthorizeCode1); - Assert.Equal(AuthorizeCode2s, jT809_JT1078_0x1700_0x1701.AuthorizeCode2); - } - - [Fact] - public void Test3() - { - JT809_JT1078_0x1700 jT809_JT1078_0x1700 = new JT809_JT1078_0x1700() - { - VehicleNo = "粤B12345", - VehicleColor = Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType = (ushort)JT809_JT1078_SubBusinessType.时效口令请求消息, - SubBodies = new JT809_JT1078_0x1700_0x1702() - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x1700).ToHexString(); - Assert.Equal("D4C14231323334350000000000000000000000000002170200000000", hex); - } - - [Fact] - public void Test4() - { - var jT809_JT1078_0x1700 = JT809Serializer.Deserialize("D4C14231323334350000000000000000000000000002170200000000".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x1700.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x1700.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.时效口令请求消息, jT809_JT1078_0x1700.SubBusinessType); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1800Test.cs b/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1800Test.cs deleted file mode 100644 index 993b7d3..0000000 --- a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1800Test.cs +++ /dev/null @@ -1,85 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Extensions.JT1078.MessageBody; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Linq; -using System.Collections.Generic; -using Xunit; - -namespace JT809.Protocol.Extensions.JT1078.Test -{ - public class JT809_JT1078_0x1800Test - { - JT809Serializer JT809Serializer; - public JT809_JT1078_0x1800Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT809Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT809Serializer = defaultConfig.GetSerializer(); - } - - - - [Fact] - public void Test1() - { - JT809_JT1078_0x1800 jT809_JT1078_0x1800 = new JT809_JT1078_0x1800() - { - VehicleNo="粤B12345", - VehicleColor= Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType= (ushort)JT809_JT1078_SubBusinessType.实时音视频请求应答消息, - SubBodies= new JT809_JT1078_0x1800_0x1801() { - ServerIp="127.0.0.1", - ServerPort=8080, - Result= JT809_JT1078_0x1800_0x1801_Result.失败 - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x1800).ToHexString(); - Assert.Equal("D4C142313233343500000000000000000000000000021801000000230100000000000000000000000000000000000000000000003132372E302E302E311F90", hex); - } - - [Fact] - public void Test2() - { - var jT809_JT1078_0x1800 = JT809Serializer.Deserialize("D4C142313233343500000000000000000000000000021801000000230100000000000000000000000000000000000000000000003132372E302E302E311F90".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x1800.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x1800.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.实时音视频请求应答消息, jT809_JT1078_0x1800.SubBusinessType); - var jT809_JT1078_0x1800_0x1801 = jT809_JT1078_0x1800.SubBodies as JT809_JT1078_0x1800_0x1801; - Assert.Equal("127.0.0.1", jT809_JT1078_0x1800_0x1801.ServerIp); - Assert.Equal(8080, jT809_JT1078_0x1800_0x1801.ServerPort); - Assert.Equal(1, (byte)jT809_JT1078_0x1800_0x1801.Result); - } - - [Fact] - public void Test3() - { - JT809_JT1078_0x1800 jT809_JT1078_0x1800 = new JT809_JT1078_0x1800() - { - VehicleNo = "粤B12345", - VehicleColor = Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType = (ushort)JT809_JT1078_SubBusinessType.主动请求停止实时音视频传输应答消息, - SubBodies = new JT809_JT1078_0x1800_0x1802() { - Result= JT809_JT1078_0x1800_0x1802_Result.失败 - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x1800).ToHexString(); - Assert.Equal("D4C1423132333435000000000000000000000000000218020000000101", hex); - } - - [Fact] - public void Test4() - { - var jT809_JT1078_0x1800 = JT809Serializer.Deserialize("D4C1423132333435000000000000000000000000000218020000000101".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x1800.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x1800.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.主动请求停止实时音视频传输应答消息, jT809_JT1078_0x1800.SubBusinessType); - var jT809_JT1078_0x1800_0x1802 = jT809_JT1078_0x1800.SubBodies as JT809_JT1078_0x1800_0x1802; - Assert.Equal(1, (byte)jT809_JT1078_0x1800_0x1802.Result); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1900Test.cs b/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1900Test.cs deleted file mode 100644 index c48631a..0000000 --- a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1900Test.cs +++ /dev/null @@ -1,174 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Extensions.JT1078.MessageBody; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Linq; -using System.Collections.Generic; -using Xunit; -using Newtonsoft.Json; - -namespace JT809.Protocol.Extensions.JT1078.Test -{ - public class JT809_JT1078_0x1900Test - { - JT809Serializer JT809Serializer; - public JT809_JT1078_0x1900Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT809Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT809Serializer = defaultConfig.GetSerializer(); - - Newtonsoft.Json.JsonConvert.DefaultSettings = new Func(() => - { - //日期类型默认格式化处理 - return new Newtonsoft.Json.JsonSerializerSettings - { - DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat, - DateFormatString = "yyyy-MM-dd HH:mm:ss" - }; - }); - } - - public object jT809_JT1078_0x1800 { get; private set; } - - [Fact] - public void Test1() - { - JT809_JT1078_0x1900 jT809_JT1078_0x1900 = new JT809_JT1078_0x1900() - { - VehicleNo="粤B12345", - VehicleColor= Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType= (ushort)JT809_JT1078_SubBusinessType.主动上传音视频资源目录信息消息, - SubBodies= new JT809_JT1078_0x1900_0x1901() { - ItemNum=2, - ItemList=new List { - new JT809_JT1078_0x1900_Record{ - AlarmType=1, - AVItemType=2, - ChannelId=3, - FileSize=4, - MemType=5, - StartTime=Convert.ToDateTime("2019-07-15 10:10:10"), - EndTime=Convert.ToDateTime("2019-07-16 10:10:10"), - StreamType=6 - }, - new JT809_JT1078_0x1900_Record{ - AlarmType=11, - AVItemType=21, - ChannelId=31, - FileSize=41, - MemType=51, - StartTime=Convert.ToDateTime("2019-06-15 10:10:10"), - EndTime=Convert.ToDateTime("2019-06-16 10:10:10"), - StreamType=61 - } - } - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x1900).ToHexString(); - Assert.Equal("D4C142313233343500000000000000000000000000021901000000440000000203000000005D2BE082000000005D2D32020000000000000001020605000000041F000000005D045382000000005D05A502000000000000000B153D3300000029", hex); - } - - [Fact] - public void Test2() - { - var jT809_JT1078_0x1900 = JT809Serializer.Deserialize("D4C142313233343500000000000000000000000000021901000000440000000203000000005D2BE082000000005D2D32020000000000000001020605000000041F000000005D045382000000005D05A502000000000000000B153D3300000029".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x1900.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x1900.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.主动上传音视频资源目录信息消息, jT809_JT1078_0x1900.SubBusinessType); - var jT809_JT1078_0x1900_0x1901 = jT809_JT1078_0x1900.SubBodies as JT809_JT1078_0x1900_0x1901; - Assert.Equal(2u, jT809_JT1078_0x1900_0x1901.ItemNum); - - Assert.Equal(1u, jT809_JT1078_0x1900_0x1901.ItemList[0].AlarmType); - Assert.Equal(2, jT809_JT1078_0x1900_0x1901.ItemList[0].AVItemType); - Assert.Equal(3, jT809_JT1078_0x1900_0x1901.ItemList[0].ChannelId); - Assert.Equal(4u, jT809_JT1078_0x1900_0x1901.ItemList[0].FileSize); - Assert.Equal(5, jT809_JT1078_0x1900_0x1901.ItemList[0].MemType); - Assert.Equal(Convert.ToDateTime("2019-07-15 10:10:10"), jT809_JT1078_0x1900_0x1901.ItemList[0].StartTime); - Assert.Equal(Convert.ToDateTime("2019-07-16 10:10:10"), jT809_JT1078_0x1900_0x1901.ItemList[0].EndTime); - Assert.Equal(6, jT809_JT1078_0x1900_0x1901.ItemList[0].StreamType); - - Assert.Equal(11u, jT809_JT1078_0x1900_0x1901.ItemList[1].AlarmType); - Assert.Equal(21, jT809_JT1078_0x1900_0x1901.ItemList[1].AVItemType); - Assert.Equal(31, jT809_JT1078_0x1900_0x1901.ItemList[1].ChannelId); - Assert.Equal(41u, jT809_JT1078_0x1900_0x1901.ItemList[1].FileSize); - Assert.Equal(51, jT809_JT1078_0x1900_0x1901.ItemList[1].MemType); - Assert.Equal(Convert.ToDateTime("2019-06-15 10:10:10"), jT809_JT1078_0x1900_0x1901.ItemList[1].StartTime); - Assert.Equal(Convert.ToDateTime("2019-06-16 10:10:10"), jT809_JT1078_0x1900_0x1901.ItemList[1].EndTime); - Assert.Equal(61, jT809_JT1078_0x1900_0x1901.ItemList[1].StreamType); - } - - [Fact] - public void Test3() - { - JT809_JT1078_0x1900 jT809_JT1078_0x1900 = new JT809_JT1078_0x1900() - { - VehicleNo = "粤B12345", - VehicleColor = Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType = (ushort)JT809_JT1078_SubBusinessType.查询音视频资源目录应答消息, - SubBodies = new JT809_JT1078_0x1900_0x1902() { - Result= JT809_JT1078_0x1900_0x1902_Result.失败, - ItemNum=2, - ItemList = new List { - new JT809_JT1078_0x1900_Record{ - AlarmType=1, - AVItemType=2, - ChannelId=3, - FileSize=4, - MemType=5, - StartTime=Convert.ToDateTime("2019-07-15 10:10:10"), - EndTime=Convert.ToDateTime("2019-07-16 10:10:10"), - StreamType=6 - }, - new JT809_JT1078_0x1900_Record{ - AlarmType=11, - AVItemType=21, - ChannelId=31, - FileSize=41, - MemType=51, - StartTime=Convert.ToDateTime("2019-06-15 10:10:10"), - EndTime=Convert.ToDateTime("2019-06-16 10:10:10"), - StreamType=61 - } - } - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x1900).ToHexString(); - Assert.Equal("D4C14231323334350000000000000000000000000002190200000045010000000203000000005D2BE082000000005D2D32020000000000000001020605000000041F000000005D045382000000005D05A502000000000000000B153D3300000029", hex); - } - - [Fact] - public void Test4() - { - var jT809_JT1078_0x1900 = JT809Serializer.Deserialize("D4C14231323334350000000000000000000000000002190200000045010000000203000000005D2BE082000000005D2D32020000000000000001020605000000041F000000005D045382000000005D05A502000000000000000B153D3300000029".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x1900.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x1900.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.查询音视频资源目录应答消息, jT809_JT1078_0x1900.SubBusinessType); - var jT809_JT1078_0x1900_0x1902 = jT809_JT1078_0x1900.SubBodies as JT809_JT1078_0x1900_0x1902; - Assert.Equal(2u, jT809_JT1078_0x1900_0x1902.ItemNum); - Assert.Equal(1, (byte)jT809_JT1078_0x1900_0x1902.Result); - - Assert.Equal(1u, jT809_JT1078_0x1900_0x1902.ItemList[0].AlarmType); - Assert.Equal(2, jT809_JT1078_0x1900_0x1902.ItemList[0].AVItemType); - Assert.Equal(3, jT809_JT1078_0x1900_0x1902.ItemList[0].ChannelId); - Assert.Equal(4u, jT809_JT1078_0x1900_0x1902.ItemList[0].FileSize); - Assert.Equal(5, jT809_JT1078_0x1900_0x1902.ItemList[0].MemType); - Assert.Equal(Convert.ToDateTime("2019-07-15 10:10:10"), jT809_JT1078_0x1900_0x1902.ItemList[0].StartTime); - Assert.Equal(Convert.ToDateTime("2019-07-16 10:10:10"), jT809_JT1078_0x1900_0x1902.ItemList[0].EndTime); - Assert.Equal(6, jT809_JT1078_0x1900_0x1902.ItemList[0].StreamType); - - Assert.Equal(11u, jT809_JT1078_0x1900_0x1902.ItemList[1].AlarmType); - Assert.Equal(21, jT809_JT1078_0x1900_0x1902.ItemList[1].AVItemType); - Assert.Equal(31, jT809_JT1078_0x1900_0x1902.ItemList[1].ChannelId); - Assert.Equal(41u, jT809_JT1078_0x1900_0x1902.ItemList[1].FileSize); - Assert.Equal(51, jT809_JT1078_0x1900_0x1902.ItemList[1].MemType); - Assert.Equal(Convert.ToDateTime("2019-06-15 10:10:10"), jT809_JT1078_0x1900_0x1902.ItemList[1].StartTime); - Assert.Equal(Convert.ToDateTime("2019-06-16 10:10:10"), jT809_JT1078_0x1900_0x1902.ItemList[1].EndTime); - Assert.Equal(61, jT809_JT1078_0x1900_0x1902.ItemList[1].StreamType); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1A00Test.cs b/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1A00Test.cs deleted file mode 100644 index 400f04d..0000000 --- a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1A00Test.cs +++ /dev/null @@ -1,97 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Extensions.JT1078.MessageBody; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Linq; -using System.Collections.Generic; -using Xunit; -using Newtonsoft.Json; - -namespace JT809.Protocol.Extensions.JT1078.Test -{ - public class JT809_JT1078_0x1A00Test - { - JT809Serializer JT809Serializer; - public JT809_JT1078_0x1A00Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT809Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT809Serializer = defaultConfig.GetSerializer(); - - Newtonsoft.Json.JsonConvert.DefaultSettings = new Func(() => - { - //日期类型默认格式化处理 - return new Newtonsoft.Json.JsonSerializerSettings - { - DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat, - DateFormatString = "yyyy-MM-dd HH:mm:ss" - }; - }); - } - - - - [Fact] - public void Test1() - { - JT809_JT1078_0x1A00 jT809_JT1078_0x1A00 = new JT809_JT1078_0x1A00() - { - VehicleNo="粤B12345", - VehicleColor= Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType= (ushort)JT809_JT1078_SubBusinessType.远程录像回放请求应答消息, - SubBodies= new JT809_JT1078_0x1A00_0x1A01() - { - Result= JT809_JT1078_0x1A00_0x1A01_Result.失败, - ServerIp="127.0.0.1", - ServerPort=8080 - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x1A00).ToHexString(); - Assert.Equal("D4C142313233343500000000000000000000000000021A010000002300000000000000000000000000000000000000000000003132372E302E302E311F9001", hex); - } - - [Fact] - public void Test2() - { - var jT809_JT1078_0x1A00 = JT809Serializer.Deserialize("D4C142313233343500000000000000000000000000021A010000002300000000000000000000000000000000000000000000003132372E302E302E311F9001".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x1A00.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x1A00.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.远程录像回放请求应答消息, jT809_JT1078_0x1A00.SubBusinessType); - var jT809_JT1078_0x1A00_0x1A01 = jT809_JT1078_0x1A00.SubBodies as JT809_JT1078_0x1A00_0x1A01; - Assert.Equal(1, (byte)jT809_JT1078_0x1A00_0x1A01.Result); - Assert.Equal("127.0.0.1", jT809_JT1078_0x1A00_0x1A01.ServerIp); - Assert.Equal(8080, jT809_JT1078_0x1A00_0x1A01.ServerPort); - } - - [Fact] - public void Test3() - { - JT809_JT1078_0x1A00 jT809_JT1078_0x1A00 = new JT809_JT1078_0x1A00() - { - VehicleNo = "粤B12345", - VehicleColor = Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType = (ushort)JT809_JT1078_SubBusinessType.远程录像回放控制应答消息, - SubBodies = new JT809_JT1078_0x1A00_0x1A02() { - Result= JT809_JT1078_0x1A00_0x1A02_Result.失败 - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x1A00).ToHexString(); - Assert.Equal("D4C142313233343500000000000000000000000000021A020000000101", hex); - } - - [Fact] - public void Test4() - { - var jT809_JT1078_0x1A00 = JT809Serializer.Deserialize("D4C142313233343500000000000000000000000000021A020000000101".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x1A00.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x1A00.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.远程录像回放控制应答消息, jT809_JT1078_0x1A00.SubBusinessType); - var jT809_JT1078_0x1A00_0x1A02 = jT809_JT1078_0x1A00.SubBodies as JT809_JT1078_0x1A00_0x1A02; - Assert.Equal(1, (byte)jT809_JT1078_0x1A00_0x1A02.Result); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1B00Test.cs b/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1B00Test.cs deleted file mode 100644 index 87ff30d..0000000 --- a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1B00Test.cs +++ /dev/null @@ -1,135 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Extensions.JT1078.MessageBody; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Linq; -using System.Collections.Generic; -using Xunit; -using Newtonsoft.Json; - -namespace JT809.Protocol.Extensions.JT1078.Test -{ - public class JT809_JT1078_0x1B00Test - { - JT809Serializer JT809Serializer; - public JT809_JT1078_0x1B00Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT809Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT809Serializer = defaultConfig.GetSerializer(); - - Newtonsoft.Json.JsonConvert.DefaultSettings = new Func(() => - { - //日期类型默认格式化处理 - return new Newtonsoft.Json.JsonSerializerSettings - { - DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat, - DateFormatString = "yyyy-MM-dd HH:mm:ss" - }; - }); - } - - - - [Fact] - public void Test1() - { - JT809_JT1078_0x1B00 jT809_JT1078_0x1B00 = new JT809_JT1078_0x1B00() - { - VehicleNo="粤B12345", - VehicleColor= Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType= (ushort)JT809_JT1078_SubBusinessType.远程录像下载请求应答消息, - SubBodies= new JT809_JT1078_0x1B00_0x1B01() - { - Result= JT809_JT1078_0x1B00_0x1B01_Result.失败, - SessionId=2 - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x1B00).ToHexString(); - Assert.Equal("D4C142313233343500000000000000000000000000021B0100000003010002", hex); - } - - [Fact] - public void Test2() - { - var jT809_JT1078_0x1B00 = JT809Serializer.Deserialize("D4C142313233343500000000000000000000000000021B0100000003010002".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x1B00.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x1B00.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.远程录像下载请求应答消息, jT809_JT1078_0x1B00.SubBusinessType); - var jT809_JT1078_0x1B00_0x1B01 = jT809_JT1078_0x1B00.SubBodies as JT809_JT1078_0x1B00_0x1B01; - Assert.Equal(1, (byte)jT809_JT1078_0x1B00_0x1B01.Result); - Assert.Equal(2, (byte)jT809_JT1078_0x1B00_0x1B01.SessionId); - } - - [Fact] - public void Test3() - { - JT809_JT1078_0x1B00 jT809_JT1078_0x1B00 = new JT809_JT1078_0x1B00() - { - VehicleNo = "粤B12345", - VehicleColor = Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType = (ushort)JT809_JT1078_SubBusinessType.远程录像下载通知消息, - SubBodies = new JT809_JT1078_0x1B00_0x1B02() { - Result= JT809_JT1078_0x1B00_0x1B02_Result.失败, - UserName="tk", - SessionId=2, - ServerIp="127.0.0.1", - FilePath="D://123/456", - Password="tk123456", - TcpPort=8080 - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x1B00).ToHexString(); - Assert.Equal("D4C142313233343500000000000000000000000000021B020000013401000200000000000000000000000000000000000000000000003132372E302E302E311F900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000746B0000000000000000000000000000746B313233343536000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000443A2F2F3132332F343536", hex); - } - - [Fact] - public void Test4() - { - var jT809_JT1078_0x1B00 = JT809Serializer.Deserialize("D4C142313233343500000000000000000000000000021B020000013401000200000000000000000000000000000000000000000000003132372E302E302E311F900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000746B0000000000000000000000000000746B313233343536000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000443A2F2F3132332F343536".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x1B00.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x1B00.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.远程录像下载通知消息, jT809_JT1078_0x1B00.SubBusinessType); - var jT809_JT1078_0x1B00_0x1B02 = jT809_JT1078_0x1B00.SubBodies as JT809_JT1078_0x1B00_0x1B02; - Assert.Equal(1, (byte)jT809_JT1078_0x1B00_0x1B02.Result); - Assert.Equal("tk", jT809_JT1078_0x1B00_0x1B02.UserName); - Assert.Equal(2, jT809_JT1078_0x1B00_0x1B02.SessionId); - Assert.Equal("127.0.0.1", jT809_JT1078_0x1B00_0x1B02.ServerIp); - Assert.Equal("D://123/456", jT809_JT1078_0x1B00_0x1B02.FilePath); - Assert.Equal("tk123456", jT809_JT1078_0x1B00_0x1B02.Password); - Assert.Equal(8080, jT809_JT1078_0x1B00_0x1B02.TcpPort); - } - - [Fact] - public void Test5() - { - JT809_JT1078_0x1B00 jT809_JT1078_0x1B00 = new JT809_JT1078_0x1B00() - { - VehicleNo = "粤B12345", - VehicleColor = Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType = (ushort)JT809_JT1078_SubBusinessType.远程录像下载控制应答消息, - SubBodies = new JT809_JT1078_0x1B00_0x1B03() - { - Result = JT809_JT1078_0x1B00_0x1B03_Result.失败 - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x1B00).ToHexString(); - Assert.Equal("D4C142313233343500000000000000000000000000021B030000000101", hex); - } - - [Fact] - public void Test6() - { - var jT809_JT1078_0x1B00 = JT809Serializer.Deserialize("D4C142313233343500000000000000000000000000021B030000000101".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x1B00.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x1B00.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.远程录像下载控制应答消息, jT809_JT1078_0x1B00.SubBusinessType); - var jT809_JT1078_0x1B00_0x1B03 = jT809_JT1078_0x1B00.SubBodies as JT809_JT1078_0x1B00_0x1B03; - Assert.Equal(1, (byte)jT809_JT1078_0x1B00_0x1B03.Result); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9700Test.cs b/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9700Test.cs deleted file mode 100644 index 181c325..0000000 --- a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9700Test.cs +++ /dev/null @@ -1,50 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Extensions.JT1078.MessageBody; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Linq; -using System.Collections.Generic; -using Xunit; - -namespace JT809.Protocol.Extensions.JT1078.Test -{ - public class JT809_JT1078_0x9700Test - { - JT809Serializer JT809Serializer; - public JT809_JT1078_0x9700Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT809Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT809Serializer = defaultConfig.GetSerializer(); - } - - - - [Fact] - public void Test1() - { - JT809_JT1078_0x9700 jT809_JT1078_0x9700 = new JT809_JT1078_0x9700() - { - VehicleNo="粤B12345", - VehicleColor= Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType= (ushort)JT809_JT1078_SubBusinessType.时效口令请求应答消息, - SubBodies= new JT809_JT1078_0x9700_0x9702() - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x9700).ToHexString(); - Assert.Equal("D4C14231323334350000000000000000000000000002970200000000", hex); - } - - [Fact] - public void Test2() - { - var jT809_JT1078_0x9700 = JT809Serializer.Deserialize("D4C14231323334350000000000000000000000000002970200000000".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x9700.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x9700.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.时效口令请求应答消息, jT809_JT1078_0x9700.SubBusinessType); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9800Test.cs b/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9800Test.cs deleted file mode 100644 index 70ef290..0000000 --- a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9800Test.cs +++ /dev/null @@ -1,93 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Extensions.JT1078.MessageBody; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Linq; -using System.Collections.Generic; -using Xunit; - -namespace JT809.Protocol.Extensions.JT1078.Test -{ - public class JT809_JT1078_0x9800Test - { - JT809Serializer JT809Serializer; - public JT809_JT1078_0x9800Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT809Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT809Serializer = defaultConfig.GetSerializer(); - } - - - - [Fact] - public void Test1() - { - var GnssDatas = Enumerable.Range(0, 36).Select(m => (byte)m).ToArray(); - var AuthorizeCodes = "0123456789012345678901234567890123456789012345678901234567890123"; - JT809_JT1078_0x9800 jT809_JT1078_0x9800 = new JT809_JT1078_0x9800() - { - VehicleNo="粤B12345", - VehicleColor= Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType= (ushort)JT809_JT1078_SubBusinessType.实时音视频请求消息, - SubBodies= new JT809_JT1078_0x9800_0x9801() { - AVitemType=1, - ChannelId=2, - GnssData= GnssDatas, - AuthorizeCode= AuthorizeCodes - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x9800).ToHexString(); - Assert.Equal("D4C14231323334350000000000000000000000000002980100000066020130313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223", hex); - } - - [Fact] - public void Test2() - { - var GnssDatas = Enumerable.Range(0, 36).Select(m => (byte)m).ToArray(); - var AuthorizeCodes = "0123456789012345678901234567890123456789012345678901234567890123"; - var jT809_JT1078_0x9800 = JT809Serializer.Deserialize("D4C14231323334350000000000000000000000000002980100000066020130313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x9800.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x9800.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.实时音视频请求消息, jT809_JT1078_0x9800.SubBusinessType); - var jT809_JT1078_0x9800_0x9801 = jT809_JT1078_0x9800.SubBodies as JT809_JT1078_0x9800_0x9801; - Assert.Equal(1, jT809_JT1078_0x9800_0x9801.AVitemType); - Assert.Equal(2, jT809_JT1078_0x9800_0x9801.ChannelId); - Assert.Equal(GnssDatas, jT809_JT1078_0x9800_0x9801.GnssData); - Assert.Equal(AuthorizeCodes, jT809_JT1078_0x9800_0x9801.AuthorizeCode); - } - - [Fact] - public void Test3() - { - JT809_JT1078_0x9800 jT809_JT1078_0x9800 = new JT809_JT1078_0x9800() - { - VehicleNo = "粤B12345", - VehicleColor = Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType = (ushort)JT809_JT1078_SubBusinessType.主动请求停止实时音视频传输消息, - SubBodies = new JT809_JT1078_0x9800_0x9802() { - ChannelId=1, - AVitemType=2 - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x9800).ToHexString(); - Assert.Equal("D4C142313233343500000000000000000000000000029802000000020102", hex); - } - - [Fact] - public void Test4() - { - var jT809_JT1078_0x9800 = JT809Serializer.Deserialize("D4C142313233343500000000000000000000000000029802000000020102".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x9800.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x9800.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.主动请求停止实时音视频传输消息, jT809_JT1078_0x9800.SubBusinessType); - var jT809_JT1078_0x9800_0x9802 = jT809_JT1078_0x9800.SubBodies as JT809_JT1078_0x9800_0x9802; - Assert.Equal(1, jT809_JT1078_0x9800_0x9802.ChannelId); - Assert.Equal(2, jT809_JT1078_0x9800_0x9802.AVitemType); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9900Test.cs b/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9900Test.cs deleted file mode 100644 index 940f218..0000000 --- a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9900Test.cs +++ /dev/null @@ -1,114 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Extensions.JT1078.MessageBody; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Linq; -using System.Collections.Generic; -using Xunit; -using Newtonsoft.Json; - -namespace JT809.Protocol.Extensions.JT1078.Test -{ - public class JT809_JT1078_0x9900Test - { - JT809Serializer JT809Serializer; - public JT809_JT1078_0x9900Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT809Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT809Serializer = defaultConfig.GetSerializer(); - - Newtonsoft.Json.JsonConvert.DefaultSettings = new Func(() => - { - //日期类型默认格式化处理 - return new Newtonsoft.Json.JsonSerializerSettings - { - DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat, - DateFormatString = "yyyy-MM-dd HH:mm:ss" - }; - }); - } - - - - [Fact] - public void Test1() - { - JT809_JT1078_0x9900 jT809_JT1078_0x9900 = new JT809_JT1078_0x9900() - { - VehicleNo="粤B12345", - VehicleColor= Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType= (ushort)JT809_JT1078_SubBusinessType.主动上传音视频资源目录信息应答消息, - SubBodies= new JT809_JT1078_0x9900_0x9901() { - Result= JT809_JT1078_0x9900_0x9901_Result.失败, - ItemNumber=2 - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x9900).ToHexString(); - Assert.Equal("D4C142313233343500000000000000000000000000029901000000020102", hex); - } - - [Fact] - public void Test2() - { - var jT809_JT1078_0x9900 = JT809Serializer.Deserialize("D4C142313233343500000000000000000000000000029901000000020102".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x9900.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x9900.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.主动上传音视频资源目录信息应答消息, jT809_JT1078_0x9900.SubBusinessType); - var jT809_JT1078_0x9900_0x9901 = jT809_JT1078_0x9900.SubBodies as JT809_JT1078_0x9900_0x9901; - Assert.Equal(1, (byte)jT809_JT1078_0x9900_0x9901.Result); - Assert.Equal(2, (byte)jT809_JT1078_0x9900_0x9901.ItemNumber); - } - - [Fact] - public void Test3() - { - var GnssDatas = Enumerable.Range(0, 36).Select(m => (byte)m).ToArray(); - var AuthorizeCodes = "0123456789012345678901234567890123456789012345678901234567890123"; - JT809_JT1078_0x9900 jT809_JT1078_0x9900 = new JT809_JT1078_0x9900() - { - VehicleNo = "粤B12345", - VehicleColor = Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType = (ushort)JT809_JT1078_SubBusinessType.查询音视频资源目录请求消息, - SubBodies = new JT809_JT1078_0x9900_0x9902() { - ChannelId = 1, - AlarmType = 2, - AVItemType = 3, - MemType = 4, - StartTime = Convert.ToDateTime("2017-07-15 10:10:10"), - EndTime = Convert.ToDateTime("2017-07-16 10:10:10"), - StreamType =5, - AuthorizeCode= AuthorizeCodes, - GnssData= GnssDatas - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x9900).ToHexString(); - Assert.Equal("D4C1423132333435000000000000000000000000000299020000008001000000005969798200000000596ACB02000000000000000203050430313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223", hex); - } - - [Fact] - public void Test4() - { - var GnssDatas = Enumerable.Range(0, 36).Select(m => (byte)m).ToArray(); - var AuthorizeCodes = "0123456789012345678901234567890123456789012345678901234567890123"; - var jT809_JT1078_0x9900 = JT809Serializer.Deserialize("D4C1423132333435000000000000000000000000000299020000008001000000005969798200000000596ACB02000000000000000203050430313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x9900.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x9900.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.查询音视频资源目录请求消息, jT809_JT1078_0x9900.SubBusinessType); - var jT809_JT1078_0x9900_0x9902 = jT809_JT1078_0x9900.SubBodies as JT809_JT1078_0x9900_0x9902; - Assert.Equal(1, jT809_JT1078_0x9900_0x9902.ChannelId); - Assert.Equal(2u, jT809_JT1078_0x9900_0x9902.AlarmType); - Assert.Equal(3, jT809_JT1078_0x9900_0x9902.AVItemType); - Assert.Equal(4, jT809_JT1078_0x9900_0x9902.MemType); - Assert.Equal(Convert.ToDateTime("2017-07-15 10:10:10"), jT809_JT1078_0x9900_0x9902.StartTime); - Assert.Equal(Convert.ToDateTime("2017-07-16 10:10:10"), jT809_JT1078_0x9900_0x9902.EndTime); - Assert.Equal(5, jT809_JT1078_0x9900_0x9902.StreamType); - Assert.Equal(AuthorizeCodes, jT809_JT1078_0x9900_0x9902.AuthorizeCode); - Assert.Equal(GnssDatas, jT809_JT1078_0x9900_0x9902.GnssData); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9A00Test.cs b/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9A00Test.cs deleted file mode 100644 index c749f77..0000000 --- a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9A00Test.cs +++ /dev/null @@ -1,116 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Extensions.JT1078.MessageBody; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Linq; -using System.Collections.Generic; -using Xunit; -using Newtonsoft.Json; - -namespace JT809.Protocol.Extensions.JT1078.Test -{ - public class JT809_JT1078_0x9A00Test - { - JT809Serializer JT809Serializer; - public JT809_JT1078_0x9A00Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT809Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT809Serializer = defaultConfig.GetSerializer(); - - Newtonsoft.Json.JsonConvert.DefaultSettings = new Func(() => - { - //日期类型默认格式化处理 - return new Newtonsoft.Json.JsonSerializerSettings - { - DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat, - DateFormatString = "yyyy-MM-dd HH:mm:ss" - }; - }); - } - - - - [Fact] - public void Test1() - { - var GnssDatas = Enumerable.Range(0, 36).Select(m => (byte)m).ToArray(); - var AuthorizeCodes = "0123456789012345678901234567890123456789012345678901234567890123"; - JT809_JT1078_0x9A00 jT809_JT1078_0x9A00 = new JT809_JT1078_0x9A00() - { - VehicleNo = "粤B12345", - VehicleColor = Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType = (ushort)JT809_JT1078_SubBusinessType.远程录像回放请求消息, - SubBodies = new JT809_JT1078_0x9A00_0x9A01() { - AuthorizeCode = AuthorizeCodes, - GnssData = GnssDatas, - AVItemType = 1, - ChannelId = 2, - MemType = 3, - StreamType = 4, - PlayBackStartTime = Convert.ToDateTime("2017-07-16 10:10:10"), - PlayBackEndTime = Convert.ToDateTime("2017-07-17 10:10:10") - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x9A00).ToHexString(); - Assert.Equal("D4C142313233343500000000000000000000000000029A01000000780201040300000000596ACB0200000000596C1C8230313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223", hex); - } - - [Fact] - public void Test2() - { - var GnssDatas = Enumerable.Range(0, 36).Select(m => (byte)m).ToArray(); - var AuthorizeCodes = "0123456789012345678901234567890123456789012345678901234567890123"; - var jT809_JT1078_0x9A00 = JT809Serializer.Deserialize("D4C142313233343500000000000000000000000000029A01000000780201040300000000596ACB0200000000596C1C8230313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x9A00.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x9A00.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.远程录像回放请求消息, jT809_JT1078_0x9A00.SubBusinessType); - var jT809_JT1078_0x9A00_0x9A01 = jT809_JT1078_0x9A00.SubBodies as JT809_JT1078_0x9A00_0x9A01; - Assert.Equal(AuthorizeCodes, jT809_JT1078_0x9A00_0x9A01.AuthorizeCode); - Assert.Equal(GnssDatas, jT809_JT1078_0x9A00_0x9A01.GnssData); - Assert.Equal(1,jT809_JT1078_0x9A00_0x9A01.AVItemType); - Assert.Equal(2,jT809_JT1078_0x9A00_0x9A01.ChannelId); - Assert.Equal(3,jT809_JT1078_0x9A00_0x9A01.MemType); - Assert.Equal(4,jT809_JT1078_0x9A00_0x9A01.StreamType); - Assert.Equal(Convert.ToDateTime("2017-07-16 10:10:10"), jT809_JT1078_0x9A00_0x9A01.PlayBackStartTime); - Assert.Equal(Convert.ToDateTime("2017-07-17 10:10:10"), jT809_JT1078_0x9A00_0x9A01.PlayBackEndTime); - } - - [Fact] - public void Test3() - { - var GnssDatas = Enumerable.Range(0, 36).Select(m => (byte)m).ToArray(); - var AuthorizeCodes = Enumerable.Range(0, 64).Select(m => (byte)m).ToArray(); - JT809_JT1078_0x9A00 jT809_JT1078_0x9A00 = new JT809_JT1078_0x9A00() - { - VehicleNo = "粤B12345", - VehicleColor = Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType = (ushort)JT809_JT1078_SubBusinessType.远程录像回放控制消息, - SubBodies = new JT809_JT1078_0x9A00_0x9A02() { - ControlType= ControlType.暂停回放, - DateTime= Convert.ToDateTime("2017-07-17 10:10:10"), - FastTime= FastTime._1倍 - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x9A00).ToHexString(); - Assert.Equal("D4C142313233343500000000000000000000000000029A020000000A010100000000596C1C82", hex); - } - - [Fact] - public void Test4() - { - var jT809_JT1078_0x9A00 = JT809Serializer.Deserialize("D4C142313233343500000000000000000000000000029A020000000A010100000000596C1C82".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x9A00.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x9A00.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.远程录像回放控制消息, jT809_JT1078_0x9A00.SubBusinessType); - var jT809_JT1078_0x9A00_0x9A02 = jT809_JT1078_0x9A00.SubBodies as JT809_JT1078_0x9A00_0x9A02; - Assert.Equal(1, (byte)jT809_JT1078_0x9A00_0x9A02.ControlType); - Assert.Equal(Convert.ToDateTime("2017-07-17 10:10:10"), jT809_JT1078_0x9A00_0x9A02.DateTime); - Assert.Equal(1, (byte)jT809_JT1078_0x9A00_0x9A02.FastTime); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9B00Test.cs b/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9B00Test.cs deleted file mode 100644 index 2826de1..0000000 --- a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9B00Test.cs +++ /dev/null @@ -1,145 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Extensions.JT1078.MessageBody; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Linq; -using System.Collections.Generic; -using Xunit; -using Newtonsoft.Json; - -namespace JT809.Protocol.Extensions.JT1078.Test -{ - public class JT809_JT1078_0x9B00Test - { - JT809Serializer JT809Serializer; - public JT809_JT1078_0x9B00Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT809Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT809Serializer = defaultConfig.GetSerializer(); - - Newtonsoft.Json.JsonConvert.DefaultSettings = new Func(() => - { - //日期类型默认格式化处理 - return new Newtonsoft.Json.JsonSerializerSettings - { - DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat, - DateFormatString = "yyyy-MM-dd HH:mm:ss" - }; - }); - } - - - - [Fact] - public void Test1() - { - var GnssDatas = Enumerable.Range(0, 36).Select(m => (byte)m).ToArray(); - var AuthorizeCodes = "0123456789012345678901234567890123456789012345678901234567890123"; - JT809_JT1078_0x9B00 jT809_JT1078_0x9B00 = new JT809_JT1078_0x9B00() - { - VehicleNo = "粤B12345", - VehicleColor = Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType = (ushort)JT809_JT1078_SubBusinessType.远程录像下载请求消息, - SubBodies = new JT809_JT1078_0x9B00_0x9B01() { - AuthorizeCode = AuthorizeCodes, - GnssData = GnssDatas, - AVItemType = 1, - ChannelId = 2, - MemType = 3, - StreamType = 4, - StartTime = Convert.ToDateTime("2017-07-16 10:10:10"), - EndTime = Convert.ToDateTime("2017-07-17 10:10:10"), - AlarmType=5, - FileSize=6 - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x9B00).ToHexString(); - Assert.Equal("D4C142313233343500000000000000000000000000029B01000000840200000000596ACB0200000000596C1C8200000000000000050104030000000630313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223", hex); - } - - [Fact] - public void Test2() - { - var GnssDatas = Enumerable.Range(0, 36).Select(m => (byte)m).ToArray(); - var AuthorizeCodes = "0123456789012345678901234567890123456789012345678901234567890123"; - var jT809_JT1078_0x9B00 = JT809Serializer.Deserialize("D4C142313233343500000000000000000000000000029B01000000840200000000596ACB0200000000596C1C8200000000000000050104030000000630313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x9B00.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x9B00.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.远程录像下载请求消息, jT809_JT1078_0x9B00.SubBusinessType); - var jT809_JT1078_0x9B00_0x9B01 = jT809_JT1078_0x9B00.SubBodies as JT809_JT1078_0x9B00_0x9B01; - Assert.Equal(AuthorizeCodes, jT809_JT1078_0x9B00_0x9B01.AuthorizeCode); - Assert.Equal(GnssDatas, jT809_JT1078_0x9B00_0x9B01.GnssData); - Assert.Equal(1, jT809_JT1078_0x9B00_0x9B01.AVItemType); - Assert.Equal(2, jT809_JT1078_0x9B00_0x9B01.ChannelId); - Assert.Equal(3, jT809_JT1078_0x9B00_0x9B01.MemType); - Assert.Equal(4, jT809_JT1078_0x9B00_0x9B01.StreamType); - Assert.Equal(Convert.ToDateTime("2017-07-16 10:10:10"), jT809_JT1078_0x9B00_0x9B01.StartTime); - Assert.Equal(Convert.ToDateTime("2017-07-17 10:10:10"), jT809_JT1078_0x9B00_0x9B01.EndTime); - Assert.Equal(5u, jT809_JT1078_0x9B00_0x9B01.AlarmType); - Assert.Equal(6u, jT809_JT1078_0x9B00_0x9B01.FileSize); - } - - [Fact] - public void Test3() - { - JT809_JT1078_0x9B00 jT809_JT1078_0x9B00 = new JT809_JT1078_0x9B00() - { - VehicleNo = "粤B12345", - VehicleColor = Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType = (ushort)JT809_JT1078_SubBusinessType.远程录像下载完成通知应答消息, - SubBodies = new JT809_JT1078_0x9B00_0x9B02() { - Result= JT809_JT1078_0x9B00_0x9B02_Result.失败, - SessionId=2 - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x9B00).ToHexString(); - Assert.Equal("D4C142313233343500000000000000000000000000029B0200000003010002", hex); - } - - [Fact] - public void Test4() - { - var jT809_JT1078_0x9B00 = JT809Serializer.Deserialize("D4C142313233343500000000000000000000000000029B0200000003010002".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x9B00.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x9B00.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.远程录像下载完成通知应答消息, jT809_JT1078_0x9B00.SubBusinessType); - var jT809_JT1078_0x9B00_0x9B02 = jT809_JT1078_0x9B00.SubBodies as JT809_JT1078_0x9B00_0x9B02; - Assert.Equal(1, (byte)jT809_JT1078_0x9B00_0x9B02.Result); - Assert.Equal(2, (byte)jT809_JT1078_0x9B00_0x9B02.SessionId); - } - [Fact] - public void Test5() - { - JT809_JT1078_0x9B00 jT809_JT1078_0x9B00 = new JT809_JT1078_0x9B00() - { - VehicleNo = "粤B12345", - VehicleColor = Protocol.Enums.JT809VehicleColorType.黄色, - SubBusinessType = (ushort)JT809_JT1078_SubBusinessType.远程录像下载控制消息, - SubBodies = new JT809_JT1078_0x9B00_0x9B03() - { - Type= JT809_JT1078_0x9B00_0x9B03_Type.继续, - SessionId = 2 - } - }; - var hex = JT809Serializer.Serialize(jT809_JT1078_0x9B00).ToHexString(); - Assert.Equal("D4C142313233343500000000000000000000000000029B0300000003000201", hex); - } - - [Fact] - public void Test6() - { - var jT809_JT1078_0x9B00 = JT809Serializer.Deserialize("D4C142313233343500000000000000000000000000029B0300000003000201".ToHexBytes()); - Assert.Equal("粤B12345", jT809_JT1078_0x9B00.VehicleNo); - Assert.Equal(Protocol.Enums.JT809VehicleColorType.黄色, jT809_JT1078_0x9B00.VehicleColor); - Assert.Equal((ushort)JT809_JT1078_SubBusinessType.远程录像下载控制消息, jT809_JT1078_0x9B00.SubBusinessType); - var jT809_JT1078_0x9B00_0x9B03 = jT809_JT1078_0x9B00.SubBodies as JT809_JT1078_0x9B00_0x9B03; - Assert.Equal(1, (byte)jT809_JT1078_0x9B00_0x9B03.Type); - Assert.Equal(2, (byte)jT809_JT1078_0x9B00_0x9B03.SessionId); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_AnalyzeTest.cs b/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_AnalyzeTest.cs deleted file mode 100644 index a3ecd60..0000000 --- a/src/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_AnalyzeTest.cs +++ /dev/null @@ -1,101 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.MessageBody; -using Microsoft.Extensions.DependencyInjection; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; - -namespace JT809.Protocol.Extensions.JT1078.Test -{ - public class JT809_JT1078_AnalyzeTest - { - JT809Serializer JT809Serializer; - public JT809_JT1078_AnalyzeTest() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT809Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT809Serializer = defaultConfig.GetSerializer(); - - Newtonsoft.Json.JsonConvert.DefaultSettings = new Func(() => - { - //日期类型默认格式化处理 - return new Newtonsoft.Json.JsonSerializerSettings - { - DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat, - DateFormatString = "yyyy-MM-dd HH:mm:ss" - }; - }); - } - [Fact] - public void Analyze() - { - var hex = "D4C1423132333435000000000000000000000000000217010000008B30313233343536373839303031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323330313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233".ToHexBytes(); - var json = JT809Serializer.Analyze(hex); - - hex = "D4C14231323334350000000000000000000000000002170200000000".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C142313233343500000000000000000000000000021801000000230100000000000000000000000000000000000000000000003132372E302E302E311F90".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C1423132333435000000000000000000000000000218020000000101".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C142313233343500000000000000000000000000021901000000440000000203000000005D2BE082000000005D2D32020000000000000001020605000000041F000000005D045382000000005D05A502000000000000000B153D3300000029".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C14231323334350000000000000000000000000002190200000045010000000203000000005D2BE082000000005D2D32020000000000000001020605000000041F000000005D045382000000005D05A502000000000000000B153D3300000029".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C142313233343500000000000000000000000000021A010000002300000000000000000000000000000000000000000000003132372E302E302E311F9001".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C142313233343500000000000000000000000000021A020000000101".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C142313233343500000000000000000000000000021B0100000003010002".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C142313233343500000000000000000000000000021B020000013401000200000000000000000000000000000000000000000000003132372E302E302E311F900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000746B0000000000000000000000000000746B313233343536000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000443A2F2F3132332F343536".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C142313233343500000000000000000000000000021B030000000101".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C14231323334350000000000000000000000000002970200000000".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C14231323334350000000000000000000000000002980100000066020130313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C142313233343500000000000000000000000000029802000000020102".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C142313233343500000000000000000000000000029901000000020102".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C1423132333435000000000000000000000000000299020000008001000000005969798200000000596ACB02000000000000000203050430313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C142313233343500000000000000000000000000029A01000000780201040300000000596ACB0200000000596C1C8230313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C142313233343500000000000000000000000000029A020000000A010100000000596C1C82".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C142313233343500000000000000000000000000029B01000000840200000000596ACB0200000000596C1C8200000000000000050104030000000630313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C142313233343500000000000000000000000000029B0200000003010002".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - - hex = "D4C142313233343500000000000000000000000000029B0300000003000201".ToHexBytes(); - json = JT809Serializer.Analyze(hex); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/DependencyInjectionExtensions.cs b/src/JT809.Protocol.Extensions.JT1078/DependencyInjectionExtensions.cs deleted file mode 100644 index d252555..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/DependencyInjectionExtensions.cs +++ /dev/null @@ -1,20 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Extensions.JT1078.MessageBody; -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078 -{ - public static class DependencyInjectionExtensions - { - public static IJT809Builder AddJT1078Configure(this IJT809Builder iJT809Builder) - { - iJT809Builder.Config.Register(Assembly.GetExecutingAssembly()); - iJT809Builder.Config.BusinessTypeFactory.Register(Assembly.GetExecutingAssembly()); - iJT809Builder.Config.SubBusinessTypeFactory.Register(Assembly.GetExecutingAssembly()); - return iJT809Builder; - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Enums/ControlType.cs b/src/JT809.Protocol.Extensions.JT1078/Enums/ControlType.cs deleted file mode 100644 index 22b54ce..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Enums/ControlType.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Enums -{ - /// - /// 控制类型 - /// - public enum ControlType:byte - { - 正常回放=0x00, - 暂停回放 = 0x01, - 结束回放 = 0x02, - 快进回放 = 0x03, - 关键帧快退回放 = 0x04, - 拖动回放 = 0x05, - 关键帧播放 = 0x06, - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Enums/FastTime.cs b/src/JT809.Protocol.Extensions.JT1078/Enums/FastTime.cs deleted file mode 100644 index 0d62ad0..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Enums/FastTime.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Enums -{ - public enum FastTime : byte - { - 无效 = 0x00, - _1倍 = 0x01, - _2倍 = 0x02, - _4倍 = 0x03, - _8倍 = 0x04, - _16倍 = 0x05, - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1800_0x1801_Result.cs b/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1800_0x1801_Result.cs deleted file mode 100644 index a55d0c9..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1800_0x1801_Result.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Enums -{ - public enum JT809_JT1078_0x1800_0x1801_Result:byte - { - 成功=0x00, - 失败 = 0x01, - 不支持 = 0x02, - 会话结束 = 0x03, - 时效口令错误 = 0x04, - 不满足跨域条件 = 0x05, - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1800_0x1802_Result.cs b/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1800_0x1802_Result.cs deleted file mode 100644 index 0eab755..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1800_0x1802_Result.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Enums -{ - public enum JT809_JT1078_0x1800_0x1802_Result:byte - { - 成功 = 0x00, - 失败 = 0x01, - 不支持 = 0x02, - 会话结束 = 0x03, - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1900_0x1902_Result.cs b/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1900_0x1902_Result.cs deleted file mode 100644 index eac384b..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1900_0x1902_Result.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Enums -{ - public enum JT809_JT1078_0x1900_0x1902_Result:byte - { - 成功 = 0x00, - 失败 = 0x01, - 不支持 = 0x02, - 会话结束 = 0x03, - 时效口令错误 = 0x04, - 不满足跨域条件 = 0x05, - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1A00_0x1A01_Result.cs b/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1A00_0x1A01_Result.cs deleted file mode 100644 index 57d5cfe..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1A00_0x1A01_Result.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Enums -{ - public enum JT809_JT1078_0x1A00_0x1A01_Result:byte - { - 成功 = 0x00, - 失败 = 0x01, - 不支持 = 0x02, - 会话结束 = 0x03, - 时效口令错误 = 0x04, - 不满足跨域条件 = 0x05, - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1A00_0x1A02_Result.cs b/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1A00_0x1A02_Result.cs deleted file mode 100644 index bd95398..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1A00_0x1A02_Result.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Enums -{ - public enum JT809_JT1078_0x1A00_0x1A02_Result:byte - { - 成功 = 0x00, - 失败 = 0x01, - 不支持 = 0x02, - 会话结束 = 0x03, - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B01_Result.cs b/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B01_Result.cs deleted file mode 100644 index 18ba1bb..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B01_Result.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Enums -{ - public enum JT809_JT1078_0x1B00_0x1B01_Result:byte - { - 成功 = 0x00, - 失败 = 0x01, - 不支持 = 0x02, - 会话结束 = 0x03, - 时效口令错误 = 0x04, - 不满足跨域条件 = 0x05, - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B02_Result.cs b/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B02_Result.cs deleted file mode 100644 index 475ca4d..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B02_Result.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Enums -{ - public enum JT809_JT1078_0x1B00_0x1B02_Result:byte - { - 成功 = 0x00, - 失败 = 0x01, - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B03_Result.cs b/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B03_Result.cs deleted file mode 100644 index acc04e4..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B03_Result.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Enums -{ - public enum JT809_JT1078_0x1B00_0x1B03_Result:byte - { - 成功 = 0x00, - 失败 = 0x01, - 不支持 = 0x02, - 会话结束 = 0x03, - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9900_0x9901_Result.cs b/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9900_0x9901_Result.cs deleted file mode 100644 index 2a405d3..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9900_0x9901_Result.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Enums -{ - public enum JT809_JT1078_0x9900_0x9901_Result:byte - { - 成功 = 0x00, - 失败 = 0x01, - 不支持 = 0x02, - 会话结束 = 0x03, - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9B00_0x9B02_Result.cs b/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9B00_0x9B02_Result.cs deleted file mode 100644 index 2afec6e..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9B00_0x9B02_Result.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Enums -{ - public enum JT809_JT1078_0x9B00_0x9B02_Result:byte - { - 成功=0x00, - 失败 = 0x01, - 不支持 = 0x02, - 会话结束 = 0x03, - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9B00_0x9B03_Type.cs b/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9B00_0x9B03_Type.cs deleted file mode 100644 index 2dda417..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9B00_0x9B03_Type.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Enums -{ - public enum JT809_JT1078_0x9B00_0x9B03_Type:byte - { - 暂停=0x00, - 继续 = 0x01, - 取消 = 0x02, - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_BusinessType.cs b/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_BusinessType.cs deleted file mode 100644 index e7659c9..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_BusinessType.cs +++ /dev/null @@ -1,93 +0,0 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.MessageBody; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Enums -{ - public enum JT809_JT1078_BusinessType : ushort - { - /// - ///主链路时效口令业务类 - ///UP_AUTHORIZE_MSG - /// - [Description("主链路时效口令业务类")] - [JT809BodiesType(typeof(JT809_JT1078_0x1700))] - [JT809BusinessTypeDescription("UP_AUTHORIZE_MSG", "主链路时效口令业务类")] - 主链路时效口令业务类 = 0x1700, - /// - ///从链路时效口令业务类 - ///DOWN_AUTHORIZE_MSG - /// - [Description("从链路时效口令业务类")] - [JT809BodiesType(typeof(JT809_JT1078_0x9700))] - [JT809BusinessTypeDescription("DOWN_AUTHORIZE_MSG", "从链路时效口令业务类")] - 从链路时效口令业务类 = 0x9700, - /// - ///主链路实时音视频业务类 - ///UP_REALVIDEO_MSG - /// - [Description("主链路实时音视频业务类")] - [JT809BodiesType(typeof(JT809_JT1078_0x1800))] - [JT809BusinessTypeDescription("UP_REALVIDEO_MSG", "主链路实时音视频业务类")] - 主链路实时音视频业务类 = 0x1800, - /// - ///从链路实时音视频业务类 - ///DOWN_REALVIDEO_MSG - /// - [Description("从链路实时音视频业务类")] - [JT809BodiesType(typeof(JT809_JT1078_0x9800))] - [JT809BusinessTypeDescription("DOWN_REALVIDEO_MSG", "从链路实时音视频业务类")] - 从链路实时音视频业务类 = 0x9800, - /// - ///主链路远程录像检索业务类 - ///UP_SEARCH_MSG - /// - [Description("主链路远程录像检索业务类")] - [JT809BodiesType(typeof(JT809_JT1078_0x1900))] - [JT809BusinessTypeDescription("UP_SEARCH_MSG", "主链路远程录像检索业务类")] - 主链路远程录像检索业务类 = 0x1900, - /// - ///从链路远程录像检索业务类 - ///DOWN_SEARCH_MSG - /// - [Description("从链路远程录像检索业务类")] - [JT809BodiesType(typeof(JT809_JT1078_0x9900))] - [JT809BusinessTypeDescription("DOWN_SEARCH_MSG", "从链路远程录像检索业务类")] - 从链路远程录像检索业务类 = 0x9900, - /// - ///主链路远程录像回放业务类 - ///UP_PLAYBACK_MSG - /// - [Description("主链路远程录像回放业务类")] - [JT809BodiesType(typeof(JT809_JT1078_0x1A00))] - [JT809BusinessTypeDescription("UP_PLAYBACK_MSG", "主链路远程录像回放业务类")] - 主链路远程录像回放业务类 = 0x1A00, - /// - ///从链路远程录像回放业务类 - ///DOWN_PLAYBACK_MSG - /// - [Description("从链路远程录像回放业务类")] - [JT809BodiesType(typeof(JT809_JT1078_0x9A00))] - [JT809BusinessTypeDescription("DOWN_PLAYBACK_MSG", "从链路远程录像回放业务类")] - 从链路远程录像回放业务类 = 0x9A00, - /// - ///主链路远程录像下载业务类 - ///UP_DOWNLOAD_MSG - /// - [Description("主链路远程录像下载业务类")] - [JT809BodiesType(typeof(JT809_JT1078_0x1B00))] - [JT809BusinessTypeDescription("UP_DOWNLOAD_MSG", "主链路远程录像下载业务类")] - 主链路远程录像下载业务类 = 0x1B00, - /// - ///从链路远程录像下载业务类 - ///DOWN_DOWNLOAD_MSG - /// - [Description("从链路远程录像下载业务类")] - [JT809BodiesType(typeof(JT809_JT1078_0x9B00))] - [JT809BusinessTypeDescription("DOWN_DOWNLOAD_MSG", "从链路远程录像下载业务类")] - 从链路远程录像下载业务类 = 0x9B00, - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_SubBusinessType.cs b/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_SubBusinessType.cs deleted file mode 100644 index ada8b14..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_SubBusinessType.cs +++ /dev/null @@ -1,181 +0,0 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.MessageBody; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Enums -{ - public enum JT809_JT1078_SubBusinessType : ushort - { - /// - ///时效口令上报消息 - ///UP_AUTHRIZE_MSG_STARTUP - /// - [Description("时效口令上报消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x1700_0x1701))] - [JT809BusinessTypeDescription("UP_AUTHRIZE_MSG_STARTUP", "时效口令上报消息")] - 时效口令上报消息 = 0x1701, - /// - ///时效口令请求消息 - ///UP_AUTHRIZE_MSG_STARTUP_REQ - /// - [Description("时效口令请求消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x1700_0x1702))] - [JT809BusinessTypeDescription("UP_AUTHRIZE_MSG_STARTUP_REQ", "时效口令请求消息")] - 时效口令请求消息 = 0x1702, - /// - ///时效口令请求应答消息 - ///DOWN_AUTHRIZE_MSG_STARTUP_REQ_ACK - /// - [Description("时效口令请求应答消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x9700_0x9702))] - [JT809BusinessTypeDescription("DOWN_AUTHRIZE_MSG_STARTUP_REQ_ACK", "时效口令请求应答消息")] - 时效口令请求应答消息 = 0x9702, - /// - ///实时音视频请求应答消息 - ///UP_REALVIDEO_MSG_STARTUP_ACK - /// - [Description("实时音视频请求应答消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x1800_0x1801))] - [JT809BusinessTypeDescription("UP_REALVIDEO_MSG_STARTUP_ACK", "实时音视频请求应答消息")] - 实时音视频请求应答消息 = 0x1801, - /// - ///主动请求停止实时音视频传输应答消息 - ///UP_REALVIDEO_MSG_END_ACK - /// - [Description("主动请求停止实时音视频传输应答消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x1800_0x1802))] - [JT809BusinessTypeDescription("UP_REALVIDEO_MSG_END_ACK", "主动请求停止实时音视频传输应答消息")] - 主动请求停止实时音视频传输应答消息 = 0x1802, - /// - ///实时音视频请求消息 - ///DOWN_REALVIDEO_MSG_STARTUP - /// - [Description("实时音视频请求消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x9800_0x9801))] - [JT809BusinessTypeDescription("DOWN_REALVIDEO_MSG_STARTUP", "实时音视频请求消息")] - 实时音视频请求消息 = 0x9801, - /// - ///主动请求停止实时音视频传输消息 - ///DOWN_REALVIDEO_MSG_END - /// - [Description("主动请求停止实时音视频传输消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x9800_0x9802))] - [JT809BusinessTypeDescription("DOWN_REALVIDEO_MSG_END", "主动请求停止实时音视频传输消息")] - 主动请求停止实时音视频传输消息 = 0x9802, - /// - ///主动上传音视频资源目录信息消息 - ///UP_FILELIST_MSG - /// - [Description("主动上传音视频资源目录信息消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x1900_0x1901))] - [JT809BusinessTypeDescription("UP_FILELIST_MSG", "主动上传音视频资源目录信息消息")] - 主动上传音视频资源目录信息消息 = 0x1901, - /// - ///查询音视频资源目录应答消息 - ///UP_REALVIDEO_FILELIST_REQ_ACK - /// - [Description("查询音视频资源目录应答消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x1900_0x1902))] - [JT809BusinessTypeDescription("UP_REALVIDEO_FILELIST_REQ_ACK", "查询音视频资源目录应答消息")] - 查询音视频资源目录应答消息 = 0x1902, - /// - ///主动上传音视频资源目录信息应答消息 - ///DOWN_FILELIST_MSG_ACK - /// - [Description("主动上传音视频资源目录信息应答消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x9900_0x9901))] - [JT809BusinessTypeDescription("DOWN_FILELIST_MSG_ACK", "主动上传音视频资源目录信息应答消息")] - 主动上传音视频资源目录信息应答消息 = 0x9901, - /// - /// 查询音视频资源目录请求消息 - ///DOWN_REALVIDEO_FILELIST_REQ - /// - [Description("查询音视频资源目录请求消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x9900_0x9902))] - [JT809BusinessTypeDescription("DOWN_REALVIDEO_FILELIST_REQ", "查询音视频资源目录请求消息")] - 查询音视频资源目录请求消息 = 0x9902, - /// - ///远程录像回放请求应答消息 - ///UP_PLAYBACK_MSG_STARTUP_ACK - /// - [Description("远程录像回放请求应答消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x1A00_0x1A01))] - [JT809BusinessTypeDescription("UP_PLAYBACK_MSG_STARTUP_ACK", "远程录像回放请求应答消息")] - 远程录像回放请求应答消息 = 0x1A01, - /// - ///远程录像回放控制应答消息 - ///UP_PLAYBACK_MSG_CONTROL_ACK - /// - [Description("远程录像回放控制应答消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x1A00_0x1A02))] - [JT809BusinessTypeDescription("UP_PLAYBACK_MSG_CONTROL_ACK", "远程录像回放控制应答消息")] - 远程录像回放控制应答消息 = 0x1A02, - /// - ///远程录像回放请求消息 - ///DOWN_PLAYBACK_MSG_STARTUP - /// - [Description("远程录像回放请求消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x9A00_0x9A01))] - [JT809BusinessTypeDescription("DOWN_PLAYBACK_MSG_STARTUP", "远程录像回放请求消息")] - 远程录像回放请求消息 = 0x9A01, - /// - ///远程录像回放控制消息 - ///DOWN_PLAYBACK_MSG_CONTROL - /// - [Description("远程录像回放控制消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x9A00_0x9A02))] - [JT809BusinessTypeDescription("DOWN_PLAYBACK_MSG_CONTROL", "远程录像回放控制消息")] - 远程录像回放控制消息 = 0x9A02, - /// - ///远程录像下载请求应答消息 - ///UP_DOWNLOAD_MSG_STARTUP_ACK - /// - [Description("远程录像下载请求应答消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x1B00_0x1B01))] - [JT809BusinessTypeDescription("UP_DOWNLOAD_MSG_STARTUP_ACK", "远程录像下载请求应答消息")] - 远程录像下载请求应答消息 = 0x1B01, - /// - ///远程录像下载通知消息 - ///UP_DOWNLOAD_MSG_END_INFORM - /// - [Description("远程录像下载通知消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x1B00_0x1B02))] - [JT809BusinessTypeDescription("UP_DOWNLOAD_MSG_END_INFORM", "远程录像下载通知消息")] - 远程录像下载通知消息 = 0x1B02, - /// - ///远程录像下载控制应答消息 - ///UP_DOWNLOAD_MSG_CONTROL_ACK - /// - [Description("远程录像下载控制应答消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x1B00_0x1B03))] - [JT809BusinessTypeDescription("UP_DOWNLOAD_MSG_CONTROL_ACK", "远程录像下载控制应答消息")] - 远程录像下载控制应答消息 = 0x1B03, - /// - ///远程录像下载请求消息 - ///DOWN_DOWNLOAD_MSG_STARTUP - /// - [Description("远程录像下载请求消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x9B00_0x9B01))] - [JT809BusinessTypeDescription("DOWN_DOWNLOAD_MSG_STARTUP", "远程录像下载请求消息")] - 远程录像下载请求消息 = 0x9B01, - /// - ///远程录像下载完成通知应答消息 - ///UP_DWONLOAD_MSG_END_INFORM_ACK - /// - [Description("远程录像下载完成通知应答消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x9B00_0x9B02))] - [JT809BusinessTypeDescription("UP_DWONLOAD_MSG_END_INFORM_ACK", "远程录像下载完成通知应答消息")] - 远程录像下载完成通知应答消息 = 0x9B02, - /// - ///远程录像下载控制消息 - ///DWON_DOWNLOAD_MSG_CONTROL - /// - [Description("远程录像下载控制消息")] - [JT809BodiesType(typeof(JT809_JT1078_0x9B00_0x9B03))] - [JT809BusinessTypeDescription("DWON_DOWNLOAD_MSG_CONTROL", "远程录像下载控制消息")] - 远程录像下载控制消息 = 0x9B03, - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Extensions/JT809MessagePackReaderExtentsion.cs b/src/JT809.Protocol.Extensions.JT1078/Extensions/JT809MessagePackReaderExtentsion.cs deleted file mode 100644 index c395be6..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Extensions/JT809MessagePackReaderExtentsion.cs +++ /dev/null @@ -1,12 +0,0 @@ -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Extensions -{ - public static class JT809MessagePackReaderExtentsion - { - - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9B00_0x9B03_Formatter.cs b/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9B00_0x9B03_Formatter.cs deleted file mode 100644 index d3eca00..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9B00_0x9B03_Formatter.cs +++ /dev/null @@ -1,27 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Extensions.JT1078.MessageBody; -using JT809.Protocol.Formatters; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.Formatters -{ - public class JT809_JT1078_0x9B00_0x9B03_Formatter : IJT809MessagePackFormatter - { - public JT809_JT1078_0x9B00_0x9B03 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9B00_0x9B03 jT808_JT1078_0x9B00_0x9B03 = new JT809_JT1078_0x9B00_0x9B03(); - jT808_JT1078_0x9B00_0x9B03.SessionId = reader.ReadUInt16(); - jT808_JT1078_0x9B00_0x9B03.Type = (JT809_JT1078_0x9B00_0x9B03_Type)reader.ReadByte(); - return jT808_JT1078_0x9B00_0x9B03; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9B00_0x9B03 value, IJT809Config config) - { - writer.WriteUInt16(value.SessionId); - writer.WriteByte((byte)value.Type); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj b/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj deleted file mode 100644 index 21b7079..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj +++ /dev/null @@ -1,34 +0,0 @@ - - - - netstandard2.0;netstandard2.1;net5.0; - 8.0 - Copyright 2019. - SmallChi(Koike) - JT809.Protocol.Extensions.JT1078 - JT809.Protocol.Extensions.JT1078 - 基于JT809协议、GB809协议扩展的视频消息协议 - 基于JT809协议、GB809协议扩展的视频消息协议 - true - https://github.com/SmallChi/JT1078 - https://github.com/SmallChi/JT1078 - https://github.com/SmallChi/JT1078/blob/master/LICENSE - https://github.com/SmallChi/JT1078/blob/master/LICENSE - true - 2.2.0 - LICENSE - JT809.Protocol.Extensions.JT1078.xml - - - - - True - - - - - - - - - diff --git a/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.xml b/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.xml deleted file mode 100644 index 6f1997f..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.xml +++ /dev/null @@ -1,751 +0,0 @@ - - - - JT809.Protocol.Extensions.JT1078 - - - - - 控制类型 - - - - - 主链路时效口令业务类 - UP_AUTHORIZE_MSG - - - - - 从链路时效口令业务类 - DOWN_AUTHORIZE_MSG - - - - - 主链路实时音视频业务类 - UP_REALVIDEO_MSG - - - - - 从链路实时音视频业务类 - DOWN_REALVIDEO_MSG - - - - - 主链路远程录像检索业务类 - UP_SEARCH_MSG - - - - - 从链路远程录像检索业务类 - DOWN_SEARCH_MSG - - - - - 主链路远程录像回放业务类 - UP_PLAYBACK_MSG - - - - - 从链路远程录像回放业务类 - DOWN_PLAYBACK_MSG - - - - - 主链路远程录像下载业务类 - UP_DOWNLOAD_MSG - - - - - 从链路远程录像下载业务类 - DOWN_DOWNLOAD_MSG - - - - - 时效口令上报消息 - UP_AUTHRIZE_MSG_STARTUP - - - - - 时效口令请求消息 - UP_AUTHRIZE_MSG_STARTUP_REQ - - - - - 时效口令请求应答消息 - DOWN_AUTHRIZE_MSG_STARTUP_REQ_ACK - - - - - 实时音视频请求应答消息 - UP_REALVIDEO_MSG_STARTUP_ACK - - - - - 主动请求停止实时音视频传输应答消息 - UP_REALVIDEO_MSG_END_ACK - - - - - 实时音视频请求消息 - DOWN_REALVIDEO_MSG_STARTUP - - - - - 主动请求停止实时音视频传输消息 - DOWN_REALVIDEO_MSG_END - - - - - 主动上传音视频资源目录信息消息 - UP_FILELIST_MSG - - - - - 查询音视频资源目录应答消息 - UP_REALVIDEO_FILELIST_REQ_ACK - - - - - 主动上传音视频资源目录信息应答消息 - DOWN_FILELIST_MSG_ACK - - - - - 查询音视频资源目录请求消息 - DOWN_REALVIDEO_FILELIST_REQ - - - - - 远程录像回放请求应答消息 - UP_PLAYBACK_MSG_STARTUP_ACK - - - - - 远程录像回放控制应答消息 - UP_PLAYBACK_MSG_CONTROL_ACK - - - - - 远程录像回放请求消息 - DOWN_PLAYBACK_MSG_STARTUP - - - - - 远程录像回放控制消息 - DOWN_PLAYBACK_MSG_CONTROL - - - - - 远程录像下载请求应答消息 - UP_DOWNLOAD_MSG_STARTUP_ACK - - - - - 远程录像下载通知消息 - UP_DOWNLOAD_MSG_END_INFORM - - - - - 远程录像下载控制应答消息 - UP_DOWNLOAD_MSG_CONTROL_ACK - - - - - 远程录像下载请求消息 - DOWN_DOWNLOAD_MSG_STARTUP - - - - - 远程录像下载完成通知应答消息 - UP_DWONLOAD_MSG_END_INFORM_ACK - - - - - 远程录像下载控制消息 - DWON_DOWNLOAD_MSG_CONTROL - - - - - 主链路时效口令交互消息 - - - - - 时效口令上报消息 - - - - - 企业视频监控平台唯一编码,平台所属企业行政区域代码+平台公共编号 - - - - - 归属地区政府平台使用的时效口令 - - - - - 跨域地区政府平台使用的时效口令 - - - - - 时效口令请求消息 - - - - - 主链路实时音视频交互消息 - - - - - 实时音视频请求应答消息 - - - - - 应答结果 - - - - - 企业视频服务器ip地址 - 32 - - - - - 企业视频服务器端口号 - - - - - 主动请求停止实时音视频传输应答消息 - - - - - 应答结果 - - - - - 主链路远程录像检索交互消息 - - - - - 主动上传音视频资源目录信息消息 - - - - - 资源目录项数目 - - - - - 资源目录项列表 - - - - - 查询音视频资源目录应答消息 - - - - - 应答结果 - - - - - 资源目录项数目 - - - - - 资源目录项列表 - 与JT808_JT1078_0x1900_0x1901共用同一个子类 - - - - - 上传音视频资源目录项 - - - - - 逻辑通道号 - - - - - UTC时间 开始 - - - - - UTC时间 结束 - - - - - 报警标志物 - - - - - 音视频类型 - - - - - 码流类型 - - - - - 存储器类型 - - - - - 文件大小 - - - - - 主链路远程录像回放交互消息 - - - - - 远程录像回放请求应答消息 - - - - - 企业视频服务器ip地址 - 32 - - - - - 企业视频服务器端口号 - - - - - 应答结果 - - - - - 远程录像回放控制应答消息 - - - - - 应答结果 - - - - - 主链路远程录像下载交互消息 - - - - - 远程录像下载请求应答消息 - - - - - 应答结果 - - - - - 对应平台文件上传消息的流水号 - - - - - 远程录像下载通知消息 - - - - - 应答结果 - - - - - 对应平台文件上传消息的流水号 - - - - - FTP服务器ip地址 - - - - - FTP服务器端口 - - - - - FTP用户名 - 49 - - - - - FTP密码 - 22 - - - - - 文件存储路径 - 200 - - - - - 远程录像下载控制应答消息 - - - - - 应答结果 - - - - - 从链路时效口令交互消息 - - - - - 时效口令请求应答消息 - - - - - 从链路实时音视频交互信息 - - - - - 实时音视频请求消息 - - - - - 逻辑通道号 - - - - - 音视频类型 - - - - - 时效口令 - - - - - 车辆进入跨域地区后5min之内的任何位置,仅跨域访问请求时使用此字段 - - - - - 主动请求停止实时音视频传输消息 - - - - - 逻辑通道号 - - - - - 音视频类型 - - - - - 从链路远程录像检索交互消息 - - - - - 主动上传音视频资源目录信息应答消息 - - - - - 应答结果 - - - - - 资源目录总数 - - - - - 查询音视频资源目录请求消息 - - - - - 逻辑通道号 - - - - - 起始时间 - - - - - 终止时间 - - - - - 报警类型 - - - - - 音视频类型 - - - - - 码流类型 - - - - - 存储器类型 - - - - - 时效口令 - 64 - - - - - 车辆进入跨域地区后5min之内任一位置,仅跨域访问请求时,使用此字段 - 36 - - - - - 从链路远程录像回放交互消息 - - - - - 远程录像回放请求消息 - - - - - 逻辑通道号 - - - - - 音视频类型 - - - - - 码流类型 - - - - - 存储器类型 - - - - - 回放起始时间 - - - - - 回放结束时间 - - - - - 时效口令 - 64 - - - - - 车辆进入跨域地区后5min之内任一位置,仅跨域访问请求时,使用此字段 - 36 - - - - - 远程录像回放控制消息 - - - - - 控制类型 - - - - - 快进或倒退倍数 - - - - - 拖动位置 - - - - - 从链路远程录像下载交互消息 - - - - - 远程录像下载请求消息 - - - - - 逻辑通道号 - - - - - 起始时间 - - - - - 终止时间 - - - - - 报警类型 - - - - - 音视频类型 - - - - - 码流类型 - - - - - 存储器类型 - - - - - 文件大小 byte - - - - - 时效口令 - 64 - - - - - 车辆进入跨域地区后5min之内任一位置,仅跨域访问请求时,使用此字段 - 36 - - - - - 远程录像下载完成通知应答消息 - - - - - 应答结果 - - - - - 对应平台文件上传消息的流水号 - - - - - 远程录像下载控制消息 - - - - - 对应平台文件上传消息的流水号 - - - - - 控制类型 - - - - diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700.cs deleted file mode 100644 index a455a31..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700.cs +++ /dev/null @@ -1,114 +0,0 @@ -using JT809.Protocol.Enums; -using JT809.Protocol.Exceptions; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 主链路时效口令交互消息 - /// - public class JT809_JT1078_0x1700 : JT809ExchangeMessageBodies,IJT809MessagePackFormatter, IJT809Analyze - { - public override ushort MsgId { get; }=JT809_JT1078_BusinessType.主链路时效口令业务类.ToUInt16Value(); - - public override JT809_LinkType LinkType { get; } = JT809_LinkType.main; - - public override string Description { get; }= "主链路时效口令交互消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x1700 value = new JT809_JT1078_0x1700(); - var virtualHex = reader.ReadVirtualArray(21); - value.VehicleNo = reader.ReadString(21); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]车牌号", value.VehicleNo); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - writer.WriteString($"[{((byte)value.VehicleColor).ReadNumber()}]车牌颜色", value.VehicleColor.ToString()); - value.SubBusinessType = reader.ReadUInt16(); - writer.WriteString($"[{value.SubBusinessType.ReadNumber()}]子业务类型标识", ((JT809SubBusinessType)value.SubBusinessType).ToString()); - value.DataLength = reader.ReadUInt32(); - writer.WriteNumber($"[{value.DataLength.ReadNumber()}]后续数据长度", value.DataLength); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - writer.WriteStartObject("子业务类型"); - instance.Analyze(ref reader, writer, config); - writer.WriteEndObject(); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - - public JT809_JT1078_0x1700 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1700 value = new JT809_JT1078_0x1700(); - value.VehicleNo = reader.ReadString(21); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - value.SubBusinessType = reader.ReadUInt16(); - value.DataLength = reader.ReadUInt32(); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( - instance, - ref reader, config); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1700 value, IJT809Config config) - { - writer.WriteStringPadRight(value.VehicleNo, 21); - writer.WriteByte((byte)value.VehicleColor); - writer.WriteUInt16(value.SubBusinessType); - try - { - // 先写入内容,然后在根据内容反写内容长度 - writer.Skip(4, out int subContentLengthPosition); - if (value.SubBodies != null) - { - if (!value.SubBodies.SkipSerialization) - { - JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( - value.SubBodies, - ref writer, value.SubBodies, - config); - } - } - writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1701.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1701.cs deleted file mode 100644 index b5876f7..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1701.cs +++ /dev/null @@ -1,64 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 时效口令上报消息 - /// - public class JT809_JT1078_0x1700_0x1701 : JT809SubBodies,IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 企业视频监控平台唯一编码,平台所属企业行政区域代码+平台公共编号 - /// - public string PlateFormId { get; set; } - /// - /// 归属地区政府平台使用的时效口令 - /// - public string AuthorizeCode1 { get; set; } - /// - /// 跨域地区政府平台使用的时效口令 - /// - public string AuthorizeCode2 { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.时效口令上报消息.ToUInt16Value(); - - public override string Description { get; }= "时效口令上报消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x1700_0x1701 value = new JT809_JT1078_0x1700_0x1701(); - var virtualHex = reader.ReadVirtualArray(11); - value.PlateFormId = reader.ReadString(11); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]企业视频监控平台唯一编码",value.PlateFormId); - virtualHex = reader.ReadVirtualArray(64); - value.AuthorizeCode1 = reader.ReadString(64); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]归属地区政府平台使用的时效口令", value.AuthorizeCode1); - virtualHex = reader.ReadVirtualArray(64); - value.AuthorizeCode2 = reader.ReadString(64); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]跨域地区政府平台使用的时效口令", value.AuthorizeCode2); - } - - public JT809_JT1078_0x1700_0x1701 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1700_0x1701 value = new JT809_JT1078_0x1700_0x1701(); - value.PlateFormId = reader.ReadString(11); - value.AuthorizeCode1 = reader.ReadString(64); - value.AuthorizeCode2 = reader.ReadString(64); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1700_0x1701 value, IJT809Config config) - { - writer.WriteStringPadRight(value.PlateFormId,11); - writer.WriteStringPadRight(value.AuthorizeCode1,64); - writer.WriteStringPadRight(value.AuthorizeCode2,64); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1702.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1702.cs deleted file mode 100644 index 00128f4..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1702.cs +++ /dev/null @@ -1,19 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 时效口令请求消息 - /// - public class JT809_JT1078_0x1700_0x1702 : JT809SubBodies - { - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.时效口令请求消息.ToUInt16Value(); - - public override string Description => "时效口令请求消息"; - - public override bool SkipSerialization { get; set; } = true; - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800.cs deleted file mode 100644 index a9fd8bd..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800.cs +++ /dev/null @@ -1,113 +0,0 @@ -using JT809.Protocol.Enums; -using JT809.Protocol.Exceptions; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 主链路实时音视频交互消息 - /// - public class JT809_JT1078_0x1800 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter, IJT809Analyze - { - public override ushort MsgId { get; } - - public override JT809_LinkType LinkType { get; } = JT809_LinkType.main; - - public override string Description { get; } = "主链路实时音视频交互消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x1800 value = new JT809_JT1078_0x1800(); - var virtualHex = reader.ReadVirtualArray(21); - value.VehicleNo = reader.ReadString(21); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]车牌号", value.VehicleNo); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - writer.WriteString($"[{((byte)value.VehicleColor).ReadNumber()}]车牌颜色", value.VehicleColor.ToString()); - value.SubBusinessType = reader.ReadUInt16(); - writer.WriteString($"[{value.SubBusinessType.ReadNumber()}]子业务类型标识", ((JT809SubBusinessType)value.SubBusinessType).ToString()); - value.DataLength = reader.ReadUInt32(); - writer.WriteNumber($"[{value.DataLength.ReadNumber()}]后续数据长度", value.DataLength); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - writer.WriteStartObject("子业务类型"); - instance.Analyze(ref reader, writer, config); - writer.WriteEndObject(); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - - public JT809_JT1078_0x1800 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1800 value = new JT809_JT1078_0x1800(); - value.VehicleNo = reader.ReadString(21); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - value.SubBusinessType = reader.ReadUInt16(); - value.DataLength = reader.ReadUInt32(); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( - instance, - ref reader, config); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1800 value, IJT809Config config) - { - writer.WriteStringPadRight(value.VehicleNo, 21); - writer.WriteByte((byte)value.VehicleColor); - writer.WriteUInt16(value.SubBusinessType); - try - { - // 先写入内容,然后在根据内容反写内容长度 - writer.Skip(4, out int subContentLengthPosition); - if (value.SubBodies != null) - { - if (!value.SubBodies.SkipSerialization) - { - JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( - value.SubBodies, - ref writer, value.SubBodies, - config); - } - } - writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1801.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1801.cs deleted file mode 100644 index 61cad01..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1801.cs +++ /dev/null @@ -1,63 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 实时音视频请求应答消息 - /// - public class JT809_JT1078_0x1800_0x1801 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 应答结果 - /// - public JT809_JT1078_0x1800_0x1801_Result Result { get; set; } - /// - /// 企业视频服务器ip地址 - /// 32 - /// - public string ServerIp { get; set; } - /// - /// 企业视频服务器端口号 - /// - public ushort ServerPort { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.实时音视频请求应答消息.ToUInt16Value(); - - public override string Description { get; } = "实时音视频请求应答消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x1800_0x1801 value = new JT809_JT1078_0x1800_0x1801(); - value.Result = (JT809_JT1078_0x1800_0x1801_Result)reader.ReadByte(); - writer.WriteString($"[{((byte)value.Result).ReadNumber()}]应答结果", value.Result.ToString()); - var virtualHex = reader.ReadVirtualArray(32); - value.ServerIp = reader.ReadString(32); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]企业视频服务器ip地址", value.ServerIp); - value.ServerPort = reader.ReadUInt16(); - writer.WriteNumber($"[{value.ServerPort.ReadNumber()}]企业视频服务器端口号", value.ServerPort); - } - - public JT809_JT1078_0x1800_0x1801 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1800_0x1801 value = new JT809_JT1078_0x1800_0x1801(); - value.Result = (JT809_JT1078_0x1800_0x1801_Result)reader.ReadByte(); - value.ServerIp = reader.ReadString(32); - value.ServerPort = reader.ReadUInt16(); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1800_0x1801 value, IJT809Config config) - { - writer.WriteByte((byte)value.Result); - writer.WriteStringPadLeft(value.ServerIp, 32); - writer.WriteUInt16(value.ServerPort); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1802.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1802.cs deleted file mode 100644 index 77d199a..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1802.cs +++ /dev/null @@ -1,45 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 主动请求停止实时音视频传输应答消息 - /// - public class JT809_JT1078_0x1800_0x1802 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 应答结果 - /// - public JT809_JT1078_0x1800_0x1802_Result Result { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.主动请求停止实时音视频传输应答消息.ToUInt16Value(); - - public override string Description { get; } = "主动请求停止实时音视频传输应答消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x1800_0x1802 value = new JT809_JT1078_0x1800_0x1802(); - value.Result = (JT809_JT1078_0x1800_0x1802_Result)reader.ReadByte(); - writer.WriteString($"[{((byte)value.Result).ReadNumber()}]应答结果", value.Result.ToString()); - } - - public JT809_JT1078_0x1800_0x1802 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1800_0x1802 value = new JT809_JT1078_0x1800_0x1802(); - value.Result = (JT809_JT1078_0x1800_0x1802_Result)reader.ReadByte(); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1800_0x1802 value, IJT809Config config) - { - writer.WriteByte((byte)value.Result); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900.cs deleted file mode 100644 index f02b847..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900.cs +++ /dev/null @@ -1,114 +0,0 @@ -using JT809.Protocol.Enums; -using JT809.Protocol.Exceptions; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 主链路远程录像检索交互消息 - /// - public class JT809_JT1078_0x1900 : JT809ExchangeMessageBodies,IJT809MessagePackFormatter, IJT809Analyze - { - public override ushort MsgId { get; } = JT809_JT1078_BusinessType.主链路远程录像检索业务类.ToUInt16Value(); - - public override JT809_LinkType LinkType { get; } = JT809_LinkType.main; - - public override string Description { get; } = "主链路远程录像检索交互消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x1900 value = new JT809_JT1078_0x1900(); - var virtualHex = reader.ReadVirtualArray(21); - value.VehicleNo = reader.ReadString(21); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]车牌号", value.VehicleNo); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - writer.WriteString($"[{((byte)value.VehicleColor).ReadNumber()}]车牌颜色", value.VehicleColor.ToString()); - value.SubBusinessType = reader.ReadUInt16(); - writer.WriteString($"[{value.SubBusinessType.ReadNumber()}]子业务类型标识", ((JT809SubBusinessType)value.SubBusinessType).ToString()); - value.DataLength = reader.ReadUInt32(); - writer.WriteNumber($"[{value.DataLength.ReadNumber()}]后续数据长度", value.DataLength); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - writer.WriteStartObject("子业务类型"); - instance.Analyze(ref reader, writer, config); - writer.WriteEndObject(); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - - public JT809_JT1078_0x1900 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1900 value = new JT809_JT1078_0x1900(); - value.VehicleNo = reader.ReadString(21); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - value.SubBusinessType = reader.ReadUInt16(); - value.DataLength = reader.ReadUInt32(); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( - instance, - ref reader, config); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1900 value, IJT809Config config) - { - writer.WriteStringPadRight(value.VehicleNo, 21); - writer.WriteByte((byte)value.VehicleColor); - writer.WriteUInt16(value.SubBusinessType); - try - { - // 先写入内容,然后在根据内容反写内容长度 - writer.Skip(4, out int subContentLengthPosition); - if (value.SubBodies != null) - { - if (!value.SubBodies.SkipSerialization) - { - JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( - value.SubBodies, - ref writer, value.SubBodies, - config); - } - } - writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1901.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1901.cs deleted file mode 100644 index c7c9148..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1901.cs +++ /dev/null @@ -1,78 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System.Collections.Generic; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 主动上传音视频资源目录信息消息 - /// - public class JT809_JT1078_0x1900_0x1901 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 资源目录项数目 - /// - public uint ItemNum { get; set; } - /// - /// 资源目录项列表 - /// - public List ItemList { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.主动上传音视频资源目录信息消息.ToUInt16Value(); - - public override string Description { get; } = "主动上传音视频资源目录信息消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x1900_0x1901 value = new JT809_JT1078_0x1900_0x1901(); - value.ItemNum = reader.ReadUInt32(); - writer.WriteNumber($"[{value.ItemNum.ReadNumber() }]资源目录项数目", value.ItemNum); - if (value.ItemNum > 0) - { - writer.WriteStartArray("资源目录项列表"); - var formatter = config.GetMessagePackFormatter(); - for (int i = 0; i < value.ItemNum; i++) - { - writer.WriteStartObject(); - formatter.Analyze(ref reader, writer, config); - writer.WriteEndObject(); - } - writer.WriteEndArray(); - } - } - - public JT809_JT1078_0x1900_0x1901 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1900_0x1901 value = new JT809_JT1078_0x1900_0x1901(); - value.ItemNum = reader.ReadUInt32(); - if (value.ItemNum > 0) - { - List jT808_JT1078_0x1900_0x1901_RecordList = new List(); - var formatter = config.GetMessagePackFormatter(); - for (int i = 0; i < value.ItemNum; i++) - { - var jT808_JT1078_0x1900_0x1901_Record = formatter.Deserialize(ref reader, config); - jT808_JT1078_0x1900_0x1901_RecordList.Add(jT808_JT1078_0x1900_0x1901_Record); - } - value.ItemList = jT808_JT1078_0x1900_0x1901_RecordList; - } - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1900_0x1901 value, IJT809Config config) - { - writer.WriteUInt32(value.ItemNum); - if (value.ItemList.Count > 0) - { - var formatter = config.GetMessagePackFormatter(); - foreach (var item in value.ItemList) - { - formatter.Serialize(ref writer, item, config); - } - } - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1902.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1902.cs deleted file mode 100644 index a636660..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1902.cs +++ /dev/null @@ -1,89 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System.Collections.Generic; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 查询音视频资源目录应答消息 - /// - public class JT809_JT1078_0x1900_0x1902 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 应答结果 - /// - public JT809_JT1078_0x1900_0x1902_Result Result { get; set; } - /// - /// 资源目录项数目 - /// - public uint ItemNum { get; set; } - /// - /// 资源目录项列表 - /// 与JT808_JT1078_0x1900_0x1901共用同一个子类 - /// - public List ItemList { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.查询音视频资源目录应答消息.ToUInt16Value(); - - public override string Description { get; } = "查询音视频资源目录应答消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x1900_0x1902 value = new JT809_JT1078_0x1900_0x1902(); - value.Result = (JT809_JT1078_0x1900_0x1902_Result)reader.ReadByte(); - writer.WriteString($"[{((byte)value.Result).ReadNumber() }]应答结果", value.Result.ToString()); - value.ItemNum = reader.ReadUInt32(); - writer.WriteNumber($"[{value.ItemNum.ReadNumber() }]资源目录项数目", value.ItemNum); - if (value.ItemNum > 0) - { - writer.WriteStartArray("资源目录项列表"); - List jT808_JT1078_0x1900_0x1901_RecordList = new List(); - var formatter = config.GetMessagePackFormatter(); - for (int i = 0; i < value.ItemNum; i++) - { - writer.WriteStartObject(); - formatter.Analyze(ref reader, writer, config); - writer.WriteEndObject(); - } - writer.WriteEndArray(); - value.ItemList = jT808_JT1078_0x1900_0x1901_RecordList; - } - } - - public JT809_JT1078_0x1900_0x1902 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1900_0x1902 value = new JT809_JT1078_0x1900_0x1902(); - value.Result = (JT809_JT1078_0x1900_0x1902_Result)reader.ReadByte(); - value.ItemNum = reader.ReadUInt32(); - if (value.ItemNum > 0) - { - List jT808_JT1078_0x1900_0x1901_RecordList = new List(); - var formatter = config.GetMessagePackFormatter(); - for (int i = 0; i < value.ItemNum; i++) - { - var jT808_JT1078_0x1900_0x1901_Record = formatter.Deserialize(ref reader, config); - jT808_JT1078_0x1900_0x1901_RecordList.Add(jT808_JT1078_0x1900_0x1901_Record); - } - value.ItemList = jT808_JT1078_0x1900_0x1901_RecordList; - } - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1900_0x1902 value, IJT809Config config) - { - writer.WriteByte((byte)value.Result); - writer.WriteUInt32(value.ItemNum); - if (value.ItemList.Count > 0) - { - var formatter = config.GetMessagePackFormatter(); - foreach (var item in value.ItemList) - { - formatter.Serialize(ref writer, item, config); - } - } - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_Record.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_Record.cs deleted file mode 100644 index ed24388..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_Record.cs +++ /dev/null @@ -1,175 +0,0 @@ -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 上传音视频资源目录项 - /// - public class JT809_JT1078_0x1900_Record : IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 逻辑通道号 - /// - public byte ChannelId { get; set; } - /// - /// UTC时间 开始 - /// - public DateTime StartTime { get; set; } - /// - /// UTC时间 结束 - /// - public DateTime EndTime { get; set; } - /// - /// 报警标志物 - /// - public ulong AlarmType { get; set; } - /// - /// 音视频类型 - /// - public byte AVItemType { get; set; } - /// - /// 码流类型 - /// - public byte StreamType { get; set; } - /// - /// 存储器类型 - /// - public byte MemType { get; set; } - /// - /// 文件大小 - /// - public uint FileSize { get; set; } - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x1900_Record value = new JT809_JT1078_0x1900_Record(); - value.ChannelId = reader.ReadByte(); - writer.WriteString($"[{value.ChannelId.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelId)); - var virtualHex = reader.ReadVirtualArray(8); - value.StartTime = reader.ReadUTCDateTime(); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]开始时间", value.StartTime); - virtualHex = reader.ReadVirtualArray(8); - value.EndTime = reader.ReadUTCDateTime(); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]结束时间", value.StartTime); - value.AlarmType = reader.ReadUInt64(); - writer.WriteNumber($"[{value.AlarmType.ReadNumber()}]报警标志物", value.AlarmType); - value.AVItemType = reader.ReadByte(); - writer.WriteString($"[{value.AVItemType.ReadNumber()}]音视频资源类型", AVResourceTypeDisplay(value.AVItemType)); - value.StreamType = reader.ReadByte(); - writer.WriteString($"[{value.StreamType.ReadNumber()}]码流类型", StreamTypeDisplay(value.StreamType)); - value.MemType = reader.ReadByte(); - writer.WriteString($"[{value.MemType.ReadNumber()}]存储器类型", MemoryTypeDisplay(value.MemType)); - value.FileSize = reader.ReadUInt32(); - writer.WriteNumber($"[{value.FileSize.ReadNumber()}]文件大小(B)", value.FileSize); - string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - switch (LogicalChannelNo) - { - case 1: - return "驾驶员"; - case 2: - return "车辆正前方"; - case 3: - return "车前门"; - case 4: - return "车厢前部"; - case 5: - return "车厢后部"; - case 7: - return "行李舱"; - case 8: - return "车辆左侧"; - case 9: - return "车辆右侧"; - case 10: - return "车辆正后方"; - case 11: - return "车厢中部"; - case 12: - return "车中门"; - case 13: - return "驾驶席车门"; - case 33: - return "驾驶员"; - case 36: - return "车厢前部"; - case 37: - return "车厢后部"; - default: - return "预留"; - } - } - string AVResourceTypeDisplay(byte AVResourceType) - { - switch (AVResourceType) - { - case 0: - return "音视频"; - case 1: - return "音频"; - case 2: - return "视频"; - default: - break; - } - return "未知"; - } - string StreamTypeDisplay(byte StreamType) - { - switch (StreamType) - { - case 1: - return "主码流"; - case 2: - return "子码流"; - default: - return "未知"; - } - } - string MemoryTypeDisplay(byte MemoryType) - { - switch (MemoryType) - { - case 1: - return "主存储器"; - case 2: - return "灾备存储器"; - default: - return "未知"; - } - } - } - - public JT809_JT1078_0x1900_Record Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1900_Record value = new JT809_JT1078_0x1900_Record(); - value.ChannelId = reader.ReadByte(); - value.StartTime = reader.ReadUTCDateTime(); - value.EndTime = reader.ReadUTCDateTime(); - value.AlarmType = reader.ReadUInt64(); - value.AVItemType = reader.ReadByte(); - value.StreamType = reader.ReadByte(); - value.MemType = reader.ReadByte(); - value.FileSize = reader.ReadUInt32(); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1900_Record value, IJT809Config config) - { - writer.WriteByte(value.ChannelId); - writer.WriteUTCDateTime(value.StartTime); - writer.WriteUTCDateTime(value.EndTime); - writer.WriteUInt64(value.AlarmType); - writer.WriteByte(value.AVItemType); - writer.WriteByte(value.StreamType); - writer.WriteByte(value.MemType); - writer.WriteUInt32(value.FileSize); - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00.cs deleted file mode 100644 index 3d78d48..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System.Text.Json; -using JT809.Protocol.Enums; -using JT809.Protocol.Exceptions; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 主链路远程录像回放交互消息 - /// - public class JT809_JT1078_0x1A00 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter, IJT809Analyze - { - public override ushort MsgId { get; } = JT809_JT1078_BusinessType.主链路远程录像回放业务类.ToUInt16Value(); - - public override JT809_LinkType LinkType { get; } = JT809_LinkType.main; - - public override string Description { get; } = "主链路远程录像回放交互消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x1A00 value = new JT809_JT1078_0x1A00(); - var virtualHex = reader.ReadVirtualArray(21); - value.VehicleNo = reader.ReadString(21); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]车牌号", value.VehicleNo); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - writer.WriteString($"[{((byte)value.VehicleColor).ReadNumber()}]车牌颜色", value.VehicleColor.ToString()); - value.SubBusinessType = reader.ReadUInt16(); - writer.WriteString($"[{value.SubBusinessType.ReadNumber()}]子业务类型标识", ((JT809SubBusinessType)value.SubBusinessType).ToString()); - value.DataLength = reader.ReadUInt32(); - writer.WriteNumber($"[{value.DataLength.ReadNumber()}]后续数据长度", value.DataLength); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - writer.WriteStartObject("子业务类型"); - instance.Analyze(ref reader, writer, config); - writer.WriteEndObject(); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - - public JT809_JT1078_0x1A00 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1A00 value = new JT809_JT1078_0x1A00(); - value.VehicleNo = reader.ReadString(21); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - value.SubBusinessType = reader.ReadUInt16(); - value.DataLength = reader.ReadUInt32(); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( - instance, - ref reader, config); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1A00 value, IJT809Config config) - { - writer.WriteStringPadRight(value.VehicleNo, 21); - writer.WriteByte((byte)value.VehicleColor); - writer.WriteUInt16(value.SubBusinessType); - try - { - // 先写入内容,然后在根据内容反写内容长度 - writer.Skip(4, out int subContentLengthPosition); - if (value.SubBodies != null) - { - if (!value.SubBodies.SkipSerialization) - { - JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( - value.SubBodies, - ref writer, value.SubBodies, - config); - } - } - writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A01.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A01.cs deleted file mode 100644 index 846ff61..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A01.cs +++ /dev/null @@ -1,63 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 远程录像回放请求应答消息 - /// - public class JT809_JT1078_0x1A00_0x1A01 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 企业视频服务器ip地址 - /// 32 - /// - public string ServerIp { get; set; } - /// - /// 企业视频服务器端口号 - /// - public ushort ServerPort { get; set; } - /// - /// 应答结果 - /// - public JT809_JT1078_0x1A00_0x1A01_Result Result { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像回放请求应答消息.ToUInt16Value(); - - public override string Description { get; } = "远程录像回放请求应答消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x1A00_0x1A01 value = new JT809_JT1078_0x1A00_0x1A01(); - var virtualHex = reader.ReadVirtualArray(32); - value.ServerIp = reader.ReadString(32); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]企业视频服务器ip地址", value.ServerIp); - value.ServerPort = reader.ReadUInt16(); - writer.WriteNumber($"[{value.ServerPort.ReadNumber()}]企业视频服务器端口号", value.ServerPort); - value.Result = (JT809_JT1078_0x1A00_0x1A01_Result)reader.ReadByte(); - writer.WriteString($"[{((byte)value.Result).ReadNumber()}]应答结果", value.Result.ToString()); - } - - public JT809_JT1078_0x1A00_0x1A01 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1A00_0x1A01 value = new JT809_JT1078_0x1A00_0x1A01(); - value.ServerIp = reader.ReadString(32); - value.ServerPort = reader.ReadUInt16(); - value.Result = (JT809_JT1078_0x1A00_0x1A01_Result)reader.ReadByte(); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1A00_0x1A01 value, IJT809Config config) - { - writer.WriteStringPadLeft(value.ServerIp, 32); - writer.WriteUInt16(value.ServerPort); - writer.WriteByte((byte)value.Result); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A02.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A02.cs deleted file mode 100644 index 0e323ce..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A02.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Text.Json; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 远程录像回放控制应答消息 - /// - public class JT809_JT1078_0x1A00_0x1A02 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 应答结果 - /// - public JT809_JT1078_0x1A00_0x1A02_Result Result { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像回放控制应答消息.ToUInt16Value(); - - public override string Description { get; } = "远程录像回放控制应答消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x1A00_0x1A02 value = new JT809_JT1078_0x1A00_0x1A02(); - value.Result = (JT809_JT1078_0x1A00_0x1A02_Result)reader.ReadByte(); - writer.WriteString($"[{((byte)value.Result).ReadNumber()}]应答结果", value.Result.ToString()); - } - - public JT809_JT1078_0x1A00_0x1A02 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1A00_0x1A02 value = new JT809_JT1078_0x1A00_0x1A02(); - value.Result = (JT809_JT1078_0x1A00_0x1A02_Result)reader.ReadByte(); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1A00_0x1A02 value, IJT809Config config) - { - writer.WriteByte((byte)value.Result); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00.cs deleted file mode 100644 index fed0c64..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System.Text.Json; -using JT809.Protocol.Enums; -using JT809.Protocol.Exceptions; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 主链路远程录像下载交互消息 - /// - public class JT809_JT1078_0x1B00 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter, IJT809Analyze - { - public override ushort MsgId { get; } = JT809_JT1078_BusinessType.主链路远程录像下载业务类.ToUInt16Value(); - - public override JT809_LinkType LinkType { get; } = JT809_LinkType.main; - - public override string Description { get; } = "主链路远程录像下载交互消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x1B00 value = new JT809_JT1078_0x1B00(); - var virtualHex = reader.ReadVirtualArray(21); - value.VehicleNo = reader.ReadString(21); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]车牌号", value.VehicleNo); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - writer.WriteString($"[{((byte)value.VehicleColor).ReadNumber()}]车牌颜色", value.VehicleColor.ToString()); - value.SubBusinessType = reader.ReadUInt16(); - writer.WriteString($"[{value.SubBusinessType.ReadNumber()}]子业务类型标识", ((JT809SubBusinessType)value.SubBusinessType).ToString()); - value.DataLength = reader.ReadUInt32(); - writer.WriteNumber($"[{value.DataLength.ReadNumber()}]后续数据长度", value.DataLength); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - writer.WriteStartObject("子业务类型"); - instance.Analyze(ref reader, writer, config); - writer.WriteEndObject(); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - - public JT809_JT1078_0x1B00 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1B00 value = new JT809_JT1078_0x1B00(); - value.VehicleNo = reader.ReadString(21); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - value.SubBusinessType = reader.ReadUInt16(); - value.DataLength = reader.ReadUInt32(); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( - instance, - ref reader, config); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1B00 value, IJT809Config config) - { - writer.WriteStringPadRight(value.VehicleNo, 21); - writer.WriteByte((byte)value.VehicleColor); - writer.WriteUInt16(value.SubBusinessType); - try - { - // 先写入内容,然后在根据内容反写内容长度 - writer.Skip(4, out int subContentLengthPosition); - if (value.SubBodies != null) - { - if (!value.SubBodies.SkipSerialization) - { - JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( - value.SubBodies, - ref writer, value.SubBodies, - config); - } - } - writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B01.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B01.cs deleted file mode 100644 index 6eabe2a..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B01.cs +++ /dev/null @@ -1,53 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 远程录像下载请求应答消息 - /// - public class JT809_JT1078_0x1B00_0x1B01 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 应答结果 - /// - public JT809_JT1078_0x1B00_0x1B01_Result Result { get; set; } - /// - /// 对应平台文件上传消息的流水号 - /// - public ushort SessionId { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像下载请求应答消息.ToUInt16Value(); - - public override string Description { get; } = "远程录像下载请求应答消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x1B00_0x1B01 value = new JT809_JT1078_0x1B00_0x1B01(); - value.Result = (JT809_JT1078_0x1B00_0x1B01_Result)reader.ReadByte(); - writer.WriteString($"[{((byte)value.Result).ReadNumber() }]应答结果", value.Result.ToString()); - value.SessionId = reader.ReadUInt16(); - writer.WriteNumber($"[{value.SessionId.ReadNumber()}]对应平台文件上传消息的流水号", value.SessionId); - } - - public JT809_JT1078_0x1B00_0x1B01 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1B00_0x1B01 value = new JT809_JT1078_0x1B00_0x1B01(); - value.Result = (JT809_JT1078_0x1B00_0x1B01_Result)reader.ReadByte(); - value.SessionId = reader.ReadUInt16(); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1B00_0x1B01 value, IJT809Config config) - { - writer.WriteByte((byte)value.Result); - writer.WriteUInt16(value.SessionId); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B02.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B02.cs deleted file mode 100644 index fd30508..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B02.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System.Text.Json; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 远程录像下载通知消息 - /// - public class JT809_JT1078_0x1B00_0x1B02 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 应答结果 - /// - public JT809_JT1078_0x1B00_0x1B02_Result Result { get; set; } - /// - /// 对应平台文件上传消息的流水号 - /// - public ushort SessionId { get; set; } - /// - /// FTP服务器ip地址 - /// - public string ServerIp { get; set; } - /// - /// FTP服务器端口 - /// - public ushort TcpPort { get; set; } - /// - /// FTP用户名 - /// 49 - /// - public string UserName { get; set; } - /// - /// FTP密码 - /// 22 - /// - public string Password { get; set; } - /// - /// 文件存储路径 - /// 200 - /// - public string FilePath { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像下载通知消息.ToUInt16Value(); - - public override string Description { get; } = "远程录像下载通知消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x1B00_0x1B02 value = new JT809_JT1078_0x1B00_0x1B02(); - value.Result = (JT809_JT1078_0x1B00_0x1B02_Result)reader.ReadByte(); - writer.WriteString($"[{((byte)value.Result).ReadNumber() }]应答结果", value.Result.ToString()); - value.SessionId = reader.ReadUInt16(); - writer.WriteNumber($"[{value.SessionId.ReadNumber()}]对应平台文件上传消息的流水号", value.SessionId); - var virtualHex = reader.ReadVirtualArray(32); - value.ServerIp = reader.ReadString(32); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]FTP服务器ip地址", value.ServerIp); - value.TcpPort = reader.ReadUInt16(); - writer.WriteNumber($"[{value.TcpPort.ReadNumber()}]FTP服务器端口", value.TcpPort); - virtualHex = reader.ReadVirtualArray(49); - value.UserName = reader.ReadString(49); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]FTP用户名", value.UserName); - virtualHex = reader.ReadVirtualArray(22); - value.Password = reader.ReadString(22); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]FTP密码", value.Password); - virtualHex = reader.ReadVirtualArray(200); - value.FilePath = reader.ReadString(200); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]文件存储路径", value.FilePath); - } - - public JT809_JT1078_0x1B00_0x1B02 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1B00_0x1B02 value = new JT809_JT1078_0x1B00_0x1B02(); - value.Result = (JT809_JT1078_0x1B00_0x1B02_Result)reader.ReadByte(); - value.SessionId = reader.ReadUInt16(); - value.ServerIp = reader.ReadString(32); - value.TcpPort = reader.ReadUInt16(); - value.UserName = reader.ReadString(49); - value.Password = reader.ReadString(22); - value.FilePath = reader.ReadString(200); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1B00_0x1B02 value, IJT809Config config) - { - writer.WriteByte((byte)value.Result); - writer.WriteUInt16(value.SessionId); - writer.WriteStringPadLeft(value.ServerIp, 32); - writer.WriteUInt16(value.TcpPort); - writer.WriteStringPadLeft(value.UserName, 49); - writer.WriteStringPadLeft(value.Password, 22); - writer.WriteStringPadLeft(value.FilePath, 200); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B03.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B03.cs deleted file mode 100644 index d96a421..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B03.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Text.Json; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 远程录像下载控制应答消息 - /// - public class JT809_JT1078_0x1B00_0x1B03 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 应答结果 - /// - public JT809_JT1078_0x1B00_0x1B03_Result Result { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像下载控制应答消息.ToUInt16Value(); - - public override string Description { get; } = "远程录像下载控制应答消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x1B00_0x1B03 value = new JT809_JT1078_0x1B00_0x1B03(); - value.Result = (JT809_JT1078_0x1B00_0x1B03_Result)reader.ReadByte(); - writer.WriteString($"[{((byte)value.Result).ReadNumber()}]应答结果", value.Result.ToString()); - } - - public JT809_JT1078_0x1B00_0x1B03 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x1B00_0x1B03 value = new JT809_JT1078_0x1B00_0x1B03(); - value.Result = (JT809_JT1078_0x1B00_0x1B03_Result)reader.ReadByte(); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x1B00_0x1B03 value, IJT809Config config) - { - writer.WriteByte((byte)value.Result); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700.cs deleted file mode 100644 index dd425fd..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System.Text.Json; -using JT809.Protocol.Enums; -using JT809.Protocol.Exceptions; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 从链路时效口令交互消息 - /// - public class JT809_JT1078_0x9700 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter, IJT809Analyze - { - public override ushort MsgId { get; } = JT809_JT1078_BusinessType.从链路时效口令业务类.ToUInt16Value(); - - public override JT809_LinkType LinkType { get; } = JT809_LinkType.subordinate; - - public override string Description { get; } = "从链路时效口令交互消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x9700 value = new JT809_JT1078_0x9700(); - var virtualHex = reader.ReadVirtualArray(21); - value.VehicleNo = reader.ReadString(21); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]车牌号", value.VehicleNo); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - writer.WriteString($"[{((byte)value.VehicleColor).ReadNumber()}]车牌颜色", value.VehicleColor.ToString()); - value.SubBusinessType = reader.ReadUInt16(); - writer.WriteString($"[{value.SubBusinessType.ReadNumber()}]子业务类型标识", ((JT809SubBusinessType)value.SubBusinessType).ToString()); - value.DataLength = reader.ReadUInt32(); - writer.WriteNumber($"[{value.DataLength.ReadNumber()}]后续数据长度", value.DataLength); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - writer.WriteStartObject("子业务类型"); - instance.Analyze(ref reader, writer, config); - writer.WriteEndObject(); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - - public JT809_JT1078_0x9700 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9700 value = new JT809_JT1078_0x9700(); - value.VehicleNo = reader.ReadString(21); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - value.SubBusinessType = reader.ReadUInt16(); - value.DataLength = reader.ReadUInt32(); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( - instance, - ref reader, config); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9700 value, IJT809Config config) - { - writer.WriteStringPadRight(value.VehicleNo, 21); - writer.WriteByte((byte)value.VehicleColor); - writer.WriteUInt16(value.SubBusinessType); - try - { - // 先写入内容,然后在根据内容反写内容长度 - writer.Skip(4, out int subContentLengthPosition); - if (value.SubBodies != null) - { - if (!value.SubBodies.SkipSerialization) - { - JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( - value.SubBodies, - ref writer, value.SubBodies, - config); - } - } - writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700_0x9702.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700_0x9702.cs deleted file mode 100644 index e93e1e3..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700_0x9702.cs +++ /dev/null @@ -1,16 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 时效口令请求应答消息 - /// - public class JT809_JT1078_0x9700_0x9702 : JT809SubBodies - { - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.时效口令请求应答消息.ToUInt16Value(); - - public override string Description { get; } = "时效口令请求应答消息"; - - public override bool SkipSerialization { get; set; } = true; - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800.cs deleted file mode 100644 index 7c3eb08..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System.Text.Json; -using JT809.Protocol.Enums; -using JT809.Protocol.Exceptions; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 从链路实时音视频交互信息 - /// - public class JT809_JT1078_0x9800 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter, IJT809Analyze - { - public override ushort MsgId { get; } = JT809_JT1078_BusinessType.从链路实时音视频业务类.ToUInt16Value(); - - public override JT809_LinkType LinkType { get; } = JT809_LinkType.subordinate; - - public override string Description { get; } = "从链路实时音视频交互信息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x9800 value = new JT809_JT1078_0x9800(); - var virtualHex = reader.ReadVirtualArray(21); - value.VehicleNo = reader.ReadString(21); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]车牌号", value.VehicleNo); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - writer.WriteString($"[{((byte)value.VehicleColor).ReadNumber()}]车牌颜色", value.VehicleColor.ToString()); - value.SubBusinessType = reader.ReadUInt16(); - writer.WriteString($"[{value.SubBusinessType.ReadNumber()}]子业务类型标识", ((JT809SubBusinessType)value.SubBusinessType).ToString()); - value.DataLength = reader.ReadUInt32(); - writer.WriteNumber($"[{value.DataLength.ReadNumber()}]后续数据长度", value.DataLength); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - writer.WriteStartObject("子业务类型"); - instance.Analyze(ref reader, writer, config); - writer.WriteEndObject(); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - - public JT809_JT1078_0x9800 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9800 value = new JT809_JT1078_0x9800(); - value.VehicleNo = reader.ReadString(21); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - value.SubBusinessType = reader.ReadUInt16(); - value.DataLength = reader.ReadUInt32(); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( - instance, - ref reader, config); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9800 value, IJT809Config config) - { - writer.WriteStringPadRight(value.VehicleNo, 21); - writer.WriteByte((byte)value.VehicleColor); - writer.WriteUInt16(value.SubBusinessType); - try - { - // 先写入内容,然后在根据内容反写内容长度 - writer.Skip(4, out int subContentLengthPosition); - if (value.SubBodies != null) - { - if (!value.SubBodies.SkipSerialization) - { - JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( - value.SubBodies, - ref writer, value.SubBodies, - config); - } - } - writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9801.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9801.cs deleted file mode 100644 index 0e75c23..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9801.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System.Text.Json; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 实时音视频请求消息 - /// - public class JT809_JT1078_0x9800_0x9801 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 逻辑通道号 - /// - public byte ChannelId { get; set; } - /// - /// 音视频类型 - /// - public byte AVitemType { get; set; } - /// - /// 时效口令 - /// - public string AuthorizeCode { get; set; } - /// - /// 车辆进入跨域地区后5min之内的任何位置,仅跨域访问请求时使用此字段 - /// - public byte[] GnssData { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.实时音视频请求消息.ToUInt16Value(); - - public override string Description { get; } = "实时音视频请求消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x9800_0x9801 value = new JT809_JT1078_0x9800_0x9801(); - value.ChannelId = reader.ReadByte(); - writer.WriteString($"[{value.ChannelId.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelId)); - value.AVitemType = reader.ReadByte(); - writer.WriteString($"[{value.AVitemType.ReadNumber()}]音视频资源类型", AVResourceTypeDisplay(value.AVitemType)); - var virtualHex = reader.ReadVirtualArray(64); - value.AuthorizeCode = reader.ReadString(64); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]时效口令", value.AuthorizeCode); - virtualHex = reader.ReadVirtualArray(36); - value.GnssData = reader.ReadArray(36).ToArray(); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]车辆进入跨域地区后5min之内的任何位置", virtualHex.ToArray().ToHexString()); - string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - switch (LogicalChannelNo) - { - case 1: - return "驾驶员"; - case 2: - return "车辆正前方"; - case 3: - return "车前门"; - case 4: - return "车厢前部"; - case 5: - return "车厢后部"; - case 7: - return "行李舱"; - case 8: - return "车辆左侧"; - case 9: - return "车辆右侧"; - case 10: - return "车辆正后方"; - case 11: - return "车厢中部"; - case 12: - return "车中门"; - case 13: - return "驾驶席车门"; - case 33: - return "驾驶员"; - case 36: - return "车厢前部"; - case 37: - return "车厢后部"; - default: - return "预留"; - } - } - string AVResourceTypeDisplay(byte AVResourceType) - { - switch (AVResourceType) - { - case 0: - return "音视频"; - case 1: - return "音频"; - case 2: - return "视频"; - default: - break; - } - return "未知"; - } - } - - public JT809_JT1078_0x9800_0x9801 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9800_0x9801 value = new JT809_JT1078_0x9800_0x9801(); - value.ChannelId = reader.ReadByte(); - value.AVitemType = reader.ReadByte(); - value.AuthorizeCode = reader.ReadString(64); - value.GnssData = reader.ReadArray(36).ToArray(); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9800_0x9801 value, IJT809Config config) - { - writer.WriteByte(value.ChannelId); - writer.WriteByte(value.AVitemType); - writer.WriteStringPadRight(value.AuthorizeCode,64); - writer.WriteArray(value.GnssData); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9802.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9802.cs deleted file mode 100644 index 636f88f..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9802.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System.Text.Json; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 主动请求停止实时音视频传输消息 - /// - public class JT809_JT1078_0x9800_0x9802 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 逻辑通道号 - /// - public byte ChannelId { get; set; } - /// - /// 音视频类型 - /// - public byte AVitemType { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.主动请求停止实时音视频传输消息.ToUInt16Value(); - - public override string Description { get; } = "主动请求停止实时音视频传输消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x9800_0x9802 value = new JT809_JT1078_0x9800_0x9802(); - value.ChannelId = reader.ReadByte(); - writer.WriteString($"[{value.ChannelId.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelId)); - value.AVitemType = reader.ReadByte(); - writer.WriteString($"[{value.AVitemType.ReadNumber()}]音视频资源类型", AVResourceTypeDisplay(value.AVitemType)); - string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - switch (LogicalChannelNo) - { - case 1: - return "驾驶员"; - case 2: - return "车辆正前方"; - case 3: - return "车前门"; - case 4: - return "车厢前部"; - case 5: - return "车厢后部"; - case 7: - return "行李舱"; - case 8: - return "车辆左侧"; - case 9: - return "车辆右侧"; - case 10: - return "车辆正后方"; - case 11: - return "车厢中部"; - case 12: - return "车中门"; - case 13: - return "驾驶席车门"; - case 33: - return "驾驶员"; - case 36: - return "车厢前部"; - case 37: - return "车厢后部"; - default: - return "预留"; - } - } - string AVResourceTypeDisplay(byte AVResourceType) - { - switch (AVResourceType) - { - case 0: - return "音视频"; - case 1: - return "音频"; - case 2: - return "视频"; - default: - break; - } - return "未知"; - } - } - - public JT809_JT1078_0x9800_0x9802 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9800_0x9802 value = new JT809_JT1078_0x9800_0x9802(); - value.ChannelId = reader.ReadByte(); - value.AVitemType = reader.ReadByte(); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9800_0x9802 value, IJT809Config config) - { - writer.WriteByte(value.ChannelId); - writer.WriteByte(value.AVitemType); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900.cs deleted file mode 100644 index 648cc1c..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System.Text.Json; -using JT809.Protocol.Enums; -using JT809.Protocol.Exceptions; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 从链路远程录像检索交互消息 - /// - public class JT809_JT1078_0x9900 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter, IJT809Analyze - { - public override ushort MsgId { get; } = JT809_JT1078_BusinessType.从链路远程录像检索业务类.ToUInt16Value(); - - public override JT809_LinkType LinkType { get; } = JT809_LinkType.subordinate; - - public override string Description { get; } = "从链路远程录像检索交互消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x9900 value = new JT809_JT1078_0x9900(); - var virtualHex = reader.ReadVirtualArray(21); - value.VehicleNo = reader.ReadString(21); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]车牌号", value.VehicleNo); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - writer.WriteString($"[{((byte)value.VehicleColor).ReadNumber()}]车牌颜色", value.VehicleColor.ToString()); - value.SubBusinessType = reader.ReadUInt16(); - writer.WriteString($"[{value.SubBusinessType.ReadNumber()}]子业务类型标识", ((JT809SubBusinessType)value.SubBusinessType).ToString()); - value.DataLength = reader.ReadUInt32(); - writer.WriteNumber($"[{value.DataLength.ReadNumber()}]后续数据长度", value.DataLength); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - writer.WriteStartObject("子业务类型"); - instance.Analyze(ref reader, writer, config); - writer.WriteEndObject(); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - - public JT809_JT1078_0x9900 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9900 value = new JT809_JT1078_0x9900(); - value.VehicleNo = reader.ReadString(21); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - value.SubBusinessType = reader.ReadUInt16(); - value.DataLength = reader.ReadUInt32(); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( - instance, - ref reader, config); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9900 value, IJT809Config config) - { - writer.WriteStringPadRight(value.VehicleNo, 21); - writer.WriteByte((byte)value.VehicleColor); - writer.WriteUInt16(value.SubBusinessType); - try - { - // 先写入内容,然后在根据内容反写内容长度 - writer.Skip(4, out int subContentLengthPosition); - if (value.SubBodies != null) - { - if (!value.SubBodies.SkipSerialization) - { - JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( - value.SubBodies, - ref writer, value.SubBodies, - config); - } - } - writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9901.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9901.cs deleted file mode 100644 index 396d95d..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9901.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System.Text.Json; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 主动上传音视频资源目录信息应答消息 - /// - public class JT809_JT1078_0x9900_0x9901 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 应答结果 - /// - public JT809_JT1078_0x9900_0x9901_Result Result { get; set; } - /// - /// 资源目录总数 - /// - public byte ItemNumber { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.主动上传音视频资源目录信息应答消息.ToUInt16Value(); - - public override string Description { get; } = "主动上传音视频资源目录信息应答消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x9900_0x9901 value = new JT809_JT1078_0x9900_0x9901(); - value.Result = (JT809_JT1078_0x9900_0x9901_Result)reader.ReadByte(); - writer.WriteString($"[{ (byte)value.Result }]应答结果", value.Result.ToString()); - value.ItemNumber = reader.ReadByte(); - writer.WriteNumber($"[{value.ItemNumber.ReadNumber()}]资源目录总数", value.ItemNumber); - } - - public JT809_JT1078_0x9900_0x9901 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9900_0x9901 value = new JT809_JT1078_0x9900_0x9901(); - value.Result = (JT809_JT1078_0x9900_0x9901_Result)reader.ReadByte(); - value.ItemNumber = reader.ReadByte(); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9900_0x9901 value, IJT809Config config) - { - writer.WriteByte((byte)value.Result); - writer.WriteByte(value.ItemNumber); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9902.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9902.cs deleted file mode 100644 index 7f22c8a..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9902.cs +++ /dev/null @@ -1,190 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 查询音视频资源目录请求消息 - /// - public class JT809_JT1078_0x9900_0x9902 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 逻辑通道号 - /// - public byte ChannelId { get; set; } - /// - /// 起始时间 - /// - public DateTime StartTime { get; set; } - /// - /// 终止时间 - /// - public DateTime EndTime { get; set; } - /// - /// 报警类型 - /// - public ulong AlarmType { get; set; } - /// - /// 音视频类型 - /// - public byte AVItemType { get; set; } - /// - /// 码流类型 - /// - public byte StreamType { get; set; } - /// - /// 存储器类型 - /// - public byte MemType { get; set; } - /// - /// 时效口令 - /// 64 - /// - public string AuthorizeCode { get; set; } - /// - /// 车辆进入跨域地区后5min之内任一位置,仅跨域访问请求时,使用此字段 - /// 36 - /// - public byte[] GnssData { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.查询音视频资源目录请求消息.ToUInt16Value(); - - public override string Description { get; } = "查询音视频资源目录请求消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x9900_0x9902 value = new JT809_JT1078_0x9900_0x9902(); - value.ChannelId = reader.ReadByte(); - writer.WriteString($"[{value.ChannelId.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelId)); - var virtualHex = reader.ReadVirtualArray(8); - value.StartTime = reader.ReadUTCDateTime(); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]开始时间", value.StartTime); - virtualHex = reader.ReadVirtualArray(8); - value.EndTime = reader.ReadUTCDateTime(); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]结束时间", value.StartTime); - value.AlarmType = reader.ReadUInt64(); - writer.WriteNumber($"[{value.AlarmType.ReadNumber()}]报警标志物", value.AlarmType); - value.AVItemType = reader.ReadByte(); - writer.WriteString($"[{value.AVItemType.ReadNumber()}]音视频资源类型", AVResourceTypeDisplay(value.AVItemType)); - value.StreamType = reader.ReadByte(); - writer.WriteString($"[{value.StreamType.ReadNumber()}]码流类型", StreamTypeDisplay(value.StreamType)); - value.MemType = reader.ReadByte(); - writer.WriteString($"[{value.MemType.ReadNumber()}]存储器类型", MemoryTypeDisplay(value.MemType)); - virtualHex = reader.ReadVirtualArray(64); - value.AuthorizeCode = reader.ReadString(64); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]时效口令", value.AuthorizeCode); - virtualHex = reader.ReadVirtualArray(36); - value.GnssData = reader.ReadArray(36).ToArray(); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]车辆进入跨域地区后5min之内任一位置", virtualHex.ToArray().ToHexString()); - string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - switch (LogicalChannelNo) - { - case 1: - return "驾驶员"; - case 2: - return "车辆正前方"; - case 3: - return "车前门"; - case 4: - return "车厢前部"; - case 5: - return "车厢后部"; - case 7: - return "行李舱"; - case 8: - return "车辆左侧"; - case 9: - return "车辆右侧"; - case 10: - return "车辆正后方"; - case 11: - return "车厢中部"; - case 12: - return "车中门"; - case 13: - return "驾驶席车门"; - case 33: - return "驾驶员"; - case 36: - return "车厢前部"; - case 37: - return "车厢后部"; - default: - return "预留"; - } - } - string AVResourceTypeDisplay(byte AVResourceType) - { - switch (AVResourceType) - { - case 0: - return "音视频"; - case 1: - return "音频"; - case 2: - return "视频"; - default: - break; - } - return "未知"; - } - string StreamTypeDisplay(byte StreamType) - { - switch (StreamType) - { - case 1: - return "主码流"; - case 2: - return "子码流"; - default: - return "未知"; - } - } - string MemoryTypeDisplay(byte MemoryType) - { - switch (MemoryType) - { - case 1: - return "主存储器"; - case 2: - return "灾备存储器"; - default: - return "未知"; - } - } - } - - public JT809_JT1078_0x9900_0x9902 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9900_0x9902 value = new JT809_JT1078_0x9900_0x9902(); - value.ChannelId = reader.ReadByte(); - value.StartTime = reader.ReadUTCDateTime(); - value.EndTime = reader.ReadUTCDateTime(); - value.AlarmType = reader.ReadUInt64(); - value.AVItemType = reader.ReadByte(); - value.StreamType = reader.ReadByte(); - value.MemType = reader.ReadByte(); - value.AuthorizeCode = reader.ReadString(64); - value.GnssData = reader.ReadArray(36).ToArray(); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9900_0x9902 value, IJT809Config config) - { - writer.WriteByte(value.ChannelId); - writer.WriteUTCDateTime(value.StartTime); - writer.WriteUTCDateTime(value.EndTime); - writer.WriteUInt64(value.AlarmType); - writer.WriteByte(value.AVItemType); - writer.WriteByte(value.StreamType); - writer.WriteByte(value.MemType); - writer.WriteStringPadRight(value.AuthorizeCode, 64); - writer.WriteArray(value.GnssData); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00.cs deleted file mode 100644 index 7030750..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System.Text.Json; -using JT809.Protocol.Enums; -using JT809.Protocol.Exceptions; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 从链路远程录像回放交互消息 - /// - public class JT809_JT1078_0x9A00 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter, IJT809Analyze - { - public override ushort MsgId { get; } = JT809_JT1078_BusinessType.从链路远程录像回放业务类.ToUInt16Value(); - - public override JT809_LinkType LinkType { get; } = JT809_LinkType.subordinate; - - public override string Description { get; } = "从链路远程录像回放交互消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x9A00 value = new JT809_JT1078_0x9A00(); - var virtualHex = reader.ReadVirtualArray(21); - value.VehicleNo = reader.ReadString(21); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]车牌号", value.VehicleNo); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - writer.WriteString($"[{((byte)value.VehicleColor).ReadNumber()}]车牌颜色", value.VehicleColor.ToString()); - value.SubBusinessType = reader.ReadUInt16(); - writer.WriteString($"[{value.SubBusinessType.ReadNumber()}]子业务类型标识", ((JT809SubBusinessType)value.SubBusinessType).ToString()); - value.DataLength = reader.ReadUInt32(); - writer.WriteNumber($"[{value.DataLength.ReadNumber()}]后续数据长度", value.DataLength); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - writer.WriteStartObject("子业务类型"); - instance.Analyze(ref reader, writer, config); - writer.WriteEndObject(); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - - public JT809_JT1078_0x9A00 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9A00 value = new JT809_JT1078_0x9A00(); - value.VehicleNo = reader.ReadString(21); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - value.SubBusinessType = reader.ReadUInt16(); - value.DataLength = reader.ReadUInt32(); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( - instance, - ref reader, config); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9A00 value, IJT809Config config) - { - writer.WriteStringPadRight(value.VehicleNo, 21); - writer.WriteByte((byte)value.VehicleColor); - writer.WriteUInt16(value.SubBusinessType); - try - { - // 先写入内容,然后在根据内容反写内容长度 - writer.Skip(4, out int subContentLengthPosition); - if (value.SubBodies != null) - { - if (!value.SubBodies.SkipSerialization) - { - JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( - value.SubBodies, - ref writer, value.SubBodies, - config); - } - } - writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A01.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A01.cs deleted file mode 100644 index 87f1c92..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A01.cs +++ /dev/null @@ -1,182 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 远程录像回放请求消息 - /// - public class JT809_JT1078_0x9A00_0x9A01 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 逻辑通道号 - /// - public byte ChannelId { get; set; } - /// - /// 音视频类型 - /// - public byte AVItemType { get; set; } - /// - /// 码流类型 - /// - public byte StreamType { get; set; } - /// - /// 存储器类型 - /// - public byte MemType { get; set; } - /// - /// 回放起始时间 - /// - public DateTime PlayBackStartTime { get; set; } - /// - /// 回放结束时间 - /// - public DateTime PlayBackEndTime { get; set; } - /// - /// 时效口令 - /// 64 - /// - public string AuthorizeCode { get; set; } - /// - /// 车辆进入跨域地区后5min之内任一位置,仅跨域访问请求时,使用此字段 - /// 36 - /// - public byte[] GnssData { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像回放请求消息.ToUInt16Value(); - - public override string Description { get; } = "远程录像回放请求消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x9A00_0x9A01 value = new JT809_JT1078_0x9A00_0x9A01(); - value.ChannelId = reader.ReadByte(); - writer.WriteString($"[{value.ChannelId.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelId)); - value.AVItemType = reader.ReadByte(); - writer.WriteString($"[{value.AVItemType.ReadNumber()}]音视频资源类型", AVResourceTypeDisplay(value.AVItemType)); - value.StreamType = reader.ReadByte(); - writer.WriteString($"[{value.StreamType.ReadNumber()}]码流类型", StreamTypeDisplay(value.StreamType)); - value.MemType = reader.ReadByte(); - writer.WriteString($"[{value.MemType.ReadNumber()}]存储器类型", MemoryTypeDisplay(value.MemType)); - var virtualHex = reader.ReadVirtualArray(8); - value.PlayBackStartTime = reader.ReadUTCDateTime(); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]回放开始时间", value.PlayBackStartTime); - virtualHex = reader.ReadVirtualArray(8); - value.PlayBackEndTime = reader.ReadUTCDateTime(); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]回放结束时间", value.PlayBackEndTime); - virtualHex = reader.ReadVirtualArray(64); - value.AuthorizeCode = reader.ReadString(64); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]时效口令", value.AuthorizeCode); - virtualHex = reader.ReadVirtualArray(36); - value.GnssData = reader.ReadArray(36).ToArray(); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]车辆进入跨域地区后5min之内任一位置", virtualHex.ToArray().ToHexString()); - string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - switch (LogicalChannelNo) - { - case 1: - return "驾驶员"; - case 2: - return "车辆正前方"; - case 3: - return "车前门"; - case 4: - return "车厢前部"; - case 5: - return "车厢后部"; - case 7: - return "行李舱"; - case 8: - return "车辆左侧"; - case 9: - return "车辆右侧"; - case 10: - return "车辆正后方"; - case 11: - return "车厢中部"; - case 12: - return "车中门"; - case 13: - return "驾驶席车门"; - case 33: - return "驾驶员"; - case 36: - return "车厢前部"; - case 37: - return "车厢后部"; - default: - return "预留"; - } - } - string AVResourceTypeDisplay(byte AVResourceType) - { - switch (AVResourceType) - { - case 0: - return "音视频"; - case 1: - return "音频"; - case 2: - return "视频"; - default: - break; - } - return "未知"; - } - string StreamTypeDisplay(byte StreamType) - { - switch (StreamType) - { - case 1: - return "主码流"; - case 2: - return "子码流"; - default: - return "未知"; - } - } - string MemoryTypeDisplay(byte MemoryType) - { - switch (MemoryType) - { - case 1: - return "主存储器"; - case 2: - return "灾备存储器"; - default: - return "未知"; - } - } - } - - public JT809_JT1078_0x9A00_0x9A01 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9A00_0x9A01 value = new JT809_JT1078_0x9A00_0x9A01(); - value.ChannelId = reader.ReadByte(); - value.AVItemType = reader.ReadByte(); - value.StreamType = reader.ReadByte(); - value.MemType = reader.ReadByte(); - value.PlayBackStartTime = reader.ReadUTCDateTime(); - value.PlayBackEndTime = reader.ReadUTCDateTime(); - value.AuthorizeCode = reader.ReadString(64); - value.GnssData = reader.ReadArray(36).ToArray(); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9A00_0x9A01 value, IJT809Config config) - { - writer.WriteByte(value.ChannelId); - writer.WriteByte(value.AVItemType); - writer.WriteByte(value.StreamType); - writer.WriteByte(value.MemType); - writer.WriteUTCDateTime(value.PlayBackStartTime); - writer.WriteUTCDateTime(value.PlayBackEndTime); - writer.WriteStringPadRight(value.AuthorizeCode, 64); - writer.WriteArray(value.GnssData); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A02.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A02.cs deleted file mode 100644 index bb17410..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A02.cs +++ /dev/null @@ -1,60 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 远程录像回放控制消息 - /// - public class JT809_JT1078_0x9A00_0x9A02 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 控制类型 - /// - public ControlType ControlType { get; set; } - /// - /// 快进或倒退倍数 - /// - public FastTime FastTime { get; set; } - /// - /// 拖动位置 - /// - public DateTime DateTime { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像回放控制消息.ToUInt16Value(); - - public override string Description { get; } = "远程录像回放控制消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x9A00_0x9A02 value = new JT809_JT1078_0x9A00_0x9A02(); - value.ControlType = (ControlType)reader.ReadByte(); - writer.WriteString($"[{((byte)value.ControlType).ReadNumber()}]控制类型", value.ControlType.ToString()); - value.FastTime = (FastTime)reader.ReadByte(); - writer.WriteString($"[{((byte)value.FastTime).ReadNumber()}]快进或倒退倍数", value.FastTime.ToString()); - var virtualHex = reader.ReadVirtualArray(8); - value.DateTime = reader.ReadUTCDateTime(); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]拖动位置", value.DateTime); - } - - public JT809_JT1078_0x9A00_0x9A02 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9A00_0x9A02 value = new JT809_JT1078_0x9A00_0x9A02(); - value.ControlType = (ControlType)reader.ReadByte(); - value.FastTime = (FastTime)reader.ReadByte(); - value.DateTime = reader.ReadUTCDateTime(); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9A00_0x9A02 value, IJT809Config config) - { - writer.WriteByte((byte)value.ControlType); - writer.WriteByte((byte)value.FastTime); - writer.WriteUTCDateTime(value.DateTime); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00.cs deleted file mode 100644 index 62a4791..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00.cs +++ /dev/null @@ -1,114 +0,0 @@ -using JT809.Protocol.Enums; -using JT809.Protocol.Exceptions; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 从链路远程录像下载交互消息 - /// - public class JT809_JT1078_0x9B00 : JT809ExchangeMessageBodies, IJT809MessagePackFormatter, IJT809Analyze - { - public override ushort MsgId { get; } = JT809_JT1078_BusinessType.从链路远程录像下载业务类.ToUInt16Value(); - - public override JT809_LinkType LinkType { get; } = JT809_LinkType.subordinate; - - public override string Description { get; } = "从链路远程录像下载交互消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x9B00 value = new JT809_JT1078_0x9B00(); - var virtualHex = reader.ReadVirtualArray(21); - value.VehicleNo = reader.ReadString(21); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]车牌号", value.VehicleNo); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - writer.WriteString($"[{((byte)value.VehicleColor).ReadNumber()}]车牌颜色", value.VehicleColor.ToString()); - value.SubBusinessType = reader.ReadUInt16(); - writer.WriteString($"[{value.SubBusinessType.ReadNumber()}]子业务类型标识", ((JT809SubBusinessType)value.SubBusinessType).ToString()); - value.DataLength = reader.ReadUInt32(); - writer.WriteNumber($"[{value.DataLength.ReadNumber()}]后续数据长度", value.DataLength); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - writer.WriteStartObject("子业务类型"); - instance.Analyze(ref reader, writer, config); - writer.WriteEndObject(); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - - public JT809_JT1078_0x9B00 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9B00 value = new JT809_JT1078_0x9B00(); - value.VehicleNo = reader.ReadString(21); - value.VehicleColor = (JT809VehicleColorType)reader.ReadByte(); - value.SubBusinessType = reader.ReadUInt16(); - value.DataLength = reader.ReadUInt32(); - try - { - if (config.SubBusinessTypeFactory.TryGetValue(value.SubBusinessType, out object instance)) - { - if (instance is JT809SubBodies subBodies) - { - if (!subBodies.SkipSerialization) - { - value.SubBodies = JT809MessagePackFormatterResolverExtensions.JT809DynamicDeserialize( - instance, - ref reader, config); - } - } - } - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9B00 value, IJT809Config config) - { - writer.WriteStringPadRight(value.VehicleNo, 21); - writer.WriteByte((byte)value.VehicleColor); - writer.WriteUInt16(value.SubBusinessType); - try - { - // 先写入内容,然后在根据内容反写内容长度 - writer.Skip(4, out int subContentLengthPosition); - if (value.SubBodies != null) - { - if (!value.SubBodies.SkipSerialization) - { - JT809MessagePackFormatterResolverExtensions.JT809DynamicSerialize( - value.SubBodies, - ref writer, value.SubBodies, - config); - } - } - writer.WriteInt32Return(writer.GetCurrentPosition() - subContentLengthPosition - 4, subContentLengthPosition); - } - catch - { - throw new JT809Exception(JT809ErrorCode.SubBodiesParseError, $"SubBusinessType>{value.SubBusinessType.ToString()}"); - } - } - } -} diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B01.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B01.cs deleted file mode 100644 index 3887ba9..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B01.cs +++ /dev/null @@ -1,202 +0,0 @@ -using JT809.Protocol.Attributes; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Extensions.JT1078.Formatters; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 远程录像下载请求消息 - /// - public class JT809_JT1078_0x9B00_0x9B01 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 逻辑通道号 - /// - public byte ChannelId { get; set; } - /// - /// 起始时间 - /// - public DateTime StartTime { get; set; } - /// - /// 终止时间 - /// - public DateTime EndTime { get; set; } - /// - /// 报警类型 - /// - public ulong AlarmType { get; set; } - /// - /// 音视频类型 - /// - public byte AVItemType { get; set; } - /// - /// 码流类型 - /// - public byte StreamType { get; set; } - /// - /// 存储器类型 - /// - public byte MemType { get; set; } - /// - /// 文件大小 byte - /// - public uint FileSize { get; set; } - /// - /// 时效口令 - /// 64 - /// - public string AuthorizeCode { get; set; } - /// - /// 车辆进入跨域地区后5min之内任一位置,仅跨域访问请求时,使用此字段 - /// 36 - /// - public byte[] GnssData { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像下载请求消息.ToUInt16Value(); - - public override string Description { get; } = "远程录像下载请求消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x9B00_0x9B01 value = new JT809_JT1078_0x9B00_0x9B01(); - value.ChannelId = reader.ReadByte(); - writer.WriteString($"[{value.ChannelId.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelId)); - var virtualHex = reader.ReadVirtualArray(8); - value.StartTime = reader.ReadUTCDateTime(); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]开始时间", value.StartTime); - virtualHex = reader.ReadVirtualArray(8); - value.EndTime = reader.ReadUTCDateTime(); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]结束时间", value.StartTime); - value.AlarmType = reader.ReadUInt64(); - writer.WriteNumber($"[{value.AlarmType.ReadNumber()}]报警标志物", value.AlarmType); - value.AVItemType = reader.ReadByte(); - writer.WriteString($"[{value.AVItemType.ReadNumber()}]音视频资源类型", AVResourceTypeDisplay(value.AVItemType)); - value.StreamType = reader.ReadByte(); - writer.WriteString($"[{value.StreamType.ReadNumber()}]码流类型", StreamTypeDisplay(value.StreamType)); - value.MemType = reader.ReadByte(); - writer.WriteString($"[{value.MemType.ReadNumber()}]存储器类型", MemoryTypeDisplay(value.MemType)); - value.FileSize = reader.ReadUInt32(); - writer.WriteNumber($"[{value.FileSize.ReadNumber()}文件大小 byte]", value.FileSize); - virtualHex = reader.ReadVirtualArray(64); - value.AuthorizeCode = reader.ReadString(64); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]时效口令", value.AuthorizeCode); - virtualHex = reader.ReadVirtualArray(36); - value.GnssData = reader.ReadArray(36).ToArray(); - writer.WriteString($"[{virtualHex.ToArray().ToHexString()}]车辆进入跨域地区后5min之内任一位置", virtualHex.ToArray().ToHexString()); - string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - switch (LogicalChannelNo) - { - case 1: - return "驾驶员"; - case 2: - return "车辆正前方"; - case 3: - return "车前门"; - case 4: - return "车厢前部"; - case 5: - return "车厢后部"; - case 7: - return "行李舱"; - case 8: - return "车辆左侧"; - case 9: - return "车辆右侧"; - case 10: - return "车辆正后方"; - case 11: - return "车厢中部"; - case 12: - return "车中门"; - case 13: - return "驾驶席车门"; - case 33: - return "驾驶员"; - case 36: - return "车厢前部"; - case 37: - return "车厢后部"; - default: - return "预留"; - } - } - string AVResourceTypeDisplay(byte AVResourceType) - { - switch (AVResourceType) - { - case 0: - return "音视频"; - case 1: - return "音频"; - case 2: - return "视频"; - default: - break; - } - return "未知"; - } - string StreamTypeDisplay(byte StreamType) - { - switch (StreamType) - { - case 1: - return "主码流"; - case 2: - return "子码流"; - default: - return "未知"; - } - } - string MemoryTypeDisplay(byte MemoryType) - { - switch (MemoryType) - { - case 1: - return "主存储器"; - case 2: - return "灾备存储器"; - default: - return "未知"; - } - } - } - - public JT809_JT1078_0x9B00_0x9B01 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9B00_0x9B01 value = new JT809_JT1078_0x9B00_0x9B01(); - value.ChannelId = reader.ReadByte(); - value.StartTime = reader.ReadUTCDateTime(); - value.EndTime = reader.ReadUTCDateTime(); - value.AlarmType = reader.ReadUInt64(); - value.AVItemType = reader.ReadByte(); - value.StreamType = reader.ReadByte(); - value.MemType = reader.ReadByte(); - value.FileSize = reader.ReadUInt32(); - value.AuthorizeCode = reader.ReadString(64); - value.GnssData = reader.ReadArray(36).ToArray(); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9B00_0x9B01 value, IJT809Config config) - { - writer.WriteByte(value.ChannelId); - writer.WriteUTCDateTime(value.StartTime); - writer.WriteUTCDateTime(value.EndTime); - writer.WriteUInt64(value.AlarmType); - writer.WriteByte(value.AVItemType); - writer.WriteByte(value.StreamType); - writer.WriteByte(value.MemType); - writer.WriteUInt32(value.FileSize); - writer.WriteStringPadRight(value.AuthorizeCode,64); - writer.WriteArray(value.GnssData); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B02.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B02.cs deleted file mode 100644 index fcb4c5d..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B02.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System.Text.Json; -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 远程录像下载完成通知应答消息 - /// - public class JT809_JT1078_0x9B00_0x9B02 : JT809SubBodies,IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 应答结果 - /// - public JT809_JT1078_0x9B00_0x9B02_Result Result { get; set; } - /// - /// 对应平台文件上传消息的流水号 - /// - public ushort SessionId { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像下载完成通知应答消息.ToUInt16Value(); - - public override string Description { get; } = "远程录像下载完成通知应答消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x9B00_0x9B02 value = new JT809_JT1078_0x9B00_0x9B02(); - value.Result = (JT809_JT1078_0x9B00_0x9B02_Result)reader.ReadByte(); - writer.WriteString($"[{((byte)value.Result).ReadNumber()}]应答结果", value.Result.ToString()); - value.SessionId = reader.ReadUInt16(); - writer.WriteNumber($"[{value.SessionId.ReadNumber()}]对应平台文件上传消息的流水号", value.SessionId); - } - - public JT809_JT1078_0x9B00_0x9B02 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9B00_0x9B02 value = new JT809_JT1078_0x9B00_0x9B02(); - value.Result = (JT809_JT1078_0x9B00_0x9B02_Result)reader.ReadByte(); - value.SessionId = reader.ReadUInt16(); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9B00_0x9B02 value, IJT809Config config) - { - writer.WriteByte((byte)value.Result); - writer.WriteUInt16(value.SessionId); - } - } -} \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B03.cs b/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B03.cs deleted file mode 100644 index 43287d1..0000000 --- a/src/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B03.cs +++ /dev/null @@ -1,53 +0,0 @@ -using JT809.Protocol.Extensions.JT1078.Enums; -using JT809.Protocol.Formatters; -using JT809.Protocol.Interfaces; -using JT809.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT809.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 远程录像下载控制消息 - /// - public class JT809_JT1078_0x9B00_0x9B03 : JT809SubBodies, IJT809MessagePackFormatter, IJT809Analyze - { - /// - /// 对应平台文件上传消息的流水号 - /// - public ushort SessionId { get; set; } - /// - /// 控制类型 - /// - public JT809_JT1078_0x9B00_0x9B03_Type Type { get; set; } - - public override ushort SubMsgId { get; } = JT809_JT1078_SubBusinessType.远程录像下载控制消息.ToUInt16Value(); - - public override string Description { get; } = "远程录像下载控制消息"; - - public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config) - { - JT809_JT1078_0x9B00_0x9B03 value = new JT809_JT1078_0x9B00_0x9B03(); - value.SessionId = reader.ReadUInt16(); - writer.WriteNumber($"[{ value.SessionId.ReadNumber()}]对应平台文件上传消息的流水号", value.SessionId); - value.Type = (JT809_JT1078_0x9B00_0x9B03_Type)reader.ReadByte(); - writer.WriteString($"[{((byte)value.Type).ReadNumber()}]控制类型", value.Type.ToString()); - } - - public JT809_JT1078_0x9B00_0x9B03 Deserialize(ref JT809MessagePackReader reader, IJT809Config config) - { - JT809_JT1078_0x9B00_0x9B03 value = new JT809_JT1078_0x9B00_0x9B03(); - value.SessionId = reader.ReadUInt16(); - value.Type = (JT809_JT1078_0x9B00_0x9B03_Type)reader.ReadByte(); - return value; - } - - public void Serialize(ref JT809MessagePackWriter writer, JT809_JT1078_0x9B00_0x9B03 value, IJT809Config config) - { - writer.WriteUInt16(value.SessionId); - writer.WriteByte((byte)value.Type); - } - } -} \ No newline at end of file