From 064b5117697a1f7aaddca0398f19bccba0de629d Mon Sep 17 00:00:00 2001
From: "SmallChi(Koike)" <564952747@qq.com>
Date: Wed, 22 Dec 2021 21:03:54 +0800
Subject: [PATCH] =?UTF-8?q?1.=E5=8D=87=E7=BA=A7net6=202.=E6=96=B0=E5=A2=9E?=
=?UTF-8?q?=E8=BD=A6=E8=BE=86=E9=A2=9C=E8=89=B2=E4=B8=BA2021=E6=A0=87?=
=?UTF-8?q?=E5=87=86=203.=E4=BF=AE=E6=94=B9=E6=96=87=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/dotnetcore.yml | 2 +-
README.md | 26 +++++-----
src/Info.props | 12 ++---
.../JT809.Protocol.Benchmark.csproj | 4 +-
.../JT809SerializerContext.cs | 2 +-
.../JT809.Protocol.Test.csproj | 8 ++--
.../JT809_0x1500_0x1502Test.cs | 8 ++--
.../JT809_0x9500_0x9502Test.cs | 2 +-
.../Enums/JT809VehicleColorType.cs | 14 ++++--
...ImageType.cs => JT809_0x9502_ImageType.cs} | 2 +-
...2_SizeType.cs => JT809_0x9502_SizeType.cs} | 2 +-
src/JT809.Protocol/JT809.Protocol.csproj | 47 ++++++++++++-------
src/JT809.Protocol/JT809.Protocol.xml | 2 +-
.../SubMessageBody/JT809_0x1500_0x1502.cs | 12 ++---
.../SubMessageBody/JT809_0x9500_0x9502.cs | 6 +--
15 files changed, 83 insertions(+), 66 deletions(-)
rename src/JT809.Protocol/Enums/{JT809__0x9502_ImageType.cs => JT809_0x9502_ImageType.cs} (82%)
rename src/JT809.Protocol/Enums/{JT809__0x9502_SizeType.cs => JT809_0x9502_SizeType.cs} (89%)
diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml
index 38273f3..b9375a0 100644
--- a/.github/workflows/dotnetcore.yml
+++ b/.github/workflows/dotnetcore.yml
@@ -12,7 +12,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@master
with:
- dotnet-version: 5.0.100
+ dotnet-version: 6.0.100
- name: dotnet info
run: dotnet --info
- name: dotnet restore
diff --git a/README.md b/README.md
index 5739642..47bc9e9 100644
--- a/README.md
+++ b/README.md
@@ -301,23 +301,23 @@ public class JT809_2019_Config : JT809GlobalConfigBase
``` ini
-BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19041.630 (2004/?/20H1)
+BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22000
Intel Core i7-8700K CPU 3.70GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores
-.NET Core SDK=5.0.100
- [Host] : .NET Core 5.0.0 (CoreCLR 5.0.20.51904, CoreFX 5.0.20.51904), X64 RyuJIT
- Job-VIMLSX : .NET Core 5.0.0 (CoreCLR 5.0.20.51904, CoreFX 5.0.20.51904), X64 RyuJIT
+.NET SDK=6.0.101
+ [Host] : .NET 6.0.1 (6.0.121.56705), X64 RyuJIT
+ Job-GLUSZL : .NET 6.0.1 (6.0.121.56705), X64 RyuJIT
-Platform=AnyCpu Server=False Toolchain=.NET Core 5.0
+Platform=AnyCpu Server=False Toolchain=.NET 6.0
```
-| Method | N | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
-|---------------------------------------- |------- |-------------:|------------:|-------------:|-----------:|------:|------:|-------------:|
-| **JT809_0x9400_0x9401_Package_Deserialize** | **100** | **466.5 μs** | **2.08 μs** | **1.85 μs** | **16.6016** | **-** | **-** | **103.13 KB** |
-| JT809_0x9400_0x9401_Package_Serialize | 100 | 202.8 μs | 3.98 μs | 4.09 μs | 14.6484 | - | - | 90.63 KB |
-| **JT809_0x9400_0x9401_Package_Deserialize** | **10000** | **46,739.4 μs** | **230.36 μs** | **179.85 μs** | **1636.3636** | **-** | **-** | **10312.53 KB** |
-| JT809_0x9400_0x9401_Package_Serialize | 10000 | 19,994.5 μs | 155.11 μs | 129.53 μs | 1468.7500 | - | - | 9062.51 KB |
-| **JT809_0x9400_0x9401_Package_Deserialize** | **100000** | **479,053.9 μs** | **9,378.79 μs** | **11,518.00 μs** | **16000.0000** | **-** | **-** | **103125.28 KB** |
-| JT809_0x9400_0x9401_Package_Serialize | 100000 | 205,928.8 μs | 2,074.26 μs | 1,940.26 μs | 14000.0000 | - | - | 90625.28 KB |
+| Method | N | Mean | Error | StdDev | Gen 0 | Allocated |
+|---------------------------------------- |------- |-------------:|------------:|------------:|-----------:|-----------:|
+| **JT809_0x9400_0x9401_Package_Deserialize** | **100** | **518.6 μs** | **4.07 μs** | **3.40 μs** | **16.6016** | **103 KB** |
+| JT809_0x9400_0x9401_Package_Serialize | 100 | 182.1 μs | 1.60 μs | 1.34 μs | 14.6484 | 91 KB |
+| **JT809_0x9400_0x9401_Package_Deserialize** | **10000** | **50,367.9 μs** | **477.53 μs** | **446.68 μs** | **1600.0000** | **10,313 KB** |
+| JT809_0x9400_0x9401_Package_Serialize | 10000 | 18,303.2 μs | 176.25 μs | 164.87 μs | 1468.7500 | 9,063 KB |
+| **JT809_0x9400_0x9401_Package_Deserialize** | **100000** | **502,960.6 μs** | **2,001.44 μs** | **1,774.22 μs** | **16000.0000** | **103,129 KB** |
+| JT809_0x9400_0x9401_Package_Serialize | 100000 | 182,137.2 μs | 1,709.29 μs | 1,598.87 μs | 14000.0000 | 90,626 KB |
## JT809协议消息对照表
diff --git a/src/Info.props b/src/Info.props
index 5fbb770..ff0a445 100644
--- a/src/Info.props
+++ b/src/Info.props
@@ -1,14 +1,14 @@
- netstandard2.0;netstandard2.1;net5.0;
- 9.0
+ netstandard2.0;netstandard2.1;net5.0;net6.0
+ 10.0
Copyright 2018.
SmallChi(Koike)
https://github.com/SmallChi/JT809
https://github.com/SmallChi/JT809
https://github.com/SmallChi/JT809/blob/master/LICENSE
https://github.com/SmallChi/JT809/blob/master/LICENSE
- 2.2.1-preview1
+ 2.2.1-preview2
LICENSE
true
latest
@@ -16,8 +16,8 @@
true
false
README.md
- true
- embedded
+ true
+ embedded
true
@@ -26,6 +26,6 @@
-
+
\ No newline at end of file
diff --git a/src/JT809.Protocol.Benchmark/JT809.Protocol.Benchmark.csproj b/src/JT809.Protocol.Benchmark/JT809.Protocol.Benchmark.csproj
index 888daaa..5688656 100644
--- a/src/JT809.Protocol.Benchmark/JT809.Protocol.Benchmark.csproj
+++ b/src/JT809.Protocol.Benchmark/JT809.Protocol.Benchmark.csproj
@@ -2,11 +2,11 @@
Exe
- net5.0
+ net6.0
-
+
diff --git a/src/JT809.Protocol.Benchmark/JT809SerializerContext.cs b/src/JT809.Protocol.Benchmark/JT809SerializerContext.cs
index 6369555..4c333a3 100644
--- a/src/JT809.Protocol.Benchmark/JT809SerializerContext.cs
+++ b/src/JT809.Protocol.Benchmark/JT809SerializerContext.cs
@@ -87,7 +87,7 @@ namespace JT809.Protocol.Benchmark
{
public JT809SerializerContextConfig()
{
- AddJob(Job.Default.WithGcServer(false).WithToolchain(CsProjCoreToolchain.NetCoreApp50).WithPlatform(Platform.AnyCpu));
+ AddJob(Job.Default.WithGcServer(false).WithToolchain(CsProjCoreToolchain.NetCoreApp60).WithPlatform(Platform.AnyCpu));
}
}
}
diff --git a/src/JT809.Protocol.Test/JT809.Protocol.Test.csproj b/src/JT809.Protocol.Test/JT809.Protocol.Test.csproj
index d5cbcf6..176937c 100644
--- a/src/JT809.Protocol.Test/JT809.Protocol.Test.csproj
+++ b/src/JT809.Protocol.Test/JT809.Protocol.Test.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
false
1701;1702;1591
@@ -11,9 +11,9 @@
-
-
-
+
+
+
all
diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1500_0x1502Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1500_0x1502Test.cs
index e63152f..b8711ef 100644
--- a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1500_0x1502Test.cs
+++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1500_0x1502Test.cs
@@ -41,8 +41,8 @@ namespace JT809.Protocol.Test.JT809SubMessageBody
Alarm = 1
},
LensID = 123,
- SizeType = JT809__0x9502_SizeType._320x240,
- Type = JT809__0x9502_ImageType.jpg,
+ SizeType = JT809_0x9502_SizeType._320x240,
+ Type = JT809_0x9502_ImageType.jpg,
};
var hex = JT809Serializer.Serialize(jT809_0x1500_0x1502).ToHexString();
//"01 00 13 07 07 DC 0F 0F 0F 07 EF 4D 80 01 70 18 40 00 35 00 2D 00 00 04 D2 00 2D 00 2D 00 00 00 01 00 00 00 01 7B 00 00 00 00 01 01"
@@ -74,8 +74,8 @@ namespace JT809.Protocol.Test.JT809SubMessageBody
Assert.Equal((uint)1, vehiclePosition.State);
Assert.Equal((uint)1, vehiclePosition.Alarm);
Assert.Equal(123, jT809_0x1500_0x1502.LensID);
- Assert.Equal(JT809__0x9502_SizeType._320x240, jT809_0x1500_0x1502.SizeType);
- Assert.Equal(JT809__0x9502_ImageType.jpg, jT809_0x1500_0x1502.Type);
+ Assert.Equal(JT809_0x9502_SizeType._320x240, jT809_0x1500_0x1502.SizeType);
+ Assert.Equal(JT809_0x9502_ImageType.jpg, jT809_0x1500_0x1502.Type);
}
}
}
diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9502Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9502Test.cs
index 017cbfa..de7c842 100644
--- a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9502Test.cs
+++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9502Test.cs
@@ -19,7 +19,7 @@ namespace JT809.Protocol.Test.JT809SubMessageBody
JT809_0x9500_0x9502 jT809_0X9500_0X9502 = new JT809_0x9500_0x9502
{
LensID=0x09,
- SizeType= Enums.JT809__0x9502_SizeType._320x240
+ SizeType= Enums.JT809_0x9502_SizeType._320x240
};
var hex = JT809Serializer.Serialize(jT809_0X9500_0X9502).ToHexString();
Assert.Equal("0901", hex);
diff --git a/src/JT809.Protocol/Enums/JT809VehicleColorType.cs b/src/JT809.Protocol/Enums/JT809VehicleColorType.cs
index 0e9af58..b05aec1 100644
--- a/src/JT809.Protocol/Enums/JT809VehicleColorType.cs
+++ b/src/JT809.Protocol/Enums/JT809VehicleColorType.cs
@@ -5,14 +5,18 @@ using System.Text;
namespace JT809.Protocol.Enums
{
///
- /// 车辆颜色,按照 JT/T415-2006 中5.4.12 的规定
+ /// 车辆颜色,按照 JT/T 415-2021 中5.4.12 的规定
///
- public enum JT809VehicleColorType:byte
+ public enum JT809VehicleColorType : byte
{
- 蓝色=0x01,
- 黄色=0x02,
+ 蓝色 = 0x01,
+ 黄色 = 0x02,
黑色 = 0x03,
白色 = 0x04,
- 其他 =0x09,
+ 其他 = 0x09,
+ 农黄色 = 91,
+ 农绿色 = 92,
+ 黄绿色 = 93,
+ 渐变绿 = 94,
}
}
diff --git a/src/JT809.Protocol/Enums/JT809__0x9502_ImageType.cs b/src/JT809.Protocol/Enums/JT809_0x9502_ImageType.cs
similarity index 82%
rename from src/JT809.Protocol/Enums/JT809__0x9502_ImageType.cs
rename to src/JT809.Protocol/Enums/JT809_0x9502_ImageType.cs
index f5884f9..4648c92 100644
--- a/src/JT809.Protocol/Enums/JT809__0x9502_ImageType.cs
+++ b/src/JT809.Protocol/Enums/JT809_0x9502_ImageType.cs
@@ -4,7 +4,7 @@ using System.Text;
namespace JT809.Protocol.Enums
{
- public enum JT809__0x9502_ImageType
+ public enum JT809_0x9502_ImageType
{
jpg=0x01,
gif=0x02,
diff --git a/src/JT809.Protocol/Enums/JT809__0x9502_SizeType.cs b/src/JT809.Protocol/Enums/JT809_0x9502_SizeType.cs
similarity index 89%
rename from src/JT809.Protocol/Enums/JT809__0x9502_SizeType.cs
rename to src/JT809.Protocol/Enums/JT809_0x9502_SizeType.cs
index d2af4a7..02bda52 100644
--- a/src/JT809.Protocol/Enums/JT809__0x9502_SizeType.cs
+++ b/src/JT809.Protocol/Enums/JT809_0x9502_SizeType.cs
@@ -4,7 +4,7 @@ using System.Text;
namespace JT809.Protocol.Enums
{
- public enum JT809__0x9502_SizeType
+ public enum JT809_0x9502_SizeType
{
_320x240=0x01,
_640x480=0x02,
diff --git a/src/JT809.Protocol/JT809.Protocol.csproj b/src/JT809.Protocol/JT809.Protocol.csproj
index 1f419bd..4901c73 100644
--- a/src/JT809.Protocol/JT809.Protocol.csproj
+++ b/src/JT809.Protocol/JT809.Protocol.csproj
@@ -31,8 +31,8 @@
-
-
+
+
@@ -84,24 +84,37 @@
-
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/JT809.Protocol/JT809.Protocol.xml b/src/JT809.Protocol/JT809.Protocol.xml
index 784b671..1267f7f 100644
--- a/src/JT809.Protocol/JT809.Protocol.xml
+++ b/src/JT809.Protocol/JT809.Protocol.xml
@@ -4369,7 +4369,7 @@
- 车辆颜色,按照 JT/T415-2006 中5.4.12 的规定
+ 车辆颜色,按照 JT/T 415-2021 中5.4.12 的规定
diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x1500_0x1502.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x1500_0x1502.cs
index 31afe24..4f18dcf 100644
--- a/src/JT809.Protocol/SubMessageBody/JT809_0x1500_0x1502.cs
+++ b/src/JT809.Protocol/SubMessageBody/JT809_0x1500_0x1502.cs
@@ -45,11 +45,11 @@ namespace JT809.Protocol.SubMessageBody
///
/// 图片大小
///
- public JT809__0x9502_SizeType SizeType { get; set; }
+ public JT809_0x9502_SizeType SizeType { get; set; }
///
/// 图像格式
///
- public JT809__0x9502_ImageType Type { get; set; }
+ public JT809_0x9502_ImageType Type { get; set; }
///
/// 图片内容
///
@@ -72,9 +72,9 @@ namespace JT809.Protocol.SubMessageBody
writer.WriteNumber($"[{value.LensID}]镜头ID", value.LensID);
value.PhotoLen = reader.ReadUInt32();
writer.WriteNumber($"[{value.PhotoLen}]图片长度", value.PhotoLen);
- value.SizeType = (JT809__0x9502_SizeType)reader.ReadByte();
+ value.SizeType = (JT809_0x9502_SizeType)reader.ReadByte();
writer.WriteString($"[{value.SizeType.ToByteValue()}]图片大小", value.SizeType.ToString());
- value.Type = (JT809__0x9502_ImageType)reader.ReadByte();
+ value.Type = (JT809_0x9502_ImageType)reader.ReadByte();
writer.WriteString($"[{value.Type.ToByteValue()}]图像格式", value.Type.ToString());
if (value.PhotoLen > 0)
{
@@ -97,8 +97,8 @@ namespace JT809.Protocol.SubMessageBody
}
value.LensID = reader.ReadByte();
value.PhotoLen = reader.ReadUInt32();
- value.SizeType = (JT809__0x9502_SizeType)reader.ReadByte();
- value.Type = (JT809__0x9502_ImageType)reader.ReadByte();
+ value.SizeType = (JT809_0x9502_SizeType)reader.ReadByte();
+ value.Type = (JT809_0x9502_ImageType)reader.ReadByte();
if (value.PhotoLen > 0)
{
value.Photo = reader.ReadArray((int)value.PhotoLen).ToArray();
diff --git a/src/JT809.Protocol/SubMessageBody/JT809_0x9500_0x9502.cs b/src/JT809.Protocol/SubMessageBody/JT809_0x9500_0x9502.cs
index afc2608..cc6a11f 100644
--- a/src/JT809.Protocol/SubMessageBody/JT809_0x9500_0x9502.cs
+++ b/src/JT809.Protocol/SubMessageBody/JT809_0x9500_0x9502.cs
@@ -32,14 +32,14 @@ namespace JT809.Protocol.SubMessageBody
/// 0x07:704x288[HALF D];
/// Ox08:704x576[DI]
///
- public JT809__0x9502_SizeType SizeType { get; set; }
+ public JT809_0x9502_SizeType SizeType { get; set; }
public void Analyze(ref JT809MessagePackReader reader, Utf8JsonWriter writer, IJT809Config config)
{
JT809_0x9500_0x9502 value = new JT809_0x9500_0x9502();
value.LensID = reader.ReadByte();
writer.WriteNumber($"[{value.LensID.ReadNumber() }]镜头ID", value.LensID);
- value.SizeType = (JT809__0x9502_SizeType)reader.ReadByte();
+ value.SizeType = (JT809_0x9502_SizeType)reader.ReadByte();
writer.WriteString($"[{value.SizeType.ToByteValue()}]图片大小", value.SizeType.ToString());
}
@@ -47,7 +47,7 @@ namespace JT809.Protocol.SubMessageBody
{
JT809_0x9500_0x9502 value = new JT809_0x9500_0x9502();
value.LensID = reader.ReadByte();
- value.SizeType = (JT809__0x9502_SizeType)reader.ReadByte();
+ value.SizeType = (JT809_0x9502_SizeType)reader.ReadByte();
return value;
}
public void Serialize(ref JT809MessagePackWriter writer, JT809_0x9500_0x9502 value, IJT809Config config)