From a4291ff448f28619fba8378be4e9ab8112409830 Mon Sep 17 00:00:00 2001 From: TK Date: Tue, 3 Mar 2020 10:47:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90jt1078=E7=9A=84808=E6=89=A9?= =?UTF-8?q?=E5=B1=95=E8=A7=A3=E6=9E=90json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JT808_0x1003Test.cs | 5 + .../JT808_0x1005Test.cs | 5 + .../JT808_0x1205Test.cs | 5 + .../JT808_0x1206Test.cs | 5 + .../JT808_0x8103CustomId.cs | 7 + .../JT808_0x9101Test.cs | 5 + .../JT808_0x9102Test.cs | 5 + .../JT808_0x9105Test.cs | 5 + .../JT808_0x9201Test.cs | 15 +- .../JT808_0x9202Test.cs | 5 + .../JT808_0x9205Test.cs | 5 + .../JT808_0x9206Test.cs | 5 + .../JT808_0x9207Test.cs | 5 + .../JT808_0x9301Test.cs | 6 + .../JT808_0x9302Test.cs | 6 + .../JT808_0x9303Test.cs | 6 + .../JT808_0x9304Test.cs | 6 + .../JT808_0x9305Test.cs | 5 +- .../JT808_0x9306Test.cs | 6 + .../JT808.Protocol.Extensions.JT1078.xml | 9 +- .../MessageBody/JT808_0x1003.cs | 78 +++++++- .../MessageBody/JT808_0x1005.cs | 17 +- .../MessageBody/JT808_0x1205.cs | 23 ++- .../MessageBody/JT808_0x1205_AVResouce.cs | 100 ++++++++++- .../MessageBody/JT808_0x1206.cs | 25 ++- .../MessageBody/JT808_0x8103_0x0075.cs | 123 ++++++++++++- .../MessageBody/JT808_0x8103_0x0076.cs | 30 +++- .../JT808_0x8103_0x0076_AVChannelRefTable.cs | 80 ++++++++- .../MessageBody/JT808_0x8103_0x0077.cs | 24 ++- .../JT808_0x8103_0x0077_SignalChannel.cs | 162 ++++++++++++++++- .../MessageBody/JT808_0x8103_0x0079.cs | 19 +- .../MessageBody/JT808_0x8103_0x007A.cs | 35 +++- .../MessageBody/JT808_0x8103_0x007B.cs | 17 +- .../MessageBody/JT808_0x8103_0x007C.cs | 49 ++++- ...T808_0x8103_0x007C_TimerWakeDayParamter.cs | 35 +++- .../MessageBody/JT808_0x9101.cs | 82 ++++++++- .../MessageBody/JT808_0x9102.cs | 86 ++++++++- .../MessageBody/JT808_0x9105.cs | 51 +++++- .../MessageBody/JT808_0x9201.cs | 168 ++++++++++++++++-- .../MessageBody/JT808_0x9202.cs | 96 +++++++++- .../MessageBody/JT808_0x9205.cs | 106 ++++++++++- .../MessageBody/JT808_0x9206.cs | 138 +++++++++++++- .../MessageBody/JT808_0x9207.cs | 27 ++- .../MessageBody/JT808_0x9301.cs | 70 +++++++- .../MessageBody/JT808_0x9302.cs | 53 +++++- .../MessageBody/JT808_0x9303.cs | 52 +++++- .../MessageBody/JT808_0x9304.cs | 52 +++++- .../MessageBody/JT808_0x9305.cs | 52 +++++- .../MessageBody/JT808_0x9306.cs | 51 +++++- 49 files changed, 1967 insertions(+), 55 deletions(-) diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1003Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1003Test.cs index 74cf322..d8bbffe 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1003Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1003Test.cs @@ -56,5 +56,10 @@ namespace JT808.Protocol.Extensions.JT1078.Test 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 index 14f68d7..626c3e3 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1005Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1005Test.cs @@ -57,5 +57,10 @@ namespace JT808.Protocol.Extensions.JT1078.Test 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 index 9f738d3..f06bdc2 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1205Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1205Test.cs @@ -93,5 +93,10 @@ namespace JT808.Protocol.Extensions.JT1078.Test 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()); + } } } diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1206Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1206Test.cs index 466b538..115369c 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1206Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x1206Test.cs @@ -53,5 +53,10 @@ namespace JT808.Protocol.Extensions.JT1078.Test 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 index b63f351..480eb2d 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x8103CustomId.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x8103CustomId.cs @@ -285,6 +285,13 @@ namespace JT808.Protocol.Extensions.JT1078.Test } } } + + [Fact] + public void Test3() + { + byte[] bytes = "7E8103009C000123456789000A070000007515030500040700000006080A00090C0000000B000201000000761B02010303020001070604050B0A08090F0E0C0D1312101117161415000000772B0201030500040700000006080A00090C0000000B000201030500040700000006080A00090C0000000B000200000079030302010000007A04000000010000007B0201020000007C140103020A00230012004500340067005600890078587E".ToHexBytes(); + var jT808_0X8103 = JT808Serializer.Analyze(bytes); + } } class DefaultGlobalConfig : GlobalConfigBase { diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9101Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9101Test.cs index 67fad77..799732a 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9101Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9101Test.cs @@ -71,5 +71,10 @@ namespace JT808.Protocol.Extensions.JT1078.Test Assert.Equal("7E910100110123456798100001093132372E302E302E31076000000101014C7E", hex); //7E910100110123456798100001093132372E302E302E31076000000101014C7E } + [Fact] + public void Test4() + { + var jT808_0X9101 = JT808Serializer.Analyze("093132372E302E302E3107600000010101".ToHexBytes()); + } } } diff --git a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9102Test.cs b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9102Test.cs index 72c1bc3..f9d3dda 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9102Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9102Test.cs @@ -64,5 +64,10 @@ namespace JT808.Protocol.Extensions.JT1078.Test //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 index a342b13..fdc6d1e 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9105Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9105Test.cs @@ -53,5 +53,10 @@ namespace JT808.Protocol.Extensions.JT1078.Test Assert.Equal(1, jT808_0x9105.LogicChannelNo); 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 index 3321c23..d13a2e3 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9201Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9201Test.cs @@ -43,8 +43,7 @@ namespace JT808.Protocol.Extensions.JT1078.Test AVItemType = 2, BeginTime = Convert.ToDateTime("2019-07-16 10:10:10"), EndTime = Convert.ToDateTime("2019-07-16 10:10:10"), - FastForwardOrFastRewindMultiples1=3, - FastForwardOrFastRewindMultiples2=4, + FastForwardOrFastRewindMultiples=3, MemType=5, PlayBackWay=6, ServerIp="127.0.0.1", @@ -54,19 +53,18 @@ namespace JT808.Protocol.Extensions.JT1078.Test UdpPort=8080 }; var hex = JT808Serializer.Serialize(jT808_0x9201).ToHexString(); - Assert.Equal("093132372E302E302E3100501F9001020705060304190716101010190716101010", hex); + Assert.Equal("093132372E302E302E3100501F90010207050603190716101010190716101010", hex); } [Fact] public void Test2() { - var jT808_0x9201 = JT808Serializer.Deserialize("093132372E302E302E3100501F9001020705060304190716101010190716101010".ToHexBytes()); + var jT808_0x9201 = JT808Serializer.Deserialize("093132372E302E302E3100501F90010207050603190716101010190716101010".ToHexBytes()); Assert.Equal(1, jT808_0x9201.LogicChannelNo); Assert.Equal(2, jT808_0x9201.AVItemType); 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.FastForwardOrFastRewindMultiples1); - Assert.Equal(4, jT808_0x9201.FastForwardOrFastRewindMultiples2); + Assert.Equal(3, jT808_0x9201.FastForwardOrFastRewindMultiples); Assert.Equal(5, jT808_0x9201.MemType); Assert.Equal(6, jT808_0x9201.PlayBackWay); Assert.Equal("127.0.0.1", jT808_0x9201.ServerIp); @@ -75,5 +73,10 @@ namespace JT808.Protocol.Extensions.JT1078.Test 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 index 0e369dc..83a7ba7 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9202Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9202Test.cs @@ -57,5 +57,10 @@ namespace JT808.Protocol.Extensions.JT1078.Test Assert.Equal(2, jT808_0x9202.FastForwardOrFastRewindMultiples); Assert.Equal(3, jT808_0x9202.PlayBackControl); } + [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 index 35c1ea6..df7cdc4 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9205Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9205Test.cs @@ -63,5 +63,10 @@ namespace JT808.Protocol.Extensions.JT1078.Test Assert.Equal(4, jT808_0x9205.MemoryType); Assert.Equal(5, jT808_0x9205.StreamType); } + [Fact] + public void Test3() + { + var jT808_0x9205 = JT808Serializer.Analyze("0319071610101019071610101100000001020504".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 index 412a52a..fcf0fa0 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9206Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9206Test.cs @@ -83,5 +83,10 @@ namespace JT808.Protocol.Extensions.JT1078.Test 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 index bc0a88a..78e8e05 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9207Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9207Test.cs @@ -53,5 +53,10 @@ namespace JT808.Protocol.Extensions.JT1078.Test 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 index 2b35558..0891480 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9301Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9301Test.cs @@ -55,5 +55,11 @@ namespace JT808.Protocol.Extensions.JT1078.Test 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 index 71f3277..bce0e56 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9302Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9302Test.cs @@ -53,5 +53,11 @@ namespace JT808.Protocol.Extensions.JT1078.Test 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 index eb75fde..64a079d 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9303Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9303Test.cs @@ -53,5 +53,11 @@ namespace JT808.Protocol.Extensions.JT1078.Test Assert.Equal(1, jT808_0x9303.LogicChannelNo); 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 index ea3c3c1..6056c5a 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9304Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9304Test.cs @@ -53,5 +53,11 @@ namespace JT808.Protocol.Extensions.JT1078.Test Assert.Equal(1, jT808_0x9304.LogicChannelNo); 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 index 2a84ff9..b65f96c 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9305Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9305Test.cs @@ -49,9 +49,8 @@ namespace JT808.Protocol.Extensions.JT1078.Test [Fact] public void Test2() { - var jT808_0x9305 = JT808Serializer.Deserialize("0102".ToHexBytes()); - Assert.Equal(1, jT808_0x9305.LogicChannelNo); - Assert.Equal(2, jT808_0x9305.StartOrStop); + 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 index a2157a1..3cd7aee 100644 --- a/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9306Test.cs +++ b/src/JT808.Protocol.Extensions.JT1078.Test/JT808_0x9306Test.cs @@ -53,5 +53,11 @@ namespace JT808.Protocol.Extensions.JT1078.Test Assert.Equal(1, jT808_0x9306.LogicChannelNo); 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/JT808.Protocol.Extensions.JT1078.xml b/src/JT808.Protocol.Extensions.JT1078/JT808.Protocol.Extensions.JT1078.xml index 59e98ba..b05222f 100644 --- a/src/JT808.Protocol.Extensions.JT1078/JT808.Protocol.Extensions.JT1078.xml +++ b/src/JT808.Protocol.Extensions.JT1078/JT808.Protocol.Extensions.JT1078.xml @@ -790,7 +790,7 @@ - 服务器IP地址服务 + 服务器IP地址长度 @@ -833,12 +833,7 @@ 回放方式 - - - 快进或快退倍数 - - - + 快进或快退倍数 diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1003.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1003.cs index df05872..165c6cc 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1003.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1003.cs @@ -1,15 +1,17 @@ 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 + public class JT808_0x1003 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { /// /// 输入音频编码方式 @@ -52,6 +54,80 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody 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(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1005.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1005.cs index 743fcfb..48bfc00 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1005.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1005.cs @@ -1,15 +1,17 @@ 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 + public class JT808_0x1005 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "终端上传乘客流量"; public override ushort MsgId => 0x1005; @@ -30,6 +32,19 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 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(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1205.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1205.cs index 5e3a4f1..6c6ef82 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1205.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1205.cs @@ -1,16 +1,18 @@ 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 + public class JT808_0x1205 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "终端上传音视频资源列表"; public override ushort MsgId => 0x1205; @@ -27,6 +29,25 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 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(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1205_AVResouce.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1205_AVResouce.cs index a600899..83b9b05 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1205_AVResouce.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1205_AVResouce.cs @@ -1,15 +1,17 @@ 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 + public class JT808_0x1205_AVResouce:IJT808MessagePackFormatter, IJT808Analyze { /// /// 逻辑通道号 @@ -44,6 +46,102 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 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(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1206.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1206.cs index c0016b7..9a761c1 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1206.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x1206.cs @@ -1,15 +1,17 @@ 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 + public class JT808_0x1206 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "文件上传完成通知"; public override ushort MsgId => 0x1206; @@ -21,6 +23,27 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 结果 /// 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(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0075.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0075.cs index 6f85381..4a4633d 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0075.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0075.cs @@ -1,6 +1,9 @@ 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 { @@ -8,7 +11,7 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 音视频参数设置 /// 0x8103_0x0075 /// - public class JT808_0x8103_0x0075 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0075 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0075; /// @@ -70,6 +73,124 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 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(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0076.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0076.cs index 2c75697..2681c49 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0076.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0076.cs @@ -1,8 +1,10 @@ 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 { @@ -10,7 +12,7 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 音视频通道列表设置 /// 0x8103_0x0076 /// - public class JT808_0x8103_0x0076 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0076 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0076; /// @@ -38,6 +40,32 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 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(); 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 index da630a8..92e9186 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0076_AVChannelRefTable.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0076_AVChannelRefTable.cs @@ -1,5 +1,7 @@ using JT808.Protocol.Formatters; +using JT808.Protocol.Interfaces; using JT808.Protocol.MessagePack; +using System.Text.Json; namespace JT808.Protocol.Extensions.JT1078.MessageBody { @@ -7,7 +9,7 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 音视频通道列表设置 /// 0x8103_0x0076_AVChannelRefTable /// - public class JT808_0x8103_0x0076_AVChannelRefTable: IJT808MessagePackFormatter + public class JT808_0x8103_0x0076_AVChannelRefTable: IJT808MessagePackFormatter, IJT808Analyze { /// /// 物理通道号 @@ -25,6 +27,82 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 是否链接云台 /// 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(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0077.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0077.cs index a557dc3..06ba2e8 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0077.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0077.cs @@ -1,8 +1,10 @@ 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 { @@ -10,7 +12,7 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody ///单独视频通道参数设置 /// 0x8103_0x0077 /// - public class JT808_0x8103_0x0077 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0077 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0077; /// @@ -24,6 +26,26 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody 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(); 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 index 5ded134..a02c570 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0077_SignalChannel.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0077_SignalChannel.cs @@ -1,12 +1,14 @@ 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 + public class JT808_0x8103_0x0077_SignalChannel: IJT808MessagePackFormatter, IJT808Analyze { /// /// 逻辑通道号 @@ -60,6 +62,164 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody ///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(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0079.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0079.cs index 2a9ea19..3df22d9 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0079.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x0079.cs @@ -1,7 +1,9 @@ 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 { @@ -9,7 +11,7 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 特殊报警录像参数设置 /// 0x8103_0x0079 /// - public class JT808_0x8103_0x0079 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x0079 : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x0079; /// @@ -30,6 +32,21 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 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(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007A.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007A.cs index b9d0002..0a8884a 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007A.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007A.cs @@ -1,7 +1,9 @@ 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 { @@ -9,7 +11,7 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 视频相关报警屏蔽字 /// 0x8103_0x007A /// - public class JT808_0x8103_0x007A : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x007A : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x007A; /// @@ -20,6 +22,37 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 视频相关屏蔽报警字 /// 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(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007B.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007B.cs index 8c6bc0b..56308e3 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007B.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007B.cs @@ -1,7 +1,9 @@ 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 { @@ -9,7 +11,7 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 图像分析报警参数设置 /// 0x8103_0x007B /// - public class JT808_0x8103_0x007B : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x007B : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x007B; /// @@ -25,6 +27,19 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 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(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007C.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007C.cs index b42aac5..efd7070 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007C.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007C.cs @@ -1,7 +1,9 @@ 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 { @@ -9,7 +11,7 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody ///终端休眠模式唤醒设置 /// 0x8103_0x007C /// - public class JT808_0x8103_0x007C : JT808_0x8103_BodyBase, IJT808MessagePackFormatter + public class JT808_0x8103_0x007C : JT808_0x8103_BodyBase, IJT808MessagePackFormatter, IJT808Analyze { public override uint ParamId { get; set; } = 0x007C; /// @@ -33,6 +35,51 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 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(); 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 index 46f7129..ab60bb7 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007C_TimerWakeDayParamter.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x8103_0x007C_TimerWakeDayParamter.cs @@ -1,7 +1,9 @@ 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 { @@ -9,7 +11,7 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody ///终端休眠模式唤醒设置 /// 0x8103_0x007C /// - public class JT808_0x8103_0x007C_TimerWakeDayParamter:IJT808MessagePackFormatter + public class JT808_0x8103_0x007C_TimerWakeDayParamter:IJT808MessagePackFormatter, IJT808Analyze { /// /// 定时唤醒启用标志 @@ -56,6 +58,37 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 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(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9101.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9101.cs index 2577ae4..5be4c2f 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9101.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9101.cs @@ -1,15 +1,17 @@ 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_0x9101:JT808Bodies, IJT808MessagePackFormatter + public class JT808_0x9101: JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "实时音视频传输请求"; public override ushort MsgId => 0x9101; @@ -50,6 +52,84 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// public byte StreamType { get; set; } + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x9101 value = new JT808_0x9101(); + value.ServerIPAddressLength = reader.ReadByte(); + writer.WriteNumber($"[{value.ServerIPAddressLength.ReadNumber()}]服务器IP地址长度", value.ServerIPAddressLength); + string ipHex = reader.ReadVirtualArray(value.ServerIPAddressLength).ToArray().ToHexString(); + value.ServerIPAddress = reader.ReadString(value.ServerIPAddressLength); + writer.WriteString($"[{ipHex}]服务器IP地址", value.ServerIPAddress); + value.ServerVideoChannelTcpPort = reader.ReadUInt16(); + writer.WriteNumber($"[{value.ServerVideoChannelTcpPort.ReadNumber()}]服务器视频通道监听端口号(TCP)", value.ServerVideoChannelTcpPort); + value.ServerVideoChannelUdpPort = reader.ReadUInt16(); + writer.WriteNumber($"[{value.ServerVideoChannelUdpPort.ReadNumber()}]服务器视频通道监听端口号(UDP)", value.ServerVideoChannelUdpPort); + value.LogicalChannelNo = reader.ReadByte(); + writer.WriteString($"[{value.LogicalChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.LogicalChannelNo)); + 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) { + switch (DataType) + { + case 0: + return "音视频"; + case 1: + return "视频"; + case 2: + return "双向对讲"; + case 3: + return "监听"; + case 4: + return "中心广播"; + case 5: + return "透传"; + default: + break; + } + + return "未知"; + } + 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 "预留"; + } + } + } + public JT808_0x9101 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x9101 jT808_0X9101 = new JT808_0x9101(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9102.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9102.cs index ba65239..cd73d2a 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9102.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9102.cs @@ -1,15 +1,17 @@ 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_0x9102:JT808Bodies, IJT808MessagePackFormatter + public class JT808_0x9102: JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "音视频实时传输控制"; public override ushort MsgId => 0x9102; @@ -43,6 +45,88 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// public byte SwitchStreamType { get; set; } + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x9102 value = new JT808_0x9102(); + value.LogicalChannelNo = reader.ReadByte(); + writer.WriteString($"[{value.LogicalChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.LogicalChannelNo)); + 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.SwitchStreamType = reader.ReadByte(); + writer.WriteString($"[{value.SwitchStreamType.ReadNumber()}]切换码流类型", value.SwitchStreamType==0?"主码流":"子码流"); + + string CloseAVDataDisplay(byte CloseAVData) { + switch (CloseAVData) + { + case 0: + return "关闭该通道有关的音视频数据"; + case 1: + return "只关闭该通道有关的音频,保留该通道有关的视频"; + case 2: + return "只关闭该通道有关的视频,保留该通道有关的音频"; + default: + return "未知"; + } + } + string ControlCmdDisplay(byte ControlCmd) { + switch (ControlCmd) + { + case 0: + return "关闭音视频传输指令"; + case 1: + return "切换码流(增加暂停和继续)"; + case 2: + return "暂停该通道所有流的发送"; + case 3: + return "恢复暂停前流的发送,与暂停前的流类型一致"; + case 4: + return "关闭双向对讲"; + default: + return "未知"; + } + } + 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 "预留"; + } + } + } + public JT808_0x9102 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x9102 jT808_0X9102 = new JT808_0x9102(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9105.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9105.cs index 4d96f99..18f0044 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9105.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9105.cs @@ -1,15 +1,17 @@ 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 + public class JT808_0x9105 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "实时音视频传输状态通知"; public override ushort MsgId => 0x9105; @@ -22,6 +24,53 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// public byte DropRate { get; set; } + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x9105 value = new JT808_0x9105(); + value.LogicChannelNo = reader.ReadByte(); + writer.WriteString($"[{value.LogicChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.LogicChannelNo)); + value.DropRate = reader.ReadByte(); + writer.WriteNumber($"[{value.DropRate.ReadNumber()}]丢包率", value.DropRate); + 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 "预留"; + } + } + } + public JT808_0x9105 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x9105 jT808_0x9105 = new JT808_0x9105(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9201.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9201.cs index 04eedf9..f81cf33 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9201.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9201.cs @@ -1,20 +1,22 @@ 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_0x9201 : JT808Bodies, IJT808MessagePackFormatter + public class JT808_0x9201 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "平台下发远程录像回放请求"; public override ushort MsgId => 0x9201; /// - /// 服务器IP地址服务 + /// 服务器IP地址长度 /// public byte ServerIpLength { get; set; } /// @@ -52,11 +54,7 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// /// 快进或快退倍数 /// - public byte FastForwardOrFastRewindMultiples1 { get; set; } - /// - /// 快进或快退倍数 - /// - public byte FastForwardOrFastRewindMultiples2 { get; set; } + public byte FastForwardOrFastRewindMultiples { get; set; } /// /// 起始时间 /// @@ -66,6 +64,156 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// public DateTime EndTime { get; set; } + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x9201 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.LogicChannelNo = reader.ReadByte(); + writer.WriteString($"[{value.LogicChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.LogicChannelNo)); + value.AVItemType = reader.ReadByte(); + writer.WriteString($"[{value.AVItemType.ReadNumber()}]音视频类型", AVItemTypeDisplay(value.AVItemType)); + value.StreamType = reader.ReadByte(); + writer.WriteString($"[{value.StreamType.ReadNumber()}]码流类型", StreamTypeDisplay(value.StreamType)); + value.MemType = reader.ReadByte(); + writer.WriteString($"[{value.MemType.ReadNumber()}]存储器类型", MemTypeDisplay(value.MemType)); + value.PlayBackWay = reader.ReadByte(); + writer.WriteString($"[{value.PlayBackWay.ReadNumber()}]回访方式", PlayBackWayDisplay(value.PlayBackWay)); + value.FastForwardOrFastRewindMultiples = reader.ReadByte(); + writer.WriteString($"[{value.FastForwardOrFastRewindMultiples.ReadNumber()}]快进或快退倍数", FastForwardOrFastRewindMultiplesDisplay(value.FastForwardOrFastRewindMultiples)); + 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")); + string AVItemTypeDisplay(byte AVItemType) + { + switch (AVItemType) + { + case 0: + return "音视频"; + case 1: + return "音频"; + case 2: + return "视频"; + case 3: + return "音频或视频"; + default: + return "未知"; + } + } + string StreamTypeDisplay(byte StreamType) + { + switch (StreamType) + { + case 0: + return "主码流或子码流"; + case 1: + return "主码流"; + case 2: + return "子码流"; + default: + return "未知"; + } + } + string MemTypeDisplay(byte MemType) + { + switch (MemType) + { + case 0: + return "主存储器或灾备服务器"; + case 1: + return "主存储器"; + case 2: + return "灾备服务器"; + default: + return "未知"; + } + } + string PlayBackWayDisplay(byte PlayBackWay) + { + switch (PlayBackWay) + { + case 0: + return "正常回放"; + case 1: + return "快进回放"; + case 2: + return "关键帧快退回访"; + case 3: + return "关键帧播放"; + case 4: + return "单帧上传"; + default: + return "未知"; + } + } + string FastForwardOrFastRewindMultiplesDisplay(byte FastForwardOrFastRewindMultiples) + { + switch (FastForwardOrFastRewindMultiples) + { + case 0: + return "无效"; + case 1: + return "1倍"; + case 2: + return "2倍"; + case 3: + return "4倍"; + case 4: + return "8倍"; + case 5: + return "16倍"; + default: + return "未知"; + } + } + 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 "预留"; + } + } + } + public JT808_0x9201 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x9201 jT808_0x9201 = new JT808_0x9201(); @@ -78,8 +226,7 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody jT808_0x9201.StreamType = reader.ReadByte(); jT808_0x9201.MemType = reader.ReadByte(); jT808_0x9201.PlayBackWay = reader.ReadByte(); - jT808_0x9201.FastForwardOrFastRewindMultiples1 = reader.ReadByte(); - jT808_0x9201.FastForwardOrFastRewindMultiples2 = reader.ReadByte(); + jT808_0x9201.FastForwardOrFastRewindMultiples = reader.ReadByte(); jT808_0x9201.BeginTime = reader.ReadDateTime6(); jT808_0x9201.EndTime = reader.ReadDateTime6(); return jT808_0x9201; @@ -97,8 +244,7 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody writer.WriteByte(value.StreamType); writer.WriteByte(value.MemType); writer.WriteByte(value.PlayBackWay); - writer.WriteByte(value.FastForwardOrFastRewindMultiples1); - writer.WriteByte(value.FastForwardOrFastRewindMultiples2); + writer.WriteByte(value.FastForwardOrFastRewindMultiples); 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 index eaad44d..1278be5 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9202.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9202.cs @@ -1,15 +1,17 @@ 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_0x9202 : JT808Bodies, IJT808MessagePackFormatter + public class JT808_0x9202 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "平台下发远程录像回放控制"; public override ushort MsgId => 0x9202; @@ -30,6 +32,98 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// public DateTime DragPlaybackPosition { get; set; } + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x9202 value = new JT808_0x9202(); + value.AVChannelNo = reader.ReadByte(); + writer.WriteString($"[{value.AVChannelNo.ReadNumber()}]音视频通道号", AVChannelNoDisplay(value.AVChannelNo)); + value.PlayBackControl = reader.ReadByte(); + writer.WriteString($"[{value.PlayBackControl.ReadNumber()}]回放控制", PlayBackControlDisplay(value.PlayBackControl)); + value.FastForwardOrFastRewindMultiples = reader.ReadByte(); + writer.WriteString($"[{value.FastForwardOrFastRewindMultiples.ReadNumber()}]快进或快退倍数", FastForwardOrFastRewindMultiplesDisplay(value.FastForwardOrFastRewindMultiples)); + value.DragPlaybackPosition = reader.ReadDateTime6(); + writer.WriteString($"[{value.DragPlaybackPosition.ToString("yyMMddHHmmss")}]拖动回放位置", value.DragPlaybackPosition.ToString("yyyy-MM-dd HH:mm:ss")); + string AVChannelNoDisplay(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 PlayBackControlDisplay(byte PlayBackControl) { + switch (PlayBackControl) + { + case 0: + return "开始回放"; + case 1: + return "暂停回放"; + case 2: + return "结束回放"; + case 3: + return "快进回放"; + case 4: + return "关键帧快退回放"; + case 5: + return "拖动回放"; + case 6: + return "关键帧播放"; + default: + return "未知"; + } + } + string FastForwardOrFastRewindMultiplesDisplay(byte FastForwardOrFastRewindMultiples) + { + switch (FastForwardOrFastRewindMultiples) + { + case 0: + return "无效"; + case 1: + return "1倍"; + case 2: + return "2倍"; + case 3: + return "4倍"; + case 4: + return "8倍"; + case 5: + return "16倍"; + default: + return "未知"; + } + } + } + public JT808_0x9202 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x9202 jT808_0x9202 = new JT808_0x9202(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9205.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9205.cs index 40b9a0e..fa637e9 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9205.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9205.cs @@ -1,15 +1,17 @@ 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 + public class JT808_0x9205 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "查询资源列表"; public override ushort MsgId => 0x9205; @@ -42,6 +44,108 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// public byte MemoryType { get; set; } + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x9205 value = new JT808_0x9205(); + 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.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.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)); + + string AVResourceTypeDisplay(byte AVResourceType) + { + switch (AVResourceType) + { + case 0: + return "音视频"; + case 1: + return "音频"; + case 2: + return "视频"; + case 3: + return "音频或视频"; + default: + return "未知"; + } + } + string StreamTypeDisplay(byte StreamType) + { + switch (StreamType) + { + case 0: + return "所有码流"; + case 1: + return "主码流"; + case 2: + return "子码流"; + default: + return "未知"; + } + } + string MemoryTypeDisplay(byte MemType) + { + switch (MemType) + { + case 0: + return "所有存储器"; + case 1: + return "主存储器"; + case 2: + return "灾备服务器"; + default: + return "未知"; + } + } + 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 "预留"; + } + } + } + public JT808_0x9205 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x9205 jT808_0x9205 = new JT808_0x9205(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9206.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9206.cs index 072744e..068b081 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9206.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9206.cs @@ -1,15 +1,17 @@ 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 + public class JT808_0x9206 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "文件上传指令"; public override ushort MsgId => 0x9206; @@ -82,6 +84,140 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// public byte TaskExcuteCondition { get; set; } + 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.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.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.AVResourceType = reader.ReadByte(); + writer.WriteString($"[{value.AVResourceType.ReadNumber()}]音视频类型", AVResourceTypeDisplay(value.AVResourceType)); + 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)); + + string AVResourceTypeDisplay(byte AVResourceType) + { + switch (AVResourceType) + { + case 0: + return "音视频"; + case 1: + return "音频"; + case 2: + return "视频"; + case 3: + return "音频或视频"; + default: + return "未知"; + } + } + string StreamTypeDisplay(byte StreamType) + { + switch (StreamType) + { + case 0: + return "所有码流"; + case 1: + return "主码流"; + case 2: + return "子码流"; + default: + return "未知"; + } + } + string MemoryPositonDisplay(byte MemoryPositon) + { + switch (MemoryPositon) + { + case 0: + return "主存储器或灾备服务器"; + case 1: + return "主存储器"; + case 2: + return "灾备服务器"; + default: + return "未知"; + } + } + 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 TaskExcuteConditionDisplay(byte TaskExcuteCondition) { + string 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) { JT808_0x9206 jT808_0x9206 = new JT808_0x9206(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9207.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9207.cs index 91b0c2d..1f54bc5 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9207.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9207.cs @@ -1,15 +1,17 @@ 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 + public class JT808_0x9207 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "文件上传控制"; public override ushort MsgId => 0x9207; @@ -21,6 +23,29 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 上传控制 /// public byte UploadControl { get; set; } + + 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)); + string UploadControlDisplay(byte UploadControl) { + switch (UploadControl) + { + case 0: + return "暂停"; + case 1: + return "继续"; + case 2: + return "取消"; + default: + return "未知"; + } + } + } + public JT808_0x9207 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x9207 jT808_0x9207 = new JT808_0x9207(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9301.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9301.cs index 9205126..e689e88 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9301.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9301.cs @@ -1,15 +1,17 @@ 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 + public class JT808_0x9301 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "云台旋转"; public override ushort MsgId => 0x9301; @@ -26,6 +28,72 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// public byte Speed { get; set; } + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x9301 value = new JT808_0x9301(); + value.LogicChannelNo = reader.ReadByte(); + writer.WriteString($"[{value.LogicChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.LogicChannelNo)); + value.Direction = reader.ReadByte(); + writer.WriteString($"[{value.Direction.ReadNumber()}]方向", DirectionDisplay(value.Direction)); + value.Speed = reader.ReadByte(); + writer.WriteNumber($"[{value.Speed.ReadNumber()}]速度", value.Speed); + 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 DirectionDisplay(byte Direction) { + switch (Direction) + { + case 0: + return "停止"; + case 1: + return "上"; + case 2: + return "下"; + case 3: + return "左"; + case 4: + return "右"; + default: + return "未知"; + } + } + } + public JT808_0x9301 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x9301 jT808_0x9301 = new JT808_0x9301(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9302.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9302.cs index 2e76179..cd8b47a 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9302.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9302.cs @@ -1,15 +1,17 @@ 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 + public class JT808_0x9302 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "云台调整焦距控制"; public override ushort MsgId => 0x9302; @@ -22,6 +24,55 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// public byte FocusAdjustmentDirection { get; set; } + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x9302 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?"焦距调大":"焦距调小"); + 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 "预留"; + } + } + } + public JT808_0x9302 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x9302 jT808_0x9302 = new JT808_0x9302(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9303.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9303.cs index dc2f2ce..b614ac4 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9303.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9303.cs @@ -1,15 +1,17 @@ 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 + public class JT808_0x9303 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "云台调整光圈控制"; public override ushort MsgId => 0x9303; @@ -21,6 +23,54 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 光圈调整方式 /// public byte IrisAdjustment { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x9303 value = new JT808_0x9303(); + value.LogicChannelNo = reader.ReadByte(); + writer.WriteString($"[{value.LogicChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.LogicChannelNo)); + value.IrisAdjustment = reader.ReadByte(); + writer.WriteString($"[{value.IrisAdjustment.ReadNumber()}]光圈调整方式", value.IrisAdjustment == 0 ? "调大" : "调小"); + 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 "预留"; + } + } + } + public JT808_0x9303 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x9303 jT808_0x9303 = new JT808_0x9303(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9304.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9304.cs index 25b56f3..1f031c3 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9304.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9304.cs @@ -1,15 +1,17 @@ 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 + public class JT808_0x9304 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "云台雨刷控制"; public override ushort MsgId => 0x9304; @@ -21,6 +23,54 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 启停标识 /// public byte StartOrStop { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x9304 value = new JT808_0x9304(); + value.LogicChannelNo = reader.ReadByte(); + writer.WriteString($"[{value.LogicChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.LogicChannelNo)); + value.StartOrStop = reader.ReadByte(); + writer.WriteString($"[{value.StartOrStop.ReadNumber()}]启停标识", value.StartOrStop == 0 ? "停止" : "启动"); + 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 "预留"; + } + } + } + public JT808_0x9304 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x9304 jT808_0x9304 = new JT808_0x9304(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9305.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9305.cs index 2043c21..5e1919d 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9305.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9305.cs @@ -1,15 +1,17 @@ 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 + public class JT808_0x9305 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "红外补光控制"; public override ushort MsgId => 0x9305; @@ -21,6 +23,54 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// 启停标识 /// public byte StartOrStop { get; set; } + + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x9305 value = new JT808_0x9305(); + value.LogicChannelNo = reader.ReadByte(); + writer.WriteString($"[{value.LogicChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.LogicChannelNo)); + value.StartOrStop = reader.ReadByte(); + writer.WriteString($"[{value.StartOrStop.ReadNumber()}]启停标识", value.StartOrStop == 0 ? "停止" : "启动"); + 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 "预留"; + } + } + } + public JT808_0x9305 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x9305 jT808_0x9305 = new JT808_0x9305(); diff --git a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9306.cs b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9306.cs index e25d8ec..8ac992a 100644 --- a/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9306.cs +++ b/src/JT808.Protocol.Extensions.JT1078/MessageBody/JT808_0x9306.cs @@ -1,15 +1,17 @@ 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 + public class JT808_0x9306 : JT808Bodies, IJT808MessagePackFormatter, IJT808Analyze { public override string Description => "云台变倍控制"; public override ushort MsgId => 0x9306; @@ -22,6 +24,53 @@ namespace JT808.Protocol.Extensions.JT1078.MessageBody /// public byte ChangeMultipleControl { get; set; } + public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config) + { + JT808_0x9306 value = new JT808_0x9306(); + value.LogicChannelNo = reader.ReadByte(); + writer.WriteString($"[{value.LogicChannelNo.ReadNumber()}]逻辑通道号", LogicalChannelNoDisplay(value.LogicChannelNo)); + value.ChangeMultipleControl = reader.ReadByte(); + writer.WriteString($"[{value.ChangeMultipleControl.ReadNumber()}]变倍控制", value.ChangeMultipleControl == 0 ? "调大" : "调小"); + 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 "预留"; + } + } + } + public JT808_0x9306 Deserialize(ref JT808MessagePackReader reader, IJT808Config config) { JT808_0x9306 jT808_0x9306 = new JT808_0x9306();