diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 2d37504..38273f3 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -21,3 +21,7 @@ jobs: run: dotnet build ./src/JT809.Protocol.Test/JT809.Protocol.Test.csproj - name: dotnet test run: dotnet test ./src/JT809.Protocol.Test/JT809.Protocol.Test.csproj + - name: dotnet JT809.Protocol.Extensions.JT1078.Test build + run: dotnet build ./src/JT809.Protocol.Extensions/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/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj diff --git a/README.md b/README.md index 5c7e763..bf2c7ea 100644 --- a/README.md +++ b/README.md @@ -479,3 +479,56 @@ Platform=AnyCpu Server=False Toolchain=.NET Core 5.0 |:------:|:------:|:------:|:------:|:------:| | 1 | 0x9600 | √ | √ | 从链路静态信息交换消息 | | 2 | 0x9601 | √ | √ | 补报车辆静态信息应答 | + +## 基于JT1078扩展的JT809消息协议 + +### 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/Info.props b/src/Info.props new file mode 100644 index 0000000..02a584e --- /dev/null +++ b/src/Info.props @@ -0,0 +1,20 @@ + + + netstandard2.0;netstandard2.1;net5.0; + 9.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 + LICENSE + true + latest + true + true + false + README.md + + \ No newline at end of file diff --git a/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj new file mode 100644 index 0000000..2330ad2 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj @@ -0,0 +1,21 @@ + + + + net5.0 + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + diff --git a/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1700Test.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1700Test.cs new file mode 100644 index 0000000..ebe9144 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1700Test.cs @@ -0,0 +1,88 @@ +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/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1800Test.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1800Test.cs new file mode 100644 index 0000000..993b7d3 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1800Test.cs @@ -0,0 +1,85 @@ +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/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1900Test.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1900Test.cs new file mode 100644 index 0000000..c48631a --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1900Test.cs @@ -0,0 +1,174 @@ +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/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1A00Test.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1A00Test.cs new file mode 100644 index 0000000..400f04d --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1A00Test.cs @@ -0,0 +1,97 @@ +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/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1B00Test.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1B00Test.cs new file mode 100644 index 0000000..87ff30d --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x1B00Test.cs @@ -0,0 +1,135 @@ +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/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9700Test.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9700Test.cs new file mode 100644 index 0000000..181c325 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9700Test.cs @@ -0,0 +1,50 @@ +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/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9800Test.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9800Test.cs new file mode 100644 index 0000000..70ef290 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9800Test.cs @@ -0,0 +1,93 @@ +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/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9900Test.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9900Test.cs new file mode 100644 index 0000000..940f218 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9900Test.cs @@ -0,0 +1,114 @@ +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/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9A00Test.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9A00Test.cs new file mode 100644 index 0000000..c749f77 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9A00Test.cs @@ -0,0 +1,116 @@ +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/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9B00Test.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9B00Test.cs new file mode 100644 index 0000000..2826de1 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_0x9B00Test.cs @@ -0,0 +1,145 @@ +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/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_AnalyzeTest.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_AnalyzeTest.cs new file mode 100644 index 0000000..a3ecd60 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078.Test/JT809_JT1078_AnalyzeTest.cs @@ -0,0 +1,101 @@ +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/JT809.Protocol.Extensions.JT1078/DependencyInjectionExtensions.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/DependencyInjectionExtensions.cs new file mode 100644 index 0000000..d252555 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/DependencyInjectionExtensions.cs @@ -0,0 +1,20 @@ +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/JT809.Protocol.Extensions.JT1078/Enums/ControlType.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/ControlType.cs new file mode 100644 index 0000000..22b54ce --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/ControlType.cs @@ -0,0 +1,20 @@ +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/JT809.Protocol.Extensions.JT1078/Enums/FastTime.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/FastTime.cs new file mode 100644 index 0000000..0d62ad0 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/FastTime.cs @@ -0,0 +1,16 @@ +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/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1800_0x1801_Result.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1800_0x1801_Result.cs new file mode 100644 index 0000000..a55d0c9 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1800_0x1801_Result.cs @@ -0,0 +1,16 @@ +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/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1800_0x1802_Result.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1800_0x1802_Result.cs new file mode 100644 index 0000000..0eab755 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1800_0x1802_Result.cs @@ -0,0 +1,14 @@ +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/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1900_0x1902_Result.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1900_0x1902_Result.cs new file mode 100644 index 0000000..eac384b --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1900_0x1902_Result.cs @@ -0,0 +1,16 @@ +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/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1A00_0x1A01_Result.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1A00_0x1A01_Result.cs new file mode 100644 index 0000000..57d5cfe --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1A00_0x1A01_Result.cs @@ -0,0 +1,16 @@ +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/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1A00_0x1A02_Result.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1A00_0x1A02_Result.cs new file mode 100644 index 0000000..bd95398 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1A00_0x1A02_Result.cs @@ -0,0 +1,14 @@ +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/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B01_Result.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B01_Result.cs new file mode 100644 index 0000000..18ba1bb --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B01_Result.cs @@ -0,0 +1,16 @@ +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/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B02_Result.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B02_Result.cs new file mode 100644 index 0000000..475ca4d --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B02_Result.cs @@ -0,0 +1,12 @@ +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/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B03_Result.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B03_Result.cs new file mode 100644 index 0000000..acc04e4 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x1B00_0x1B03_Result.cs @@ -0,0 +1,14 @@ +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/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9900_0x9901_Result.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9900_0x9901_Result.cs new file mode 100644 index 0000000..2a405d3 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9900_0x9901_Result.cs @@ -0,0 +1,14 @@ +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/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9B00_0x9B02_Result.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9B00_0x9B02_Result.cs new file mode 100644 index 0000000..2afec6e --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9B00_0x9B02_Result.cs @@ -0,0 +1,14 @@ +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/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9B00_0x9B03_Type.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9B00_0x9B03_Type.cs new file mode 100644 index 0000000..2dda417 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_0x9B00_0x9B03_Type.cs @@ -0,0 +1,13 @@ +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/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_BusinessType.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_BusinessType.cs new file mode 100644 index 0000000..e7659c9 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_BusinessType.cs @@ -0,0 +1,93 @@ +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/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_SubBusinessType.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_SubBusinessType.cs new file mode 100644 index 0000000..ada8b14 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Enums/JT809_JT1078_SubBusinessType.cs @@ -0,0 +1,181 @@ +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/JT809.Protocol.Extensions.JT1078/Extensions/JT809MessagePackReaderExtentsion.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Extensions/JT809MessagePackReaderExtentsion.cs new file mode 100644 index 0000000..c395be6 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Extensions/JT809MessagePackReaderExtentsion.cs @@ -0,0 +1,12 @@ +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/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9B00_0x9B03_Formatter.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9B00_0x9B03_Formatter.cs new file mode 100644 index 0000000..d3eca00 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/Formatters/JT809_JT1078_0x9B00_0x9B03_Formatter.cs @@ -0,0 +1,27 @@ +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/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj new file mode 100644 index 0000000..e682dc9 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.csproj @@ -0,0 +1,22 @@ + + + + JT809.Protocol.Extensions.JT1078 + JT809.Protocol.Extensions.JT1078 + 基于JT809协议、GB809协议扩展的视频消息协议 + 基于JT809协议、GB809协议扩展的视频消息协议 + JT809.Protocol.Extensions.JT1078.xml + + + + + True + + + + + + + + + diff --git a/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.xml b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.xml new file mode 100644 index 0000000..6f1997f --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/JT809.Protocol.Extensions.JT1078.xml @@ -0,0 +1,751 @@ + + + + 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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700.cs new file mode 100644 index 0000000..a455a31 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700.cs @@ -0,0 +1,114 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1701.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1701.cs new file mode 100644 index 0000000..b5876f7 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1701.cs @@ -0,0 +1,64 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1702.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1702.cs new file mode 100644 index 0000000..00128f4 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1700_0x1702.cs @@ -0,0 +1,19 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800.cs new file mode 100644 index 0000000..a9fd8bd --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800.cs @@ -0,0 +1,113 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1801.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1801.cs new file mode 100644 index 0000000..61cad01 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1801.cs @@ -0,0 +1,63 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1802.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1802.cs new file mode 100644 index 0000000..77d199a --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1800_0x1802.cs @@ -0,0 +1,45 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900.cs new file mode 100644 index 0000000..f02b847 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900.cs @@ -0,0 +1,114 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1901.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1901.cs new file mode 100644 index 0000000..c7c9148 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1901.cs @@ -0,0 +1,78 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1902.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1902.cs new file mode 100644 index 0000000..a636660 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_0x1902.cs @@ -0,0 +1,89 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_Record.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_Record.cs new file mode 100644 index 0000000..ed24388 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1900_Record.cs @@ -0,0 +1,175 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00.cs new file mode 100644 index 0000000..3d78d48 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00.cs @@ -0,0 +1,111 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A01.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A01.cs new file mode 100644 index 0000000..846ff61 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A01.cs @@ -0,0 +1,63 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A02.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A02.cs new file mode 100644 index 0000000..0e323ce --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1A00_0x1A02.cs @@ -0,0 +1,42 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00.cs new file mode 100644 index 0000000..fed0c64 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00.cs @@ -0,0 +1,111 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B01.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B01.cs new file mode 100644 index 0000000..6eabe2a --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B01.cs @@ -0,0 +1,53 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B02.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B02.cs new file mode 100644 index 0000000..fd30508 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B02.cs @@ -0,0 +1,97 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B03.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B03.cs new file mode 100644 index 0000000..d96a421 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x1B00_0x1B03.cs @@ -0,0 +1,42 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700.cs new file mode 100644 index 0000000..dd425fd --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700.cs @@ -0,0 +1,111 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700_0x9702.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700_0x9702.cs new file mode 100644 index 0000000..e93e1e3 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9700_0x9702.cs @@ -0,0 +1,16 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800.cs new file mode 100644 index 0000000..7c3eb08 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800.cs @@ -0,0 +1,111 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9801.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9801.cs new file mode 100644 index 0000000..0e75c23 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9801.cs @@ -0,0 +1,121 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9802.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9802.cs new file mode 100644 index 0000000..636f88f --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9800_0x9802.cs @@ -0,0 +1,103 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900.cs new file mode 100644 index 0000000..648cc1c --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900.cs @@ -0,0 +1,111 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9901.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9901.cs new file mode 100644 index 0000000..396d95d --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9901.cs @@ -0,0 +1,50 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9902.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9902.cs new file mode 100644 index 0000000..7f22c8a --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9900_0x9902.cs @@ -0,0 +1,190 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00.cs new file mode 100644 index 0000000..7030750 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00.cs @@ -0,0 +1,111 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A01.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A01.cs new file mode 100644 index 0000000..87f1c92 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A01.cs @@ -0,0 +1,182 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A02.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A02.cs new file mode 100644 index 0000000..bb17410 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9A00_0x9A02.cs @@ -0,0 +1,60 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00.cs new file mode 100644 index 0000000..62a4791 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00.cs @@ -0,0 +1,114 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B01.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B01.cs new file mode 100644 index 0000000..3887ba9 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B01.cs @@ -0,0 +1,202 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B02.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B02.cs new file mode 100644 index 0000000..fcb4c5d --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B02.cs @@ -0,0 +1,50 @@ +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/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B03.cs b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B03.cs new file mode 100644 index 0000000..43287d1 --- /dev/null +++ b/src/JT809.Protocol.Extensions/JT809.Protocol.Extensions.JT1078/MessageBody/JT809_JT1078_0x9B00_0x9B03.cs @@ -0,0 +1,53 @@ +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 diff --git a/src/JT809.Protocol.sln b/src/JT809.Protocol.sln index c170b26..adfe267 100644 --- a/src/JT809.Protocol.sln +++ b/src/JT809.Protocol.sln @@ -9,6 +9,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT809.Protocol.Test", "JT80 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT809.Protocol.Benchmark", "JT809.Protocol.Benchmark\JT809.Protocol.Benchmark.csproj", "{47CE50B3-A0D6-4F5F-907B-01BD7B8AB87F}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{DDC00254-B8A4-453B-8F50-79961F2EB30B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT809.Protocol.Extensions.JT1078", "JT809.Protocol.Extensions\JT809.Protocol.Extensions.JT1078\JT809.Protocol.Extensions.JT1078.csproj", "{D20DFA7E-F99B-4C8F-81EF-71E7F874157A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT809.Protocol.Extensions.JT1078.Test", "JT809.Protocol.Extensions\JT809.Protocol.Extensions.JT1078.Test\JT809.Protocol.Extensions.JT1078.Test.csproj", "{212A6F12-6410-4D76-9DFA-A7BF7DE5EFDF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{63D43A33-9CD2-4487-803E-51CA61BB7A5A}" + ProjectSection(SolutionItems) = preProject + ..\.github\workflows\dotnetcore.yml = ..\.github\workflows\dotnetcore.yml + Info.props = Info.props + ..\LICENSE = ..\LICENSE + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,10 +40,22 @@ Global {47CE50B3-A0D6-4F5F-907B-01BD7B8AB87F}.Debug|Any CPU.Build.0 = Debug|Any CPU {47CE50B3-A0D6-4F5F-907B-01BD7B8AB87F}.Release|Any CPU.ActiveCfg = Release|Any CPU {47CE50B3-A0D6-4F5F-907B-01BD7B8AB87F}.Release|Any CPU.Build.0 = Release|Any CPU + {D20DFA7E-F99B-4C8F-81EF-71E7F874157A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D20DFA7E-F99B-4C8F-81EF-71E7F874157A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D20DFA7E-F99B-4C8F-81EF-71E7F874157A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D20DFA7E-F99B-4C8F-81EF-71E7F874157A}.Release|Any CPU.Build.0 = Release|Any CPU + {212A6F12-6410-4D76-9DFA-A7BF7DE5EFDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {212A6F12-6410-4D76-9DFA-A7BF7DE5EFDF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {212A6F12-6410-4D76-9DFA-A7BF7DE5EFDF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {212A6F12-6410-4D76-9DFA-A7BF7DE5EFDF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {D20DFA7E-F99B-4C8F-81EF-71E7F874157A} = {DDC00254-B8A4-453B-8F50-79961F2EB30B} + {212A6F12-6410-4D76-9DFA-A7BF7DE5EFDF} = {DDC00254-B8A4-453B-8F50-79961F2EB30B} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {6159526D-F9A2-4984-A941-B65CA7B0E2EE} EndGlobalSection diff --git a/src/JT809.Protocol/JT809.Protocol.csproj b/src/JT809.Protocol/JT809.Protocol.csproj index c1207a7..ec91249 100644 --- a/src/JT809.Protocol/JT809.Protocol.csproj +++ b/src/JT809.Protocol/JT809.Protocol.csproj @@ -1,21 +1,10 @@  - + - netstandard2.0;netstandard2.1;net5.0; - latest - Copyright 2018. - SmallChi JT809 JT809 JT809协议、GB809协议、道路运输车辆卫星定位系统-平台数据交换协议(支持2011、2019版本) JT809协议、GB809协议、道路运输车辆卫星定位系统-平台数据交换协议(支持2011、2019版本) - true - https://github.com/SmallChi/JT809 - https://github.com/SmallChi/JT809 - https://github.com/SmallChi/JT809/blob/master/LICENSE - false - 2.2.0 - LICENSE JT809.Protocol.xml @@ -112,11 +101,7 @@ - - - - - + True