diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index da6d58c..b8dbcb4 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -17,10 +17,6 @@ jobs: run: dotnet --info - name: dotnet restore run: dotnet restore ./src/JT1078.sln - - name: dotnet JT808.Protocol.Extensions.JT1078.Test build - run: dotnet build ./src/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj - - name: dotnet JT808.Protocol.Extensions.JT1078.Test test - run: dotnet test ./src/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj - name: dotnet JT809.Protocol.Extensions.JT1078.Test build run: dotnet build ./src/JT809.Protocol.Extensions.JT1078.Test/JT809.Protocol.Extensions.JT1078.Test.csproj - name: dotnet JT809.Protocol.Extensions.JT1078.Test test diff --git a/src/JT1078.sln b/src/JT1078.sln index 1c9bde7..82f27ac 100644 --- a/src/JT1078.sln +++ b/src/JT1078.sln @@ -3,14 +3,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29020.237 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT808.Protocol.Extensions.JT1078", "JT808.Protocol.Extensions.JT1078\JT808.Protocol.Extensions.JT1078.csproj", "{F060F379-C8E4-4CA6-A54C-938A9780ACD2}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT809.Protocol.Extensions.JT1078", "JT809.Protocol.Extensions.JT1078\JT809.Protocol.Extensions.JT1078.csproj", "{2F987285-EB7A-4934-909E-50E42A2D1140}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT1078.Protocol", "JT1078.Protocol\JT1078.Protocol.csproj", "{60CAC24B-7317-48BF-9DBF-7F3ECA3689A4}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT808.Protocol.Extensions.JT1078.Test", "JT808.Protocol.Extensions.JT1078.Test\JT808.Protocol.Extensions.JT1078.Test.csproj", "{C6A43FDF-C609-40BB-B598-87F0BF7B944B}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT809.Protocol.Extensions.JT1078.Test", "JT809.Protocol.Extensions.JT1078.Test\JT809.Protocol.Extensions.JT1078.Test.csproj", "{E9FF2716-EF30-4180-879B-E8AB979ACFF3}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT1078.Protocol.Test", "JT1078.Protocol.Test\JT1078.Protocol.Test.csproj", "{9ADD82F9-E0B2-4263-8573-151F673BB33F}" @@ -52,18 +48,6 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F060F379-C8E4-4CA6-A54C-938A9780ACD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F060F379-C8E4-4CA6-A54C-938A9780ACD2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F060F379-C8E4-4CA6-A54C-938A9780ACD2}.Debug|x64.ActiveCfg = Debug|Any CPU - {F060F379-C8E4-4CA6-A54C-938A9780ACD2}.Debug|x64.Build.0 = Debug|Any CPU - {F060F379-C8E4-4CA6-A54C-938A9780ACD2}.Debug|x86.ActiveCfg = Debug|Any CPU - {F060F379-C8E4-4CA6-A54C-938A9780ACD2}.Debug|x86.Build.0 = Debug|Any CPU - {F060F379-C8E4-4CA6-A54C-938A9780ACD2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F060F379-C8E4-4CA6-A54C-938A9780ACD2}.Release|Any CPU.Build.0 = Release|Any CPU - {F060F379-C8E4-4CA6-A54C-938A9780ACD2}.Release|x64.ActiveCfg = Release|Any CPU - {F060F379-C8E4-4CA6-A54C-938A9780ACD2}.Release|x64.Build.0 = Release|Any CPU - {F060F379-C8E4-4CA6-A54C-938A9780ACD2}.Release|x86.ActiveCfg = Release|Any CPU - {F060F379-C8E4-4CA6-A54C-938A9780ACD2}.Release|x86.Build.0 = Release|Any CPU {2F987285-EB7A-4934-909E-50E42A2D1140}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2F987285-EB7A-4934-909E-50E42A2D1140}.Debug|Any CPU.Build.0 = Debug|Any CPU {2F987285-EB7A-4934-909E-50E42A2D1140}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -88,18 +72,6 @@ Global {60CAC24B-7317-48BF-9DBF-7F3ECA3689A4}.Release|x64.Build.0 = Release|Any CPU {60CAC24B-7317-48BF-9DBF-7F3ECA3689A4}.Release|x86.ActiveCfg = Release|Any CPU {60CAC24B-7317-48BF-9DBF-7F3ECA3689A4}.Release|x86.Build.0 = Release|Any CPU - {C6A43FDF-C609-40BB-B598-87F0BF7B944B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C6A43FDF-C609-40BB-B598-87F0BF7B944B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C6A43FDF-C609-40BB-B598-87F0BF7B944B}.Debug|x64.ActiveCfg = Debug|Any CPU - {C6A43FDF-C609-40BB-B598-87F0BF7B944B}.Debug|x64.Build.0 = Debug|Any CPU - {C6A43FDF-C609-40BB-B598-87F0BF7B944B}.Debug|x86.ActiveCfg = Debug|Any CPU - {C6A43FDF-C609-40BB-B598-87F0BF7B944B}.Debug|x86.Build.0 = Debug|Any CPU - {C6A43FDF-C609-40BB-B598-87F0BF7B944B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C6A43FDF-C609-40BB-B598-87F0BF7B944B}.Release|Any CPU.Build.0 = Release|Any CPU - {C6A43FDF-C609-40BB-B598-87F0BF7B944B}.Release|x64.ActiveCfg = Release|Any CPU - {C6A43FDF-C609-40BB-B598-87F0BF7B944B}.Release|x64.Build.0 = Release|Any CPU - {C6A43FDF-C609-40BB-B598-87F0BF7B944B}.Release|x86.ActiveCfg = Release|Any CPU - {C6A43FDF-C609-40BB-B598-87F0BF7B944B}.Release|x86.Build.0 = Release|Any CPU {E9FF2716-EF30-4180-879B-E8AB979ACFF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E9FF2716-EF30-4180-879B-E8AB979ACFF3}.Debug|Any CPU.Build.0 = Debug|Any CPU {E9FF2716-EF30-4180-879B-E8AB979ACFF3}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -237,7 +209,6 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {C6A43FDF-C609-40BB-B598-87F0BF7B944B} = {0655AF84-E578-409F-AB0E-B47E0D2F6814} {E9FF2716-EF30-4180-879B-E8AB979ACFF3} = {0655AF84-E578-409F-AB0E-B47E0D2F6814} {9ADD82F9-E0B2-4263-8573-151F673BB33F} = {0655AF84-E578-409F-AB0E-B47E0D2F6814} {77402142-54E5-4E64-8F9E-BCAAC2CD0E8D} = {807ADB1F-FED4-4A56-82D2-F08F1FB7C886} diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj b/src/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj deleted file mode 100644 index 445b395..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net5.0 - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808LocationAttach.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808LocationAttach.cs deleted file mode 100644 index 9f94c3b..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808LocationAttach.cs +++ /dev/null @@ -1,91 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessageBody; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Reflection; -using Xunit; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808LocationAttach - { - JT808Serializer JT808Serializer; - - public JT808LocationAttach() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1.AddJT808Configure(new DefaultGlobalConfig()) - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = new JT808Serializer(defaultConfig); - } - [Fact] - public void Test1() - { - JT808_0x0200 jT808UploadLocationRequest = new JT808_0x0200 - { - AlarmFlag = 1, - Altitude = 40, - GPSTime = DateTime.Parse("2018-07-15 10:10:10"), - Lat = 12222222, - Lng = 132444444, - Speed = 60, - Direction = 0, - StatusFlag = 2, - JT808LocationAttachData = new Dictionary() - }; - jT808UploadLocationRequest.JT808LocationAttachData.Add(0x14, new JT808_0x0200_0x14 - { - VideoRelateAlarm = 100 - }); - jT808UploadLocationRequest.JT808LocationAttachData.Add(0x15, new JT808_0x0200_0x15 - { - VideoSignalLoseAlarmStatus = 100 - }); - jT808UploadLocationRequest.JT808LocationAttachData.Add(0x16, new JT808_0x0200_0x16 - { - VideoSignalOcclusionAlarmStatus = 100 - }); - jT808UploadLocationRequest.JT808LocationAttachData.Add(0x17, new JT808_0x0200_0x17 - { - StorageFaultAlarmStatus = 100 - }); - jT808UploadLocationRequest.JT808LocationAttachData.Add(0x18, new JT808_0x0200_0x18 - { - AbnormalDrivingBehaviorAlarmType = 100, - FatigueLevel = 88 - }); - var hex = JT808Serializer.Serialize(jT808UploadLocationRequest).ToHexString(); - Assert.Equal("000000010000000200BA7F0E07E4F11C0028003C0000180715101010140400000064150400000064160400000064170200641803006458", hex); - } - - [Fact] - public void Test2() - { - byte[] bodys = "000000010000000200BA7F0E07E4F11C0028003C0000180715101010140400000064150400000064160400000064170200641803006458".ToHexBytes(); - JT808_0x0200 jT808UploadLocationRequest = JT808Serializer.Deserialize(bodys); - Assert.Equal(1u, jT808UploadLocationRequest.AlarmFlag); - Assert.Equal(DateTime.Parse("2018-07-15 10:10:10"), jT808UploadLocationRequest.GPSTime); - Assert.Equal(12222222, jT808UploadLocationRequest.Lat); - Assert.Equal(132444444, jT808UploadLocationRequest.Lng); - Assert.Equal(60, jT808UploadLocationRequest.Speed); - Assert.Equal(2u, jT808UploadLocationRequest.StatusFlag); - Assert.Equal(100u, ((JT808_0x0200_0x14)jT808UploadLocationRequest.JT808LocationAttachData[0x14]).VideoRelateAlarm); - Assert.Equal(100u, ((JT808_0x0200_0x15)jT808UploadLocationRequest.JT808LocationAttachData[0x15]).VideoSignalLoseAlarmStatus); - Assert.Equal(100u, ((JT808_0x0200_0x16)jT808UploadLocationRequest.JT808LocationAttachData[0x16]).VideoSignalOcclusionAlarmStatus); - Assert.Equal(100u, ((JT808_0x0200_0x17)jT808UploadLocationRequest.JT808LocationAttachData[0x17]).StorageFaultAlarmStatus); - Assert.Equal(100u, ((JT808_0x0200_0x18)jT808UploadLocationRequest.JT808LocationAttachData[0x18]).AbnormalDrivingBehaviorAlarmType); - Assert.Equal(88, ((JT808_0x0200_0x18)jT808UploadLocationRequest.JT808LocationAttachData[0x18]).FatigueLevel); - } - - [Fact] - public void Test3() - { - byte[] bodys = "000000010000000200BA7F0E07E4F11C0028003C0000180715101010140400000064150400000064160400000064170200641803006458".ToHexBytes(); - string json = JT808Serializer.Analyze(bodys); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x0200Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x0200Test.cs deleted file mode 100644 index 0158215..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x0200Test.cs +++ /dev/null @@ -1,114 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Extensions.JT1078.Enums; -using JT808.Protocol.MessageBody; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x0200Test - { - JT808Serializer JT808Serializer; - public JT808_0x0200Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = defaultConfig.GetSerializer(); - } - - [Fact] - public void Test_0x14_1() - { - JT808_0x0200 jT808UploadLocationRequest = new JT808_0x0200 - { - AlarmFlag = 1, - Altitude = 40, - GPSTime = DateTime.Parse("2020-01-31 20:20:20"), - Lat = 12222222, - Lng = 132444444, - Speed = 60, - Direction = 0, - StatusFlag = 2, - JT808LocationAttachData = new Dictionary() - }; - jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_JT1078_Constants.JT808_0X0200_0x14, new JT808_0x0200_0x14 - { - VideoRelateAlarm = (uint)(VideoRelateAlarmType.视频信号遮挡报警 | VideoRelateAlarmType.其他视频设备故障报警) - }); - var hex = JT808Serializer.Serialize(jT808UploadLocationRequest).ToHexString(); - Assert.Equal("000000010000000200BA7F0E07E4F11C0028003C000020013120202014040000000A", hex); - } - - [Fact] - public void Test_0x14_2() - { - byte[] bodys = "000000010000000200BA7F0E07E4F11C0028003C000020013120202014040000000A".ToHexBytes(); - JT808_0x0200 jT808UploadLocationRequest = JT808Serializer.Deserialize(bodys); - Assert.Equal((uint)1, jT808UploadLocationRequest.AlarmFlag); - Assert.Equal(DateTime.Parse("2020-01-31 20:20:20"), jT808UploadLocationRequest.GPSTime); - Assert.Equal(12222222, jT808UploadLocationRequest.Lat); - Assert.Equal(132444444, jT808UploadLocationRequest.Lng); - Assert.Equal(60, jT808UploadLocationRequest.Speed); - Assert.Equal((uint)2, jT808UploadLocationRequest.StatusFlag); - Assert.Equal((uint)(VideoRelateAlarmType.视频信号遮挡报警 | VideoRelateAlarmType.其他视频设备故障报警), ((JT808_0x0200_0x14)jT808UploadLocationRequest.JT808LocationAttachData[JT808_JT1078_Constants.JT808_0X0200_0x14]).VideoRelateAlarm); - } - - [Fact] - public void Test_0x14_3() - { - byte[] bodys = "000000010000000200BA7F0E07E4F11C0028003C000020013120202014040000000A".ToHexBytes(); - string json = JT808Serializer.Analyze(bodys); - } - - [Fact] - public void Test_0x15_1() - { - JT808_0x0200 jT808UploadLocationRequest = new JT808_0x0200 - { - AlarmFlag = 1, - Altitude = 40, - GPSTime = DateTime.Parse("2020-01-31 20:20:20"), - Lat = 12222222, - Lng = 132444444, - Speed = 60, - Direction = 0, - StatusFlag = 2, - JT808LocationAttachData = new Dictionary() - }; - jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_JT1078_Constants.JT808_0X0200_0x15, new JT808_0x0200_0x15 - { - VideoSignalLoseAlarmStatus=3 - }); - var hex = JT808Serializer.Serialize(jT808UploadLocationRequest).ToHexString(); - Assert.Equal("000000010000000200BA7F0E07E4F11C0028003C0000200131202020150400000003", hex); - } - - [Fact] - public void Test_0x15_2() - { - byte[] bodys = "000000010000000200BA7F0E07E4F11C0028003C0000200131202020150400000003".ToHexBytes(); - JT808_0x0200 jT808UploadLocationRequest = JT808Serializer.Deserialize(bodys); - Assert.Equal((uint)1, jT808UploadLocationRequest.AlarmFlag); - Assert.Equal(DateTime.Parse("2020-01-31 20:20:20"), jT808UploadLocationRequest.GPSTime); - Assert.Equal(12222222, jT808UploadLocationRequest.Lat); - Assert.Equal(132444444, jT808UploadLocationRequest.Lng); - Assert.Equal(60, jT808UploadLocationRequest.Speed); - Assert.Equal((uint)2, jT808UploadLocationRequest.StatusFlag); - Assert.Equal(3u, ((JT808_0x0200_0x15)jT808UploadLocationRequest.JT808LocationAttachData[JT808_JT1078_Constants.JT808_0X0200_0x15]).VideoSignalLoseAlarmStatus); - } - - [Fact] - public void Test_0x15_3() - { - byte[] bodys = "000000010000000200BA7F0E07E4F11C0028003C0000200131202020150400000003".ToHexBytes(); - string json = JT808Serializer.Analyze(bodys); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1003Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1003Test.cs deleted file mode 100644 index d8bbffe..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1003Test.cs +++ /dev/null @@ -1,65 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x1003Test - { - JT808Serializer JT808Serializer; - public JT808_0x1003Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = defaultConfig.GetSerializer(); - } - - [Fact] - public void Test1() - { - JT808_0x1003 jT808_0x1003 = new JT808_0x1003() - { - AudioFrameLength = 1, - EnterAudioChannelsNumber = 2, - EnterAudioEncoding = 3, - EnterAudioSampleDigits = 4, - EnterAudioSampleRate = 5, - IsSupportedAudioOutput = 1, - VideoEncoding = 6, - TerminalSupportedMaxNumberOfAudioPhysicalChannels = 7, - TerminalSupportedMaxNumberOfVideoPhysicalChannels = 8 - }; - var hex = JT808Serializer.Serialize(jT808_0x1003).ToHexString(); - Assert.Equal("03020504000101060708", hex); - } - - [Fact] - public void Test2() - { - JT808_0x1003 jT808_0x1003 = JT808Serializer.Deserialize("03020504000101060708".ToHexBytes()); - Assert.Equal(1,jT808_0x1003.AudioFrameLength); - Assert.Equal(2, jT808_0x1003.EnterAudioChannelsNumber); - Assert.Equal(3, jT808_0x1003.EnterAudioEncoding); - Assert.Equal(4, jT808_0x1003.EnterAudioSampleDigits); - Assert.Equal(5, jT808_0x1003.EnterAudioSampleRate); - Assert.Equal(1, jT808_0x1003.IsSupportedAudioOutput); - Assert.Equal(6, jT808_0x1003.VideoEncoding); - Assert.Equal(7, jT808_0x1003.TerminalSupportedMaxNumberOfAudioPhysicalChannels); - Assert.Equal(8, jT808_0x1003.TerminalSupportedMaxNumberOfVideoPhysicalChannels); - } - [Fact] - public void Test3() - { - var json = JT808Serializer.Analyze("03020504000101060708".ToHexBytes()); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1005Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1005Test.cs deleted file mode 100644 index 626c3e3..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1005Test.cs +++ /dev/null @@ -1,66 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x1005Test - { - JT808Serializer JT808Serializer; - public JT808_0x1005Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = 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() - { - JT808_0x1005 jT808_0x1005 = new JT808_0x1005() - { - BeginTime=Convert.ToDateTime("2019-07-16 10:20:01"), - EndTime= Convert.ToDateTime("2019-07-16 10:25:02"), - GettingOffNumber=1, - GettingOnNumber=1 - }; - var hex = JT808Serializer.Serialize(jT808_0x1005).ToHexString(); - Assert.Equal("19071610200119071610250200010001", hex); - } - - [Fact] - public void Test2() - { - var jT808_0x1005 = JT808Serializer.Deserialize("19071610200119071610250200010001".ToHexBytes()); - Assert.Equal(Convert.ToDateTime("2019-07-16 10:20:01"),jT808_0x1005.BeginTime); - Assert.Equal(Convert.ToDateTime("2019-07-16 10:25:02"),jT808_0x1005.EndTime); - Assert.Equal(1, jT808_0x1005.GettingOffNumber); - Assert.Equal(1, jT808_0x1005.GettingOnNumber); - } - [Fact] - public void Test3() - { - var json = JT808Serializer.Analyze("19071610200119071610250200010001".ToHexBytes()); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1205Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1205Test.cs deleted file mode 100644 index 0c3e16a..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1205Test.cs +++ /dev/null @@ -1,141 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; -using System.Linq; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x1205Test - { - JT808Serializer JT808Serializer; - public JT808_0x1205Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = 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() - { - JT808_0x1205 jT808_0x1205 = new JT808_0x1205() - { - MsgNum = 1, - AVResouceTotal = 2, - AVResouces = new List { - new JT808_0x1205_AVResouce{ - AlarmFlag=1, - AVResourceType=2, - BeginTime=Convert.ToDateTime("2019-07-16 10:20:01"), - EndTime=Convert.ToDateTime("2019-07-16 10:25:01"), - FileSize=3, - LogicChannelNo=4, - MemoryType=5, - StreamType=6 - }, - new JT808_0x1205_AVResouce{ - AlarmFlag=11, - AVResourceType=21, - BeginTime=Convert.ToDateTime("2019-07-16 11:20:01"), - EndTime=Convert.ToDateTime("2019-07-16 11:25:02"), - FileSize=31, - LogicChannelNo=41, - MemoryType=51, - StreamType=61 - } - } - }; - var hex = JT808Serializer.Serialize(jT808_0x1205).ToHexString(); - Assert.Equal("0001000000020419071610200119071610250100000000000000010206050000000329190716112001190716112502000000000000000B153D330000001F", hex); - } - - [Fact] - public void Test2() - { - var jT808_0x1205 = JT808Serializer.Deserialize("0001000000020419071610200119071610250100000000000000010206050000000329190716112001190716112502000000000000000B153D330000001F".ToHexBytes()); - Assert.Equal(1, jT808_0x1205.MsgNum); - Assert.Equal(2u, jT808_0x1205.AVResouceTotal); - - Assert.Equal(1u, jT808_0x1205.AVResouces[0].AlarmFlag); - Assert.Equal(2, jT808_0x1205.AVResouces[0].AVResourceType); - Assert.Equal(Convert.ToDateTime("2019-07-16 10:20:01"),jT808_0x1205.AVResouces[0].BeginTime); - Assert.Equal(Convert.ToDateTime("2019-07-16 10:25:01"),jT808_0x1205.AVResouces[0].EndTime); - Assert.Equal(3u, jT808_0x1205.AVResouces[0].FileSize); - Assert.Equal(4, jT808_0x1205.AVResouces[0].LogicChannelNo); - Assert.Equal(5, jT808_0x1205.AVResouces[0].MemoryType); - Assert.Equal(6, jT808_0x1205.AVResouces[0].StreamType); - - Assert.Equal(11u, jT808_0x1205.AVResouces[1].AlarmFlag); - Assert.Equal(21, jT808_0x1205.AVResouces[1].AVResourceType); - Assert.Equal(Convert.ToDateTime("2019-07-16 11:20:01"),jT808_0x1205.AVResouces[1].BeginTime); - Assert.Equal(Convert.ToDateTime("2019-07-16 11:25:02"),jT808_0x1205.AVResouces[1].EndTime); - Assert.Equal(31u, jT808_0x1205.AVResouces[1].FileSize); - Assert.Equal(41, jT808_0x1205.AVResouces[1].LogicChannelNo); - Assert.Equal(51, jT808_0x1205.AVResouces[1].MemoryType); - Assert.Equal(61, jT808_0x1205.AVResouces[1].StreamType); - } - [Fact] - public void Test3() - { - var json = JT808Serializer.Analyze("000100000002041907161020011907161025010000000102060500000003291907161120011907161125020000000B153D330000001F".ToHexBytes()); - } - - [Fact] - public void Test4() - { - var data1 = JT808Serializer.HeaderDeserialize("7E120523A204066657506200EB00020001015A00000023012012191042052012191050190000000000000000000101064446D10120121910221720121910420500000000000000000001010F1FE8EB0120121910023420121910221700000000000000000001010F182D5C0120121909471120121910015500000000000000000001010B38F2430120121909274020121909471100000000000000000001010F056DB40120121909080920121909274000000000000000000001010F0724380120121908483820121909080900000000000000000001010F0530AB0120121908290720121908483800000000000000000001010F05896C0120121908093720121908290700000000000000000001010F02CD3B0120121907500520121908093700000000000000000001010F056FEF0120121907303420121907500500000000000000000001010F043C3401201219072541201219073034000000000000000000010103C26C5F0120121907061120121907254100000000000000000001010F03F0C10120121906464220121907061100000000000000000001010F02F6330120121906271220121906464200000000000000000001010F02E43B0120121906074220121906271200000000000000000001010F033D670120121905481120121906074200000000000000000001010F088BF20120121905284120121905481100000000000000000001010F03F9FE0120121905091020121905284100000000000000000001010F05B1040120121904494020121905091000000000000000000001010F02B3540120121904301020121904494000000000000000000001010F0417B00120121904103920121904301000000000000000000001010F0538970120121903510820121904103900000000000000000001010F054E9E0120121903313820121903510800000000000000000001010F016ECB0120121903120820121903313800000000000000000001010F0333C00120121902523820121903120700000000000000000001010F029D230120121902330720121902523700000000000000000001010F0354E40120121902133720121902330700000000000000000001010F03303D0120121901540720121902133700000000000000000001010F04981E0120121901343720121901540700000000000000000001010F02AD940120121901150820121901343700000000000000000001010EFFD7CF0120121900553720121901150800000000000000000001010F07D9330120121900360720121900553700000000000000000001010F040E740C7E".ToHexBytes()); - var data2 = JT808Serializer.HeaderDeserialize("7E1205203804066657506200EC000200020120121900163320121900360700000000000000000001010F0CE4CD0120121900002220121900163300000000000000000001010C6F9E7B5D7E".ToHexBytes()); - var realBody = data1.Bodies.Concat(data2.Bodies).ToArray(); - var result = JT808Serializer.Deserialize(realBody); - } - - - [Fact] - public void Test5() - { - var data1 = JT808Serializer.Deserialize("7E120523A204066657506200EB00020001015A00000023012012191042052012191050190000000000000000000101064446D10120121910221720121910420500000000000000000001010F1FE8EB0120121910023420121910221700000000000000000001010F182D5C0120121909471120121910015500000000000000000001010B38F2430120121909274020121909471100000000000000000001010F056DB40120121909080920121909274000000000000000000001010F0724380120121908483820121909080900000000000000000001010F0530AB0120121908290720121908483800000000000000000001010F05896C0120121908093720121908290700000000000000000001010F02CD3B0120121907500520121908093700000000000000000001010F056FEF0120121907303420121907500500000000000000000001010F043C3401201219072541201219073034000000000000000000010103C26C5F0120121907061120121907254100000000000000000001010F03F0C10120121906464220121907061100000000000000000001010F02F6330120121906271220121906464200000000000000000001010F02E43B0120121906074220121906271200000000000000000001010F033D670120121905481120121906074200000000000000000001010F088BF20120121905284120121905481100000000000000000001010F03F9FE0120121905091020121905284100000000000000000001010F05B1040120121904494020121905091000000000000000000001010F02B3540120121904301020121904494000000000000000000001010F0417B00120121904103920121904301000000000000000000001010F0538970120121903510820121904103900000000000000000001010F054E9E0120121903313820121903510800000000000000000001010F016ECB0120121903120820121903313800000000000000000001010F0333C00120121902523820121903120700000000000000000001010F029D230120121902330720121902523700000000000000000001010F0354E40120121902133720121902330700000000000000000001010F03303D0120121901540720121902133700000000000000000001010F04981E0120121901343720121901540700000000000000000001010F02AD940120121901150820121901343700000000000000000001010EFFD7CF0120121900553720121901150800000000000000000001010F07D9330120121900360720121900553700000000000000000001010F040E740C7E".ToHexBytes()); - var data2 = JT808Serializer.Deserialize("7E1205203804066657506200EC000200020120121900163320121900360700000000000000000001010F0CE4CD0120121900002220121900163300000000000000000001010C6F9E7B5D7E".ToHexBytes()); - var realBody = data1.SubDataBodies.Concat(data2.SubDataBodies).ToArray(); - var result = JT808Serializer.Deserialize(realBody); - } - - [Fact] - public void Test6() - { - var pack1 = JT808Serializer.Deserialize("7E120523A204066657506200EB00020001015A00000023012012191042052012191050190000000000000000000101064446D10120121910221720121910420500000000000000000001010F1FE8EB0120121910023420121910221700000000000000000001010F182D5C0120121909471120121910015500000000000000000001010B38F2430120121909274020121909471100000000000000000001010F056DB40120121909080920121909274000000000000000000001010F0724380120121908483820121909080900000000000000000001010F0530AB0120121908290720121908483800000000000000000001010F05896C0120121908093720121908290700000000000000000001010F02CD3B0120121907500520121908093700000000000000000001010F056FEF0120121907303420121907500500000000000000000001010F043C3401201219072541201219073034000000000000000000010103C26C5F0120121907061120121907254100000000000000000001010F03F0C10120121906464220121907061100000000000000000001010F02F6330120121906271220121906464200000000000000000001010F02E43B0120121906074220121906271200000000000000000001010F033D670120121905481120121906074200000000000000000001010F088BF20120121905284120121905481100000000000000000001010F03F9FE0120121905091020121905284100000000000000000001010F05B1040120121904494020121905091000000000000000000001010F02B3540120121904301020121904494000000000000000000001010F0417B00120121904103920121904301000000000000000000001010F0538970120121903510820121904103900000000000000000001010F054E9E0120121903313820121903510800000000000000000001010F016ECB0120121903120820121903313800000000000000000001010F0333C00120121902523820121903120700000000000000000001010F029D230120121902330720121902523700000000000000000001010F0354E40120121902133720121902330700000000000000000001010F03303D0120121901540720121902133700000000000000000001010F04981E0120121901343720121901540700000000000000000001010F02AD940120121901150820121901343700000000000000000001010EFFD7CF0120121900553720121901150800000000000000000001010F07D9330120121900360720121900553700000000000000000001010F040E740C7E".ToHexBytes()); - var pack2 = JT808Serializer.Deserialize("7E1205203804066657506200EC000200020120121900163320121900360700000000000000000001010F0CE4CD0120121900002220121900163300000000000000000001010C6F9E7B5D7E".ToHexBytes()); - var realBody = pack1.SubDataBodies.Concat(pack2.SubDataBodies).ToArray(); - var result = JT808Serializer.Analyze(pack1.Header.MsgId,realBody); - } - - [Fact] - public void Test7() - { - var pack1 = JT808Serializer.Deserialize("7E120523A204066657506200EB00020001015A00000023012012191042052012191050190000000000000000000101064446D10120121910221720121910420500000000000000000001010F1FE8EB0120121910023420121910221700000000000000000001010F182D5C0120121909471120121910015500000000000000000001010B38F2430120121909274020121909471100000000000000000001010F056DB40120121909080920121909274000000000000000000001010F0724380120121908483820121909080900000000000000000001010F0530AB0120121908290720121908483800000000000000000001010F05896C0120121908093720121908290700000000000000000001010F02CD3B0120121907500520121908093700000000000000000001010F056FEF0120121907303420121907500500000000000000000001010F043C3401201219072541201219073034000000000000000000010103C26C5F0120121907061120121907254100000000000000000001010F03F0C10120121906464220121907061100000000000000000001010F02F6330120121906271220121906464200000000000000000001010F02E43B0120121906074220121906271200000000000000000001010F033D670120121905481120121906074200000000000000000001010F088BF20120121905284120121905481100000000000000000001010F03F9FE0120121905091020121905284100000000000000000001010F05B1040120121904494020121905091000000000000000000001010F02B3540120121904301020121904494000000000000000000001010F0417B00120121904103920121904301000000000000000000001010F0538970120121903510820121904103900000000000000000001010F054E9E0120121903313820121903510800000000000000000001010F016ECB0120121903120820121903313800000000000000000001010F0333C00120121902523820121903120700000000000000000001010F029D230120121902330720121902523700000000000000000001010F0354E40120121902133720121902330700000000000000000001010F03303D0120121901540720121902133700000000000000000001010F04981E0120121901343720121901540700000000000000000001010F02AD940120121901150820121901343700000000000000000001010EFFD7CF0120121900553720121901150800000000000000000001010F07D9330120121900360720121900553700000000000000000001010F040E740C7E".ToHexBytes()); - var pack2 = JT808Serializer.Deserialize("7E1205203804066657506200EC000200020120121900163320121900360700000000000000000001010F0CE4CD0120121900002220121900163300000000000000000001010C6F9E7B5D7E".ToHexBytes()); - var realBody = pack1.SubDataBodies.Concat(pack2.SubDataBodies).ToArray(); - var result = JT808Serializer.AnalyzeJsonBuffer(pack1.Header.MsgId, realBody); - string json = Encoding.UTF8.GetString(result); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1206Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1206Test.cs deleted file mode 100644 index 115369c..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1206Test.cs +++ /dev/null @@ -1,62 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x1206Test - { - JT808Serializer JT808Serializer; - public JT808_0x1206Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = 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() - { - JT808_0x1206 jT808_0x1206 = new JT808_0x1206() - { - MsgNum=1, - Result=1 - }; - var hex = JT808Serializer.Serialize(jT808_0x1206).ToHexString(); - Assert.Equal("000101", hex); - } - - [Fact] - public void Test2() - { - var jT808_0x1206 = JT808Serializer.Deserialize("000101".ToHexBytes()); - Assert.Equal(1, jT808_0x1206.MsgNum); - Assert.Equal(1, jT808_0x1206.Result); - } - [Fact] - public void Test3() - { - var jT808_0x1206 = JT808Serializer.Analyze("000101".ToHexBytes()); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x8103CustomId.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x8103CustomId.cs deleted file mode 100644 index 480eb2d..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x8103CustomId.cs +++ /dev/null @@ -1,300 +0,0 @@ -using JT808.Protocol.Enums; -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessageBody; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text; -using Xunit; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x8103CustomId - { - JT808Serializer JT808Serializer; - - public JT808_0x8103CustomId() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1.AddJT808Configure(new DefaultGlobalConfig()) - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = new JT808Serializer(defaultConfig); - } - [Fact] - public void Test1() - { - JT808Package jT808Package = new JT808Package - { - Header = new JT808Header - { - MsgId = JT808MsgId.设置终端参数.ToUInt16Value(), - ManualMsgNum = 10, - TerminalPhoneNo = "123456789", - }, - Bodies = new JT808_0x8103 - { - ParamList = new List { - new JT808_0x8103_0x0075 { - AudioOutputEnabled=1, - OSD=2, - RTS_EncodeMode=3, - RTS_KF_Interval=4, - RTS_Resolution=5, - RTS_Target_CodeRate=6, - RTS_Target_FPS=7, - StreamStore_EncodeMode=8, - StreamStore_KF_Interval=9, - StreamStore_Resolution=10, - StreamStore_Target_CodeRate=11, - StreamStore_Target_FPS=12 - }, - new JT808_0x8103_0x0076 { - AudioChannelTotal=1, - AVChannelTotal=2, - VudioChannelTotal=3, - ParamLength=27, - AVChannelRefTables=new List{ - new JT808_0x8103_0x0076_AVChannelRefTable{ - ChannelType =0, - IsConnectCloudPlat =1, - LogicChannelNo =2, - PhysicalChannelNo =3 }, - new JT808_0x8103_0x0076_AVChannelRefTable{ - ChannelType =4, - IsConnectCloudPlat =5, - LogicChannelNo =6, - PhysicalChannelNo =7 }, - new JT808_0x8103_0x0076_AVChannelRefTable{ - ChannelType =8, - IsConnectCloudPlat =9, - LogicChannelNo =10, - PhysicalChannelNo =11 }, - new JT808_0x8103_0x0076_AVChannelRefTable{ - ChannelType =12, - IsConnectCloudPlat =13, - LogicChannelNo =14, - PhysicalChannelNo =15 }, - new JT808_0x8103_0x0076_AVChannelRefTable{ - ChannelType =16, - IsConnectCloudPlat =17, - LogicChannelNo =18, - PhysicalChannelNo =19 }, - new JT808_0x8103_0x0076_AVChannelRefTable{ - ChannelType =20, - IsConnectCloudPlat =21, - LogicChannelNo =22, - PhysicalChannelNo =23 } - } - }, - new JT808_0x8103_0x0077{ - NeedSetChannelTotal=2, - ParamLength=43, - SignalChannels=new List{ - new JT808_0x8103_0x0077_SignalChannel{ - LogicChannelNo =1, - OSD =2, - RTS_EncodeMode =3, - RTS_KF_Interval =4, - RTS_Resolution =5, - RTS_Target_CodeRate =6, - RTS_Target_FPS =7, - StreamStore_EncodeMode =8, - StreamStore_KF_Interval =9, - StreamStore_Resolution =10, - StreamStore_Target_CodeRate=11, - StreamStore_Target_FPS =12 - }, - new JT808_0x8103_0x0077_SignalChannel{ - LogicChannelNo=1, - OSD =2, - RTS_EncodeMode =3, - RTS_KF_Interval =4, - RTS_Resolution =5, - RTS_Target_CodeRate =6, - RTS_Target_FPS =7, - StreamStore_EncodeMode =8, - StreamStore_KF_Interval =9, - StreamStore_Resolution =10, - StreamStore_Target_CodeRate=11, - StreamStore_Target_FPS =12 - } - } - }, - new JT808_0x8103_0x0079{ - BeginMinute=1, - Duration =2, - StorageThresholds =3 - }, - new JT808_0x8103_0x007A{ - AlarmShielding=1 - }, - new JT808_0x8103_0x007B{ - NuclearLoadNumber=1, - FatigueThreshold =2 - }, - new JT808_0x8103_0x007C{ - SleepWakeMode=1, - TimerWakeDaySet =2, - WakeConditionType =3, - TimerWakeDayParamter=new JT808_0x8103_0x007C_TimerWakeDayParamter{ - TimePeriod1CloseTime="12", - TimePeriod1WakeTime="23", - TimePeriod2CloseTime="34", - TimePeriod2WakeTime="45", - TimePeriod3CloseTime="56", - TimePeriod3WakeTime="67", - TimePeriod4CloseTime="78", - TimePeriod4WakeTime="89", - TimerWakeEnableFlag=10 - } - } - } - } - }; - var hex = JT808Serializer.Serialize(jT808Package).ToHexString(); - Assert.Equal("7E8103009C000123456789000A070000007515030500040700000006080A00090C0000000B000201000000761B02010303020001070604050B0A08090F0E0C0D1312101117161415000000772B0201030500040700000006080A00090C0000000B000201030500040700000006080A00090C0000000B000200000079030302010000007A04000000010000007B0201020000007C140103020A00230012004500340067005600890078587E", hex); - } - - [Fact] - public void Test2() - { - byte[] bytes = "7E8103009C000123456789000A070000007515030500040700000006080A00090C0000000B000201000000761B02010303020001070604050B0A08090F0E0C0D1312101117161415000000772B0201030500040700000006080A00090C0000000B000201030500040700000006080A00090C0000000B000200000079030302010000007A04000000010000007B0201020000007C140103020A00230012004500340067005600890078587E".ToHexBytes(); - JT808Package jT808_0X8103 = JT808Serializer.Deserialize(bytes); - Assert.Equal(JT808MsgId.设置终端参数.ToUInt16Value(), jT808_0X8103.Header.MsgId); - Assert.Equal(10, jT808_0X8103.Header.MsgNum); - Assert.Equal("123456789", jT808_0X8103.Header.TerminalPhoneNo); - - JT808_0x8103 jT808_0x8103 = (JT808_0x8103)jT808_0X8103.Bodies; - foreach (var item in jT808_0x8103.ParamList) - { - switch (item) - { - case JT808_0x8103_0x0075 jT808_0x8103_0x0075: - Assert.Equal(1,jT808_0x8103_0x0075.AudioOutputEnabled); - Assert.Equal(2,jT808_0x8103_0x0075.OSD); - Assert.Equal(3,jT808_0x8103_0x0075.RTS_EncodeMode); - Assert.Equal(4,jT808_0x8103_0x0075.RTS_KF_Interval); - Assert.Equal(5,jT808_0x8103_0x0075.RTS_Resolution); - Assert.Equal(6u,jT808_0x8103_0x0075.RTS_Target_CodeRate); - Assert.Equal(7,jT808_0x8103_0x0075.RTS_Target_FPS); - Assert.Equal(8,jT808_0x8103_0x0075.StreamStore_EncodeMode); - Assert.Equal(9,jT808_0x8103_0x0075.StreamStore_KF_Interval); - Assert.Equal(10,jT808_0x8103_0x0075.StreamStore_Resolution); - Assert.Equal(11u,jT808_0x8103_0x0075.StreamStore_Target_CodeRate); - Assert.Equal(12u,jT808_0x8103_0x0075.StreamStore_Target_FPS); - break; - case JT808_0x8103_0x0076 jT808_0x8103_0x0076: - Assert.Equal(1,jT808_0x8103_0x0076.AudioChannelTotal); - Assert.Equal(2, jT808_0x8103_0x0076.AVChannelTotal); - Assert.Equal(3,jT808_0x8103_0x0076.VudioChannelTotal); - Assert.Equal(27,jT808_0x8103_0x0076.ParamLength); - - Assert.Equal(0,jT808_0x8103_0x0076.AVChannelRefTables[0].ChannelType); - Assert.Equal(1,jT808_0x8103_0x0076.AVChannelRefTables[0].IsConnectCloudPlat); - Assert.Equal(2,jT808_0x8103_0x0076.AVChannelRefTables[0].LogicChannelNo); - Assert.Equal(3,jT808_0x8103_0x0076.AVChannelRefTables[0].PhysicalChannelNo); - - Assert.Equal(4,jT808_0x8103_0x0076.AVChannelRefTables[1].ChannelType); - Assert.Equal(5,jT808_0x8103_0x0076.AVChannelRefTables[1].IsConnectCloudPlat); - Assert.Equal(6,jT808_0x8103_0x0076.AVChannelRefTables[1].LogicChannelNo); - Assert.Equal(7,jT808_0x8103_0x0076.AVChannelRefTables[1].PhysicalChannelNo); - - Assert.Equal(8,jT808_0x8103_0x0076.AVChannelRefTables[2].ChannelType); - Assert.Equal(9,jT808_0x8103_0x0076.AVChannelRefTables[2].IsConnectCloudPlat); - Assert.Equal(10,jT808_0x8103_0x0076.AVChannelRefTables[2].LogicChannelNo); - Assert.Equal(11,jT808_0x8103_0x0076.AVChannelRefTables[2].PhysicalChannelNo); - - Assert.Equal(12,jT808_0x8103_0x0076.AVChannelRefTables[3].ChannelType); - Assert.Equal(13,jT808_0x8103_0x0076.AVChannelRefTables[3].IsConnectCloudPlat); - Assert.Equal(14,jT808_0x8103_0x0076.AVChannelRefTables[3].LogicChannelNo); - Assert.Equal(15,jT808_0x8103_0x0076.AVChannelRefTables[3].PhysicalChannelNo); - - Assert.Equal(16,jT808_0x8103_0x0076.AVChannelRefTables[4].ChannelType); - Assert.Equal(17,jT808_0x8103_0x0076.AVChannelRefTables[4].IsConnectCloudPlat); - Assert.Equal(18,jT808_0x8103_0x0076.AVChannelRefTables[4].LogicChannelNo); - Assert.Equal(19,jT808_0x8103_0x0076.AVChannelRefTables[4].PhysicalChannelNo); - - Assert.Equal(20,jT808_0x8103_0x0076.AVChannelRefTables[5].ChannelType); - Assert.Equal(21,jT808_0x8103_0x0076.AVChannelRefTables[5].IsConnectCloudPlat); - Assert.Equal(22,jT808_0x8103_0x0076.AVChannelRefTables[5].LogicChannelNo); - Assert.Equal(23,jT808_0x8103_0x0076.AVChannelRefTables[5].PhysicalChannelNo); - break; - case JT808_0x8103_0x0077 jT808_0x8103_0x0077: - Assert.Equal(2,jT808_0x8103_0x0077.NeedSetChannelTotal); - Assert.Equal(43,jT808_0x8103_0x0077.ParamLength); - - Assert.Equal(1,jT808_0x8103_0x0077.SignalChannels[0].LogicChannelNo); - Assert.Equal(2,jT808_0x8103_0x0077.SignalChannels[0].OSD); - Assert.Equal(3,jT808_0x8103_0x0077.SignalChannels[0].RTS_EncodeMode); - Assert.Equal(4,jT808_0x8103_0x0077.SignalChannels[0].RTS_KF_Interval); - Assert.Equal(5,jT808_0x8103_0x0077.SignalChannels[0].RTS_Resolution); - Assert.Equal(6u,jT808_0x8103_0x0077.SignalChannels[0].RTS_Target_CodeRate); - Assert.Equal(7,jT808_0x8103_0x0077.SignalChannels[0].RTS_Target_FPS); - Assert.Equal(8,jT808_0x8103_0x0077.SignalChannels[0].StreamStore_EncodeMode); - Assert.Equal(9,jT808_0x8103_0x0077.SignalChannels[0].StreamStore_KF_Interval); - Assert.Equal(10,jT808_0x8103_0x0077.SignalChannels[0].StreamStore_Resolution); - Assert.Equal(11u,jT808_0x8103_0x0077.SignalChannels[0].StreamStore_Target_CodeRate); - Assert.Equal(12,jT808_0x8103_0x0077.SignalChannels[0].StreamStore_Target_FPS); - - Assert.Equal(1,jT808_0x8103_0x0077.SignalChannels[1].LogicChannelNo); - Assert.Equal(2,jT808_0x8103_0x0077.SignalChannels[1].OSD); - Assert.Equal(3,jT808_0x8103_0x0077.SignalChannels[1].RTS_EncodeMode); - Assert.Equal(4,jT808_0x8103_0x0077.SignalChannels[1].RTS_KF_Interval); - Assert.Equal(5,jT808_0x8103_0x0077.SignalChannels[1].RTS_Resolution); - Assert.Equal(6u,jT808_0x8103_0x0077.SignalChannels[1].RTS_Target_CodeRate); - Assert.Equal(7,jT808_0x8103_0x0077.SignalChannels[1].RTS_Target_FPS); - Assert.Equal(8,jT808_0x8103_0x0077.SignalChannels[1].StreamStore_EncodeMode); - Assert.Equal(9,jT808_0x8103_0x0077.SignalChannels[1].StreamStore_KF_Interval); - Assert.Equal(10,jT808_0x8103_0x0077.SignalChannels[1].StreamStore_Resolution); - Assert.Equal(11u,jT808_0x8103_0x0077.SignalChannels[1].StreamStore_Target_CodeRate); - Assert.Equal(12,jT808_0x8103_0x0077.SignalChannels[1].StreamStore_Target_FPS); - - break; - case JT808_0x8103_0x0079 jT808_0x8103_0x0079: - Assert.Equal(1,jT808_0x8103_0x0079.BeginMinute); - Assert.Equal(2,jT808_0x8103_0x0079.Duration); - Assert.Equal(3,jT808_0x8103_0x0079.StorageThresholds); - break; - case JT808_0x8103_0x007A jT808_0x8103_0x007A: - Assert.Equal(1u,jT808_0x8103_0x007A.AlarmShielding); - break; - case JT808_0x8103_0x007B jT808_0x8103_0x007B: - Assert.Equal(1,jT808_0x8103_0x007B.NuclearLoadNumber); - Assert.Equal(2,jT808_0x8103_0x007B.FatigueThreshold); - break; - case JT808_0x8103_0x007C jT808_0x8103_0x007C: - Assert.Equal(1,jT808_0x8103_0x007C.SleepWakeMode); - Assert.Equal(2,jT808_0x8103_0x007C.TimerWakeDaySet); - Assert.Equal(3,jT808_0x8103_0x007C.WakeConditionType); - Assert.Equal("12", jT808_0x8103_0x007C.TimerWakeDayParamter.TimePeriod1CloseTime); - Assert.Equal("23",jT808_0x8103_0x007C.TimerWakeDayParamter.TimePeriod1WakeTime); - Assert.Equal("34",jT808_0x8103_0x007C.TimerWakeDayParamter.TimePeriod2CloseTime); - Assert.Equal("45",jT808_0x8103_0x007C.TimerWakeDayParamter.TimePeriod2WakeTime); - Assert.Equal("56",jT808_0x8103_0x007C.TimerWakeDayParamter.TimePeriod3CloseTime); - Assert.Equal("67",jT808_0x8103_0x007C.TimerWakeDayParamter.TimePeriod3WakeTime); - Assert.Equal("78",jT808_0x8103_0x007C.TimerWakeDayParamter.TimePeriod4CloseTime); - Assert.Equal("89", jT808_0x8103_0x007C.TimerWakeDayParamter.TimePeriod4WakeTime); - Assert.Equal(10,jT808_0x8103_0x007C.TimerWakeDayParamter.TimerWakeEnableFlag); - break; - default: - break; - } - } - } - - [Fact] - public void Test3() - { - byte[] bytes = "7E8103009C000123456789000A070000007515030500040700000006080A00090C0000000B000201000000761B02010303020001070604050B0A08090F0E0C0D1312101117161415000000772B0201030500040700000006080A00090C0000000B000201030500040700000006080A00090C0000000B000200000079030302010000007A04000000010000007B0201020000007C140103020A00230012004500340067005600890078587E".ToHexBytes(); - var jT808_0X8103 = JT808Serializer.Analyze(bytes); - } - } - class DefaultGlobalConfig : GlobalConfigBase - { - public override string ConfigId { protected set; get; } = "Default"; - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9101Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9101Test.cs deleted file mode 100644 index 7dad73f..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9101Test.cs +++ /dev/null @@ -1,101 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x9101Test - { - JT808Serializer JT808Serializer; - public JT808_0x9101Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = defaultConfig.GetSerializer(); - } - - [Fact] - public void Test1() - { - JT808_0x9101 jT808_0X9101 = new JT808_0x9101(); - jT808_0X9101.ServerIp = "127.0.0.1"; - jT808_0X9101.TcpPort = 1888; - jT808_0X9101.UdpPort = 0; - jT808_0X9101.ChannelNo= 1; - jT808_0X9101.DataType= 1; - jT808_0X9101.StreamType= 1; - var hex = JT808Serializer.Serialize(jT808_0X9101).ToHexString(); - Assert.Equal("093132372E302E302E3107600000010101", hex); - } - - [Fact] - public void Test2() - { - JT808_0x9101 jT808_0X9101= JT808Serializer.Deserialize("093132372E302E302E3107600000010101".ToHexBytes()); - Assert.Equal("127.0.0.1", jT808_0X9101.ServerIp); - Assert.Equal(9, jT808_0X9101.ServerIpLength); - Assert.Equal(1888, jT808_0X9101.TcpPort); - Assert.Equal(0, jT808_0X9101.UdpPort); - Assert.Equal(1, jT808_0X9101.ChannelNo); - Assert.Equal(1, jT808_0X9101.DataType); - Assert.Equal(1, jT808_0X9101.StreamType); - } - - [Fact] - public void Test3() - { - JT808Package jT808Package = new JT808Package(); - JT808Header header = new JT808Header(); - header.MsgId = 0x9101; - header.MsgNum = 1; - header.TerminalPhoneNo = "12345679810"; - jT808Package.Header = header; - JT808_0x9101 jT808_0X9101 = new JT808_0x9101(); - jT808_0X9101.ServerIp = "127.0.0.1"; - jT808_0X9101.TcpPort = 1888; - jT808_0X9101.UdpPort = 0; - jT808_0X9101.ChannelNo = 1; - jT808_0X9101.DataType = 1; - jT808_0X9101.StreamType = 1; - jT808Package.Bodies = jT808_0X9101; - var hex = JT808Serializer.Serialize(jT808Package).ToHexString(); - Assert.Equal("7E910100110123456798100001093132372E302E302E31076000000101014C7E", hex); - //7E910100110123456798100001093132372E302E302E31076000000101014C7E - } - - [Fact] - public void Test4() - { - var jT808_0X9101 = JT808Serializer.Analyze("093132372E302E302E3107600000010101".ToHexBytes()); - } - - [Fact] - public void Test5() - { - JT808Package jT808Package = new JT808Package(); - JT808Header header = new JT808Header(); - header.MsgId = 0x9101; - header.MsgNum = 1; - header.TerminalPhoneNo = ""; - jT808Package.Header = header; - JT808_0x9101 jT808_0X9101 = new JT808_0x9101(); - jT808_0X9101.ServerIp = ""; - jT808_0X9101.TcpPort = 1078; - jT808_0X9101.UdpPort = 0; - jT808_0X9101.ChannelNo = 3; - jT808_0X9101.DataType = 1; - jT808_0X9101.StreamType = 1; - jT808Package.Bodies = jT808_0X9101; - var hex = JT808Serializer.Serialize(jT808Package).ToHexString(); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9102Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9102Test.cs deleted file mode 100644 index 6ed77e8..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9102Test.cs +++ /dev/null @@ -1,73 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; -using Microsoft.Extensions.Logging; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x9102Test - { - JT808Serializer JT808Serializer; - public JT808_0x9102Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = defaultConfig.GetSerializer(); - } - - [Fact] - public void Test1() - { - JT808_0x9102 jT808_0X9102 = new JT808_0x9102(); - jT808_0X9102.ChannelNo = 1; - jT808_0X9102.ControlCmd = 1; - jT808_0X9102.CloseAVData = 0; - jT808_0X9102.StreamType = 0; - var hex = JT808Serializer.Serialize(jT808_0X9102).ToHexString(); - Assert.Equal("01010000", hex); - } - - [Fact] - public void Test2() - { - JT808_0x9102 jT808_0X9102 = JT808Serializer.Deserialize("01010000".ToHexBytes()); - Assert.Equal(1, jT808_0X9102.ChannelNo); - Assert.Equal(1, jT808_0X9102.ControlCmd); - Assert.Equal(0, jT808_0X9102.CloseAVData); - Assert.Equal(0, jT808_0X9102.StreamType); - } - - [Fact] - public void Test3() - { - JT808Package jT808Package = new JT808Package(); - JT808Header header = new JT808Header(); - header.MsgId = 0x9102; - header.ManualMsgNum = 1; - header.TerminalPhoneNo = "12345679810"; - jT808Package.Header = header; - JT808_0x9102 jT808_0X9102 = new JT808_0x9102(); - jT808_0X9102.ChannelNo = 1; - jT808_0X9102.ControlCmd = 1; - jT808_0X9102.CloseAVData = 0; - jT808_0X9102.StreamType = 0; - jT808Package.Bodies = jT808_0X9102; - var hex = JT808Serializer.Serialize(jT808Package).ToHexString(); - //7E910200040123456798100001010100001E7E - Assert.Equal("7E910200040123456798100001010100001E7E", hex); - } - [Fact] - public void Test4() - { - var jT808_0rX9102 = JT808Serializer.Analyze("01010000".ToHexBytes()); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9105Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9105Test.cs deleted file mode 100644 index 34fc0c4..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9105Test.cs +++ /dev/null @@ -1,62 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x9105Test - { - JT808Serializer JT808Serializer; - public JT808_0x9105Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = 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() - { - JT808_0x9105 jT808_0x9105 = new JT808_0x9105() - { - ChannelNo=1, - DropRate=2 - }; - var hex = JT808Serializer.Serialize(jT808_0x9105).ToHexString(); - Assert.Equal("0102", hex); - } - - [Fact] - public void Test2() - { - var jT808_0x9105 = JT808Serializer.Deserialize("0102".ToHexBytes()); - Assert.Equal(1, jT808_0x9105.ChannelNo); - Assert.Equal(2, jT808_0x9105.DropRate); - } - [Fact] - public void Test3() - { - var jT808_0x9105 = JT808Serializer.Analyze("0102".ToHexBytes()); - } - } -} \ No newline at end of file diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9201Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9201Test.cs deleted file mode 100644 index 2f9bea7..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9201Test.cs +++ /dev/null @@ -1,82 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x9201Test - { - JT808Serializer JT808Serializer; - public JT808_0x9201Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = 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() - { - JT808_0x9201 jT808_0x9201 = new JT808_0x9201() - { - ChannelNo = 1, - MediaType = 2, - BeginTime = Convert.ToDateTime("2019-07-16 10:10:10"), - EndTime = Convert.ToDateTime("2019-07-16 10:10:10"), - PlaySpeed=3, - MemoryType=5, - PlaybackWay=6, - ServerIp="127.0.0.1", - ServerIpLength=9, - StreamType=7, - TcpPort=80, - UdpPort=8080 - }; - var hex = JT808Serializer.Serialize(jT808_0x9201).ToHexString(); - Assert.Equal("093132372E302E302E3100501F90010207050603190716101010190716101010", hex); - } - - [Fact] - public void Test2() - { - var jT808_0x9201 = JT808Serializer.Deserialize("093132372E302E302E3100501F90010207050603190716101010190716101010".ToHexBytes()); - Assert.Equal(1, jT808_0x9201.ChannelNo); - Assert.Equal(2, jT808_0x9201.MediaType); - Assert.Equal(Convert.ToDateTime("2019-07-16 10:10:10"), jT808_0x9201.BeginTime); - Assert.Equal(Convert.ToDateTime("2019-07-16 10:10:10"), jT808_0x9201.EndTime); - Assert.Equal(3, jT808_0x9201.PlaySpeed); - Assert.Equal(5, jT808_0x9201.MemoryType); - Assert.Equal(6, jT808_0x9201.PlaybackWay); - Assert.Equal("127.0.0.1", jT808_0x9201.ServerIp); - Assert.Equal(9, jT808_0x9201.ServerIpLength); - Assert.Equal(7, jT808_0x9201.StreamType); - Assert.Equal(80, jT808_0x9201.TcpPort); - Assert.Equal(8080, jT808_0x9201.UdpPort); - } - [Fact] - public void Test3() - { - var jT808_0x9201 = JT808Serializer.Analyze("093132372E302E302E3100501F90010207050603190716101010190716101010".ToHexBytes()); - } - } -} \ No newline at end of file diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9202Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9202Test.cs deleted file mode 100644 index 3c2829e..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9202Test.cs +++ /dev/null @@ -1,66 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x9202Test - { - JT808Serializer JT808Serializer; - public JT808_0x9202Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = 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() - { - JT808_0x9202 jT808_0x9202 = new JT808_0x9202() - { - ChannelNo=1, - DragPlayPosition=Convert.ToDateTime("2019-07-16 10:10:10"), - PlaySpeed=2, - PlayControl=3 - }; - var hex = JT808Serializer.Serialize(jT808_0x9202).ToHexString(); - Assert.Equal("010302190716101010", hex); - } - - [Fact] - public void Test2() - { - var jT808_0x9202 = JT808Serializer.Deserialize("010302190716101010".ToHexBytes()); - Assert.Equal(1, jT808_0x9202.ChannelNo); - Assert.Equal(Convert.ToDateTime("2019-07-16 10:10:10"), jT808_0x9202.DragPlayPosition); - Assert.Equal(2, jT808_0x9202.PlaySpeed); - Assert.Equal(3, jT808_0x9202.PlayControl); - } - [Fact] - public void Test3() - { - var jT808_0x9202 = JT808Serializer.Analyze("010302190716101010".ToHexBytes()); - } - } -} \ No newline at end of file diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9205Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9205Test.cs deleted file mode 100644 index 7598a6f..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9205Test.cs +++ /dev/null @@ -1,72 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x9205Test - { - JT808Serializer JT808Serializer; - public JT808_0x9205Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = 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() - { - JT808_0x9205 jT808_0x9205 = new JT808_0x9205() - { - AlarmFlag=1, - MediaType=2, - BeginTime= Convert.ToDateTime("2019-07-16 10:10:10"), - EndTime= Convert.ToDateTime("2019-07-16 10:10:11"), - ChannelNo=3, - MemoryType=4, - StreamType =5 - }; - var hex = JT808Serializer.Serialize(jT808_0x9205).ToHexString(); - Assert.Equal("031907161010101907161010110000000000000001020504", hex); - } - - [Fact] - public void Test2() - { - var jT808_0x9205 = JT808Serializer.Deserialize("031907161010101907161010110000000000000001020504".ToHexBytes()); - Assert.Equal(1u, jT808_0x9205.AlarmFlag); - Assert.Equal(2, jT808_0x9205.MediaType); - Assert.Equal(Convert.ToDateTime("2019-07-16 10:10:10"), jT808_0x9205.BeginTime); - Assert.Equal(Convert.ToDateTime("2019-07-16 10:10:11"), jT808_0x9205.EndTime); - Assert.Equal(3, jT808_0x9205.ChannelNo); - Assert.Equal(4, jT808_0x9205.MemoryType); - Assert.Equal(5, jT808_0x9205.StreamType); - } - [Fact] - public void Test3() - { - var jT808_0x9205 = JT808Serializer.Analyze("031907161010101907161010110000000000000001020504".ToHexBytes()); - } - } -} \ No newline at end of file diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9206Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9206Test.cs deleted file mode 100644 index 7fa3a03..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9206Test.cs +++ /dev/null @@ -1,92 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x9206Test - { - JT808Serializer JT808Serializer; - public JT808_0x9206Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = 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() - { - JT808_0x9206 jT808_0x9206 = new JT808_0x9206() - { - AlarmFlag=1, - MediaType=2, - BeginTime= Convert.ToDateTime("2019-07-16 10:10:10"), - EndTime= Convert.ToDateTime("2019-07-16 10:10:11"), - ChannelNo=3, - StreamType =5, - FileUploadPath ="D://1112", - FileUploadPathLength=8, - MemoryPositon=4, - Password="123456", - PasswordLength=6, - Port=808, - ServerIp="127.0.0.1", - ServerIpLength=9, - TaskExcuteCondition=7, - UserName="tk", - UserNameLength=2 - }; - var hex = JT808Serializer.Serialize(jT808_0x9206).ToHexString(); - Assert.Equal("093132372E302E302E31032802746B0631323334353608443A2F2F31313132031907161010101907161010110000000102050407", hex); - } - - [Fact] - public void Test2() - { - var jT808_0x9206 = JT808Serializer.Deserialize("093132372E302E302E31032802746B0631323334353608443A2F2F31313132031907161010101907161010110000000102050407".ToHexBytes()); - Assert.Equal(1u, jT808_0x9206.AlarmFlag); - Assert.Equal(2, jT808_0x9206.MediaType); - Assert.Equal(Convert.ToDateTime("2019-07-16 10:10:10"), jT808_0x9206.BeginTime); - Assert.Equal(Convert.ToDateTime("2019-07-16 10:10:11"), jT808_0x9206.EndTime); - Assert.Equal(3, jT808_0x9206.ChannelNo); - Assert.Equal(5, jT808_0x9206.StreamType); - Assert.Equal("D://1112", jT808_0x9206.FileUploadPath); - Assert.Equal(8, jT808_0x9206.FileUploadPathLength); - Assert.Equal(4, jT808_0x9206.MemoryPositon); - Assert.Equal("123456", jT808_0x9206.Password); - Assert.Equal(6, jT808_0x9206.PasswordLength); - Assert.Equal(808, jT808_0x9206.Port); - Assert.Equal("127.0.0.1", jT808_0x9206.ServerIp); - Assert.Equal(9, jT808_0x9206.ServerIpLength); - Assert.Equal(7, jT808_0x9206.TaskExcuteCondition); - Assert.Equal("tk", jT808_0x9206.UserName); - Assert.Equal(2, jT808_0x9206.UserNameLength); - } - [Fact] - public void Test3() - { - var jT808_0x9206 = JT808Serializer.Analyze("093132372E302E302E31032802746B0631323334353608443A2F2F31313132031907161010101907161010110000000102050407".ToHexBytes()); - } - } -} \ No newline at end of file diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9207Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9207Test.cs deleted file mode 100644 index 78e8e05..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9207Test.cs +++ /dev/null @@ -1,62 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x9207Test - { - JT808Serializer JT808Serializer; - public JT808_0x9207Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = 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() - { - JT808_0x9207 jT808_0x9207 = new JT808_0x9207() - { - MgsNum=1, - UploadControl=2 - }; - var hex = JT808Serializer.Serialize(jT808_0x9207).ToHexString(); - Assert.Equal("000102", hex); - } - - [Fact] - public void Test2() - { - var jT808_0x9207 = JT808Serializer.Deserialize("000102".ToHexBytes()); - Assert.Equal(1, jT808_0x9207.MgsNum); - Assert.Equal(2, jT808_0x9207.UploadControl); - } - [Fact] - public void Test3() - { - var jT808_0x9207 = JT808Serializer.Analyze("000102".ToHexBytes()); - } - } -} \ No newline at end of file diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9301Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9301Test.cs deleted file mode 100644 index bab269f..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9301Test.cs +++ /dev/null @@ -1,65 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x9301Test - { - JT808Serializer JT808Serializer; - public JT808_0x9301Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = 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() - { - JT808_0x9301 jT808_0x9301 = new JT808_0x9301() - { - ChannelNo=1, - Speed=2, - Direction=3 - }; - var hex = JT808Serializer.Serialize(jT808_0x9301).ToHexString(); - Assert.Equal("010302", hex); - } - - [Fact] - public void Test2() - { - var jT808_0x9301 = JT808Serializer.Deserialize("010302".ToHexBytes()); - Assert.Equal(1, jT808_0x9301.ChannelNo); - Assert.Equal(2, jT808_0x9301.Speed); - Assert.Equal(3, jT808_0x9301.Direction); - } - [Fact] - public void Test3() - { - var jT808_0x9301 = JT808Serializer.Analyze("010302".ToHexBytes()); - - } - } -} \ No newline at end of file diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9302Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9302Test.cs deleted file mode 100644 index bce0e56..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9302Test.cs +++ /dev/null @@ -1,63 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x9302Test - { - JT808Serializer JT808Serializer; - public JT808_0x9302Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = 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() - { - JT808_0x9302 jT808_0x9302 = new JT808_0x9302() - { - LogicChannelNo=1, - FocusAdjustmentDirection=2 - }; - var hex = JT808Serializer.Serialize(jT808_0x9302).ToHexString(); - Assert.Equal("0102", hex); - } - - [Fact] - public void Test2() - { - var jT808_0x9302 = JT808Serializer.Deserialize("0102".ToHexBytes()); - Assert.Equal(1, jT808_0x9302.LogicChannelNo); - Assert.Equal(2, jT808_0x9302.FocusAdjustmentDirection); - } - [Fact] - public void Test3() - { - var jT808_0x9302 = JT808Serializer.Analyze("0102".ToHexBytes()); - - } - } -} \ No newline at end of file diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9303Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9303Test.cs deleted file mode 100644 index d72ac0c..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9303Test.cs +++ /dev/null @@ -1,63 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x9303Test - { - JT808Serializer JT808Serializer; - public JT808_0x9303Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = 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() - { - JT808_0x9303 jT808_0x9303 = new JT808_0x9303() - { - ChannelNo=1, - IrisAdjustment=2 - }; - var hex = JT808Serializer.Serialize(jT808_0x9303).ToHexString(); - Assert.Equal("0102", hex); - } - - [Fact] - public void Test2() - { - var jT808_0x9303 = JT808Serializer.Deserialize("0102".ToHexBytes()); - Assert.Equal(1, jT808_0x9303.ChannelNo); - Assert.Equal(2, jT808_0x9303.IrisAdjustment); - } - [Fact] - public void Test3() - { - var jT808_0x9303 = JT808Serializer.Analyze("0102".ToHexBytes()); - - } - } -} \ No newline at end of file diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9304Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9304Test.cs deleted file mode 100644 index 5cb9962..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9304Test.cs +++ /dev/null @@ -1,63 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x9304Test - { - JT808Serializer JT808Serializer; - public JT808_0x9304Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = 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() - { - JT808_0x9304 jT808_0x9304 = new JT808_0x9304() - { - ChannelNo=1, - StartOrStop=2 - }; - var hex = JT808Serializer.Serialize(jT808_0x9304).ToHexString(); - Assert.Equal("0102", hex); - } - - [Fact] - public void Test2() - { - var jT808_0x9304 = JT808Serializer.Deserialize("0102".ToHexBytes()); - Assert.Equal(1, jT808_0x9304.ChannelNo); - Assert.Equal(2, jT808_0x9304.StartOrStop); - } - [Fact] - public void Test3() - { - var jT808_0x9304 = JT808Serializer.Analyze("0102".ToHexBytes()); - - } - } -} \ No newline at end of file diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9305Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9305Test.cs deleted file mode 100644 index 7dd7751..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9305Test.cs +++ /dev/null @@ -1,56 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x9305Test - { - JT808Serializer JT808Serializer; - public JT808_0x9305Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = 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() - { - JT808_0x9305 jT808_0x9305 = new JT808_0x9305() - { - ChannelNo=1, - StartOrStop=2 - }; - var hex = JT808Serializer.Serialize(jT808_0x9305).ToHexString(); - Assert.Equal("0102", hex); - } - - [Fact] - public void Test2() - { - var jT808_0x9305 = JT808Serializer.Analyze("0102".ToHexBytes()); - - } - } -} \ No newline at end of file diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9306Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9306Test.cs deleted file mode 100644 index 3f3c633..0000000 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9306Test.cs +++ /dev/null @@ -1,63 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; - -namespace JT808.Protocol.Extensions.JT1078.Test -{ - public class JT808_0x9306Test - { - JT808Serializer JT808Serializer; - public JT808_0x9306Test() - { - IServiceCollection serviceDescriptors1 = new ServiceCollection(); - serviceDescriptors1 - .AddJT808Configure() - .AddJT1078Configure(); - var ServiceProvider1 = serviceDescriptors1.BuildServiceProvider(); - var defaultConfig = ServiceProvider1.GetRequiredService(); - JT808Serializer = 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() - { - JT808_0x9306 jT808_0x9306 = new JT808_0x9306() - { - ChannelNo=1, - ChangeMultipleControl=2 - }; - var hex = JT808Serializer.Serialize(jT808_0x9306).ToHexString(); - Assert.Equal("0102", hex); - } - - [Fact] - public void Test2() - { - var jT808_0x9306 = JT808Serializer.Deserialize("0102".ToHexBytes()); - Assert.Equal(1, jT808_0x9306.ChannelNo); - Assert.Equal(2, jT808_0x9306.ChangeMultipleControl); - } - [Fact] - public void Test3() - { - var jT808_0x9306 = JT808Serializer.Analyze("0102".ToHexBytes()); - - } - } -} \ No newline at end of file diff --git a/src/JT808.Protocol.Extensions.JT1078/DependencyInjectionExtensions.cs b/src/JT808.Protocol.Extensions.JT1078/DependencyInjectionExtensions.cs deleted file mode 100644 index c188a55..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/DependencyInjectionExtensions.cs +++ /dev/null @@ -1,20 +0,0 @@ -using JT808.Protocol.Extensions.JT1078.Enums; -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text; - -namespace JT808.Protocol.Extensions.JT1078 -{ - public static class DependencyInjectionExtensions - { - public static IJT808Builder AddJT1078Configure(this IJT808Builder jT808Builder) - { - jT808Builder.Config.Register(Assembly.GetExecutingAssembly()); - return jT808Builder; - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/Enums/JT808_JT1078_MsgId.cs b/src/JT808.Protocol.Extensions.JT1078/Enums/JT808_JT1078_MsgId.cs deleted file mode 100644 index 6d916c8..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/Enums/JT808_JT1078_MsgId.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace JT808.Protocol.Extensions.JT1078.Enums -{ -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public enum JT808_JT1078_MsgId:ushort - - { - 终端上传音视频属性 = 0x1003, - 终端上传乘客流量 = 0x1005, - 终端上传音视频资源列表 = 0x1205, - 文件上传完成通知 = 0x1206, - 查询终端音视频属性 = 0x9003, - 实时音视频传输请求 = 0x9101, - 音视频实时传输控制 = 0x9102, - 实时音视频传输状态通知 = 0x9105, - 平台下发远程录像回放请求 = 0x9201, - 平台下发远程录像回放控制 = 0x9202, - 查询资源列表 = 0x9205, - 文件上传指令 = 0x9206, - 文件上传控制 = 0x9207, - 云台旋转 = 0x9301, - 云台调整焦距控制 = 0x9302, - 云台调整光圈控制 = 0x9303, - 云台雨刷控制 = 0x9304, - 红外补光控制 = 0x9305, - 云台变倍控制 = 0x9306 - } - #pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 -} diff --git a/src/JT808.Protocol.Extensions.JT1078/Enums/VideoRelateAlarmType.cs b/src/JT808.Protocol.Extensions.JT1078/Enums/VideoRelateAlarmType.cs deleted file mode 100644 index b4641ab..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/Enums/VideoRelateAlarmType.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace JT808.Protocol.Extensions.JT1078.Enums -{ - [Flags] -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public enum VideoRelateAlarmType:uint - { - 视频信号丢失报警=0, - 视频信号遮挡报警=2, - 存储单元故障报警=4, - 其他视频设备故障报警=8, - 客车超员报警=16, - 异常驾驶行为报警=32, - 特殊报警录像达到存储阈值报警=64, - } -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 -} diff --git a/src/JT808.Protocol.Extensions.JT1078/JT808.Protocol.Extensions.JT1078.csproj b/src/JT808.Protocol.Extensions.JT1078/JT808.Protocol.Extensions.JT1078.csproj deleted file mode 100644 index 60bb8ae..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/JT808.Protocol.Extensions.JT1078.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - - netstandard2.0;netstandard2.1;net5.0; - 8.0 - Copyright 2019. - SmallChi(Koike) - JT808.Protocol.Extensions.JT1078 - JT808.Protocol.Extensions.JT1078 - 基于JT808协议、GB808协议扩展的视频消息协议 - 基于JT808协议、GB808协议扩展的视频消息协议 - true - https://github.com/SmallChi/JT1078 - https://github.com/SmallChi/JT1078 - https://github.com/SmallChi/JT1078/blob/master/LICENSE - https://github.com/SmallChi/JT1078/blob/master/LICENSE - false - 2.3.6 - LICENSE - JT808.Protocol.Extensions.JT1078.xml - - - - - True - - - - - - - - - - diff --git a/src/JT808.Protocol.Extensions.JT1078/JT808.Protocol.Extensions.JT1078.xml b/src/JT808.Protocol.Extensions.JT1078/JT808.Protocol.Extensions.JT1078.xml deleted file mode 100644 index ced8b64..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/JT808.Protocol.Extensions.JT1078.xml +++ /dev/null @@ -1,1289 +0,0 @@ - - - - JT808.Protocol.Extensions.JT1078 - - - - - 视频相关报警 - - - - - 视频信号丢失报警状态 - - - - - 视频信号遮挡报警状态 - - - - - 存储器故障报警状态 - - - - - 异常驾驶行为报警详细描述 - - - - - 音视频参数设置 - - - - - 音视频通道列表设置 - - - - - 单独视频通道参数设置 - - - - - 特殊报警录像参数设置 - - - - - 视频相关报警屏蔽字 - - - - - 图像分析报警参数设置 - - - - - 终端休眠模式唤醒设置 - - - - - 视频相关报警 - 0x0200_0x14 - - - - - 数据 长度 - - - - - 视频相关报警 - - - - - - 视频信号丢失报警状态 - 0x0200_0x15 - - - - - 数据 长度 - - - - - 视频信号丢失报警状态 - - - - - 视频信号遮挡报警状态 - 0x0200_0x16 - - - - - 数据 长度 - - - - - 视频信号遮挡报警状态 - - - - - 存储器故障报警状态 - 0x0200_0x17 - - - - - 数据 长度 - - - - - 存储器故障报警状态 - - - - - 异常驾驶行为报警详细描述 - 0x0200_0x18 - - - - - 数据 长度 - - - - - 异常驾驶行为报警类型 - - - - - 疲劳程度 - - - - - 终端上传音视频属性 - - - - - 输入音频编码方式 - - - - - 输入音频声道数 - - - - - 输入音频采样率 - - - - - 输入音频采样位数 - - - - - 音频帧长度 - - - - - 是否支持音频输出 - - - - - 视频编码方式 - - - - - 终端支持的最大音频物理通道数量 - - - - - 终端支持的最大视频物理通道数量 - - - - - 终端上传乘客流量 - - - - - 起始时间 - - - - - 结束时间 - - - - - 上车人数 - - - - - 下车人数 - - - - - 终端上传音视频资源列表 - - - - - 流水号 - - - - - 音视频资源总数 - - - - - 音视频资源列表 - - - - - 终端上传音视频资源列表 - - - - - 逻辑通道号 - - - - - 开始时间 - - - - - 结束时间 - - - - - 报警标志 - - - - - 音视频资源类型 - - - - - 码流类型 - - - - - 存储器类型 - - - - - 文件大小 - - - - - 文件上传完成通知 - - - - - 流水号 - - - - - 结果 - - - - - 音视频参数设置 - 0x8103_0x0075 - - - - - 数据 长度 - - - - - 实时流编码模式 - - - - - 实时流分辨率 - - - - - 实时流关键帧间隔 - (范围1-1000)帧 - - - - - 实时流目标帧率 - - - - - 实时流目标码率 - 单位未千位每秒(kbps) - - - - - 存储流编码模式 - - - - - 存储流分辨率 - - - - - 存储流关键帧间隔 - (范围1-1000)帧 - - - - - 存储流目标帧率 - - - - - 存储流目标码率 - 单位未千位每秒(kbps) - - - - - OSD字幕叠加设置 - - - - - 是否启用音频输出 - 0:不启用 - 1:启用 - - - - - 音视频通道列表设置 - 0x8103_0x0076 - - - - - 数据 长度 - - - - - 音视频通道总数 - l - - - - - 音频通道总数 - m - - - - - 视频通道总数 - n - - - - - 音视频通道对照表 - 4*(l+m+n) - - - - - 音视频通道列表设置 - 0x8103_0x0076_AVChannelRefTable - - - - - 物理通道号 - - - - - 逻辑通道号 - - - - - 通道类型 - - - - - 是否链接云台 - - - - - 单独视频通道参数设置 - 0x8103_0x0077 - - - - - 数据 长度 - - - - - 需单独设置视频参数的通道数量 用n表示 - - - - - 逻辑通道号 - - - - - 实时流编码模式 - - - - - 实时流分辨率 - - - - - 实时流关键帧间隔 - (范围1-1000)帧 - - - - - 实时流目标帧率 - - - - - 实时流目标码率 - 单位未千位每秒(kbps) - - - - - 存储流编码模式 - - - - - 存储流分辨率 - - - - - 存储流关键帧间隔 - (范围1-1000)帧 - - - - - 存储流目标帧率 - - - - - 存储流目标码率 - 单位未千位每秒(kbps) - - - - - OSD字幕叠加设置 - - - - - 特殊报警录像参数设置 - 0x8103_0x0079 - - - - - 数据 长度 - - - - - 特殊报警录像存储阈值 - - - - - 特殊报警录像持续时间 - - - - - 特殊报警标识起始时间 - 分钟min - - - - - 视频相关报警屏蔽字 - 0x8103_0x007A - - - - - 数据 长度 - - - - - 视频相关屏蔽报警字 - - - - - 图像分析报警参数设置 - 0x8103_0x007B - - - - - 数据 长度 - - - - - 车辆核载人数 - - - - - 疲劳程度阈值 - - - - - 终端休眠模式唤醒设置 - 0x8103_0x007C - - - - - 数据 长度 - - - - - 休眠唤醒模式 - - - - - 唤醒条件类型 - - - - - 定时唤醒日设置 - - - - - 日定时唤醒参数列表 - - - - - 终端休眠模式唤醒设置 - 0x8103_0x007C - - - - - 定时唤醒启用标志 - - - - - 时间段1唤醒时间 - 2 - - - - - 时间段1关闭时间 - 2 - - - - - 时间段2唤醒时间 - 2 - - - - - 时间段2关闭时间 - 2 - - - - - 时间段3唤醒时间 - 2 - - - - - 时间段3关闭时间 - 2 - - - - - 时间段4唤醒时间 - 2 - - - - - 时间段4关闭时间 - 2 - - - - - 查询终端音视频属性 - - - - - 实时音视频传输请求(live、talk、listen、fanout、passThrough直播、对讲、监听、广播、透传请求) - - - - - 视频服务器IP地址长度 - - - - - 视频服务器IP地址 - - - - - 视频服务器TCP端口号,不使用TCP协议传输时保持默认值0即可(TCP和UDP二选一,当TCP和UDP均非默认值时一般以TCP为准) - - - - - 视频服务器UDP端口号,不使用UDP协议传输时保持默认值0即可(TCP和UDP二选一,当TCP和UDP均非默认值时一般以TCP为准) - - - - - 逻辑通道号 - - - - - 数据类型 - 0:音视频 - 1:视频 - 2:双向对讲 - 3:监听 - 4:中心广播 - 5:透传 - - - - - 码流类型 - 0:主码流 - 1:子码流 - - - - - 格式分析 - - - - - - - - 反序列化 - - - - - - - - 序列化 - - - - - - - - 音视频实时传输控制(LiveControl直播控制) - - - - - 逻辑通道号 - - - - - 控制指令 - 平台可以通过该指令对设备的实时音视频进行控制: - 0:关闭音视频传输指令 - 1:切换码流(增加暂停和继续) - 2:暂停该通道所有流的发送 - 3:恢复暂停前流的发送,与暂停前的流类型一致 - 4:关闭双向对讲 - - - - - 关闭音视频类型 - 0:关闭该通道有关的音视频数据 - 1:只关闭该通道有关的音频,保留该通道有关的视频 - 2:只关闭该通道有关的视频,保留该通道有关的音频 - - - - - 切换码流类型 - 将之前申请的码流切换为新申请的码流,音频与切换前保持一致。 - 新申请的码流为: - 0:主码流 - 1:子码流 - - - - - 格式分析 - - - - - - - - 反序列化 - - - - - - - - 序列化 - - - - - - - - 实时音视频传输状态通知 - - - - - 逻辑通道号 - - - - - 丢包率 - 当前传输通道的丢包率,数值乘以100之后取整部分 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 平台下发远程录像回放请求(vod点播请求) - - - - - 服务器IP地址长度 - - - - - 服务器IP地址 - - - - - 视频服务器TCP端口号,不使用TCP协议传输时保持默认值0即可(TCP和UDP二选一,当TCP和UDP均非默认值时一般以TCP为准) - - - - - 视频服务器UDP端口号,不使用UDP协议传输时保持默认值0即可(TCP和UDP二选一,当TCP和UDP均非默认值时一般以TCP为准) - - - - - 逻辑通道号 - - - - - 音视频类型(媒体类型) - 0:audio and video - 1:audio - 2:video - 3:audio or video - - - - - 码流类型 - 0:主或子码流 - 1:主 - 2:子 - 如果此通道只传输音频,置为0 - - - - - 存储器类型 - 0:主或灾备存储器 - 1:主存储器 - 2:灾备存储器 - - - - - 回放方式 - 0:正常 - 1:快进 - 2:关键帧快退回放 - 3:关键帧播放 - 4:单帧上传 - - - - - 快进或快退倍数,当为1和2时,此字段有效,否则置0 - 0:无效 - 1:1倍 - 2:2倍 - 3:4倍 - 4:8倍 - 5:16倍 - - - - - 开始时间,当为4时,该字段表示单帧上传时间 - - - - - 结束时间,当为4时,该字段无效 - - - - - 格式分析 - - - - - - - - 反序列化 - - - - - - - - 序列化 - - - - - - - - 平台下发远程录像回放控制(VodControl点播控制) - - - - - 音视频通道号 - - - - - 回放控制 - 0:开始 - 1:暂停 - 2:结束 - 3:快进 - 4:关键帧快退播放 - 5:拖动(到指定位置) - 6:关键帧播放 - - - - - 快进或快退倍数,当为3和4时,此字段有效,否则置0 - 0:无效 - 1:1倍 - 2:2倍 - 3:4倍 - 4:8倍 - 5:16倍 - - - - - 拖动回放位置,当为5时有效(必须) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 查询资源列表 - - - - - 逻辑通道号 - - - - - 开始时间 - - - - - 结束时间 - - - - - 报警标志 - - - - - 音视频资源类型 - 0:audio and video - 1:audio - 2:video - 3:audio or video - - - - - 码流类型 - 0:主或子码流 - 1:主 - 2:子 - - - - - 存储器类型 - 0:主或灾备存储器 - 1:主存储器 - 2:灾备存储器 - - - - - 文件上传指令 - - - - - 服务器IP地址服务 - - - - - 服务器IP地址 - - - - - 服务器端口 - - - - - 用户名长度 - - - - - 用户名 - - - - - 密码长度 - - - - - 密码 - - - - - 文件上传路径长度 - - - - - 文件上传路径 - - - - - 逻辑通道号 - - - - - 起始时间 - - - - - 结束时间 - - - - - 报警标志 - - - - - 音视频资源类型 - - - - - 码流类型 - - - - - 存储位置 - - - - - 任务执行条件 - - - - - 文件上传控制 - - - - - 流水号 - - - - - 上传控制 - - - - - 云台旋转 - - - - - 逻辑通道号 - - - - - 方向 - 0:停止 - 1:上 - 2:下 - 3:左 - 4:右 - - - - - 速度 - 0-255 - - - - - 云台调整焦距控制 - - - - - 逻辑通道号 - - - - - 焦距调整方向 - - - - - 云台调整光圈控制 - - - - - 逻辑通道号 - - - - - 光圈调整方式 - - - - - 云台雨刷控制 - - - - - 逻辑通道号 - - - - - 启停标识 - - - - - 红外补光控制 - - - - - 逻辑通道号 - - - - - 启停标识 - - - - - 云台变倍控制 - - - - - 逻辑通道号 - - - - - 变倍控制 - - - - diff --git a/src/JT808.Protocol.Extensions.JT1078/JT808_JT1078_Constants.cs b/src/JT808.Protocol.Extensions.JT1078/JT808_JT1078_Constants.cs deleted file mode 100644 index 40406b2..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/JT808_JT1078_Constants.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT808.Protocol.Extensions.JT1078 -{ - public static class JT808_JT1078_Constants - { - /// - /// 视频相关报警 - /// - public const byte JT808_0X0200_0x14 = 0x14; - /// - /// 视频信号丢失报警状态 - /// - public const byte JT808_0X0200_0x15 = 0x15; - /// - /// 视频信号遮挡报警状态 - /// - public const byte JT808_0X0200_0x16 = 0x16; - /// - /// 存储器故障报警状态 - /// - public const byte JT808_0X0200_0x17 = 0x17; - /// - /// 异常驾驶行为报警详细描述 - /// - public const byte JT808_0X0200_0x18 = 0x18; - - /// - /// 音视频参数设置 - /// - public const uint JT808_0X8103_0x0075 = 0x0075; - /// - /// 音视频通道列表设置 - /// - public const uint JT808_0X8103_0x0076 = 0x0076; - /// - /// 单独视频通道参数设置 - /// - public const uint JT808_0X8103_0x0077 = 0x0077; - /// - /// 特殊报警录像参数设置 - /// - public const uint JT808_0X8103_0x0079 = 0x0079; - /// - /// 视频相关报警屏蔽字 - /// - public const uint JT808_0X8103_0x007A = 0x007A; - /// - /// 图像分析报警参数设置 - /// - public const uint JT808_0X8103_0x007B = 0x007B; - /// - /// 终端休眠模式唤醒设置 - /// - public const uint JT808_0X8103_0x007C = 0x007C; - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x0200_0x14.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x0200_0x14.cs deleted file mode 100644 index b06c751..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x0200_0x14.cs +++ /dev/null @@ -1,65 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.MessageBody; -using JT808.Protocol.MessagePack; -using JT808.Protocol.Interfaces; -using System.Text.Json; -using JT808.Protocol.Extensions.JT1078.Enums; -using System.Linq; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 视频相关报警 - /// 0x0200_0x14 - /// - public class JT808_0x0200_0x14 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter,IJT808Analyze - { - public override byte AttachInfoId { get; set; } = 0x14; - /// - /// 数据 长度 - /// - public override byte AttachInfoLength { get; set; } = 4; - /// - /// 视频相关报警 - /// - /// - public uint VideoRelateAlarm { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x0200_0x14 value = new JT808_0x0200_0x14(); - value.AttachInfoId = reader.ReadByte(); - writer.WriteNumber($"[{value.AttachInfoId.ReadNumber()}]附加信息Id", value.AttachInfoId); - value.AttachInfoLength = reader.ReadByte(); - writer.WriteNumber($"[{value.AttachInfoLength.ReadNumber()}]附加信息长度", value.AttachInfoLength); - value.VideoRelateAlarm = reader.ReadUInt32(); - writer.WriteNumber($"[{value.VideoRelateAlarm.ReadNumber()}]视频相关报警", value.VideoRelateAlarm); - var videoRelateAlarmFlags = JT808EnumExtensions.GetEnumTypes(value.VideoRelateAlarm, 32); - if (videoRelateAlarmFlags.Any()) - { - writer.WriteStartArray("视频报警集合"); - foreach (var item in videoRelateAlarmFlags) - { - writer.WriteStringValue(item.ToString()); - } - writer.WriteEndArray(); - } - } - - public JT808_0x0200_0x14 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x0200_0x14 value = new JT808_0x0200_0x14(); - value.AttachInfoId = reader.ReadByte(); - value.AttachInfoLength = reader.ReadByte(); - value.VideoRelateAlarm = reader.ReadUInt32(); - return value; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x14 value, IJT808Config config) - { - writer.WriteByte(value.AttachInfoId); - writer.WriteByte(value.AttachInfoLength); - writer.WriteUInt32(value.VideoRelateAlarm); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x0200_0x15.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x0200_0x15.cs deleted file mode 100644 index db886b9..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x0200_0x15.cs +++ /dev/null @@ -1,69 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessageBody; -using JT808.Protocol.MessagePack; -using System; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 视频信号丢失报警状态 - /// 0x0200_0x15 - /// - public class JT808_0x0200_0x15 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter, IJT808Analyze - { - public override byte AttachInfoId { get; set; } = 0x15; - /// - /// 数据 长度 - /// - public override byte AttachInfoLength { get; set; } = 4; - /// - /// 视频信号丢失报警状态 - /// - public uint VideoSignalLoseAlarmStatus { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x0200_0x15 value = new JT808_0x0200_0x15(); - value.AttachInfoId = reader.ReadByte(); - writer.WriteNumber($"[{value.AttachInfoId.ReadNumber()}]附加信息Id", value.AttachInfoId); - value.AttachInfoLength = reader.ReadByte(); - writer.WriteNumber($"[{value.AttachInfoLength.ReadNumber()}]附加信息长度", value.AttachInfoLength); - value.VideoSignalLoseAlarmStatus = reader.ReadUInt32(); - writer.WriteNumber($"[{value.VideoSignalLoseAlarmStatus.ReadNumber()}]视频信号丢失报警状态", value.VideoSignalLoseAlarmStatus); - var videoSignalLoseAlarmStatusSpan = Convert.ToString(value.VideoSignalLoseAlarmStatus, 2).PadLeft(32, '0').AsSpan(); - writer.WriteStartArray("视频信号丢失报警状态集合"); - int index = 0; - foreach (var item in videoSignalLoseAlarmStatusSpan) - { - if (item == '1') - { - writer.WriteStringValue($"{index}通道视频信号丢失"); - } - else - { - writer.WriteStringValue($"{index}通道视频正常"); - } - index++; - } - writer.WriteEndArray(); - } - - public JT808_0x0200_0x15 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x0200_0x15 value = new JT808_0x0200_0x15(); - value.AttachInfoId = reader.ReadByte(); - value.AttachInfoLength = reader.ReadByte(); - value.VideoSignalLoseAlarmStatus = reader.ReadUInt32(); - return value; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x15 value, IJT808Config config) - { - writer.WriteByte(value.AttachInfoId); - writer.WriteByte(value.AttachInfoLength); - writer.WriteUInt32(value.VideoSignalLoseAlarmStatus); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x0200_0x16.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x0200_0x16.cs deleted file mode 100644 index 5602d06..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x0200_0x16.cs +++ /dev/null @@ -1,69 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessageBody; -using JT808.Protocol.MessagePack; -using System; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 视频信号遮挡报警状态 - /// 0x0200_0x16 - /// - public class JT808_0x0200_0x16 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter, IJT808Analyze - { - public override byte AttachInfoId { get; set; } = 0x16; - /// - /// 数据 长度 - /// - public override byte AttachInfoLength { get; set; } = 4; - /// - /// 视频信号遮挡报警状态 - /// - public uint VideoSignalOcclusionAlarmStatus { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x0200_0x16 value = new JT808_0x0200_0x16(); - value.AttachInfoId = reader.ReadByte(); - writer.WriteNumber($"[{value.AttachInfoId.ReadNumber()}]附加信息Id", value.AttachInfoId); - value.AttachInfoLength = reader.ReadByte(); - writer.WriteNumber($"[{value.AttachInfoLength.ReadNumber()}]附加信息长度", value.AttachInfoLength); - value.VideoSignalOcclusionAlarmStatus = reader.ReadUInt32(); - writer.WriteNumber($"[{value.VideoSignalOcclusionAlarmStatus.ReadNumber()}]视频信号遮挡报警状态", value.VideoSignalOcclusionAlarmStatus); - var videoSignalOcclusionAlarmStatusSpan = Convert.ToString(value.VideoSignalOcclusionAlarmStatus, 2).PadLeft(32, '0').AsSpan(); - writer.WriteStartArray("视频信号遮挡报警状态集合"); - int index = 0; - foreach (var item in videoSignalOcclusionAlarmStatusSpan) - { - if (item == '1') - { - writer.WriteStringValue($"{index}通道视频信号遮挡"); - } - else - { - writer.WriteStringValue($"{index}通道视频正常"); - } - index++; - } - writer.WriteEndArray(); - } - - public JT808_0x0200_0x16 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x0200_0x16 value = new JT808_0x0200_0x16(); - value.AttachInfoId = reader.ReadByte(); - value.AttachInfoLength = reader.ReadByte(); - value.VideoSignalOcclusionAlarmStatus = reader.ReadUInt32(); - return value; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x16 value, IJT808Config config) - { - writer.WriteByte(value.AttachInfoId); - writer.WriteByte(value.AttachInfoLength); - writer.WriteUInt32(value.VideoSignalOcclusionAlarmStatus); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x0200_0x17.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x0200_0x17.cs deleted file mode 100644 index 373b8b9..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x0200_0x17.cs +++ /dev/null @@ -1,83 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessageBody; -using JT808.Protocol.MessagePack; -using System; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 存储器故障报警状态 - /// 0x0200_0x17 - /// - public class JT808_0x0200_0x17 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter, IJT808Analyze - { - public override byte AttachInfoId { get; set; } = 0x17; - /// - /// 数据 长度 - /// - public override byte AttachInfoLength { get; set; } = 2; - /// - /// 存储器故障报警状态 - /// - public ushort StorageFaultAlarmStatus{ get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x0200_0x17 value = new JT808_0x0200_0x17(); - value.AttachInfoId = reader.ReadByte(); - writer.WriteNumber($"[{value.AttachInfoId.ReadNumber()}]附加信息Id", value.AttachInfoId); - value.AttachInfoLength = reader.ReadByte(); - writer.WriteNumber($"[{value.AttachInfoLength.ReadNumber()}]附加信息长度", value.AttachInfoLength); - value.StorageFaultAlarmStatus = reader.ReadUInt16(); - writer.WriteNumber($"[{value.StorageFaultAlarmStatus.ReadNumber()}]存储器故障报警状态", value.StorageFaultAlarmStatus); - var storageFaultAlarmStatusSpan = Convert.ToString(value.StorageFaultAlarmStatus, 2).PadLeft(16, '0').AsSpan(); - writer.WriteStartArray("存储器故障报警状态集合"); - int index = 0; - foreach (var item in storageFaultAlarmStatusSpan) - { - if (index < 4) - { - if (item == '1') - { - writer.WriteStringValue($"{index}灾备存储装置故障"); - } - else - { - writer.WriteStringValue($"{index}灾备存储装置正常"); - } - } - else - { - if (item == '1') - { - writer.WriteStringValue($"{index}主存储器故障"); - } - else - { - writer.WriteStringValue($"{index}主存储器正常"); - } - } - index++; - } - writer.WriteEndArray(); - } - - public JT808_0x0200_0x17 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x0200_0x17 value = new JT808_0x0200_0x17(); - value.AttachInfoId = reader.ReadByte(); - value.AttachInfoLength = reader.ReadByte(); - value.StorageFaultAlarmStatus = reader.ReadUInt16(); - return value; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x17 value, IJT808Config config) - { - writer.WriteByte(value.AttachInfoId); - writer.WriteByte(value.AttachInfoLength); - writer.WriteUInt16(value.StorageFaultAlarmStatus); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x0200_0x18.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x0200_0x18.cs deleted file mode 100644 index a71c553..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x0200_0x18.cs +++ /dev/null @@ -1,90 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessageBody; -using JT808.Protocol.MessagePack; -using System; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 异常驾驶行为报警详细描述 - /// 0x0200_0x18 - /// - public class JT808_0x0200_0x18 : JT808_0x0200_BodyBase, IJT808MessagePackFormatter, IJT808Analyze - { - public override byte AttachInfoId { get; set; } = 0x18; - /// - /// 数据 长度 - /// - public override byte AttachInfoLength { get; set; } = 3; - /// - /// 异常驾驶行为报警类型 - /// - public ushort AbnormalDrivingBehaviorAlarmType{ get; set; } - /// - /// 疲劳程度 - /// - public byte FatigueLevel { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x0200_0x18 value = new JT808_0x0200_0x18(); - value.AttachInfoId = reader.ReadByte(); - writer.WriteNumber($"[{value.AttachInfoId.ReadNumber()}]附加信息Id", value.AttachInfoId); - value.AttachInfoLength = reader.ReadByte(); - writer.WriteNumber($"[{value.AttachInfoLength.ReadNumber()}]附加信息长度", value.AttachInfoLength); - value.AbnormalDrivingBehaviorAlarmType = reader.ReadUInt16(); - writer.WriteNumber($"[{value.AbnormalDrivingBehaviorAlarmType.ReadNumber()}]异常驾驶行为报警类型", value.AbnormalDrivingBehaviorAlarmType); - writer.WriteStartArray("视频信号遮挡报警状态集合"); - var abnormalDrivingBehaviorAlarmTypeSpan = Convert.ToString(value.AbnormalDrivingBehaviorAlarmType, 2).PadLeft(16, '0').AsSpan(); - int index = 0; - foreach (var item in abnormalDrivingBehaviorAlarmTypeSpan) - { - string tmpResult = item == '1' ? "有" : "无"; - if (index == 0) - { - writer.WriteStringValue($"[bit{index}疲劳]_{tmpResult}"); - } - else if (index == 1) - { - writer.WriteStringValue($"[bit{index}打电话]_{tmpResult}"); - } - else if (index == 2) - { - writer.WriteStringValue($"[bit{index}抽烟]_{tmpResult}"); - } - else if (index>=3 && index<=10) - { - writer.WriteStringValue($"[bit{index}保留]_{tmpResult}"); - } - else - { - writer.WriteStringValue($"[bit{index}自定义]_{tmpResult}"); - } - index++; - } - writer.WriteEndArray(); - value.FatigueLevel = reader.ReadByte(); - writer.WriteNumber($"[{value.FatigueLevel.ReadNumber()}]疲劳程度", value.FatigueLevel); - } - - public JT808_0x0200_0x18 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x0200_0x18 value = new JT808_0x0200_0x18(); - value.AttachInfoId = reader.ReadByte(); - value.AttachInfoLength = reader.ReadByte(); - value.AbnormalDrivingBehaviorAlarmType = reader.ReadUInt16(); - value.FatigueLevel = reader.ReadByte(); - return value; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x0200_0x18 value, IJT808Config config) - { - writer.WriteByte(value.AttachInfoId); - writer.WriteByte(value.AttachInfoLength); - writer.WriteUInt16(value.AbnormalDrivingBehaviorAlarmType); - writer.WriteByte(value.FatigueLevel); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1003.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1003.cs deleted file mode 100644 index 165c6cc..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1003.cs +++ /dev/null @@ -1,159 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 终端上传音视频属性 - /// - public class JT808_0x1003 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { - /// - /// 输入音频编码方式 - /// - public byte EnterAudioEncoding { get; set; } - /// - /// 输入音频声道数 - /// - public byte EnterAudioChannelsNumber { get; set; } - /// - /// 输入音频采样率 - /// - public byte EnterAudioSampleRate { get; set; } - /// - /// 输入音频采样位数 - /// - public byte EnterAudioSampleDigits { get; set; } - /// - /// 音频帧长度 - /// - public ushort AudioFrameLength { get; set; } - /// - /// 是否支持音频输出 - /// - public byte IsSupportedAudioOutput { get; set; } - /// - /// 视频编码方式 - /// - public byte VideoEncoding { get; set; } - /// - /// 终端支持的最大音频物理通道数量 - /// - public byte TerminalSupportedMaxNumberOfAudioPhysicalChannels{ get; set; } - /// - /// 终端支持的最大视频物理通道数量 - /// - public byte TerminalSupportedMaxNumberOfVideoPhysicalChannels { get; set; } - - public override ushort MsgId => 0x1003; - - public override string Description => "终端上传音视频属性"; - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x1003 value = new JT808_0x1003(); - value.EnterAudioEncoding = reader.ReadByte(); - writer.WriteString($"[{value.EnterAudioEncoding.ReadNumber()}]输入音频编码方式", AudioVideoEncodingDisplay(value.EnterAudioEncoding)); - value.EnterAudioChannelsNumber = reader.ReadByte(); - writer.WriteNumber($"[{value.EnterAudioChannelsNumber.ReadNumber()}]输入音频声道数", value.EnterAudioChannelsNumber); - value.EnterAudioSampleRate = reader.ReadByte(); - writer.WriteString($"[{value.EnterAudioSampleRate.ReadNumber()}]输入音频采样率", AudioSampleRateDisplay(value.EnterAudioSampleRate)); - - value.EnterAudioSampleDigits = reader.ReadByte(); - writer.WriteString($"[{value.EnterAudioSampleDigits.ReadNumber()}]输入音频采样位数", AudioSampleDigitsDisplay(value.EnterAudioSampleDigits)); - value.AudioFrameLength = reader.ReadUInt16(); - writer.WriteNumber($"[{value.AudioFrameLength.ReadNumber()}]音频帧长度", value.AudioFrameLength); - value.IsSupportedAudioOutput = reader.ReadByte(); - writer.WriteString($"[{value.IsSupportedAudioOutput.ReadNumber()}]是否支持音频输出", value.IsSupportedAudioOutput==0?"不支持":"支持"); - - value.VideoEncoding = reader.ReadByte(); - writer.WriteString($"[{value.VideoEncoding.ReadNumber()}]视频编码方式", AudioVideoEncodingDisplay(value.VideoEncoding)); - value.TerminalSupportedMaxNumberOfAudioPhysicalChannels = reader.ReadByte(); - writer.WriteNumber($"[{value.TerminalSupportedMaxNumberOfAudioPhysicalChannels.ReadNumber()}]终端支持的最大音频物理通道数量", value.TerminalSupportedMaxNumberOfAudioPhysicalChannels); - value.TerminalSupportedMaxNumberOfVideoPhysicalChannels = reader.ReadByte(); - writer.WriteNumber($"[{value.TerminalSupportedMaxNumberOfVideoPhysicalChannels.ReadNumber()}]终端支持的最大视频物理通道数量", value.TerminalSupportedMaxNumberOfVideoPhysicalChannels); - - string AudioVideoEncodingDisplay(byte AudioVideoEncoding) { - switch (AudioVideoEncoding) - { - case 19: - return "AAC"; - case 25: - return "MP3"; - case 91: - return "透传"; - case 98: - return "H.264"; - case 99: - return "H.265"; - default: - break; - } - return "未解析"; - } - string AudioSampleRateDisplay(byte AudioSampleRate) { - switch (AudioSampleRate) - { - case 0: - return "8 kHz"; - case 1: - return "22.05 kHz"; - case 2: - return "44.1 kHz"; - case 3: - return "48 kHz"; - default: - break; - } - return "未知"; - } - string AudioSampleDigitsDisplay(byte AudioSampleDigits) { - switch (AudioSampleDigits) - { - case 0: - return "8 位"; - case 1: - return "16 位"; - case 2: - return "32 位"; - default: - break; - } - return "未知"; - } - } - - public JT808_0x1003 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x1003 jT808_0x1003 = new JT808_0x1003(); - jT808_0x1003.EnterAudioEncoding = reader.ReadByte(); - jT808_0x1003.EnterAudioChannelsNumber = reader.ReadByte(); - jT808_0x1003.EnterAudioSampleRate = reader.ReadByte(); - jT808_0x1003.EnterAudioSampleDigits = reader.ReadByte(); - jT808_0x1003.AudioFrameLength = reader.ReadUInt16(); - jT808_0x1003.IsSupportedAudioOutput = reader.ReadByte(); - jT808_0x1003.VideoEncoding = reader.ReadByte(); - jT808_0x1003.TerminalSupportedMaxNumberOfAudioPhysicalChannels = reader.ReadByte(); - jT808_0x1003.TerminalSupportedMaxNumberOfVideoPhysicalChannels = reader.ReadByte(); - return jT808_0x1003; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x1003 value, IJT808Config config) - { - writer.WriteByte(value.EnterAudioEncoding); - writer.WriteByte(value.EnterAudioChannelsNumber); - writer.WriteByte(value.EnterAudioSampleRate); - writer.WriteByte(value.EnterAudioSampleDigits); - writer.WriteUInt16(value.AudioFrameLength); - writer.WriteByte(value.IsSupportedAudioOutput); - writer.WriteByte(value.VideoEncoding); - writer.WriteByte(value.TerminalSupportedMaxNumberOfAudioPhysicalChannels); - writer.WriteByte(value.TerminalSupportedMaxNumberOfVideoPhysicalChannels); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1005.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1005.cs deleted file mode 100644 index 48bfc00..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1005.cs +++ /dev/null @@ -1,66 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 终端上传乘客流量 - /// - public class JT808_0x1005 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { - public override string Description => "终端上传乘客流量"; - public override ushort MsgId => 0x1005; - /// - /// 起始时间 - /// - public DateTime BeginTime { get; set; } - /// - /// 结束时间 - /// - public DateTime EndTime { get; set; } - /// - /// 上车人数 - /// - public ushort GettingOnNumber { get; set; } - /// - /// 下车人数 - /// - public ushort GettingOffNumber { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x1005 value = new JT808_0x1005(); - value.BeginTime = reader.ReadDateTime6(); - writer.WriteString($"[{value.BeginTime.ToString("yyMMddHHmmss")}]开始时间", value.BeginTime.ToString("yyyy-MM-dd HH:mm:ss")); - value.EndTime = reader.ReadDateTime6(); - writer.WriteString($"[{value.EndTime.ToString("yyMMddHHmmss")}]结束时间", value.EndTime.ToString("yyyy-MM-dd HH:mm:ss")); - value.GettingOnNumber = reader.ReadUInt16(); - writer.WriteNumber($"[{value.GettingOnNumber.ReadNumber()}]从开始时间到结束时间的上车人数",value.GettingOnNumber); - value.GettingOffNumber = reader.ReadUInt16(); - writer.WriteNumber($"[{value.GettingOffNumber.ReadNumber()}]从开始时间到结束时间的下车人数", value.GettingOffNumber); - } - - public JT808_0x1005 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x1005 jT808_0x1005 = new JT808_0x1005(); - jT808_0x1005.BeginTime = reader.ReadDateTime6(); - jT808_0x1005.EndTime = reader.ReadDateTime6(); - jT808_0x1005.GettingOnNumber = reader.ReadUInt16(); - jT808_0x1005.GettingOffNumber = reader.ReadUInt16(); - return jT808_0x1005; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x1005 value, IJT808Config config) - { - writer.WriteDateTime6(value.BeginTime); - writer.WriteDateTime6(value.EndTime); - writer.WriteUInt16(value.GettingOnNumber); - writer.WriteUInt16(value.GettingOffNumber); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1205.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1205.cs deleted file mode 100644 index 47a4df5..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1205.cs +++ /dev/null @@ -1,82 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 终端上传音视频资源列表 - /// - public class JT808_0x1205 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { - public override string Description => "终端上传音视频资源列表"; - public override ushort MsgId => 0x1205; - /// - /// 流水号 - /// - public ushort MsgNum { get; set; } - /// - /// 音视频资源总数 - /// - public uint AVResouceTotal{ get; set; } - /// - /// 音视频资源列表 - /// - public List AVResouces { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x1205 value = new JT808_0x1205(); - value.MsgNum = reader.ReadUInt16(); - writer.WriteNumber($"[{value.MsgNum.ReadNumber()}]流水号", value.MsgNum); - value.AVResouceTotal = reader.ReadUInt32(); - writer.WriteNumber($"[{value.AVResouceTotal.ReadNumber()}]音视频资源总数", value.AVResouceTotal); - writer.WriteStartArray("音视频资源列表"); - var formatter = config.GetMessagePackFormatter(); - for (int i = 0; i < value.AVResouceTotal; i++) - { - writer.WriteStartObject(); - formatter.Analyze(ref reader, writer, config); - writer.WriteEndObject(); - } - writer.WriteEndArray(); - } - - public JT808_0x1205 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x1205 jT808_0x1205 = new JT808_0x1205(); - jT808_0x1205.MsgNum = reader.ReadUInt16(); - jT808_0x1205.AVResouceTotal = reader.ReadUInt32(); - var channelTotal = jT808_0x1205.AVResouceTotal;//音视频资源总数 - if (channelTotal > 0) - { - jT808_0x1205.AVResouces = new List(); - var formatter = config.GetMessagePackFormatter(); - for (int i = 0; i < channelTotal; i++) - { - jT808_0x1205.AVResouces.Add(formatter.Deserialize(ref reader, config)); - } - } - return jT808_0x1205; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x1205 value, IJT808Config config) - { - writer.WriteUInt16(value.MsgNum); - writer.WriteUInt32(value.AVResouceTotal); - if (value.AVResouces.Any()) - { - var formatter = config.GetMessagePackFormatter(); - foreach (var AVResouce in value.AVResouces) - { - formatter.Serialize(ref writer, AVResouce, config); - } - } - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1205_AVResouce.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1205_AVResouce.cs deleted file mode 100644 index 9dec3df..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1205_AVResouce.cs +++ /dev/null @@ -1,171 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 终端上传音视频资源列表 - /// - public class JT808_0x1205_AVResouce:IJT808MessagePackFormatter, IJT808Analyze - { - /// - /// 逻辑通道号 - /// - public byte LogicChannelNo { get; set; } - /// - /// 开始时间 - /// - public DateTime BeginTime { get; set; } - /// - /// 结束时间 - /// - public DateTime EndTime { get; set; } - /// - /// 报警标志 - /// - public ulong AlarmFlag { get; set; } - /// - /// 音视频资源类型 - /// - public byte AVResourceType { get; set; } - /// - /// 码流类型 - /// - public byte StreamType { get; set; } - /// - /// 存储器类型 - /// - public byte MemoryType { get; set; } - /// - /// 文件大小 - /// - public uint FileSize { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x1205_AVResouce value = new JT808_0x1205_AVResouce(); - value.LogicChannelNo = reader.ReadByte(); - writer.WriteString($"[{value.LogicChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.LogicChannelNo)); - value.BeginTime = reader.ReadDateTime6(); - writer.WriteString($"[{value.BeginTime.ToString("yyMMddHHmmss")}]开始时间", value.BeginTime.ToString("yyyy-MM-dd HH:mm:ss")); - value.BeginTime = reader.ReadDateTime6(); - writer.WriteString($"[{value.BeginTime.ToString("yyMMddHHmmss")}]开始时间", value.BeginTime.ToString("yyyy-MM-dd HH:mm:ss")); - value.AlarmFlag = reader.ReadUInt32(); - writer.WriteNumber($"[{value.AlarmFlag.ReadNumber()}]报警标志", value.AlarmFlag);//此处的报警标志不是很明白 - value.AVResourceType = reader.ReadByte(); - writer.WriteString($"[{value.AVResourceType.ReadNumber()}]音视频资源类型", AVResourceTypeDisplay(value.AVResourceType)); - value.StreamType = reader.ReadByte(); - writer.WriteString($"[{value.StreamType.ReadNumber()}]码流类型", StreamTypeDisplay(value.StreamType)); - value.MemoryType = reader.ReadByte(); - writer.WriteString($"[{value.MemoryType.ReadNumber()}]存储器类型", MemoryTypeDisplay(value.MemoryType)); - 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 JT808_0x1205_AVResouce Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x1205_AVResouce jT808_0x1205_AVResouce = new JT808_0x1205_AVResouce(); - jT808_0x1205_AVResouce.LogicChannelNo = reader.ReadByte(); - jT808_0x1205_AVResouce.BeginTime = reader.ReadDateTime6(); - jT808_0x1205_AVResouce.EndTime = reader.ReadDateTime6(); - jT808_0x1205_AVResouce.AlarmFlag = reader.ReadUInt64(); - jT808_0x1205_AVResouce.AVResourceType = reader.ReadByte(); - jT808_0x1205_AVResouce.StreamType = reader.ReadByte(); - jT808_0x1205_AVResouce.MemoryType = reader.ReadByte(); - jT808_0x1205_AVResouce.FileSize = reader.ReadUInt32(); - return jT808_0x1205_AVResouce; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x1205_AVResouce value, IJT808Config config) - { - writer.WriteByte(value.LogicChannelNo); - writer.WriteDateTime6(value.BeginTime); - writer.WriteDateTime6(value.EndTime); - writer.WriteUInt64(value.AlarmFlag); - writer.WriteByte(value.AVResourceType); - writer.WriteByte(value.StreamType); - writer.WriteByte(value.MemoryType); - writer.WriteUInt32(value.FileSize); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1206.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1206.cs deleted file mode 100644 index 9a761c1..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1206.cs +++ /dev/null @@ -1,61 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 文件上传完成通知 - /// - public class JT808_0x1206 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { - public override string Description => "文件上传完成通知"; - public override ushort MsgId => 0x1206; - /// - /// 流水号 - /// - public ushort MsgNum { get; set; } - /// - /// 结果 - /// - public byte Result{ get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x1206 value = new JT808_0x1206(); - value.MsgNum = reader.ReadUInt16(); - writer.WriteNumber($"[{value.MsgNum.ReadNumber()}]流水号", value.MsgNum); - value.Result = reader.ReadByte(); - writer.WriteString($"[{value.Result.ReadNumber()}]结果", ResultDisplay(value.Result)); - string ResultDisplay(byte Result) { - switch (Result) - { - case 0: - return "成功"; - case 1: - return "失败"; - default: - return "未知"; - } - } - } - - public JT808_0x1206 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x1206 jT808_0x1206 = new JT808_0x1206(); - jT808_0x1206.MsgNum = reader.ReadUInt16(); - jT808_0x1206.Result = reader.ReadByte(); - return jT808_0x1206; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x1206 value, IJT808Config config) - { - writer.WriteUInt16(value.MsgNum); - writer.WriteByte(value.Result); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0075.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0075.cs deleted file mode 100644 index 4a4633d..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0075.cs +++ /dev/null @@ -1,232 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessageBody; -using JT808.Protocol.MessagePack; -using System; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 音视频参数设置 - /// 0x8103_0x0075 - /// - public class JT808_0x8103_0x0075 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze - { - public override uint ParamId { get; set; } = 0x0075; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 21; - /// - /// 实时流编码模式 - /// - public byte RTS_EncodeMode { get; set; } - /// - /// 实时流分辨率 - /// - public byte RTS_Resolution { get; set; } - /// - /// 实时流关键帧间隔 - /// (范围1-1000)帧 - /// - public ushort RTS_KF_Interval { get; set; } - /// - /// 实时流目标帧率 - /// - public byte RTS_Target_FPS { get; set; } - /// - /// 实时流目标码率 - /// 单位未千位每秒(kbps) - /// - public uint RTS_Target_CodeRate { get; set; } - /// - /// 存储流编码模式 - /// - public byte StreamStore_EncodeMode { get; set; } - /// - /// 存储流分辨率 - /// - public byte StreamStore_Resolution { get; set; } - /// - /// 存储流关键帧间隔 - /// (范围1-1000)帧 - /// - public ushort StreamStore_KF_Interval { get; set; } - /// - /// 存储流目标帧率 - /// - public byte StreamStore_Target_FPS { get; set; } - /// - /// 存储流目标码率 - /// 单位未千位每秒(kbps) - /// - public uint StreamStore_Target_CodeRate { get; set; } - /// - ///OSD字幕叠加设置 - /// - public ushort OSD { get; set; } - /// - ///是否启用音频输出 - ///0:不启用 - ///1:启用 - /// - public byte AudioOutputEnabled { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x8103_0x0075 value = new JT808_0x8103_0x0075(); - value.ParamId = reader.ReadUInt32(); - writer.WriteNumber($"[{value.ParamId.ReadNumber()}]参数 ID", value.ParamId); - value.ParamLength = reader.ReadByte(); - writer.WriteNumber($"[{value.ParamLength.ReadNumber()}]数据长度", value.ParamLength); - value.RTS_EncodeMode = reader.ReadByte(); - writer.WriteString($"[{value.RTS_EncodeMode.ReadNumber()}]实时流编码模式", RTS_EncodeModeDisplay(value.RTS_EncodeMode)); - value.RTS_Resolution = reader.ReadByte(); - writer.WriteString($"[{value.RTS_Resolution.ReadNumber()}]实时流分辨率", RTS_ResolutionDisplay(value.RTS_Resolution)); - value.RTS_KF_Interval = reader.ReadUInt16(); - writer.WriteNumber($"[{value.RTS_KF_Interval.ReadNumber()}]实时流关键帧间隔(帧)", value.RTS_KF_Interval); - value.RTS_Target_FPS = reader.ReadByte(); - writer.WriteNumber($"[{value.RTS_Target_FPS.ReadNumber()}]实时流目标帧率(帧/s)", value.RTS_Target_FPS); - value.RTS_Target_CodeRate = reader.ReadUInt32(); - writer.WriteNumber($"[{value.RTS_Target_CodeRate.ReadNumber()}]实时流目标码流(kbps)", value.RTS_Target_CodeRate); - value.StreamStore_EncodeMode = reader.ReadByte(); - writer.WriteString($"[{value.StreamStore_EncodeMode.ReadNumber()}]存储量编码模式", StreamStore_EncodeModeDisplay(value.StreamStore_EncodeMode)); - value.StreamStore_Resolution = reader.ReadByte(); - writer.WriteString($"[{value.StreamStore_Resolution.ReadNumber()}]存储流分辨率", StreamStore_ResolutionDisplay(value.StreamStore_Resolution)); - value.StreamStore_KF_Interval = reader.ReadUInt16(); - writer.WriteNumber($"[{value.StreamStore_KF_Interval.ReadNumber()}]存储流关键帧间隔(帧)", value.StreamStore_KF_Interval); - value.StreamStore_Target_FPS = reader.ReadByte(); - writer.WriteNumber($"[{value.StreamStore_Target_FPS.ReadNumber()}]存储流目标帧率(帧/s)", value.StreamStore_Target_FPS); - value.StreamStore_Target_CodeRate = reader.ReadUInt32(); - writer.WriteNumber($"[{value.StreamStore_Target_CodeRate.ReadNumber()}]存储流目标码流(kbps)", value.StreamStore_Target_CodeRate); - value.OSD = reader.ReadUInt16(); - writer.WriteString($"[{value.OSD.ReadNumber()}]OBD字幕叠加设置", OBDDisplay(value.OSD)); - value.AudioOutputEnabled = reader.ReadByte(); - writer.WriteString($"[{value.AudioOutputEnabled.ReadNumber()}]是否启用音频输出", value.AudioOutputEnabled == 0 ? "不启用" : "启用"); - string RTS_EncodeModeDisplay(byte RTS_EncodeMode) { - switch (RTS_EncodeMode) - { - case 0: - return "CBR固定码流"; - case 1: - return "VBR可变码流"; - case 2: - return "ABR平均码流"; - default: - break; - } - return "未知"; - } - string RTS_ResolutionDisplay(byte RTS_Resolution) { - switch (RTS_Resolution) - { - case 0: - return "QCIF"; - case 1: - return "CIF"; - case 2: - return "WCIF"; - case 3: - return "D1"; - case 4: - return "WD1"; - case 5: - return "720P"; - case 6: - return "1080P"; - default: - break; - } - return "未知"; - } - string StreamStore_EncodeModeDisplay(byte StreamStore_EncodeMode) { - { - switch (RTS_EncodeMode) - { - case 0: - return "CBR固定码流"; - case 1: - return "VBR可变码流"; - case 2: - return "ABR平均码流"; - default: - break; - } - return "未知"; - } - } - string StreamStore_ResolutionDisplay(byte StreamStore_Resolution) { - switch (RTS_Resolution) - { - case 0: - return "QCIF"; - case 1: - return "CIF"; - case 2: - return "WCIF"; - case 3: - return "D1"; - case 4: - return "WD1"; - case 5: - return "720P"; - case 6: - return "1080P"; - default: - break; - } - return "未知"; - } - string OBDDisplay(ushort OBD) { - string obdDisplay = string.Empty; - obdDisplay += ((OBD & 0x0001) == 1) ? ",日期和时间" : ""; - obdDisplay += ((OBD >> 1 & 0x0001) == 1) ? ",车牌号码" : ""; - obdDisplay += ((OBD >> 2 & 0x0001) == 1) ? ",逻辑通道号" : ""; - obdDisplay += ((OBD >> 3 & 0x0001) == 1) ? ",经纬度" : ""; - obdDisplay += ((OBD >> 4 & 0x0001) == 1) ? ",行驶记录速度" : ""; - obdDisplay += ((OBD >> 5 & 0x0001) == 1) ? ",卫星定位速度" : ""; - obdDisplay += ((OBD >> 6 & 0x0001) == 1) ? ",连续驾驶时间" : ""; - return obdDisplay.Length>0? obdDisplay.Substring(1):""; - } - } - - public JT808_0x8103_0x0075 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x8103_0x0075 jT808_0X8103_0X0075 = new JT808_0x8103_0x0075(); - jT808_0X8103_0X0075.ParamId = reader.ReadUInt32(); - jT808_0X8103_0X0075.ParamLength = reader.ReadByte(); - jT808_0X8103_0X0075.RTS_EncodeMode = reader.ReadByte(); - jT808_0X8103_0X0075.RTS_Resolution = reader.ReadByte(); - jT808_0X8103_0X0075.RTS_KF_Interval = reader.ReadUInt16(); - jT808_0X8103_0X0075.RTS_Target_FPS = reader.ReadByte(); - jT808_0X8103_0X0075.RTS_Target_CodeRate = reader.ReadUInt32(); - jT808_0X8103_0X0075.StreamStore_EncodeMode = reader.ReadByte(); - jT808_0X8103_0X0075.StreamStore_Resolution = reader.ReadByte(); - jT808_0X8103_0X0075.StreamStore_KF_Interval = reader.ReadUInt16(); - jT808_0X8103_0X0075.StreamStore_Target_FPS = reader.ReadByte(); - jT808_0X8103_0X0075.StreamStore_Target_CodeRate = reader.ReadUInt32(); - jT808_0X8103_0X0075.OSD = reader.ReadUInt16(); - jT808_0X8103_0X0075.AudioOutputEnabled = reader.ReadByte(); - return jT808_0X8103_0X0075; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0075 value, IJT808Config config) - { - writer.WriteUInt32(value.ParamId); - writer.WriteByte(value.ParamLength); - writer.WriteByte(value.RTS_EncodeMode); - writer.WriteByte(value.RTS_Resolution); - writer.WriteUInt16(value.RTS_KF_Interval); - writer.WriteByte(value.RTS_Target_FPS); - writer.WriteUInt32(value.RTS_Target_CodeRate); - writer.WriteByte(value.StreamStore_EncodeMode); - writer.WriteByte(value.StreamStore_Resolution); - writer.WriteUInt16(value.StreamStore_KF_Interval); - writer.WriteByte(value.StreamStore_Target_FPS); - writer.WriteUInt32(value.StreamStore_Target_CodeRate); - writer.WriteUInt16(value.OSD); - writer.WriteByte(value.AudioOutputEnabled); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0076.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0076.cs deleted file mode 100644 index 2681c49..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0076.cs +++ /dev/null @@ -1,108 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessageBody; -using JT808.Protocol.MessagePack; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 音视频通道列表设置 - /// 0x8103_0x0076 - /// - public class JT808_0x8103_0x0076 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze - { - public override uint ParamId { get; set; } = 0x0076; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } - /// - /// 音视频通道总数 - /// l - /// - public byte AVChannelTotal { get; set; } - /// - /// 音频通道总数 - /// m - /// - public byte AudioChannelTotal { get; set; } - /// - /// 视频通道总数 - /// n - /// - public byte VudioChannelTotal { get; set; } - /// - /// 音视频通道对照表 - /// 4*(l+m+n) - /// - public List AVChannelRefTables { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x8103_0x0076 value = new JT808_0x8103_0x0076(); - value.ParamId = reader.ReadUInt32(); - writer.WriteNumber($"[{value.ParamId.ReadNumber()}]参数 ID", value.ParamId); - value.ParamLength = reader.ReadByte(); - writer.WriteNumber($"[{value.ParamLength.ReadNumber()}]数据长度", value.ParamLength); - value.AVChannelTotal = reader.ReadByte(); - writer.WriteNumber($"[{value.AVChannelTotal.ReadNumber()}]音视频通道总数", value.AVChannelTotal); - value.AudioChannelTotal = reader.ReadByte(); - writer.WriteNumber($"[{value.AudioChannelTotal.ReadNumber()}]音频通道总数", value.AudioChannelTotal); - value.VudioChannelTotal = reader.ReadByte(); - writer.WriteNumber($"[{value.VudioChannelTotal.ReadNumber()}]视频通道总数", value.VudioChannelTotal); - var channelTotal = value.AVChannelTotal + value.AudioChannelTotal + value.VudioChannelTotal;//通道总数 - - writer.WriteStartArray("音视频通道对照表"); - for (int i = 0; i < channelTotal; i++) - { - writer.WriteStartObject(); - var formatter = config.GetMessagePackFormatter(); - formatter.Analyze(ref reader, writer, config); - writer.WriteEndObject(); - } - writer.WriteEndArray(); - } - - public JT808_0x8103_0x0076 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x8103_0x0076 jT808_0X8103_0X0076 = new JT808_0x8103_0x0076(); - jT808_0X8103_0X0076.ParamId = reader.ReadUInt32(); - jT808_0X8103_0X0076.ParamLength = reader.ReadByte(); - jT808_0X8103_0X0076.AVChannelTotal = reader.ReadByte(); - jT808_0X8103_0X0076.AudioChannelTotal = reader.ReadByte(); - jT808_0X8103_0X0076.VudioChannelTotal = reader.ReadByte(); - var channelTotal = jT808_0X8103_0X0076.AVChannelTotal + jT808_0X8103_0X0076.AudioChannelTotal + jT808_0X8103_0X0076.VudioChannelTotal;//通道总数 - if (channelTotal > 0) - { - jT808_0X8103_0X0076.AVChannelRefTables = new List(); - var formatter = config.GetMessagePackFormatter(); - for (int i = 0; i < channelTotal; i++) - { - jT808_0X8103_0X0076.AVChannelRefTables.Add(formatter.Deserialize(ref reader, config)); - } - } - return jT808_0X8103_0X0076; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0076 value, IJT808Config config) - { - writer.WriteUInt32(value.ParamId); - writer.Skip(1, out int position); - writer.WriteByte(value.AVChannelTotal); - writer.WriteByte(value.AudioChannelTotal); - writer.WriteByte(value.VudioChannelTotal); - if (value.AVChannelRefTables.Any()) - { - var formatter = config.GetMessagePackFormatter(); - foreach (var AVChannelRefTable in value.AVChannelRefTables) - { - formatter.Serialize(ref writer, AVChannelRefTable, config); - } - } - writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - position - 1), position); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0076_AVChannelRefTable.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0076_AVChannelRefTable.cs deleted file mode 100644 index 92e9186..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0076_AVChannelRefTable.cs +++ /dev/null @@ -1,124 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 音视频通道列表设置 - /// 0x8103_0x0076_AVChannelRefTable - /// - public class JT808_0x8103_0x0076_AVChannelRefTable: IJT808MessagePackFormatter, IJT808Analyze - { - /// - /// 物理通道号 - /// - public byte PhysicalChannelNo { get; set; } - /// - /// 逻辑通道号 - /// - public byte LogicChannelNo { get; set; } - /// - /// 通道类型 - /// - public byte ChannelType { get; set; } - /// - /// 是否链接云台 - /// - public byte IsConnectCloudPlat { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x8103_0x0076_AVChannelRefTable value = new JT808_0x8103_0x0076_AVChannelRefTable(); - value.PhysicalChannelNo = reader.ReadByte(); - writer.WriteNumber($"[{value.PhysicalChannelNo.ReadNumber()}]物理通道号", value.PhysicalChannelNo); - value.LogicChannelNo = reader.ReadByte(); - writer.WriteString($"[{value.LogicChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.LogicChannelNo)); - value.ChannelType = reader.ReadByte(); - writer.WriteString($"[{value.ChannelType.ReadNumber()}]通道类型", ChannelTypeDisplay(value.ChannelType)); - value.IsConnectCloudPlat = reader.ReadByte(); - writer.WriteString($"[{value.IsConnectCloudPlat.ReadNumber()}]是否链接云台", IsConnectCloudPlatDisplay(value.IsConnectCloudPlat)); - 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 ChannelTypeDisplay(byte ChannelType) { - switch (ChannelType) - { - case 0: - return "音视频"; - case 1: - return "音频"; - case 2: - return "视频"; - default: - return "未知"; - } - } - string IsConnectCloudPlatDisplay(byte IsConnectCloudPlat) { - switch (IsConnectCloudPlat) - { - case 0: - return "未连接"; - case 1: - return "连接"; - default: - return "未知"; - } - } - } - - public JT808_0x8103_0x0076_AVChannelRefTable Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x8103_0x0076_AVChannelRefTable jT808_0X8103_0X0076_AVChannelRefTable = new JT808_0x8103_0x0076_AVChannelRefTable(); - jT808_0X8103_0X0076_AVChannelRefTable.PhysicalChannelNo = reader.ReadByte(); - jT808_0X8103_0X0076_AVChannelRefTable.LogicChannelNo = reader.ReadByte(); - jT808_0X8103_0X0076_AVChannelRefTable.ChannelType = reader.ReadByte(); - jT808_0X8103_0X0076_AVChannelRefTable.IsConnectCloudPlat = reader.ReadByte(); - return jT808_0X8103_0X0076_AVChannelRefTable; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0076_AVChannelRefTable value, IJT808Config config) - { - writer.WriteByte(value.PhysicalChannelNo); - writer.WriteByte(value.LogicChannelNo); - writer.WriteByte(value.ChannelType); - writer.WriteByte(value.IsConnectCloudPlat); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0077.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0077.cs deleted file mode 100644 index 06ba2e8..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0077.cs +++ /dev/null @@ -1,83 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessageBody; -using JT808.Protocol.MessagePack; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - ///单独视频通道参数设置 - /// 0x8103_0x0077 - /// - public class JT808_0x8103_0x0077 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze - { - public override uint ParamId { get; set; } = 0x0077; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } - /// - /// 需单独设置视频参数的通道数量 用n表示 - /// - public byte NeedSetChannelTotal { get; set; } - - public List SignalChannels { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x8103_0x0077 value = new JT808_0x8103_0x0077(); - value.ParamId = reader.ReadUInt32(); - writer.WriteNumber($"[{value.ParamId.ReadNumber()}]参数 ID", value.ParamId); - value.ParamLength = reader.ReadByte(); - writer.WriteNumber($"[{value.ParamLength.ReadNumber()}]数据长度", value.ParamLength); - value.NeedSetChannelTotal = reader.ReadByte(); - writer.WriteNumber($"[{value.NeedSetChannelTotal.ReadNumber()}]需单独设置视频参数的通道数量", value.NeedSetChannelTotal); - writer.WriteStartArray("音视频通道对照表"); - for (int i = 0; i < value.NeedSetChannelTotal; i++) - { - writer.WriteStartObject(); - var formatter = config.GetMessagePackFormatter(); - formatter.Analyze(ref reader, writer, config); - writer.WriteEndObject(); - } - writer.WriteEndArray(); - } - - public JT808_0x8103_0x0077 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x8103_0x0077 jT808_0X8103_0X0077 = new JT808_0x8103_0x0077(); - jT808_0X8103_0X0077.ParamId = reader.ReadUInt32(); - jT808_0X8103_0X0077.ParamLength = reader.ReadByte(); - jT808_0X8103_0X0077.NeedSetChannelTotal = reader.ReadByte(); - if (jT808_0X8103_0X0077.NeedSetChannelTotal > 0) - { - jT808_0X8103_0X0077.SignalChannels = new List(); - var formatter = config.GetMessagePackFormatter(); - for (int i = 0; i < jT808_0X8103_0X0077.NeedSetChannelTotal; i++) - { - jT808_0X8103_0X0077.SignalChannels.Add(formatter.Deserialize(ref reader, config)); - } - } - return jT808_0X8103_0X0077; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0077 value, IJT808Config config) - { - writer.WriteUInt32(value.ParamId); - writer.Skip(1, out var position); - writer.WriteByte(value.NeedSetChannelTotal); - if (value.SignalChannels.Any()) - { - var formatter = config.GetMessagePackFormatter(); - foreach (var signalChannel in value.SignalChannels) - { - formatter.Serialize(ref writer, signalChannel, config); - } - } - writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - position - 1), position); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0077_SignalChannel.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0077_SignalChannel.cs deleted file mode 100644 index a02c570..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0077_SignalChannel.cs +++ /dev/null @@ -1,257 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - public class JT808_0x8103_0x0077_SignalChannel: IJT808MessagePackFormatter, IJT808Analyze - { - /// - /// 逻辑通道号 - /// - public byte LogicChannelNo { get; set; } - /// - /// 实时流编码模式 - /// - public byte RTS_EncodeMode { get; set; } - /// - /// 实时流分辨率 - /// - public byte RTS_Resolution { get; set; } - /// - /// 实时流关键帧间隔 - /// (范围1-1000)帧 - /// - public ushort RTS_KF_Interval { get; set; } - /// - /// 实时流目标帧率 - /// - public byte RTS_Target_FPS { get; set; } - /// - /// 实时流目标码率 - /// 单位未千位每秒(kbps) - /// - public uint RTS_Target_CodeRate { get; set; } - /// - /// 存储流编码模式 - /// - public byte StreamStore_EncodeMode { get; set; } - /// - /// 存储流分辨率 - /// - public byte StreamStore_Resolution { get; set; } - /// - /// 存储流关键帧间隔 - /// (范围1-1000)帧 - /// - public ushort StreamStore_KF_Interval { get; set; } - /// - /// 存储流目标帧率 - /// - public byte StreamStore_Target_FPS { get; set; } - /// - /// 存储流目标码率 - /// 单位未千位每秒(kbps) - /// - public uint StreamStore_Target_CodeRate { get; set; } - /// - ///OSD字幕叠加设置 - /// - public ushort OSD { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x8103_0x0077_SignalChannel value = new JT808_0x8103_0x0077_SignalChannel(); - value.LogicChannelNo = reader.ReadByte(); - writer.WriteString($"[{value.LogicChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.LogicChannelNo)); - value.RTS_EncodeMode = reader.ReadByte(); - writer.WriteString($"[{value.RTS_EncodeMode.ReadNumber()}]实时流编码模式", RTS_EncodeModeDisplay(value.RTS_EncodeMode)); - value.RTS_Resolution = reader.ReadByte(); - writer.WriteString($"[{value.RTS_Resolution.ReadNumber()}]实时流分辨率", RTS_ResolutionDisplay(value.RTS_Resolution)); - value.RTS_KF_Interval = reader.ReadUInt16(); - writer.WriteNumber($"[{value.RTS_KF_Interval.ReadNumber()}]实时流关键帧间隔(帧)", value.RTS_KF_Interval); - value.RTS_Target_FPS = reader.ReadByte(); - writer.WriteNumber($"[{value.RTS_Target_FPS.ReadNumber()}]实时流目标帧率(帧/s)", value.RTS_Target_FPS); - value.RTS_Target_CodeRate = reader.ReadUInt32(); - writer.WriteNumber($"[{value.RTS_Target_CodeRate.ReadNumber()}]实时流目标码率(kbps)", value.RTS_Target_CodeRate); - value.StreamStore_EncodeMode = reader.ReadByte(); - writer.WriteString($"[{value.StreamStore_EncodeMode.ReadNumber()}]存储流编码模式", StreamStore_EncodeModeDisplay(value.StreamStore_EncodeMode)); - value.StreamStore_Resolution = reader.ReadByte(); - writer.WriteString($"[{value.StreamStore_Resolution.ReadNumber()}]存储流分辨率", StreamStore_ResolutionDisplay(value.StreamStore_Resolution)); - value.StreamStore_KF_Interval = reader.ReadUInt16(); - writer.WriteNumber($"[{value.StreamStore_KF_Interval.ReadNumber()}]存储流关键帧间隔(帧)", value.StreamStore_KF_Interval); - value.StreamStore_Target_FPS = reader.ReadByte(); - writer.WriteNumber($"[{value.StreamStore_Target_FPS.ReadNumber()}]存储流目标帧率(帧/s)", value.StreamStore_Target_FPS); - value.StreamStore_Target_CodeRate = reader.ReadUInt32(); - writer.WriteNumber($"[{value.StreamStore_Target_CodeRate.ReadNumber()}]存储流目标码率(kbps)", value.StreamStore_Target_CodeRate); - value.OSD = reader.ReadUInt16(); - writer.WriteString($"[{value.OSD.ReadNumber()}]OSD字幕叠加设置", OBDDisplay(value.OSD)); - 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 RTS_EncodeModeDisplay(byte RTS_EncodeMode) - { - switch (RTS_EncodeMode) - { - case 0: - return "CBR固定码流"; - case 1: - return "VBR可变码流"; - case 2: - return "ABR平均码流"; - default: - break; - } - return "未知"; - } - string RTS_ResolutionDisplay(byte RTS_Resolution) - { - switch (RTS_Resolution) - { - case 0: - return "QCIF"; - case 1: - return "CIF"; - case 2: - return "WCIF"; - case 3: - return "D1"; - case 4: - return "WD1"; - case 5: - return "720P"; - case 6: - return "1080P"; - default: - break; - } - return "未知"; - } - string StreamStore_EncodeModeDisplay(byte StreamStore_EncodeMode) - { - { - switch (StreamStore_EncodeMode) - { - case 0: - return "CBR固定码流"; - case 1: - return "VBR可变码流"; - case 2: - return "ABR平均码流"; - default: - break; - } - return "未知"; - } - } - string StreamStore_ResolutionDisplay(byte StreamStore_Resolution) - { - switch (StreamStore_Resolution) - { - case 0: - return "QCIF"; - case 1: - return "CIF"; - case 2: - return "WCIF"; - case 3: - return "D1"; - case 4: - return "WD1"; - case 5: - return "720P"; - case 6: - return "1080P"; - default: - break; - } - return "未知"; - } - string OBDDisplay(ushort OBD) - { - string obdDisplay = string.Empty; - obdDisplay += ((OBD & 0x0001) == 1) ? ",日期和时间" : ""; - obdDisplay += ((OBD >> 1 & 0x0001) == 1) ? ",车牌号码" : ""; - obdDisplay += ((OBD >> 2 & 0x0001) == 1) ? ",逻辑通道号" : ""; - obdDisplay += ((OBD >> 3 & 0x0001) == 1) ? ",经纬度" : ""; - obdDisplay += ((OBD >> 4 & 0x0001) == 1) ? ",行驶记录速度" : ""; - obdDisplay += ((OBD >> 5 & 0x0001) == 1) ? ",卫星定位速度" : ""; - obdDisplay += ((OBD >> 6 & 0x0001) == 1) ? ",连续驾驶时间" : ""; - return obdDisplay.Length > 0 ? obdDisplay.Substring(1) : ""; - } - } - - public JT808_0x8103_0x0077_SignalChannel Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x8103_0x0077_SignalChannel jT808_0X8103_0X0077_SignalChannel = new JT808_0x8103_0x0077_SignalChannel(); - jT808_0X8103_0X0077_SignalChannel.LogicChannelNo = reader.ReadByte(); - jT808_0X8103_0X0077_SignalChannel.RTS_EncodeMode = reader.ReadByte(); - jT808_0X8103_0X0077_SignalChannel.RTS_Resolution = reader.ReadByte(); - jT808_0X8103_0X0077_SignalChannel.RTS_KF_Interval = reader.ReadUInt16(); - jT808_0X8103_0X0077_SignalChannel.RTS_Target_FPS = reader.ReadByte(); - jT808_0X8103_0X0077_SignalChannel.RTS_Target_CodeRate = reader.ReadUInt32(); - jT808_0X8103_0X0077_SignalChannel.StreamStore_EncodeMode = reader.ReadByte(); - jT808_0X8103_0X0077_SignalChannel.StreamStore_Resolution = reader.ReadByte(); - jT808_0X8103_0X0077_SignalChannel.StreamStore_KF_Interval = reader.ReadUInt16(); - jT808_0X8103_0X0077_SignalChannel.StreamStore_Target_FPS = reader.ReadByte(); - jT808_0X8103_0X0077_SignalChannel.StreamStore_Target_CodeRate = reader.ReadUInt32(); - jT808_0X8103_0X0077_SignalChannel.OSD = reader.ReadUInt16(); - return jT808_0X8103_0X0077_SignalChannel; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0077_SignalChannel value, IJT808Config config) - { - writer.WriteByte(value.LogicChannelNo); - writer.WriteByte(value.RTS_EncodeMode); - writer.WriteByte(value.RTS_Resolution); - writer.WriteUInt16(value.RTS_KF_Interval); - writer.WriteByte(value.RTS_Target_FPS); - writer.WriteUInt32(value.RTS_Target_CodeRate); - writer.WriteByte(value.StreamStore_EncodeMode); - writer.WriteByte(value.StreamStore_Resolution); - writer.WriteUInt16(value.StreamStore_KF_Interval); - writer.WriteByte(value.StreamStore_Target_FPS); - writer.WriteUInt32(value.StreamStore_Target_CodeRate); - writer.WriteUInt16(value.OSD); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0079.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0079.cs deleted file mode 100644 index 3df22d9..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0079.cs +++ /dev/null @@ -1,70 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessageBody; -using JT808.Protocol.MessagePack; -using System.Collections.Generic; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 特殊报警录像参数设置 - /// 0x8103_0x0079 - /// - public class JT808_0x8103_0x0079 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze - { - public override uint ParamId { get; set; } = 0x0079; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 3; - /// - /// 特殊报警录像存储阈值 - /// - public byte StorageThresholds { get; set; } - /// - /// 特殊报警录像持续时间 - /// - public byte Duration { get; set; } - /// - /// 特殊报警标识起始时间 - /// 分钟min - /// - public byte BeginMinute { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x8103_0x0079 value = new JT808_0x8103_0x0079(); - value.ParamId = reader.ReadUInt32(); - writer.WriteNumber($"[{value.ParamId.ReadNumber()}]参数 ID", value.ParamId); - value.ParamLength = reader.ReadByte(); - writer.WriteNumber($"[{value.ParamLength.ReadNumber()}]数据长度", value.ParamLength); - value.StorageThresholds = reader.ReadByte(); - writer.WriteNumber($"[{value.StorageThresholds.ReadNumber()}]特殊报警录像存储阈值(百分比)", value.StorageThresholds); - value.Duration = reader.ReadByte(); - writer.WriteNumber($"[{value.Duration.ReadNumber()}]特殊报警录像持续时间(分钟)", value.Duration); - value.BeginMinute = reader.ReadByte(); - writer.WriteNumber($"[{value.BeginMinute.ReadNumber()}]特殊报警标识起始时间(分钟)", value.BeginMinute); - } - - public JT808_0x8103_0x0079 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x8103_0x0079 jT808_0x8103_0x0079 = new JT808_0x8103_0x0079(); - jT808_0x8103_0x0079.ParamId = reader.ReadUInt32(); - jT808_0x8103_0x0079.ParamLength = reader.ReadByte(); - jT808_0x8103_0x0079.StorageThresholds = reader.ReadByte(); - jT808_0x8103_0x0079.Duration = reader.ReadByte(); - jT808_0x8103_0x0079.BeginMinute = reader.ReadByte(); - return jT808_0x8103_0x0079; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x0079 value, IJT808Config config) - { - writer.WriteUInt32(value.ParamId); - writer.WriteByte(value.ParamLength); - writer.WriteByte(value.StorageThresholds); - writer.WriteByte(value.Duration); - writer.WriteByte(value.BeginMinute); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007A.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007A.cs deleted file mode 100644 index 0a8884a..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007A.cs +++ /dev/null @@ -1,72 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessageBody; -using JT808.Protocol.MessagePack; -using System.Collections.Generic; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 视频相关报警屏蔽字 - /// 0x8103_0x007A - /// - public class JT808_0x8103_0x007A : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze - { - public override uint ParamId { get; set; } = 0x007A; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 4; - /// - /// 视频相关屏蔽报警字 - /// - public uint AlarmShielding { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x8103_0x007A value = new JT808_0x8103_0x007A(); - value.ParamId = reader.ReadUInt32(); - writer.WriteNumber($"[{value.ParamId.ReadNumber()}]参数 ID", value.ParamId); - value.ParamLength = reader.ReadByte(); - writer.WriteNumber($"[{value.ParamLength.ReadNumber()}]数据长度", value.ParamLength); - value.AlarmShielding = reader.ReadUInt32(); - writer.WriteString($"[{value.AlarmShielding.ReadNumber()}]视频相关屏蔽报警字", AlarmShieldingDisplay(value.AlarmShielding)); - string AlarmShieldingDisplay(uint AlarmShielding) - { - switch (AlarmShielding) - { - case 0x14: - return "视频相关报警"; - case 0x15: - return "视频信号丢失报警状态"; - case 0x16: - return "视频信号遮挡报警状态"; - case 0x17: - return "存储器故障报警状态"; - case 0x18: - return "异常驾驶行为详细描述"; - default: - break; - } - return "未知"; - } - } - - public JT808_0x8103_0x007A Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x8103_0x007A jT808_0x8103_0x007A = new JT808_0x8103_0x007A(); - jT808_0x8103_0x007A.ParamId = reader.ReadUInt32(); - jT808_0x8103_0x007A.ParamLength = reader.ReadByte(); - jT808_0x8103_0x007A.AlarmShielding = reader.ReadUInt32(); - return jT808_0x8103_0x007A; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x007A value, IJT808Config config) - { - writer.WriteUInt32(value.ParamId); - writer.WriteByte(value.ParamLength); - writer.WriteUInt32(value.AlarmShielding); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007B.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007B.cs deleted file mode 100644 index 56308e3..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007B.cs +++ /dev/null @@ -1,61 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessageBody; -using JT808.Protocol.MessagePack; -using System.Collections.Generic; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 图像分析报警参数设置 - /// 0x8103_0x007B - /// - public class JT808_0x8103_0x007B : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze - { - public override uint ParamId { get; set; } = 0x007B; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 2; - /// - /// 车辆核载人数 - /// - public byte NuclearLoadNumber { get; set; } - /// - /// 疲劳程度阈值 - /// - public byte FatigueThreshold { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x8103_0x007B value = new JT808_0x8103_0x007B(); - value.ParamId = reader.ReadUInt32(); - writer.WriteNumber($"[{value.ParamId.ReadNumber()}]参数 ID", value.ParamId); - value.ParamLength = reader.ReadByte(); - writer.WriteNumber($"[{value.ParamLength.ReadNumber()}]数据长度", value.ParamLength); - value.NuclearLoadNumber = reader.ReadByte(); - writer.WriteNumber($"[{value.NuclearLoadNumber.ReadNumber()}]车辆核载人数", value.NuclearLoadNumber); - value.FatigueThreshold = reader.ReadByte(); - writer.WriteNumber($"[{value.FatigueThreshold.ReadNumber()}]疲劳程度阈值", value.FatigueThreshold); - } - - public JT808_0x8103_0x007B Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x8103_0x007B jT808_0x8103_0x007B = new JT808_0x8103_0x007B(); - jT808_0x8103_0x007B.ParamId = reader.ReadUInt32(); - jT808_0x8103_0x007B.ParamLength = reader.ReadByte(); - jT808_0x8103_0x007B.NuclearLoadNumber = reader.ReadByte(); - jT808_0x8103_0x007B.FatigueThreshold = reader.ReadByte(); - return jT808_0x8103_0x007B; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x007B value, IJT808Config config) - { - writer.WriteUInt32(value.ParamId); - writer.WriteByte(value.ParamLength); - writer.WriteByte(value.NuclearLoadNumber); - writer.WriteByte(value.FatigueThreshold); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007C.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007C.cs deleted file mode 100644 index efd7070..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007C.cs +++ /dev/null @@ -1,106 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessageBody; -using JT808.Protocol.MessagePack; -using System.Collections.Generic; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - ///终端休眠模式唤醒设置 - /// 0x8103_0x007C - /// - public class JT808_0x8103_0x007C : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze - { - public override uint ParamId { get; set; } = 0x007C; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 20; - /// - /// 休眠唤醒模式 - /// - public byte SleepWakeMode { get; set; } - /// - /// 唤醒条件类型 - /// - public byte WakeConditionType { get; set; } - /// - /// 定时唤醒日设置 - /// - public byte TimerWakeDaySet { get; set; } - /// - /// 日定时唤醒参数列表 - /// - public JT808_0x8103_0x007C_TimerWakeDayParamter TimerWakeDayParamter { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x8103_0x007C value = new JT808_0x8103_0x007C(); - value.ParamId = reader.ReadUInt32(); - writer.WriteNumber($"[{value.ParamId.ReadNumber()}]参数 ID", value.ParamId); - value.ParamLength = reader.ReadByte(); - writer.WriteNumber($"[{value.ParamLength.ReadNumber()}]数据长度", value.ParamLength); - value.SleepWakeMode = reader.ReadByte(); - writer.WriteString($"[{value.SleepWakeMode.ReadNumber()}]休眠唤醒模式", SleepWakeModeDisplay(value.SleepWakeMode)); - value.WakeConditionType = reader.ReadByte(); - writer.WriteString($"[{value.WakeConditionType.ReadNumber()}]唤醒条件类型", WakeConditionTypeDisplay(value.WakeConditionType)); - value.TimerWakeDaySet = reader.ReadByte(); - writer.WriteString($"[{value.TimerWakeDaySet.ReadNumber()}]定时唤醒日设置", TimerWakeDaySetDisplay(value.TimerWakeDaySet)); - writer.WriteStartObject("日定时唤醒参数列表"); - config.GetMessagePackFormatter().Analyze(ref reader,writer, config); - writer.WriteEndObject(); - string SleepWakeModeDisplay(byte SleepWakeMode) { - string sleepWakeModeDisplay = string.Empty; - sleepWakeModeDisplay += (SleepWakeMode & 0x01) == 1 ? ",条件唤醒" : ""; - sleepWakeModeDisplay += (SleepWakeMode>>1 & 0x01) == 1 ? ",定时唤醒" : ""; - sleepWakeModeDisplay += (SleepWakeMode>>2 & 0x01) == 1 ? ",手动唤醒" : ""; - return sleepWakeModeDisplay.Length>0? sleepWakeModeDisplay.Substring(1):""; - } - string WakeConditionTypeDisplay(byte WakeConditionType) - { - string wakeConditionTypeDisplay = string.Empty; - wakeConditionTypeDisplay += (WakeConditionType & 0x01) == 1 ? ",紧急报警" : ""; - wakeConditionTypeDisplay += (WakeConditionType >> 1 & 0x01) == 1 ? ",碰撞侧翻报警" : ""; - wakeConditionTypeDisplay += (WakeConditionType >> 2 & 0x01) == 1 ? ",车辆开门" : ""; - return wakeConditionTypeDisplay.Length>0? wakeConditionTypeDisplay.Substring(1):""; - } - string TimerWakeDaySetDisplay(byte TimerWakeDaySet) - { - string timerWakeDaySetDisplay = string.Empty; - timerWakeDaySetDisplay+= (TimerWakeDaySet & 0x01) == 1 ? ",周一":""; - timerWakeDaySetDisplay+= (TimerWakeDaySet >> 1 & 0x01) == 1 ? ",周二" :""; - timerWakeDaySetDisplay+= (TimerWakeDaySet >> 1 & 0x02) == 1 ? ",周三" :""; - timerWakeDaySetDisplay+= (TimerWakeDaySet >> 1 & 0x03) == 1 ? ",周四" :""; - timerWakeDaySetDisplay+= (TimerWakeDaySet >> 1 & 0x04) == 1 ? ",周五" :""; - timerWakeDaySetDisplay+= (TimerWakeDaySet >> 1 & 0x05) == 1 ? ",周六" :""; - timerWakeDaySetDisplay += (TimerWakeDaySet >> 1 & 0x06) == 1 ? ",周日" : ""; - return timerWakeDaySetDisplay.Length>0? timerWakeDaySetDisplay.Substring(1):""; - } - } - - public JT808_0x8103_0x007C Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x8103_0x007C jT808_0x8103_0x007C = new JT808_0x8103_0x007C(); - jT808_0x8103_0x007C.ParamId = reader.ReadUInt32(); - jT808_0x8103_0x007C.ParamLength = reader.ReadByte(); - jT808_0x8103_0x007C.SleepWakeMode = reader.ReadByte(); - jT808_0x8103_0x007C.WakeConditionType = reader.ReadByte(); - jT808_0x8103_0x007C.TimerWakeDaySet = reader.ReadByte(); - jT808_0x8103_0x007C.TimerWakeDayParamter = config.GetMessagePackFormatter().Deserialize(ref reader, config); - return jT808_0x8103_0x007C; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x007C value, IJT808Config config) - { - writer.WriteUInt32(value.ParamId); - writer.Skip(1, out var position); - writer.WriteByte(value.SleepWakeMode); - writer.WriteByte(value.WakeConditionType); - writer.WriteByte(value.TimerWakeDaySet); - config.GetMessagePackFormatter().Serialize(ref writer, value.TimerWakeDayParamter, config); - writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - position - 1), position); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007C_TimerWakeDayParamter.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007C_TimerWakeDayParamter.cs deleted file mode 100644 index ab60bb7..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007C_TimerWakeDayParamter.cs +++ /dev/null @@ -1,120 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessageBody; -using JT808.Protocol.MessagePack; -using System.Collections.Generic; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - ///终端休眠模式唤醒设置 - /// 0x8103_0x007C - /// - public class JT808_0x8103_0x007C_TimerWakeDayParamter:IJT808MessagePackFormatter, IJT808Analyze - { - /// - /// 定时唤醒启用标志 - /// - public byte TimerWakeEnableFlag { get; set; } - /// - /// 时间段1唤醒时间 - /// 2 - /// - public string TimePeriod1WakeTime { get; set; } - /// - /// 时间段1关闭时间 - /// 2 - /// - public string TimePeriod1CloseTime { get; set; } - /// - /// 时间段2唤醒时间 - /// 2 - /// - public string TimePeriod2WakeTime { get; set; } - /// - /// 时间段2关闭时间 - /// 2 - /// - public string TimePeriod2CloseTime { get; set; } - /// - /// 时间段3唤醒时间 - /// 2 - /// - public string TimePeriod3WakeTime { get; set; } - /// - /// 时间段3关闭时间 - /// 2 - /// - public string TimePeriod3CloseTime { get; set; } - /// - /// 时间段4唤醒时间 - /// 2 - /// - public string TimePeriod4WakeTime { get; set; } - /// - /// 时间段4关闭时间 - /// 2 - /// - public string TimePeriod4CloseTime { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x8103_0x007C_TimerWakeDayParamter value = new JT808_0x8103_0x007C_TimerWakeDayParamter(); - value.TimerWakeEnableFlag = reader.ReadByte(); - writer.WriteString($"[{value.TimerWakeEnableFlag.ReadNumber()}]定时唤醒启用标志", TimerWakeEnableFlagDisplay(value.TimerWakeEnableFlag)); - value.TimePeriod1WakeTime = reader.ReadBCD(4); - writer.WriteString($"[{value.TimePeriod1WakeTime}]时间段1唤醒时间", value.TimePeriod1WakeTime); - value.TimePeriod1CloseTime = reader.ReadBCD(4); - writer.WriteString($"[{value.TimePeriod1CloseTime}]时间段1关闭时间", value.TimePeriod1CloseTime); - value.TimePeriod2WakeTime = reader.ReadBCD(4); - writer.WriteString($"[{value.TimePeriod2WakeTime}]时间段2唤醒时间", value.TimePeriod2WakeTime); - value.TimePeriod2CloseTime = reader.ReadBCD(4); - writer.WriteString($"[{value.TimePeriod2CloseTime}]时间段2关闭时间", value.TimePeriod2CloseTime); - value.TimePeriod3WakeTime = reader.ReadBCD(4); - writer.WriteString($"[{value.TimePeriod3WakeTime}]时间段3唤醒时间", value.TimePeriod3WakeTime); - value.TimePeriod3CloseTime = reader.ReadBCD(4); - writer.WriteString($"[{value.TimePeriod3CloseTime}]时间段3关闭时间", value.TimePeriod3CloseTime); - value.TimePeriod4WakeTime = reader.ReadBCD(4); - writer.WriteString($"[{value.TimePeriod4WakeTime}]时间段4唤醒时间", value.TimePeriod4WakeTime); - value.TimePeriod4CloseTime = reader.ReadBCD(4); - writer.WriteString($"[{value.TimePeriod4CloseTime}]时间段4关闭时间", value.TimePeriod4CloseTime); - string TimerWakeEnableFlagDisplay(byte TimerWakeEnableFlag) { - string timerWakeEnableFlagDisplay = string.Empty; - timerWakeEnableFlagDisplay += (TimerWakeEnableFlag & 0x01) == 1 ? ",时间段1唤醒时间启用" : ""; - timerWakeEnableFlagDisplay += (TimerWakeEnableFlag & 0x01) == 1 ? ",时间段2唤醒时间启用" : ""; - timerWakeEnableFlagDisplay += (TimerWakeEnableFlag & 0x01) == 1 ? ",时间段3唤醒时间启用" : ""; - timerWakeEnableFlagDisplay += (TimerWakeEnableFlag & 0x01) == 1 ? ",时间段4唤醒时间启用" : ""; - return timerWakeEnableFlagDisplay.Length > 0 ? timerWakeEnableFlagDisplay.Substring(1) : ""; - } - } - - public JT808_0x8103_0x007C_TimerWakeDayParamter Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x8103_0x007C_TimerWakeDayParamter jT808_0x8103_0x007C_TimerWakeDayParamter = new JT808_0x8103_0x007C_TimerWakeDayParamter(); - jT808_0x8103_0x007C_TimerWakeDayParamter.TimerWakeEnableFlag = reader.ReadByte(); - jT808_0x8103_0x007C_TimerWakeDayParamter.TimePeriod1WakeTime = reader.ReadBCD(4); - jT808_0x8103_0x007C_TimerWakeDayParamter.TimePeriod1CloseTime = reader.ReadBCD(4); - jT808_0x8103_0x007C_TimerWakeDayParamter.TimePeriod2WakeTime = reader.ReadBCD(4); - jT808_0x8103_0x007C_TimerWakeDayParamter.TimePeriod2CloseTime = reader.ReadBCD(4); - jT808_0x8103_0x007C_TimerWakeDayParamter.TimePeriod3WakeTime = reader.ReadBCD(4); - jT808_0x8103_0x007C_TimerWakeDayParamter.TimePeriod3CloseTime = reader.ReadBCD(4); - jT808_0x8103_0x007C_TimerWakeDayParamter.TimePeriod4WakeTime = reader.ReadBCD(4); - jT808_0x8103_0x007C_TimerWakeDayParamter.TimePeriod4CloseTime = reader.ReadBCD(4); - return jT808_0x8103_0x007C_TimerWakeDayParamter; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x8103_0x007C_TimerWakeDayParamter value, IJT808Config config) - { - writer.WriteByte(value.TimerWakeEnableFlag); - writer.WriteBCD(value.TimePeriod1WakeTime, 4); - writer.WriteBCD(value.TimePeriod1CloseTime, 4); - writer.WriteBCD(value.TimePeriod2WakeTime, 4); - writer.WriteBCD(value.TimePeriod2CloseTime, 4); - writer.WriteBCD(value.TimePeriod3WakeTime, 4); - writer.WriteBCD(value.TimePeriod3CloseTime, 4); - writer.WriteBCD(value.TimePeriod4WakeTime, 4); - writer.WriteBCD(value.TimePeriod4CloseTime, 4); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9003.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9003.cs deleted file mode 100644 index fc04943..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9003.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 查询终端音视频属性 - /// - public class JT808_0x9003:JT808Bodies - { -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public override string Description => "查询终端音视频属性"; - - public override ushort MsgId => 0x9003; - public override bool SkipSerialization { get; set; } = true; -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9101.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9101.cs deleted file mode 100644 index 3473455..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9101.cs +++ /dev/null @@ -1,154 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 实时音视频传输请求(live、talk、listen、fanout、passThrough直播、对讲、监听、广播、透传请求) - /// - public class JT808_0x9101: JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public override string Description => "实时音视频传输请求"; - public override ushort MsgId => 0x9101; -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - - /// - /// 视频服务器IP地址长度 - /// - public byte ServerIpLength { get;internal set; } - /// - /// 视频服务器IP地址 - /// - public string ServerIp { get; set; } - /// - /// 视频服务器TCP端口号,不使用TCP协议传输时保持默认值0即可(TCP和UDP二选一,当TCP和UDP均非默认值时一般以TCP为准) - /// - public ushort TcpPort { get; set; } - /// - /// 视频服务器UDP端口号,不使用UDP协议传输时保持默认值0即可(TCP和UDP二选一,当TCP和UDP均非默认值时一般以TCP为准) - /// - public ushort UdpPort { get; set; } - /// - /// 逻辑通道号 - /// - public byte ChannelNo { get; set; } - /// - /// 数据类型 - /// 0:音视频 - /// 1:视频 - /// 2:双向对讲 - /// 3:监听 - /// 4:中心广播 - /// 5:透传 - /// - public byte DataType { get; set; } - /// - /// 码流类型 - /// 0:主码流 - /// 1:子码流 - /// - public byte StreamType { get; set; } - - /// - /// 格式分析 - /// - /// - /// - /// - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - var value = new JT808_0x9101(); - value.ServerIpLength = reader.ReadByte(); - writer.WriteNumber($"[{value.ServerIpLength.ReadNumber()}]服务器IP地址长度", value.ServerIpLength); - string ipHex = reader.ReadVirtualArray(value.ServerIpLength).ToArray().ToHexString(); - value.ServerIp = reader.ReadString(value.ServerIpLength); - writer.WriteString($"[{ipHex}]服务器IP地址", value.ServerIp); - value.TcpPort = reader.ReadUInt16(); - writer.WriteNumber($"[{value.TcpPort.ReadNumber()}]服务器视频通道监听端口号(TCP)", value.TcpPort); - value.UdpPort = reader.ReadUInt16(); - writer.WriteNumber($"[{value.UdpPort.ReadNumber()}]服务器视频通道监听端口号(UDP)", value.UdpPort); - value.ChannelNo = reader.ReadByte(); - writer.WriteString($"[{value.ChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelNo)); - value.DataType = reader.ReadByte(); - writer.WriteString($"[{value.DataType.ReadNumber()}]数据类型", DataTypeDisplay(value.DataType)); - value.StreamType = reader.ReadByte(); - writer.WriteString($"[{value.StreamType.ReadNumber()}]码流类型", value.StreamType==0?"主码流":"子码流"); - string DataTypeDisplay(byte DataType) { - return DataType switch - { - 0 => "音视频", - 1 => "视频", - 2 => "双向对讲", - 3 => "监听", - 4 => "中心广播", - 5 => "透传", - _ => "未知", - }; - } - string LogicalChannelNoDisplay(byte LogicalChannelNo) { - return LogicalChannelNo switch - { - 1 => "驾驶员", - 2 => "车辆正前方", - 3 => "车前门", - 4 => "车厢前部", - 5 => "车厢后部", - 7 => "行李舱", - 8 => "车辆左侧", - 9 => "车辆右侧", - 10 => "车辆正后方", - 11 => "车厢中部", - 12 => "车中门", - 13 => "驾驶席车门", - 33 => "驾驶员", - 36 => "车厢前部", - 37 => "车厢后部", - _ => "预留", - }; - } - } - - /// - /// 反序列化 - /// - /// - /// - /// - public JT808_0x9101 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - var jT808_0x9101 = new JT808_0x9101(); - jT808_0x9101.ServerIpLength = reader.ReadByte(); - jT808_0x9101.ServerIp = reader.ReadString(jT808_0x9101.ServerIpLength); - jT808_0x9101.TcpPort = reader.ReadUInt16(); - jT808_0x9101.UdpPort = reader.ReadUInt16(); - jT808_0x9101.ChannelNo = reader.ReadByte(); - jT808_0x9101.DataType = reader.ReadByte(); - jT808_0x9101.StreamType = reader.ReadByte(); - return jT808_0x9101; - } - - /// - /// 序列化 - /// - /// - /// - /// - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9101 value, IJT808Config config) - { - writer.Skip(1, out int position); - writer.WriteString(value.ServerIp); - writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - position - 1), position); - writer.WriteUInt16(value.TcpPort); - writer.WriteUInt16(value.UdpPort); - writer.WriteByte(value.ChannelNo); - writer.WriteByte(value.DataType); - writer.WriteByte(value.StreamType); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9102.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9102.cs deleted file mode 100644 index fd4a5e1..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9102.cs +++ /dev/null @@ -1,142 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 音视频实时传输控制(LiveControl直播控制) - /// - public class JT808_0x9102 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public override string Description => "音视频实时传输控制"; - public override ushort MsgId => 0x9102; -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - /// - /// 逻辑通道号 - /// - public byte ChannelNo { get; set; } - /// - /// 控制指令 - /// 平台可以通过该指令对设备的实时音视频进行控制: - /// 0:关闭音视频传输指令 - /// 1:切换码流(增加暂停和继续) - /// 2:暂停该通道所有流的发送 - /// 3:恢复暂停前流的发送,与暂停前的流类型一致 - /// 4:关闭双向对讲 - /// - public byte ControlCmd { get; set; } - /// - /// 关闭音视频类型 - /// 0:关闭该通道有关的音视频数据 - /// 1:只关闭该通道有关的音频,保留该通道有关的视频 - /// 2:只关闭该通道有关的视频,保留该通道有关的音频 - /// - public byte CloseAVData { get; set; } - /// - /// 切换码流类型 - /// 将之前申请的码流切换为新申请的码流,音频与切换前保持一致。 - /// 新申请的码流为: - /// 0:主码流 - /// 1:子码流 - /// - public byte StreamType { get; set; } - - /// - /// 格式分析 - /// - /// - /// - /// - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x9102 value = new JT808_0x9102(); - value.ChannelNo = reader.ReadByte(); - writer.WriteString($"[{value.ChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelNo)); - value.ControlCmd = reader.ReadByte(); - writer.WriteString($"[{value.ControlCmd.ReadNumber()}]控制指令", ControlCmdDisplay(value.ControlCmd)); - value.CloseAVData = reader.ReadByte(); - writer.WriteString($"[{value.CloseAVData.ReadNumber()}]关闭音视频类型", CloseAVDataDisplay(value.CloseAVData)); - value.StreamType = reader.ReadByte(); - writer.WriteString($"[{value.StreamType.ReadNumber()}]切换码流类型", value.StreamType == 0 ? "主码流" : "子码流"); - - string CloseAVDataDisplay(byte CloseAVData) - { - return CloseAVData switch - { - 0 => "关闭该通道有关的音视频数据", - 1 => "只关闭该通道有关的音频,保留该通道有关的视频", - 2 => "只关闭该通道有关的视频,保留该通道有关的音频", - _ => "未知", - }; - } - string ControlCmdDisplay(byte ControlCmd) - { - return ControlCmd switch - { - 0 => "关闭音视频传输指令", - 1 => "切换码流(增加暂停和继续)", - 2 => "暂停该通道所有流的发送", - 3 => "恢复暂停前流的发送,与暂停前的流类型一致", - 4 => "关闭双向对讲", - _ => "未知", - }; - } - string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - return LogicalChannelNo switch - { - 1 => "驾驶员", - 2 => "车辆正前方", - 3 => "车前门", - 4 => "车厢前部", - 5 => "车厢后部", - 7 => "行李舱", - 8 => "车辆左侧", - 9 => "车辆右侧", - 10 => "车辆正后方", - 11 => "车厢中部", - 12 => "车中门", - 13 => "驾驶席车门", - 33 => "驾驶员", - 36 => "车厢前部", - 37 => "车厢后部", - _ => "预留", - }; - } - } - /// - /// 反序列化 - /// - /// - /// - /// - public JT808_0x9102 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - var jT808_0X9102 = new JT808_0x9102(); - jT808_0X9102.ChannelNo = reader.ReadByte(); - jT808_0X9102.ControlCmd = reader.ReadByte(); - jT808_0X9102.CloseAVData = reader.ReadByte(); - jT808_0X9102.StreamType = reader.ReadByte(); - return jT808_0X9102; - } - /// - /// 序列化 - /// - /// - /// - /// - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9102 value, IJT808Config config) - { - writer.WriteByte(value.ChannelNo); - writer.WriteByte(value.ControlCmd); - writer.WriteByte(value.CloseAVData); - writer.WriteByte(value.StreamType); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9105.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9105.cs deleted file mode 100644 index 9f10bc9..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9105.cs +++ /dev/null @@ -1,92 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 实时音视频传输状态通知 - /// - public class JT808_0x9105 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public override string Description => "实时音视频传输状态通知"; - public override ushort MsgId => 0x9105; -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - /// - /// 逻辑通道号 - /// - public byte ChannelNo { get; set; } - /// - /// 丢包率 - /// 当前传输通道的丢包率,数值乘以100之后取整部分 - /// - public byte DropRate { get; set; } - - /// - /// - /// - /// - /// - /// - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x9105 value = new JT808_0x9105(); - value.ChannelNo = reader.ReadByte(); - writer.WriteString($"[{value.ChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelNo)); - value.DropRate = reader.ReadByte(); - writer.WriteNumber($"[{value.DropRate.ReadNumber()}]丢包率", value.DropRate); - string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - return LogicalChannelNo switch - { - 1 => "驾驶员", - 2 => "车辆正前方", - 3 => "车前门", - 4 => "车厢前部", - 5 => "车厢后部", - 7 => "行李舱", - 8 => "车辆左侧", - 9 => "车辆右侧", - 10 => "车辆正后方", - 11 => "车厢中部", - 12 => "车中门", - 13 => "驾驶席车门", - 33 => "驾驶员", - 36 => "车厢前部", - 37 => "车厢后部", - _ => "预留", - }; - } - } - - /// - /// - /// - /// - /// - /// - public JT808_0x9105 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x9105 jT808_0x9105 = new JT808_0x9105(); - jT808_0x9105.ChannelNo = reader.ReadByte(); - jT808_0x9105.DropRate = reader.ReadByte(); - return jT808_0x9105; - } - /// - /// - /// - /// - /// - /// - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9105 value, IJT808Config config) - { - writer.WriteByte(value.ChannelNo); - writer.WriteByte(value.DropRate); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9201.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9201.cs deleted file mode 100644 index 3aeff31..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9201.cs +++ /dev/null @@ -1,251 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 平台下发远程录像回放请求(vod点播请求) - /// - public class JT808_0x9201 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public override string Description => "平台下发远程录像回放请求"; - public override ushort MsgId => 0x9201; -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - /// - /// 服务器IP地址长度 - /// - public byte ServerIpLength { get; set; } - /// - /// 服务器IP地址 - /// - public string ServerIp { get; set; } - /// - /// 视频服务器TCP端口号,不使用TCP协议传输时保持默认值0即可(TCP和UDP二选一,当TCP和UDP均非默认值时一般以TCP为准) - /// - public ushort TcpPort { get; set; } - /// - /// 视频服务器UDP端口号,不使用UDP协议传输时保持默认值0即可(TCP和UDP二选一,当TCP和UDP均非默认值时一般以TCP为准) - /// - public ushort UdpPort { get; set; } - /// - /// 逻辑通道号 - /// - public byte ChannelNo { get; set; } - /// - /// 音视频类型(媒体类型) - /// 0:audio and video - /// 1:audio - /// 2:video - /// 3:audio or video - /// - public byte MediaType { get; set; } - /// - /// 码流类型 - /// 0:主或子码流 - /// 1:主 - /// 2:子 - /// 如果此通道只传输音频,置为0 - /// - public byte StreamType { get; set; } - /// - /// 存储器类型 - /// 0:主或灾备存储器 - /// 1:主存储器 - /// 2:灾备存储器 - /// - public byte MemoryType { get; set; } - /// - /// 回放方式 - /// 0:正常 - /// 1:快进 - /// 2:关键帧快退回放 - /// 3:关键帧播放 - /// 4:单帧上传 - /// - public byte PlaybackWay { get; set; } - /// - /// 快进或快退倍数,当为1和2时,此字段有效,否则置0 - /// 0:无效 - /// 1:1倍 - /// 2:2倍 - /// 3:4倍 - /// 4:8倍 - /// 5:16倍 - /// - public byte PlaySpeed { get; set; } - /// - /// 开始时间,当为4时,该字段表示单帧上传时间 - /// - public DateTime BeginTime { get; set; } - /// - /// 结束时间,当为4时,该字段无效 - /// - public DateTime EndTime { get; set; } - - /// - /// 格式分析 - /// - /// - /// - /// - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - var value = new JT808_0x9201(); - value.ServerIpLength = reader.ReadByte(); - writer.WriteNumber($"[{value.ServerIpLength.ReadNumber()}]服务器IP地址长度", value.ServerIpLength); - string ipHex = reader.ReadVirtualArray(value.ServerIpLength).ToArray().ToHexString(); - value.ServerIp = reader.ReadString(value.ServerIpLength); - writer.WriteString($"[{ipHex}]服务器IP地址", value.ServerIp); - value.TcpPort = reader.ReadUInt16(); - writer.WriteNumber($"[{value.TcpPort.ReadNumber()}]服务器视频通道监听端口号(TCP)", value.TcpPort); - value.UdpPort = reader.ReadUInt16(); - writer.WriteNumber($"[{value.UdpPort.ReadNumber()}]服务器视频通道监听端口号(UDP)", value.UdpPort); - value.ChannelNo = reader.ReadByte(); - writer.WriteString($"[{value.ChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelNo)); - value.MediaType = reader.ReadByte(); - writer.WriteString($"[{value.MediaType.ReadNumber()}]音视频类型", AVItemTypeDisplay(value.MediaType)); - value.StreamType = reader.ReadByte(); - writer.WriteString($"[{value.StreamType.ReadNumber()}]码流类型", StreamTypeDisplay(value.StreamType)); - value.MemoryType = reader.ReadByte(); - writer.WriteString($"[{value.MemoryType.ReadNumber()}]存储器类型", MemTypeDisplay(value.MemoryType)); - value.PlaybackWay = reader.ReadByte(); - writer.WriteString($"[{value.PlaybackWay.ReadNumber()}]回访方式", PlayBackWayDisplay(value.PlaybackWay)); - value.PlaySpeed = reader.ReadByte(); - writer.WriteString($"[{value.PlaySpeed.ReadNumber()}]快进或快退倍数", FastForwardOrFastRewindMultiplesDisplay(value.PlaySpeed)); - value.BeginTime = reader.ReadDateTime6(); - writer.WriteString($"[{value.BeginTime:yyMMddHHmmss}]起始时间", value.BeginTime.ToString("yyyy-MM-dd HH:mm:ss")); - value.EndTime = reader.ReadDateTime6(); - writer.WriteString($"[{value.EndTime:yyMMddHHmmss}]结束时间", value.EndTime.ToString("yyyy-MM-dd HH:mm:ss")); - static string AVItemTypeDisplay(byte AVItemType) - { - return AVItemType switch - { - 0 => "音视频", - 1 => "音频", - 2 => "视频", - 3 => "音频或视频", - _ => "未知", - }; - } - static string StreamTypeDisplay(byte StreamType) - { - return StreamType switch - { - 0 => "主码流或子码流", - 1 => "主码流", - 2 => "子码流", - _ => "未知", - }; - } - static string MemTypeDisplay(byte MemType) - { - return MemType switch - { - 0 => "主存储器或灾备服务器", - 1 => "主存储器", - 2 => "灾备服务器", - _ => "未知", - }; - } - static string PlayBackWayDisplay(byte PlayBackWay) - { - return PlayBackWay switch - { - 0 => "正常回放", - 1 => "快进回放", - 2 => "关键帧快退回访", - 3 => "关键帧播放", - 4 => "单帧上传", - _ => "未知", - }; - } - static string FastForwardOrFastRewindMultiplesDisplay(byte FastForwardOrFastRewindMultiples) - { - return FastForwardOrFastRewindMultiples switch - { - 0 => "无效", - 1 => "1倍", - 2 => "2倍", - 3 => "4倍", - 4 => "8倍", - 5 => "16倍", - _ => "未知", - }; - } - static string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - return LogicalChannelNo switch - { - 1 => "驾驶员", - 2 => "车辆正前方", - 3 => "车前门", - 4 => "车厢前部", - 5 => "车厢后部", - 7 => "行李舱", - 8 => "车辆左侧", - 9 => "车辆右侧", - 10 => "车辆正后方", - 11 => "车厢中部", - 12 => "车中门", - 13 => "驾驶席车门", - 33 => "驾驶员", - 36 => "车厢前部", - 37 => "车厢后部", - _ => "预留", - }; - } - } - /// - /// 反序列化 - /// - /// - /// - /// - public JT808_0x9201 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - JT808_0x9201 jT808_0x9201 = new JT808_0x9201(); - jT808_0x9201.ServerIpLength = reader.ReadByte(); - jT808_0x9201.ServerIp = reader.ReadString(jT808_0x9201.ServerIpLength); - jT808_0x9201.TcpPort = reader.ReadUInt16(); - jT808_0x9201.UdpPort = reader.ReadUInt16(); - jT808_0x9201.ChannelNo = reader.ReadByte(); - jT808_0x9201.MediaType = reader.ReadByte(); - jT808_0x9201.StreamType = reader.ReadByte(); - jT808_0x9201.MemoryType = reader.ReadByte(); - jT808_0x9201.PlaybackWay = reader.ReadByte(); - jT808_0x9201.PlaySpeed = reader.ReadByte(); - jT808_0x9201.BeginTime = reader.ReadDateTime6(); - jT808_0x9201.EndTime = reader.ReadDateTime6(); - return jT808_0x9201; - } - - /// - /// 序列化 - /// - /// - /// - /// - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9201 value, IJT808Config config) - { - writer.Skip(1, out int position); - writer.WriteString(value.ServerIp); - writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - position - 1), position);//计算完字符串后,回写字符串长度 - writer.WriteUInt16(value.TcpPort); - writer.WriteUInt16(value.UdpPort); - writer.WriteByte(value.ChannelNo); - writer.WriteByte(value.MediaType); - writer.WriteByte(value.StreamType); - writer.WriteByte(value.MemoryType); - writer.WriteByte(value.PlaybackWay); - writer.WriteByte(value.PlaySpeed); - writer.WriteDateTime6(value.BeginTime); - writer.WriteDateTime6(value.EndTime); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9202.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9202.cs deleted file mode 100644 index f7a67fe..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9202.cs +++ /dev/null @@ -1,144 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 平台下发远程录像回放控制(VodControl点播控制) - /// - public class JT808_0x9202 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public override string Description => "平台下发远程录像回放控制"; - public override ushort MsgId => 0x9202; -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - /// - /// 音视频通道号 - /// - public byte ChannelNo { get; set; } - /// - /// 回放控制 - /// 0:开始 - /// 1:暂停 - /// 2:结束 - /// 3:快进 - /// 4:关键帧快退播放 - /// 5:拖动(到指定位置) - /// 6:关键帧播放 - /// - public byte PlayControl { get; set; } - /// - /// 快进或快退倍数,当为3和4时,此字段有效,否则置0 - /// 0:无效 - /// 1:1倍 - /// 2:2倍 - /// 3:4倍 - /// 4:8倍 - /// 5:16倍 - /// - public byte PlaySpeed { get; set; } - /// - /// 拖动回放位置,当为5时有效(必须) - /// - public DateTime DragPlayPosition { get; set; } - /// - /// - /// - /// - /// - /// - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x9202 value = new JT808_0x9202(); - value.ChannelNo = reader.ReadByte(); - writer.WriteString($"[{value.ChannelNo.ReadNumber()}]音视频通道号", AVChannelNoDisplay(value.ChannelNo)); - value.PlayControl = reader.ReadByte(); - writer.WriteString($"[{value.PlayControl.ReadNumber()}]回放控制", PlayBackControlDisplay(value.PlayControl)); - value.PlaySpeed = reader.ReadByte(); - writer.WriteString($"[{value.PlaySpeed.ReadNumber()}]快进或快退倍数", FastForwardOrFastRewindMultiplesDisplay(value.PlaySpeed)); - value.DragPlayPosition = reader.ReadDateTime6(); - writer.WriteString($"[{value.DragPlayPosition.ToString("yyMMddHHmmss")}]拖动回放位置", value.DragPlayPosition.ToString("yyyy-MM-dd HH:mm:ss")); - static string AVChannelNoDisplay(byte LogicalChannelNo) - { - return LogicalChannelNo switch - { - 1 => "驾驶员", - 2 => "车辆正前方", - 3 => "车前门", - 4 => "车厢前部", - 5 => "车厢后部", - 7 => "行李舱", - 8 => "车辆左侧", - 9 => "车辆右侧", - 10 => "车辆正后方", - 11 => "车厢中部", - 12 => "车中门", - 13 => "驾驶席车门", - 33 => "驾驶员", - 36 => "车厢前部", - 37 => "车厢后部", - _ => "预留", - }; - } - static string PlayBackControlDisplay(byte PlayBackControl) { - return PlayBackControl switch - { - 0 => "开始回放", - 1 => "暂停回放", - 2 => "结束回放", - 3 => "快进回放", - 4 => "关键帧快退回放", - 5 => "拖动回放", - 6 => "关键帧播放", - _ => "未知", - }; - } - static string FastForwardOrFastRewindMultiplesDisplay(byte FastForwardOrFastRewindMultiples) - { - return FastForwardOrFastRewindMultiples switch - { - 0 => "无效", - 1 => "1倍", - 2 => "2倍", - 3 => "4倍", - 4 => "8倍", - 5 => "16倍", - _ => "未知", - }; - } - } - /// - /// - /// - /// - /// - /// - public JT808_0x9202 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - var jT808_0x9202 = new JT808_0x9202(); - jT808_0x9202.ChannelNo = reader.ReadByte(); - jT808_0x9202.PlayControl = reader.ReadByte(); - jT808_0x9202.PlaySpeed = reader.ReadByte(); - jT808_0x9202.DragPlayPosition = reader.ReadDateTime6(); - return jT808_0x9202; - } - /// - /// - /// - /// - /// - /// - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9202 value, IJT808Config config) - { - writer.WriteByte(value.ChannelNo); - writer.WriteByte(value.PlayControl); - writer.WriteByte(value.PlaySpeed); - writer.WriteDateTime6(value.DragPlayPosition); - } - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9205.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9205.cs deleted file mode 100644 index a882789..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9205.cs +++ /dev/null @@ -1,157 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 查询资源列表 - /// - public class JT808_0x9205 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public override string Description => "查询资源列表"; - public override ushort MsgId => 0x9205; -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - /// - /// 逻辑通道号 - /// - public byte ChannelNo { get; set; } - /// - /// 开始时间 - /// - public DateTime BeginTime { get; set; } - /// - /// 结束时间 - /// - public DateTime EndTime { get; set; } - /// - /// 报警标志 - /// - public ulong AlarmFlag { get; set; } - /// - /// 音视频资源类型 - /// 0:audio and video - /// 1:audio - /// 2:video - /// 3:audio or video - /// - public byte MediaType { get; set; } - /// - /// 码流类型 - /// 0:主或子码流 - /// 1:主 - /// 2:子 - /// - public byte StreamType { get; set; } - /// - /// 存储器类型 - /// 0:主或灾备存储器 - /// 1:主存储器 - /// 2:灾备存储器 - /// - public byte MemoryType { get; set; } -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x9205 value = new JT808_0x9205(); - value.ChannelNo = reader.ReadByte(); - writer.WriteString($"[{value.ChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelNo)); - value.BeginTime = reader.ReadDateTime6(); - writer.WriteString($"[{value.BeginTime.ToString("yyMMddHHmmss")}]起始时间", value.BeginTime.ToString("yyyy-MM-dd HH:mm:ss")); - value.EndTime = reader.ReadDateTime6(); - writer.WriteString($"[{value.EndTime.ToString("yyMMddHHmmss")}]起始时间", value.EndTime.ToString("yyyy-MM-dd HH:mm:ss")); - value.AlarmFlag = reader.ReadUInt64(); - writer.WriteNumber($"[{value.AlarmFlag.ReadNumber()}]报警标志", value.AlarmFlag); - value.MediaType = reader.ReadByte(); - writer.WriteString($"[{value.MediaType.ReadNumber()}]音视频类型", AVResourceTypeDisplay(value.MediaType)); - value.StreamType = reader.ReadByte(); - writer.WriteString($"[{value.StreamType.ReadNumber()}]码流类型", StreamTypeDisplay(value.StreamType)); - value.MemoryType = reader.ReadByte(); - writer.WriteString($"[{value.MemoryType.ReadNumber()}]存储器类型", MemoryTypeDisplay(value.MemoryType)); - - static string AVResourceTypeDisplay(byte AVResourceType) - { - return AVResourceType switch - { - 0 => "音视频", - 1 => "音频", - 2 => "视频", - 3 => "音频或视频", - _ => "未知", - }; - } - static string StreamTypeDisplay(byte StreamType) - { - return StreamType switch - { - 0 => "所有码流", - 1 => "主码流", - 2 => "子码流", - _ => "未知", - }; - } - static string MemoryTypeDisplay(byte MemType) - { - return MemType switch - { - 0 => "所有存储器", - 1 => "主存储器", - 2 => "灾备服务器", - _ => "未知", - }; - } - static string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - return LogicalChannelNo switch - { - 1 => "驾驶员", - 2 => "车辆正前方", - 3 => "车前门", - 4 => "车厢前部", - 5 => "车厢后部", - 7 => "行李舱", - 8 => "车辆左侧", - 9 => "车辆右侧", - 10 => "车辆正后方", - 11 => "车厢中部", - 12 => "车中门", - 13 => "驾驶席车门", - 33 => "驾驶员", - 36 => "车厢前部", - 37 => "车厢后部", - _ => "预留", - }; - } - } - - public JT808_0x9205 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - var jT808_0x9205 = new JT808_0x9205(); - jT808_0x9205.ChannelNo = reader.ReadByte(); - jT808_0x9205.BeginTime = reader.ReadDateTime6(); - jT808_0x9205.EndTime = reader.ReadDateTime6(); - jT808_0x9205.AlarmFlag = reader.ReadUInt64(); - jT808_0x9205.MediaType = reader.ReadByte(); - jT808_0x9205.StreamType = reader.ReadByte(); - jT808_0x9205.MemoryType = reader.ReadByte(); - return jT808_0x9205; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9205 value, IJT808Config config) - { - writer.WriteByte(value.ChannelNo); - writer.WriteDateTime6(value.BeginTime); - writer.WriteDateTime6(value.EndTime); - writer.WriteUInt64(value.AlarmFlag); - writer.WriteByte(value.MediaType); - writer.WriteByte(value.StreamType); - writer.WriteByte(value.MemoryType); - } -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9206.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9206.cs deleted file mode 100644 index 87c5a41..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9206.cs +++ /dev/null @@ -1,244 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 文件上传指令 - /// - public class JT808_0x9206 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public override string Description => "文件上传指令"; - public override ushort MsgId => 0x9206; -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - /// - /// 服务器IP地址服务 - /// - public byte ServerIpLength { get; set; } - /// - /// 服务器IP地址 - /// - public string ServerIp { get; set; } - /// - /// 服务器端口 - /// - public ushort Port { get; set; } - /// - /// 用户名长度 - /// - public byte UserNameLength { get; set; } - /// - /// 用户名 - /// - public string UserName { get; set; } - /// - /// 密码长度 - /// - public byte PasswordLength { get; set; } - /// - /// 密码 - /// - public string Password { get; set; } - /// - /// 文件上传路径长度 - /// - public byte FileUploadPathLength { get; set; } - /// - /// 文件上传路径 - /// - public string FileUploadPath { get; set; } - /// - /// 逻辑通道号 - /// - public byte ChannelNo { get; set; } - /// - /// 起始时间 - /// - public DateTime BeginTime { get; set; } - /// - /// 结束时间 - /// - public DateTime EndTime { get; set; } - /// - /// 报警标志 - /// - public uint AlarmFlag { get; set; } - /// - /// 音视频资源类型 - /// - public byte MediaType { get; set; } - /// - /// 码流类型 - /// - public byte StreamType { get; set; } - /// - /// 存储位置 - /// - public byte MemoryPositon { get; set; } - /// - /// 任务执行条件 - /// - public byte TaskExcuteCondition { get; set; } - -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x9206 value = new JT808_0x9206(); - value.ServerIpLength = reader.ReadByte(); - writer.WriteNumber($"[{value.ServerIpLength.ReadNumber()}]服务器IP地址长度", value.ServerIpLength); - string ipHex = reader.ReadVirtualArray(value.ServerIpLength).ToArray().ToHexString(); - value.ServerIp = reader.ReadString(value.ServerIpLength); - writer.WriteString($"[{ipHex}]服务器IP地址", value.ServerIp); - value.Port = reader.ReadUInt16(); - writer.WriteNumber($"[{value.Port.ReadNumber()}]服务器端口", value.Port); - value.UserNameLength = reader.ReadByte(); - writer.WriteNumber($"[{value.UserNameLength.ReadNumber()}]用户名长度", value.UserNameLength); - string userNameHex = reader.ReadVirtualArray(value.UserNameLength).ToArray().ToHexString(); - value.UserName = reader.ReadString(value.UserNameLength); - writer.WriteString($"[{userNameHex}]用户名", value.UserName); - value.PasswordLength = reader.ReadByte(); - writer.WriteNumber($"[{value.PasswordLength.ReadNumber()}]密码长度", value.PasswordLength); - string passwordHex = reader.ReadVirtualArray(value.PasswordLength).ToArray().ToHexString(); - value.Password = reader.ReadString(value.PasswordLength); - writer.WriteString($"[{passwordHex}]密码", value.Password); - value.FileUploadPathLength = reader.ReadByte(); - writer.WriteNumber($"[{value.FileUploadPathLength.ReadNumber()}]文件上传路径长度", value.FileUploadPathLength); - string fileUploadPathHex = reader.ReadVirtualArray(value.FileUploadPathLength).ToArray().ToHexString(); - value.FileUploadPath = reader.ReadString(value.FileUploadPathLength); - writer.WriteString($"[{fileUploadPathHex}]文件上传路径", value.FileUploadPath); - - value.ChannelNo = reader.ReadByte(); - writer.WriteString($"[{value.ChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelNo)); - value.BeginTime = reader.ReadDateTime6(); - writer.WriteString($"[{value.BeginTime.ToString("yyMMddHHmmss")}]起始时间", value.BeginTime.ToString("yyyy-MM-dd HH:mm:ss")); - value.EndTime = reader.ReadDateTime6(); - writer.WriteString($"[{value.EndTime.ToString("yyMMddHHmmss")}]起始时间", value.EndTime.ToString("yyyy-MM-dd HH:mm:ss")); - value.AlarmFlag = reader.ReadUInt32(); - writer.WriteNumber($"[{value.AlarmFlag.ReadNumber()}]报警标志", value.AlarmFlag); - value.MediaType = reader.ReadByte(); - writer.WriteString($"[{value.MediaType.ReadNumber()}]音视频类型", AVResourceTypeDisplay(value.MediaType)); - value.StreamType = reader.ReadByte(); - writer.WriteString($"[{value.StreamType.ReadNumber()}]码流类型", StreamTypeDisplay(value.StreamType)); - value.MemoryPositon = reader.ReadByte(); - writer.WriteString($"[{value.MemoryPositon.ReadNumber()}]存储器类型", MemoryPositonDisplay(value.MemoryPositon)); - value.TaskExcuteCondition = reader.ReadByte(); - writer.WriteString($"[{value.TaskExcuteCondition.ReadNumber()}]任务执行条件", TaskExcuteConditionDisplay(value.TaskExcuteCondition)); - - static string AVResourceTypeDisplay(byte AVResourceType) - { - return AVResourceType switch - { - 0 => "音视频", - 1 => "音频", - 2 => "视频", - 3 => "音频或视频", - _ => "未知", - }; - } - static string StreamTypeDisplay(byte StreamType) - { - return StreamType switch - { - 0 => "所有码流", - 1 => "主码流", - 2 => "子码流", - _ => "未知", - }; - } - static string MemoryPositonDisplay(byte MemoryPositon) - { - return MemoryPositon switch - { - 0 => "主存储器或灾备服务器", - 1 => "主存储器", - 2 => "灾备服务器", - _ => "未知", - }; - } - static string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - return LogicalChannelNo switch - { - 1 => "驾驶员", - 2 => "车辆正前方", - 3 => "车前门", - 4 => "车厢前部", - 5 => "车厢后部", - 7 => "行李舱", - 8 => "车辆左侧", - 9 => "车辆右侧", - 10 => "车辆正后方", - 11 => "车厢中部", - 12 => "车中门", - 13 => "驾驶席车门", - 33 => "驾驶员", - 36 => "车厢前部", - 37 => "车厢后部", - _ => "预留", - }; - } - static string TaskExcuteConditionDisplay(byte TaskExcuteCondition) { - var taskExcuteConditionDisplay = string.Empty; - taskExcuteConditionDisplay += (TaskExcuteCondition & 0x01) == 1 ? ",WIFI":""; - taskExcuteConditionDisplay += (TaskExcuteCondition & 0x01) == 1 ? ",LAN" : ""; - taskExcuteConditionDisplay += (TaskExcuteCondition & 0x01) == 1 ? ",3G/4G" : ""; - return taskExcuteConditionDisplay.Length > 0 ? taskExcuteConditionDisplay.Substring(1) : ""; - } - } - - public JT808_0x9206 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - var jT808_0x9206 = new JT808_0x9206(); - jT808_0x9206.ServerIpLength = reader.ReadByte(); - jT808_0x9206.ServerIp = reader.ReadString(jT808_0x9206.ServerIpLength); - jT808_0x9206.Port = reader.ReadUInt16(); - jT808_0x9206.UserNameLength = reader.ReadByte(); - jT808_0x9206.UserName = reader.ReadString(jT808_0x9206.UserNameLength); - jT808_0x9206.PasswordLength = reader.ReadByte(); - jT808_0x9206.Password = reader.ReadString(jT808_0x9206.PasswordLength); - jT808_0x9206.FileUploadPathLength = reader.ReadByte(); - jT808_0x9206.FileUploadPath = reader.ReadString(jT808_0x9206.FileUploadPathLength); - jT808_0x9206.ChannelNo = reader.ReadByte(); - jT808_0x9206.BeginTime = reader.ReadDateTime6(); - jT808_0x9206.EndTime = reader.ReadDateTime6(); - jT808_0x9206.AlarmFlag = reader.ReadUInt32(); - jT808_0x9206.MediaType = reader.ReadByte(); - jT808_0x9206.StreamType = reader.ReadByte(); - jT808_0x9206.MemoryPositon = reader.ReadByte(); - jT808_0x9206.TaskExcuteCondition = reader.ReadByte(); - return jT808_0x9206; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9206 value, IJT808Config config) - { - writer.Skip(1, out int serverIpLengthposition); - writer.WriteString(value.ServerIp); - writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - serverIpLengthposition - 1), serverIpLengthposition); - writer.WriteUInt16(value.Port); - writer.Skip(1, out int userNameLengthposition); - writer.WriteString(value.UserName); - writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - userNameLengthposition - 1), userNameLengthposition); - writer.Skip(1, out int passwordLengthLengthposition); - writer.WriteString(value.Password); - writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - passwordLengthLengthposition - 1), passwordLengthLengthposition); - writer.Skip(1, out int fileUploadPathLengthLengthposition); - writer.WriteString(value.FileUploadPath); - writer.WriteByteReturn((byte)(writer.GetCurrentPosition() - fileUploadPathLengthLengthposition - 1), fileUploadPathLengthLengthposition); - writer.WriteByte(value.ChannelNo); - writer.WriteDateTime6(value.BeginTime); - writer.WriteDateTime6(value.EndTime); - writer.WriteUInt32(value.AlarmFlag); - writer.WriteByte(value.MediaType); - writer.WriteByte(value.StreamType); - writer.WriteByte(value.MemoryPositon); - writer.WriteByte(value.TaskExcuteCondition); - } -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9207.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9207.cs deleted file mode 100644 index 0867ffd..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9207.cs +++ /dev/null @@ -1,63 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 文件上传控制 - /// - public class JT808_0x9207 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public override string Description => "文件上传控制"; - public override ushort MsgId => 0x9207; -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - /// - /// 流水号 - /// - public ushort MgsNum { get; set; } - /// - /// 上传控制 - /// - public byte UploadControl { get; set; } - -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x9207 value = new JT808_0x9207(); - value.MgsNum = reader.ReadUInt16(); - writer.WriteNumber($"[{value.MgsNum.ReadNumber()}]流水号", value.MgsNum); - value.UploadControl = reader.ReadByte(); - writer.WriteString($"[{value.UploadControl.ReadNumber()}]上传控制", UploadControlDisplay(value.UploadControl)); - static string UploadControlDisplay(byte UploadControl) { - return UploadControl switch - { - 0 => "暂停", - 1 => "继续", - 2 => "取消", - _ => "未知", - }; - } - } - - public JT808_0x9207 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - var jT808_0x9207 = new JT808_0x9207(); - jT808_0x9207.MgsNum = reader.ReadUInt16(); - jT808_0x9207.UploadControl = reader.ReadByte(); - return jT808_0x9207; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9207 value, IJT808Config config) - { - writer.WriteUInt16(value.MgsNum); - writer.WriteByte(value.UploadControl); - } -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9301.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9301.cs deleted file mode 100644 index bbc7737..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9301.cs +++ /dev/null @@ -1,100 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 云台旋转 - /// - public class JT808_0x9301 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public override string Description => "云台旋转"; - public override ushort MsgId => 0x9301; -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - /// - /// 逻辑通道号 - /// - public byte ChannelNo { get; set; } - /// - /// 方向 - /// 0:停止 - /// 1:上 - /// 2:下 - /// 3:左 - /// 4:右 - /// - public byte Direction { get; set; } - /// - /// 速度 - /// 0-255 - /// - public byte Speed { get; set; } -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x9301 value = new JT808_0x9301(); - value.ChannelNo = reader.ReadByte(); - writer.WriteString($"[{value.ChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelNo)); - value.Direction = reader.ReadByte(); - writer.WriteString($"[{value.Direction.ReadNumber()}]方向", DirectionDisplay(value.Direction)); - value.Speed = reader.ReadByte(); - writer.WriteNumber($"[{value.Speed.ReadNumber()}]速度", value.Speed); - static string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - return LogicalChannelNo switch - { - 1 => "驾驶员", - 2 => "车辆正前方", - 3 => "车前门", - 4 => "车厢前部", - 5 => "车厢后部", - 7 => "行李舱", - 8 => "车辆左侧", - 9 => "车辆右侧", - 10 => "车辆正后方", - 11 => "车厢中部", - 12 => "车中门", - 13 => "驾驶席车门", - 33 => "驾驶员", - 36 => "车厢前部", - 37 => "车厢后部", - _ => "预留", - }; - } - static string DirectionDisplay(byte Direction) { - return Direction switch - { - 0 => "停止", - 1 => "上", - 2 => "下", - 3 => "左", - 4 => "右", - _ => "未知", - }; - } - } - - public JT808_0x9301 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - var jT808_0x9301 = new JT808_0x9301(); - jT808_0x9301.ChannelNo = reader.ReadByte(); - jT808_0x9301.Direction = reader.ReadByte(); - jT808_0x9301.Speed = reader.ReadByte(); - return jT808_0x9301; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9301 value, IJT808Config config) - { - writer.WriteByte(value.ChannelNo); - writer.WriteByte(value.Direction); - writer.WriteByte(value.Speed); - } -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9302.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9302.cs deleted file mode 100644 index 27802fb..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9302.cs +++ /dev/null @@ -1,78 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 云台调整焦距控制 - /// - public class JT808_0x9302 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public override string Description => "云台调整焦距控制"; - public override ushort MsgId => 0x9302; -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - - /// - /// 逻辑通道号 - /// - public byte LogicChannelNo { get; set; } - /// - /// 焦距调整方向 - /// - public byte FocusAdjustmentDirection { get; set; } -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - var value = new JT808_0x9302(); - - value.LogicChannelNo = reader.ReadByte(); - writer.WriteString($"[{value.LogicChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.LogicChannelNo)); - value.FocusAdjustmentDirection = reader.ReadByte(); - writer.WriteString($"[{value.FocusAdjustmentDirection.ReadNumber()}]焦距调整方向", value.FocusAdjustmentDirection==0?"焦距调大":"焦距调小"); - - static string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - return LogicalChannelNo switch - { - 1 => "驾驶员", - 2 => "车辆正前方", - 3 => "车前门", - 4 => "车厢前部", - 5 => "车厢后部", - 7 => "行李舱", - 8 => "车辆左侧", - 9 => "车辆右侧", - 10 => "车辆正后方", - 11 => "车厢中部", - 12 => "车中门", - 13 => "驾驶席车门", - 33 => "驾驶员", - 36 => "车厢前部", - 37 => "车厢后部", - _ => "预留", - }; - } - } - - public JT808_0x9302 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - var jT808_0x9302 = new JT808_0x9302(); - jT808_0x9302.LogicChannelNo = reader.ReadByte(); - jT808_0x9302.FocusAdjustmentDirection = reader.ReadByte(); - return jT808_0x9302; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9302 value, IJT808Config config) - { - writer.WriteByte(value.LogicChannelNo); - writer.WriteByte(value.FocusAdjustmentDirection); - } -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9303.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9303.cs deleted file mode 100644 index 7776400..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9303.cs +++ /dev/null @@ -1,76 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 云台调整光圈控制 - /// - public class JT808_0x9303 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public override string Description => "云台调整光圈控制"; - public override ushort MsgId => 0x9303; -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - /// - /// 逻辑通道号 - /// - public byte ChannelNo { get; set; } - /// - /// 光圈调整方式 - /// - public byte IrisAdjustment { get; set; } -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x9303 value = new JT808_0x9303(); - value.ChannelNo = reader.ReadByte(); - writer.WriteString($"[{value.ChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelNo)); - value.IrisAdjustment = reader.ReadByte(); - writer.WriteString($"[{value.IrisAdjustment.ReadNumber()}]光圈调整方式", value.IrisAdjustment == 0 ? "调大" : "调小"); - - static string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - return LogicalChannelNo switch - { - 1 => "驾驶员", - 2 => "车辆正前方", - 3 => "车前门", - 4 => "车厢前部", - 5 => "车厢后部", - 7 => "行李舱", - 8 => "车辆左侧", - 9 => "车辆右侧", - 10 => "车辆正后方", - 11 => "车厢中部", - 12 => "车中门", - 13 => "驾驶席车门", - 33 => "驾驶员", - 36 => "车厢前部", - 37 => "车厢后部", - _ => "预留", - }; - } - } - - public JT808_0x9303 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - var jT808_0x9303 = new JT808_0x9303(); - jT808_0x9303.ChannelNo = reader.ReadByte(); - jT808_0x9303.IrisAdjustment = reader.ReadByte(); - return jT808_0x9303; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9303 value, IJT808Config config) - { - writer.WriteByte(value.ChannelNo); - writer.WriteByte(value.IrisAdjustment); - } -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9304.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9304.cs deleted file mode 100644 index 8b01d6e..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9304.cs +++ /dev/null @@ -1,75 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 云台雨刷控制 - /// - public class JT808_0x9304 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public override string Description => "云台雨刷控制"; - public override ushort MsgId => 0x9304; - /// - /// 逻辑通道号 - /// - public byte ChannelNo { get; set; } - /// - /// 启停标识 - /// - public byte StartOrStop { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x9304 value = new JT808_0x9304(); - value.ChannelNo = reader.ReadByte(); - writer.WriteString($"[{value.ChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelNo)); - value.StartOrStop = reader.ReadByte(); - writer.WriteString($"[{value.StartOrStop.ReadNumber()}]启停标识", value.StartOrStop == 0 ? "停止" : "启动"); - - static string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - return LogicalChannelNo switch - { - 1 => "驾驶员", - 2 => "车辆正前方", - 3 => "车前门", - 4 => "车厢前部", - 5 => "车厢后部", - 7 => "行李舱", - 8 => "车辆左侧", - 9 => "车辆右侧", - 10 => "车辆正后方", - 11 => "车厢中部", - 12 => "车中门", - 13 => "驾驶席车门", - 33 => "驾驶员", - 36 => "车厢前部", - 37 => "车厢后部", - _ => "预留", - }; - } - } - - public JT808_0x9304 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - var jT808_0x9304 = new JT808_0x9304(); - jT808_0x9304.ChannelNo = reader.ReadByte(); - jT808_0x9304.StartOrStop = reader.ReadByte(); - return jT808_0x9304; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9304 value, IJT808Config config) - { - writer.WriteByte(value.ChannelNo); - writer.WriteByte(value.StartOrStop); - } -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9305.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9305.cs deleted file mode 100644 index aa2aa33..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9305.cs +++ /dev/null @@ -1,75 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 红外补光控制 - /// - public class JT808_0x9305 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public override string Description => "红外补光控制"; - public override ushort MsgId => 0x9305; - /// - /// 逻辑通道号 - /// - public byte ChannelNo { get; set; } - /// - /// 启停标识 - /// - public byte StartOrStop { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - JT808_0x9305 value = new JT808_0x9305(); - value.ChannelNo = reader.ReadByte(); - writer.WriteString($"[{value.ChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelNo)); - value.StartOrStop = reader.ReadByte(); - writer.WriteString($"[{value.StartOrStop.ReadNumber()}]启停标识", value.StartOrStop == 0 ? "停止" : "启动"); - - static string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - return LogicalChannelNo switch - { - 1 => "驾驶员", - 2 => "车辆正前方", - 3 => "车前门", - 4 => "车厢前部", - 5 => "车厢后部", - 7 => "行李舱", - 8 => "车辆左侧", - 9 => "车辆右侧", - 10 => "车辆正后方", - 11 => "车厢中部", - 12 => "车中门", - 13 => "驾驶席车门", - 33 => "驾驶员", - 36 => "车厢前部", - 37 => "车厢后部", - _ => "预留", - }; - } - } - - public JT808_0x9305 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - var jT808_0x9305 = new JT808_0x9305(); - jT808_0x9305.ChannelNo = reader.ReadByte(); - jT808_0x9305.StartOrStop = reader.ReadByte(); - return jT808_0x9305; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9305 value, IJT808Config config) - { - writer.WriteByte(value.ChannelNo); - writer.WriteByte(value.StartOrStop); - } -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - } -} diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9306.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9306.cs deleted file mode 100644 index c0f7f79..0000000 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9306.cs +++ /dev/null @@ -1,76 +0,0 @@ -using JT808.Protocol.Formatters; -using JT808.Protocol.Interfaces; -using JT808.Protocol.MessagePack; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; - -namespace JT808.Protocol.Extensions.JT1078.MessageBody -{ - /// - /// 云台变倍控制 - /// - public class JT808_0x9306 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze - { -#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 - public override string Description => "云台变倍控制"; - - public override ushort MsgId => 0x9306; - /// - /// 逻辑通道号 - /// - public byte ChannelNo { get; set; } - /// - /// 变倍控制 - /// - public byte ChangeMultipleControl { get; set; } - - public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) - { - var value = new JT808_0x9306(); - value.ChannelNo = reader.ReadByte(); - writer.WriteString($"[{value.ChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.ChannelNo)); - value.ChangeMultipleControl = reader.ReadByte(); - writer.WriteString($"[{value.ChangeMultipleControl.ReadNumber()}]变倍控制", value.ChangeMultipleControl == 0 ? "调大" : "调小"); - - static string LogicalChannelNoDisplay(byte LogicalChannelNo) - { - return LogicalChannelNo switch - { - 1 => "驾驶员", - 2 => "车辆正前方", - 3 => "车前门", - 4 => "车厢前部", - 5 => "车厢后部", - 7 => "行李舱", - 8 => "车辆左侧", - 9 => "车辆右侧", - 10 => "车辆正后方", - 11 => "车厢中部", - 12 => "车中门", - 13 => "驾驶席车门", - 33 => "驾驶员", - 36 => "车厢前部", - 37 => "车厢后部", - _ => "预留", - }; - } - } - - public JT808_0x9306 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) - { - var jT808_0x9306 = new JT808_0x9306(); - jT808_0x9306.ChannelNo = reader.ReadByte(); - jT808_0x9306.ChangeMultipleControl = reader.ReadByte(); - return jT808_0x9306; - } - - public void Serialize(ref JT808MessagePackWriter writer, JT808_0x9306 value, IJT808Config config) - { - writer.WriteByte(value.ChannelNo); - writer.WriteByte(value.ChangeMultipleControl); - } -#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 - } -} diff --git a/src/JT808.Protocol.Extensions.WebApiTest/JT808.Protocol.Extensions.WebApiTest.csproj b/src/JT808.Protocol.Extensions.WebApiTest/JT808.Protocol.Extensions.WebApiTest.csproj deleted file mode 100644 index ad8e8b3..0000000 --- a/src/JT808.Protocol.Extensions.WebApiTest/JT808.Protocol.Extensions.WebApiTest.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - Exe - netcoreapp2.2 - - - - - - - - - - - - - diff --git a/src/JT808.Protocol.Extensions.WebApiTest/Program.cs b/src/JT808.Protocol.Extensions.WebApiTest/Program.cs deleted file mode 100644 index fcb43bf..0000000 --- a/src/JT808.Protocol.Extensions.WebApiTest/Program.cs +++ /dev/null @@ -1,145 +0,0 @@ -using JT808.DotNetty.Abstractions.Dtos; -using JT808.DotNetty.WebApiClientTool; -using JT808.Protocol.Extensions.JT1078; -using JT808.Protocol.Extensions.JT1078.MessageBody; -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using System; -using WebApiClient.Extensions.DependencyInjection; - -namespace JT808.Protocol.Extensions.WebApiTest -{ - class Program - { - static void Main(string[] args) - { - IServiceCollection serviceDescriptors = new ServiceCollection(); - - serviceDescriptors - .AddJT808Configure() - .AddJT1078Configure(); - - serviceDescriptors.AddHttpApi().ConfigureHttpApiConfig((c, p) => - { - c.HttpHost = new Uri("http://localhost:12819/jt808api/"); - c.FormatOptions.DateTimeFormat = "yyyy-MM-dd HH:mm:ss.fff"; - //c.LoggerFactory = p.GetRequiredService(); - }); - - IServiceProvider serviceProvider = serviceDescriptors.BuildServiceProvider(); - - IJT808Config config = serviceProvider.GetRequiredService(); - JT808Serializer JT808Serializer = config.GetSerializer(); - IJT808DotNettyWebApi JT808DotNettyWebApiClient = serviceProvider.GetRequiredService(); - string terminalPhoneNo = ""; - string serverIPAddress = ""; - - //创建子码流 - // CreateSub(terminalPhoneNo, serverIPAddress, JT808Serializer, JT808DotNettyWebApiClient); - - ////创建主码流 - CreateMain(terminalPhoneNo, serverIPAddress, JT808Serializer, JT808DotNettyWebApiClient); - - Console.ReadKey(); - } - - public static void CreateSub(string terminalPhoneNo,string serverIPAddress,JT808Serializer JT808Serializer, IJT808DotNettyWebApi JT808DotNettyWebApiClient) - { - JT808Package jT808Package = new JT808Package(); - JT808Header header = new JT808Header(); - header.MsgId = 0x9101; - header.MsgNum = 1; - header.TerminalPhoneNo = terminalPhoneNo; - jT808Package.Header = header; - JT808_0x9101 jT808_0X9101 = new JT808_0x9101(); - jT808_0X9101.ServerIPAddress = serverIPAddress; - jT808_0X9101.ServerVideoChannelTcpPort = 1808; - jT808_0X9101.ServerVideoChannelUdpPort = 0; - jT808_0X9101.LogicalChannelNo = 1; - jT808_0X9101.DataType = 1; - jT808_0X9101.StreamType = 1; - jT808Package.Bodies = jT808_0X9101; - - var data = JT808Serializer.Serialize(jT808Package); - Console.WriteLine(JsonConvert.SerializeObject(data.ToHexString())); - var tmpSend = JsonConvert.SerializeObject(new JT808UnificationSendRequestDto - { - TerminalPhoneNo = terminalPhoneNo, - Data = data - }); - //由于升级忘记测试接口导致接口变更用不了使用postman替代下 - //var result = JT808DotNettyWebApiClient.UnificationTcpSend(new JT808UnificationSendRequestDto - //{ - // TerminalPhoneNo = terminalPhoneNo, - // Data = data - //}).GetAwaiter().GetResult(); - - //Console.WriteLine(JsonConvert.SerializeObject(result)); - Console.WriteLine(tmpSend); - } - - public static void CreateMain(string terminalPhoneNo, string serverIPAddress, JT808Serializer JT808Serializer, IJT808DotNettyWebApi JT808DotNettyWebApiClient) - { - JT808Package jT808Package = new JT808Package(); - JT808Header header = new JT808Header(); - header.MsgId = 0x9101; - header.MsgNum = 2; - header.TerminalPhoneNo = terminalPhoneNo; - jT808Package.Header = header; - JT808_0x9101 jT808_0X9101 = new JT808_0x9101(); - jT808_0X9101.ServerIPAddress = serverIPAddress; - jT808_0X9101.ServerVideoChannelTcpPort = 1808; - jT808_0X9101.ServerVideoChannelUdpPort = 0; - jT808_0X9101.LogicalChannelNo = 1; - jT808_0X9101.DataType = 1; - jT808_0X9101.StreamType =0; - jT808Package.Bodies = jT808_0X9101; - - var data = JT808Serializer.Serialize(jT808Package); - Console.WriteLine(JsonConvert.SerializeObject(data.ToHexString())); - - var tmpSend = JsonConvert.SerializeObject(new JT808UnificationSendRequestDto - { - TerminalPhoneNo = terminalPhoneNo, - Data = data - }); - - //var result = JT808DotNettyWebApiClient.UnificationTcpSend(new JT808UnificationSendRequestDto - //{ - // TerminalPhoneNo = terminalPhoneNo, - // Data = data - //}).GetAwaiter().GetResult(); - - //Console.WriteLine(JsonConvert.SerializeObject(result)); - Console.WriteLine(tmpSend); - } - - public static void Close(string terminalPhoneNo, JT808Serializer JT808Serializer, IJT808DotNettyWebApi JT808DotNettyWebApiClient) - { - JT808Package jT808Package1 = new JT808Package(); - JT808Header header1 = new JT808Header(); - header1.MsgId = 0x9102; - header1.MsgNum = 3; - header1.TerminalPhoneNo = terminalPhoneNo; - jT808Package1.Header = header1; - JT808_0x9102 jT808_0X9102 = new JT808_0x9102(); - jT808_0X9102.LogicalChannelNo = 1; - jT808_0X9102.ControlCmd = 1; - jT808_0X9102.CloseAVData = 0; - jT808_0X9102.SwitchStreamType = 0; - jT808Package1.Bodies = jT808_0X9102; - var data1 = JT808Serializer.Serialize(jT808Package1); - Console.WriteLine(JsonConvert.SerializeObject(data1.ToHexString())); - - var result1 = JT808DotNettyWebApiClient.UnificationTcpSend(new JT808UnificationSendRequestDto - { - TerminalPhoneNo = terminalPhoneNo, - Data = data1 - }).GetAwaiter().GetResult(); - - Console.WriteLine(JsonConvert.SerializeObject(result1)); - } - } -}