From 777b2abe18f7112d6abffe47a7099066fdc1fb01 Mon Sep 17 00:00:00 2001
From: "SmallChi(Koike)" <564952747@qq.com>
Date: Sun, 29 Dec 2019 11:21:16 +0800
Subject: [PATCH] =?UTF-8?q?1.=E5=8D=87=E7=BA=A71078=E7=9A=84808=E3=80=8180?=
=?UTF-8?q?9=E6=89=A9=E5=B1=95=E5=8D=8F=E8=AE=AE=202.=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E6=96=87=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 64 ++++-----
.../JT1078.Flv.Benchmark.csproj | 11 +-
.../JT1078FlvEncoderContext.cs | 2 +-
.../JT808HexExtensions.cs | 129 ++++++++++++++++++
src/JT1078.Flv/JT1078.Flv.xml | 46 +++++++
.../JT1078.Protocol.Benchmark.csproj | 17 +--
.../JT1078FlvEncoderContext.cs | 84 ++++++++++++
.../JT1078SerializerContext.cs | 3 +-
...808.Protocol.Extensions.JT1078.Test.csproj | 2 -
.../JT808LocationAttach.cs | 5 +-
.../JT808_0x8103CustomId.cs | 8 +-
.../JT808_0x9102Test.cs | 2 +-
.../JT808.Protocol.Extensions.JT1078.csproj | 4 +-
...809.Protocol.Extensions.JT1078.Test.csproj | 6 +-
.../JT809.Protocol.Extensions.JT1078.csproj | 4 +-
15 files changed, 317 insertions(+), 70 deletions(-)
create mode 100644 src/JT1078.Flv.Benchmark/JT808HexExtensions.cs
create mode 100644 src/JT1078.Protocol.Benchmark/JT1078FlvEncoderContext.cs
diff --git a/README.md b/README.md
index 0709257..22e819e 100644
--- a/README.md
+++ b/README.md
@@ -127,29 +127,23 @@ Assert.Equal("00 00 00 01 61 E1 A2 BF 00 98 CF C0 EE 1E 17 28 34 07 78 8E 39 A4
``` ini
-BenchmarkDotNet=v0.11.5, OS=Windows 10.0.18362
+BenchmarkDotNet=v0.12.0, OS=Windows 10.0.18363
Intel Core i7-8700K CPU 3.70GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores
- [Host] : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 64bit RyuJIT-v4.8.4018.0
- Job-LGLQDK : .NET Core 2.2.7 (CoreCLR 4.6.28008.02, CoreFX 4.6.28008.03), 64bit RyuJIT
- Job-ZHZJMS : .NET Core 3.0.0 (CoreCLR 4.700.19.46205, CoreFX 4.700.19.46214), 64bit RyuJIT
+.NET Core SDK=3.1.100
+ [Host] : .NET Core 3.1.0 (CoreCLR 4.700.19.56402, CoreFX 4.700.19.56404), X64 RyuJIT
+ Job-SIQGUC : .NET Core 3.1.0 (CoreCLR 4.700.19.56402, CoreFX 4.700.19.56404), X64 RyuJIT
-Platform=AnyCpu Server=False
+Platform=AnyCpu Server=False Toolchain=.NET Core 3.1
```
-| Method | Toolchain | N | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
-|------------------ |-------------- |------- |--------------:|--------------:|--------------:|-----------:|--------:|------:|-------------:|
-| **JT1078Serializer** | **.NET Core 2.2** | **100** | **549.14 us** | **6.4469 us** | **6.0305 us** | **38.0859** | **-** | **-** | **235.16 KB** |
-| JT1078Deserialize | .NET Core 2.2 | 100 | 42.61 us | 0.2607 us | 0.2439 us | 23.8647 | 0.0610 | - | 146.88 KB |
-| JT1078Serializer | .NET Core 3.0 | 100 | 196.98 us | 1.8462 us | 1.7270 us | 37.8418 | - | - | 232.81 KB |
-| JT1078Deserialize | .NET Core 3.0 | 100 | 33.64 us | 0.3528 us | 0.3128 us | 23.8037 | - | - | 146.09 KB |
-| **JT1078Serializer** | **.NET Core 2.2** | **10000** | **54,292.55 us** | **221.0286 us** | **195.9361 us** | **3800.0000** | **-** | **-** | **23515.63 KB** |
-| JT1078Deserialize | .NET Core 2.2 | 10000 | 4,276.85 us | 25.6729 us | 21.4381 us | 2382.8125 | 7.8125 | - | 14687.5 KB |
-| JT1078Serializer | .NET Core 3.0 | 10000 | 17,527.79 us | 203.5101 us | 190.3634 us | 3781.2500 | - | - | 23281.25 KB |
-| JT1078Deserialize | .NET Core 3.0 | 10000 | 3,450.90 us | 49.3875 us | 43.7807 us | 2382.8125 | 3.9063 | - | 14609.38 KB |
-| **JT1078Serializer** | **.NET Core 2.2** | **100000** | **544,508.44 us** | **4,522.9521 us** | **4,009.4793 us** | **38000.0000** | **-** | **-** | **235156.25 KB** |
-| JT1078Deserialize | .NET Core 2.2 | 100000 | 43,453.20 us | 169.8988 us | 158.9234 us | 23833.3333 | 83.3333 | - | 146875 KB |
-| JT1078Serializer | .NET Core 3.0 | 100000 | 174,163.26 us | 848.6417 us | 708.6542 us | 38000.0000 | - | - | 232812.5 KB |
-| JT1078Deserialize | .NET Core 3.0 | 100000 | 34,266.16 us | 357.1659 us | 334.0932 us | 23800.0000 | - | - | 146093.75 KB |
+| Method | N | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
+|------------------ |------- |--------------:|-------------:|-------------:|-----------:|-------:|------:|-------------:|
+| **JT1078Serializer** | **100** | **183.51 us** | **2.207 us** | **2.064 us** | **37.8418** | **-** | **-** | **232.81 KB** |
+| JT1078Deserialize | 100 | 35.88 us | 0.503 us | 0.420 us | 23.8037 | - | - | 146.09 KB |
+| **JT1078Serializer** | **10000** | **23,107.15 us** | **196.882 us** | **184.164 us** | **3781.2500** | **-** | **-** | **23281.25 KB** |
+| JT1078Deserialize | 10000 | 3,620.54 us | 45.558 us | 40.386 us | 2382.8125 | 3.9063 | - | 14609.38 KB |
+| **JT1078Serializer** | **100000** | **236,213.13 us** | **5,465.042 us** | **6,074.380 us** | **38000.0000** | **-** | **-** | **232812.5 KB** |
+| JT1078Deserialize | 100000 | 37,065.84 us | 665.875 us | 590.281 us | 23785.7143 | - | - | 146093.75 KB |
## 基于JT1078的Flv视频编码器
@@ -182,26 +176,26 @@ Platform=AnyCpu Server=False
``` ini
-BenchmarkDotNet=v0.11.5, OS=Windows 10.0.18362
+BenchmarkDotNet=v0.12.0, OS=Windows 10.0.18363
Intel Core i7-8700K CPU 3.70GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores
-.NET Core SDK=3.0.100
- [Host] : .NET Core 3.0.0 (CoreCLR 4.700.19.46205, CoreFX 4.700.19.46214), 64bit RyuJIT
- Job-QJAHWX : .NET Core 3.0.0 (CoreCLR 4.700.19.46205, CoreFX 4.700.19.46214), 64bit RyuJIT
+.NET Core SDK=3.1.100
+ [Host] : .NET Core 3.1.0 (CoreCLR 4.700.19.56402, CoreFX 4.700.19.56404), X64 RyuJIT
+ Job-GMXLRW : .NET Core 3.1.0 (CoreCLR 4.700.19.56402, CoreFX 4.700.19.56404), X64 RyuJIT
-Platform=AnyCpu Server=False Toolchain=.NET Core 3.0
+Platform=AnyCpu Server=False Toolchain=.NET Core 3.1
```
-| Method | N | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
-|---------------- |------- |----------------:|---------------:|---------------:|------------:|----------:|------:|-------------:|
-| **EXPGolombReader** | **100** | **12.15 us** | **0.2320 us** | **0.2482 us** | **1.5259** | **-** | **-** | **9.38 KB** |
-| H264Decoder | 100 | 1,353.34 us | 10.7795 us | 9.0014 us | 128.9063 | 1.9531 | - | 795.31 KB |
-| FlvEncoder | 100 | 215.75 us | 4.3104 us | 8.3047 us | 252.1973 | 3.6621 | - | 1545.31 KB |
-| **EXPGolombReader** | **10000** | **1,125.22 us** | **13.9630 us** | **13.0610 us** | **152.3438** | **-** | **-** | **937.5 KB** |
-| H264Decoder | 10000 | 136,046.46 us | 2,694.6748 us | 2,388.7590 us | 12750.0000 | 250.0000 | - | 79531.25 KB |
-| FlvEncoder | 10000 | 22,609.35 us | 448.6121 us | 1,133.7000 us | 25218.7500 | 343.7500 | - | 154531.25 KB |
-| **EXPGolombReader** | **100000** | **11,832.04 us** | **240.9705 us** | **321.6888 us** | **1515.6250** | **-** | **-** | **9375 KB** |
-| H264Decoder | 100000 | 1,430,712.75 us | 27,590.0058 us | 27,097.0749 us | 129000.0000 | 3000.0000 | - | 795312.5 KB |
-| FlvEncoder | 100000 | 224,622.61 us | 4,087.9082 us | 3,823.8318 us | 252000.0000 | 3666.6667 | - | 1545312.5 KB |
+| Method | N | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
+|---------------- |------- |----------------:|-------------:|-------------:|------------:|----------:|------:|--------------:|
+| **EXPGolombReader** | **100** | **11.23 us** | **0.032 us** | **0.025 us** | **1.5259** | **-** | **-** | **9.38 KB** |
+| H264Decoder | 100 | 1,218.74 us | 23.313 us | 27.752 us | 126.9531 | 1.9531 | - | 786.72 KB |
+| FlvEncoder | 100 | 215.40 us | 3.245 us | 2.533 us | 249.0234 | 3.4180 | - | 1528.91 KB |
+| **EXPGolombReader** | **10000** | **1,170.19 us** | **22.642 us** | **25.167 us** | **152.3438** | **-** | **-** | **937.5 KB** |
+| H264Decoder | 10000 | 119,152.25 us | 955.118 us | 893.418 us | 12800.0000 | 200.0000 | - | 78672.14 KB |
+| FlvEncoder | 10000 | 21,582.41 us | 587.627 us | 549.667 us | 24937.5000 | - | - | 152890.63 KB |
+| **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 |
## 基于JT808扩展的JT1078消息协议
diff --git a/src/JT1078.Flv.Benchmark/JT1078.Flv.Benchmark.csproj b/src/JT1078.Flv.Benchmark/JT1078.Flv.Benchmark.csproj
index 385985a..65a49d3 100644
--- a/src/JT1078.Flv.Benchmark/JT1078.Flv.Benchmark.csproj
+++ b/src/JT1078.Flv.Benchmark/JT1078.Flv.Benchmark.csproj
@@ -1,17 +1,12 @@
- net472;netcoreapp3.0;
- true
- AnyCPU
Exe
-
+ netcoreapp3.1
-
-
-
-
+
+
diff --git a/src/JT1078.Flv.Benchmark/JT1078FlvEncoderContext.cs b/src/JT1078.Flv.Benchmark/JT1078FlvEncoderContext.cs
index 80d99b3..8fd9b31 100644
--- a/src/JT1078.Flv.Benchmark/JT1078FlvEncoderContext.cs
+++ b/src/JT1078.Flv.Benchmark/JT1078FlvEncoderContext.cs
@@ -78,7 +78,7 @@ namespace JT1078.Flv.Benchmark
{
public JT1078FlvEncoderConfig()
{
- Add(Job.Default.WithGcServer(false).With(CsProjCoreToolchain.NetCoreApp30).With(Platform.AnyCpu));
+ Add(Job.Default.WithGcServer(false).With(CsProjCoreToolchain.NetCoreApp31).With(Platform.AnyCpu));
}
}
}
diff --git a/src/JT1078.Flv.Benchmark/JT808HexExtensions.cs b/src/JT1078.Flv.Benchmark/JT808HexExtensions.cs
new file mode 100644
index 0000000..8248bd5
--- /dev/null
+++ b/src/JT1078.Flv.Benchmark/JT808HexExtensions.cs
@@ -0,0 +1,129 @@
+using System;
+
+namespace JT808.Protocol.Extensions
+{
+ ///
+ ///
+ /// ref:"www.codeproject.com/tips/447938/high-performance-csharp-byte-array-to-hex-string-t"
+ ///
+ public static partial class JT808BinaryExtensions
+ {
+ public static string ToHexString(this byte[] source)
+ {
+ return HexUtil.DoHexDump(source, 0, source.Length).ToUpper();
+ }
+
+ public static int WriteHexStringLittle(byte[] bytes, int offset, string data, int len)
+ {
+ if (data == null) data = "";
+ data = data.Replace(" ", "");
+ int startIndex = 0;
+ if (data.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
+ {
+ startIndex = 2;
+ }
+ int length = len;
+ if (length == -1)
+ {
+ length = (data.Length - startIndex) / 2;
+ }
+ int noOfZero = length * 2 + startIndex - data.Length;
+ if (noOfZero > 0)
+ {
+ data = data.Insert(startIndex, new string('0', noOfZero));
+ }
+ int byteIndex = 0;
+ while (startIndex < data.Length && byteIndex < length)
+ {
+ bytes[offset + byteIndex] = Convert.ToByte(data.Substring(startIndex, 2), 16);
+ startIndex += 2;
+ byteIndex++;
+ }
+ return length;
+ }
+
+ ///
+ /// 16进制字符串转16进制数组
+ ///
+ ///
+ ///
+ ///
+ public static byte[] ToHexBytes(this string hexString)
+ {
+ hexString = hexString.Replace(" ", "");
+ byte[] buf = new byte[hexString.Length / 2];
+ ReadOnlySpan readOnlySpan = hexString.AsSpan();
+ for (int i = 0; i < hexString.Length; i++)
+ {
+ if (i % 2 == 0)
+ {
+ buf[i / 2] = Convert.ToByte(readOnlySpan.Slice(i, 2).ToString(), 16);
+ }
+ }
+ return buf;
+ }
+
+ public static string ReadHexStringLittle(ReadOnlySpan read, ref int offset, int len)
+ {
+ ReadOnlySpan source = read.Slice(offset, len);
+ string hex = HexUtil.DoHexDump(read, offset, len);
+ offset += len;
+ return hex;
+ }
+
+ ///
+ /// Copyright (c) Microsoft. All rights reserved.
+ /// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ ///
+ ///
+
+ }
+
+ public static class HexUtil
+ {
+ static readonly char[] HexdumpTable = new char[256 * 4];
+ static HexUtil()
+ {
+ char[] digits = "0123456789ABCDEF".ToCharArray();
+ for (int i = 0; i < 256; i++)
+ {
+ HexdumpTable[i << 1] = digits[(int)((uint)i >> 4 & 0x0F)];
+ HexdumpTable[(i << 1) + 1] = digits[i & 0x0F];
+ }
+ }
+
+ public static string DoHexDump(ReadOnlySpan buffer, int fromIndex, int length)
+ {
+ if (length == 0)
+ {
+ return "";
+ }
+ int endIndex = fromIndex + length;
+ var buf = new char[length << 1];
+ int srcIdx = fromIndex;
+ int dstIdx = 0;
+ for (; srcIdx < endIndex; srcIdx++, dstIdx += 2)
+ {
+ Array.Copy(HexdumpTable, buffer[srcIdx] << 1, buf, dstIdx, 2);
+ }
+ return new string(buf);
+ }
+
+ public static string DoHexDump(byte[] array, int fromIndex, int length)
+ {
+ if (length == 0)
+ {
+ return "";
+ }
+ int endIndex = fromIndex + length;
+ var buf = new char[length << 1];
+ int srcIdx = fromIndex;
+ int dstIdx = 0;
+ for (; srcIdx < endIndex; srcIdx++, dstIdx += 2)
+ {
+ Array.Copy(HexdumpTable, (array[srcIdx] & 0xFF) << 1, buf, dstIdx, 2);
+ }
+ return new string(buf);
+ }
+ }
+}
diff --git a/src/JT1078.Flv/JT1078.Flv.xml b/src/JT1078.Flv/JT1078.Flv.xml
index 639bba6..420425a 100644
--- a/src/JT1078.Flv/JT1078.Flv.xml
+++ b/src/JT1078.Flv/JT1078.Flv.xml
@@ -79,6 +79,31 @@
当前接收到的flv数据
+
+
+ flv存储帧信息
+
+
+
+
+ flv上一帧的数据大小
+
+
+
+
+ 1078当前时间戳
+
+
+
+
+ 与flv上一帧相减的时间间隔
+
+
+
+
+ 1078数据类型
+
+
Tag Data部分大小
@@ -123,6 +148,27 @@
+
+
+ 字段长度
+
+
+
+
+ 字段名称
+
+
+
+
+ Amf3数据类型
+ ref:video_file_format_spec_v10.pdf scriptdatavalue type
+
+
+
+
+ 对应的值
+
+
高4位
diff --git a/src/JT1078.Protocol.Benchmark/JT1078.Protocol.Benchmark.csproj b/src/JT1078.Protocol.Benchmark/JT1078.Protocol.Benchmark.csproj
index 565db06..e2d06c4 100644
--- a/src/JT1078.Protocol.Benchmark/JT1078.Protocol.Benchmark.csproj
+++ b/src/JT1078.Protocol.Benchmark/JT1078.Protocol.Benchmark.csproj
@@ -1,21 +1,22 @@
- netcoreapp2.2;net472;netcoreapp3.0;
- true
- AnyCPU
Exe
-
+ netcoreapp3.1
+
+
+
+ true
-
-
-
-
+
+
+
+
diff --git a/src/JT1078.Protocol.Benchmark/JT1078FlvEncoderContext.cs b/src/JT1078.Protocol.Benchmark/JT1078FlvEncoderContext.cs
new file mode 100644
index 0000000..8fd9b31
--- /dev/null
+++ b/src/JT1078.Protocol.Benchmark/JT1078FlvEncoderContext.cs
@@ -0,0 +1,84 @@
+using BenchmarkDotNet.Attributes;
+using BenchmarkDotNet.Configs;
+using BenchmarkDotNet.Environments;
+using BenchmarkDotNet.Jobs;
+using BenchmarkDotNet.Toolchains.CsProj;
+using JT1078.Flv.MessagePack;
+using JT1078.Protocol;
+using JT1078.Protocol.H264;
+using JT1078.Protocol.MessagePack;
+using JT808.Protocol.Extensions;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace JT1078.Flv.Benchmark
+{
+ [Config(typeof(JT1078FlvEncoderConfig))]
+ [MarkdownExporterAttribute.GitHub]
+ [MemoryDiagnoser]
+ public class JT1078FlvEncoderContext
+ {
+ JT1078Package Package;
+ List H264NALUs;
+ H264NALU SPSNALu;
+ H264Decoder h264Decoder = new H264Decoder();
+ FlvEncoder flvEncoder = new FlvEncoder();
+
+ [Params(100, 10000, 100000)]
+ public int N;
+
+ [GlobalSetup]
+ public void Setup()
+ {
+ var lines = File.ReadAllLines(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "JT1078_1.txt"));
+ foreach (var line in lines)
+ {
+ var data = line.Split(',');
+ var bytes = data[6].ToHexBytes();
+ JT1078Package package = JT1078Serializer.Deserialize(bytes);
+ Package = JT1078Serializer.Merge(package);
+ }
+ H264NALUs = h264Decoder.ParseNALU(Package);
+ SPSNALu = H264NALUs.FirstOrDefault(f => f.NALUHeader.NalUnitType == 7);
+ SPSNALu.RawData = h264Decoder.DiscardEmulationPreventionBytes(SPSNALu.RawData);
+ }
+
+ [Benchmark(Description = "EXPGolombReader")]
+ public void EXPGolombReaderTest()
+ {
+ for (var i = 0; i < N; i++)
+ {
+ ExpGolombReader h264GolombReader = new ExpGolombReader(SPSNALu.RawData);
+ h264GolombReader.ReadSPS();
+ }
+ }
+
+ [Benchmark(Description = "H264Decoder")]
+ public void H264Decoder()
+ {
+ for (var i = 0; i < N; i++)
+ {
+ var nalus = h264Decoder.ParseNALU(Package);
+ }
+ }
+
+ [Benchmark(Description = "FlvEncoder")]
+ public void FlvEncoder()
+ {
+ for(var i=0;i< N;i++)
+ {
+ var contents = flvEncoder.CreateFlvFrame(H264NALUs);
+ }
+ }
+ }
+
+ public class JT1078FlvEncoderConfig : ManualConfig
+ {
+ public JT1078FlvEncoderConfig()
+ {
+ Add(Job.Default.WithGcServer(false).With(CsProjCoreToolchain.NetCoreApp31).With(Platform.AnyCpu));
+ }
+ }
+}
diff --git a/src/JT1078.Protocol.Benchmark/JT1078SerializerContext.cs b/src/JT1078.Protocol.Benchmark/JT1078SerializerContext.cs
index fdffe44..c471fae 100644
--- a/src/JT1078.Protocol.Benchmark/JT1078SerializerContext.cs
+++ b/src/JT1078.Protocol.Benchmark/JT1078SerializerContext.cs
@@ -58,8 +58,7 @@ namespace JT1078.Protocol.Benchmark
{
public JT1078SerializerConfig()
{
- Add(Job.Default.WithGcServer(false).With(CsProjCoreToolchain.NetCoreApp22).With(Platform.AnyCpu));
- Add(Job.Default.WithGcServer(false).With(CsProjCoreToolchain.NetCoreApp30).With(Platform.AnyCpu));
+ Add(Job.Default.WithGcServer(false).With(CsProjCoreToolchain.NetCoreApp31).With(Platform.AnyCpu));
}
}
}
diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj b/src/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj
index ca4ef0c..1df775e 100644
--- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj
+++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj
@@ -2,8 +2,6 @@
netcoreapp3.1
-
- false
diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808LocationAttach.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808LocationAttach.cs
index eea6927..6be3cbb 100644
--- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808LocationAttach.cs
+++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808LocationAttach.cs
@@ -16,9 +16,10 @@ namespace JT808.Protocol.Extensions.JT1078.Test
public JT808LocationAttach()
{
IServiceCollection serviceDescriptors1 = new ServiceCollection();
- serviceDescriptors1.AddJT808Configure(new DefaultGlobalConfig()).AddJT1078Configure();
+ serviceDescriptors1.AddJT808Configure(new DefaultGlobalConfig())
+ .AddJT1078Configure();
var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider();
- var defaultConfig = ServiceProvider1.GetRequiredService();
+ var defaultConfig = ServiceProvider1.GetRequiredService();
JT808Serializer = new JT808Serializer(defaultConfig);
}
[Fact]
diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x8103CustomId.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x8103CustomId.cs
index 297b038..b63f351 100644
--- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x8103CustomId.cs
+++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x8103CustomId.cs
@@ -18,9 +18,10 @@ namespace JT808.Protocol.Extensions.JT1078.Test
public JT808_0x8103CustomId()
{
IServiceCollection serviceDescriptors1 = new ServiceCollection();
- serviceDescriptors1.AddJT808Configure(new DefaultGlobalConfig()).AddJT1078Configure();
+ serviceDescriptors1.AddJT808Configure(new DefaultGlobalConfig())
+ .AddJT1078Configure();
var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider();
- var defaultConfig = ServiceProvider1.GetRequiredService();
+ var defaultConfig = ServiceProvider1.GetRequiredService();
JT808Serializer = new JT808Serializer(defaultConfig);
}
[Fact]
@@ -31,7 +32,7 @@ namespace JT808.Protocol.Extensions.JT1078.Test
Header = new JT808Header
{
MsgId = JT808MsgId.设置终端参数.ToUInt16Value(),
- MsgNum = 10,
+ ManualMsgNum = 10,
TerminalPhoneNo = "123456789",
},
Bodies = new JT808_0x8103
@@ -154,7 +155,6 @@ namespace JT808.Protocol.Extensions.JT1078.Test
}
}
};
- var str = Newtonsoft.Json.JsonConvert.SerializeObject(jT808Package.Bodies);
var hex = JT808Serializer.Serialize(jT808Package).ToHexString();
Assert.Equal("7E8103009C000123456789000A070000007515030500040700000006080A00090C0000000B000201000000761B02010303020001070604050B0A08090F0E0C0D1312101117161415000000772B0201030500040700000006080A00090C0000000B000201030500040700000006080A00090C0000000B000200000079030302010000007A04000000010000007B0201020000007C140103020A00230012004500340067005600890078587E", hex);
}
diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9102Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9102Test.cs
index e3f6993..72c1bc3 100644
--- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9102Test.cs
+++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9102Test.cs
@@ -51,7 +51,7 @@ namespace JT808.Protocol.Extensions.JT1078.Test
JT808Package jT808Package = new JT808Package();
JT808Header header = new JT808Header();
header.MsgId = 0x9102;
- header.MsgNum = 1;
+ header.ManualMsgNum = 1;
header.TerminalPhoneNo = "12345679810";
jT808Package.Header = header;
JT808_0x9102 jT808_0X9102 = new JT808_0x9102();
diff --git a/src/JT808.Protocol.Extensions.JT1078/JT808.Protocol.Extensions.JT1078.csproj b/src/JT808.Protocol.Extensions.JT1078/JT808.Protocol.Extensions.JT1078.csproj
index 8ffe968..e14d106 100644
--- a/src/JT808.Protocol.Extensions.JT1078/JT808.Protocol.Extensions.JT1078.csproj
+++ b/src/JT808.Protocol.Extensions.JT1078/JT808.Protocol.Extensions.JT1078.csproj
@@ -15,7 +15,7 @@
https://github.com/SmallChi/JT1078/blob/master/LICENSE
https://github.com/SmallChi/JT1078/blob/master/LICENSE
false
- 2.2.2
+ 2.2.3
LICENSE
@@ -28,7 +28,7 @@
-
+
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
index 38b1f73..4ff0696 100644
--- 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
@@ -1,12 +1,12 @@
- netcoreapp3.0
+ netcoreapp3.1
-
-
+
+
all
diff --git a/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj b/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj
index 9297c31..ad46298 100644
--- a/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj
+++ b/src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj
@@ -15,7 +15,7 @@
https://github.com/SmallChi/JT1078/blob/master/LICENSE
https://github.com/SmallChi/JT1078/blob/master/LICENSE
false
- 2.1.2
+ 2.1.3
LICENSE
@@ -27,7 +27,7 @@
-
+