|
- 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<IJT809Config>();
- JT809Serializer = defaultConfig.GetSerializer();
-
- Newtonsoft.Json.JsonConvert.DefaultSettings = new Func<JsonSerializerSettings>(() =>
- {
- //日期类型默认格式化处理
- 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<JT809_JT1078_0x1700>(hex);
-
- hex = "D4C14231323334350000000000000000000000000002170200000000".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x1700>(hex);
-
- hex = "D4C142313233343500000000000000000000000000021801000000230100000000000000000000000000000000000000000000003132372E302E302E311F90".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x1800>(hex);
-
- hex = "D4C1423132333435000000000000000000000000000218020000000101".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x1800>(hex);
-
- hex = "D4C142313233343500000000000000000000000000021901000000440000000203000000005D2BE082000000005D2D32020000000000000001020605000000041F000000005D045382000000005D05A502000000000000000B153D3300000029".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x1900>(hex);
-
- hex = "D4C14231323334350000000000000000000000000002190200000045010000000203000000005D2BE082000000005D2D32020000000000000001020605000000041F000000005D045382000000005D05A502000000000000000B153D3300000029".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x1900>(hex);
-
- hex = "D4C142313233343500000000000000000000000000021A010000002300000000000000000000000000000000000000000000003132372E302E302E311F9001".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x1A00>(hex);
-
- hex = "D4C142313233343500000000000000000000000000021A020000000101".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x1A00>(hex);
-
- hex = "D4C142313233343500000000000000000000000000021B0100000003010002".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x1B00>(hex);
-
- hex = "D4C142313233343500000000000000000000000000021B020000013401000200000000000000000000000000000000000000000000003132372E302E302E311F900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000746B0000000000000000000000000000746B313233343536000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000443A2F2F3132332F343536".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x1B00>(hex);
-
- hex = "D4C142313233343500000000000000000000000000021B030000000101".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x1B00>(hex);
-
- hex = "D4C14231323334350000000000000000000000000002970200000000".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x9700>(hex);
-
- hex = "D4C14231323334350000000000000000000000000002980100000066020130313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x9800>(hex);
-
- hex = "D4C142313233343500000000000000000000000000029802000000020102".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x9800>(hex);
-
- hex = "D4C142313233343500000000000000000000000000029901000000020102".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x9900>(hex);
-
- hex = "D4C1423132333435000000000000000000000000000299020000008001000000005969798200000000596ACB02000000000000000203050430313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x9900>(hex);
-
- hex = "D4C142313233343500000000000000000000000000029A01000000780201040300000000596ACB0200000000596C1C8230313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x9A00>(hex);
-
- hex = "D4C142313233343500000000000000000000000000029A020000000A010100000000596C1C82".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x9A00>(hex);
-
- hex = "D4C142313233343500000000000000000000000000029B01000000840200000000596ACB0200000000596C1C8200000000000000050104030000000630313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x9B00>(hex);
-
- hex = "D4C142313233343500000000000000000000000000029B0200000003010002".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x9B00>(hex);
-
- hex = "D4C142313233343500000000000000000000000000029B0300000003000201".ToHexBytes();
- json = JT809Serializer.Analyze<JT809_JT1078_0x9B00>(hex);
- }
- }
- }
|