Kaynağa Gözat

1.升级1078的808、809扩展协议

2.修改文档
tags/v1.1.0
SmallChi(Koike) 5 yıl önce
ebeveyn
işleme
777b2abe18
15 değiştirilmiş dosya ile 317 ekleme ve 70 silme
  1. +29
    -35
      README.md
  2. +3
    -8
      src/JT1078.Flv.Benchmark/JT1078.Flv.Benchmark.csproj
  3. +1
    -1
      src/JT1078.Flv.Benchmark/JT1078FlvEncoderContext.cs
  4. +129
    -0
      src/JT1078.Flv.Benchmark/JT808HexExtensions.cs
  5. +46
    -0
      src/JT1078.Flv/JT1078.Flv.xml
  6. +9
    -8
      src/JT1078.Protocol.Benchmark/JT1078.Protocol.Benchmark.csproj
  7. +84
    -0
      src/JT1078.Protocol.Benchmark/JT1078FlvEncoderContext.cs
  8. +1
    -2
      src/JT1078.Protocol.Benchmark/JT1078SerializerContext.cs
  9. +0
    -2
      src/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj
  10. +3
    -2
      src/JT808.Protocol.Extensions.JT1078.Test/JT808LocationAttach.cs
  11. +4
    -4
      src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x8103CustomId.cs
  12. +1
    -1
      src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9102Test.cs
  13. +2
    -2
      src/JT808.Protocol.Extensions.JT1078/JT808.Protocol.Extensions.JT1078.csproj
  14. +3
    -3
      src/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj
  15. +2
    -2
      src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj

+ 29
- 35
README.md Dosyayı Görüntüle

@@ -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 |

## <span id="1078flv">基于JT1078的Flv视频编码器</span>

@@ -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 |

## <span id="808ext">基于JT808扩展的JT1078消息协议</span>



+ 3
- 8
src/JT1078.Flv.Benchmark/JT1078.Flv.Benchmark.csproj Dosyayı Görüntüle

@@ -1,17 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.0;</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>AnyCPU</PlatformTarget>
<OutputType>Exe</OutputType>
<StartupObject />
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.11.5" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.11.5" />
<PackageReference Include="JT808" Version="2.1.7" />
<PackageReference Include="NETStandard.Library" Version="2.0.3" />
<PackageReference Include="BenchmarkDotNet" Version="0.12.0" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.12.0" />
<PackageReference Include="System.Buffers" Version="4.5.0" />
<PackageReference Include="System.Memory" Version="4.5.3" />
</ItemGroup>


+ 1
- 1
src/JT1078.Flv.Benchmark/JT1078FlvEncoderContext.cs Dosyayı Görüntüle

@@ -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));
}
}
}

+ 129
- 0
src/JT1078.Flv.Benchmark/JT808HexExtensions.cs Dosyayı Görüntüle

@@ -0,0 +1,129 @@
using System;

namespace JT808.Protocol.Extensions
{
/// <summary>
///
/// ref:"www.codeproject.com/tips/447938/high-performance-csharp-byte-array-to-hex-string-t"
/// </summary>
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;
}

/// <summary>
/// 16进制字符串转16进制数组
/// </summary>
/// <param name="hexString"></param>
/// <param name="separator"></param>
/// <returns></returns>
public static byte[] ToHexBytes(this string hexString)
{
hexString = hexString.Replace(" ", "");
byte[] buf = new byte[hexString.Length / 2];
ReadOnlySpan<char> 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<byte> read, ref int offset, int len)
{
ReadOnlySpan<byte> source = read.Slice(offset, len);
string hex = HexUtil.DoHexDump(read, offset, len);
offset += len;
return hex;
}

/// <summary>
/// Copyright (c) Microsoft. All rights reserved.
/// Licensed under the MIT license. See LICENSE file in the project root for full license information.
/// <see cref="DotNetty.Buffers.ByteBufferUtil"/>
/// </summary>

}

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<byte> 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);
}
}
}

+ 46
- 0
src/JT1078.Flv/JT1078.Flv.xml Dosyayı Görüntüle

@@ -79,6 +79,31 @@
<param name="currentBufferFlvFrame">当前接收到的flv数据</param>
<returns></returns>
</member>
<member name="T:JT1078.Flv.FlvFrameInfo">
<summary>
flv存储帧信息
</summary>
</member>
<member name="P:JT1078.Flv.FlvFrameInfo.PreviousTagSize">
<summary>
flv上一帧的数据大小
</summary>
</member>
<member name="P:JT1078.Flv.FlvFrameInfo.Timestamp">
<summary>
1078当前时间戳
</summary>
</member>
<member name="P:JT1078.Flv.FlvFrameInfo.Interval">
<summary>
与flv上一帧相减的时间间隔
</summary>
</member>
<member name="P:JT1078.Flv.FlvFrameInfo.LastDataType">
<summary>
1078数据类型
</summary>
</member>
<member name="P:JT1078.Flv.FlvTags.DataSize">
<summary>
Tag Data部分大小
@@ -123,6 +148,27 @@
</summary>
</member>
<!-- Badly formed XML comment ignored for member "T:JT1078.Flv.Metadata.AVCDecoderConfigurationRecord" -->
<member name="P:JT1078.Flv.Metadata.IAmf3Metadata.FieldNameLength">
<summary>
字段长度
</summary>
</member>
<member name="P:JT1078.Flv.Metadata.IAmf3Metadata.FieldName">
<summary>
字段名称
</summary>
</member>
<member name="P:JT1078.Flv.Metadata.IAmf3Metadata.DataType">
<summary>
Amf3数据类型
ref:video_file_format_spec_v10.pdf scriptdatavalue type
</summary>
</member>
<member name="P:JT1078.Flv.Metadata.IAmf3Metadata.Value">
<summary>
对应的值
</summary>
</member>
<member name="P:JT1078.Flv.Metadata.VideoTags.FrameType">
<summary>
高4位


+ 9
- 8
src/JT1078.Protocol.Benchmark/JT1078.Protocol.Benchmark.csproj Dosyayı Görüntüle

@@ -1,21 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.2;net472;netcoreapp3.0;</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>AnyCPU</PlatformTarget>
<OutputType>Exe</OutputType>
<StartupObject />
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.11.5" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.11.5" />
<PackageReference Include="JT808" Version="2.1.7" />
<PackageReference Include="NETStandard.Library" Version="2.0.3" />
<PackageReference Include="BenchmarkDotNet" Version="0.12.0" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.12.0" />
<PackageReference Include="System.Buffers" Version="4.5.0" />
<PackageReference Include="System.Memory" Version="4.5.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\JT1078.Flv.Benchmark\JT1078.Flv.Benchmark.csproj" />
<ProjectReference Include="..\JT1078.Flv\JT1078.Flv.csproj" />
<ProjectReference Include="..\JT1078.Protocol\JT1078.Protocol.csproj" />
</ItemGroup>



+ 84
- 0
src/JT1078.Protocol.Benchmark/JT1078FlvEncoderContext.cs Dosyayı Görüntüle

@@ -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<H264NALU> 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));
}
}
}

+ 1
- 2
src/JT1078.Protocol.Benchmark/JT1078SerializerContext.cs Dosyayı Görüntüle

@@ -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));
}
}
}

+ 0
- 2
src/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj Dosyayı Görüntüle

@@ -2,8 +2,6 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>


+ 3
- 2
src/JT808.Protocol.Extensions.JT1078.Test/JT808LocationAttach.cs Dosyayı Görüntüle

@@ -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<IJT808Config>();
var defaultConfig = ServiceProvider1.GetRequiredService<DefaultGlobalConfig>();
JT808Serializer = new JT808Serializer(defaultConfig);
}
[Fact]


+ 4
- 4
src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x8103CustomId.cs Dosyayı Görüntüle

@@ -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<IJT808Config>();
var defaultConfig = ServiceProvider1.GetRequiredService<DefaultGlobalConfig>();
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);
}


+ 1
- 1
src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9102Test.cs Dosyayı Görüntüle

@@ -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();


+ 2
- 2
src/JT808.Protocol.Extensions.JT1078/JT808.Protocol.Extensions.JT1078.csproj Dosyayı Görüntüle

@@ -15,7 +15,7 @@
<licenseUrl>https://github.com/SmallChi/JT1078/blob/master/LICENSE</licenseUrl>
<license>https://github.com/SmallChi/JT1078/blob/master/LICENSE</license>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>2.2.2</Version>
<Version>2.2.3</Version>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>

@@ -28,7 +28,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JT808" Version="2.2.2" />
<PackageReference Include="JT808" Version="2.2.3" />
</ItemGroup>

<ItemGroup>


+ 3
- 3
src/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj Dosyayı Görüntüle

@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>


+ 2
- 2
src/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj Dosyayı Görüntüle

@@ -15,7 +15,7 @@
<licenseUrl>https://github.com/SmallChi/JT1078/blob/master/LICENSE</licenseUrl>
<license>https://github.com/SmallChi/JT1078/blob/master/LICENSE</license>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>2.1.2</Version>
<Version>2.1.3</Version>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>

@@ -27,7 +27,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="JT809" Version="2.1.2" />
<PackageReference Include="JT809" Version="2.1.3" />
</ItemGroup>

</Project>

Yükleniyor…
İptal
Kaydet