diff --git a/README.md b/README.md index e236714..1dba68a 100644 --- a/README.md +++ b/README.md @@ -331,9 +331,9 @@ Platform=AnyCpu Server=True | 1 | 0x1001 | √ | √ | 主链路登录请求消息 | | 2 | 0x1002 | √ | √ | 主链路登录应答消息 | | 3 | 0x1003 | √ | √ | 主链路注销请求消息 | -| 4 | 0x1004 | √ | 数据体为空 | 主链路注销应答消息 | -| 5 | 0x1005 | √ | 数据体为空 | 主链路连接保持请求消息 | -| 6 | 0x1006 | √ | 数据体为空 | 主链路连接保持应答消息 | +| 4 | 0x1004 | √ | √ | 主链路注销应答消息 | +| 5 | 0x1005 | √ | √ | 主链路连接保持请求消息 | +| 6 | 0x1006 | √ | √ | 主链路连接保持应答消息 | | 7 | 0x1007 | √ | √ | 主链路断开通知消息 | | 8 | 0x1008 | √ | √ |下级平台主动关闭链路通知消息 | @@ -344,9 +344,9 @@ Platform=AnyCpu Server=True | 1 | 0x9001 | √ | √ | 从链路连接请求消息 | | 2 | 0x9002 | √ | √ | 从链路连接应答消息 | | 3 | 0x9003 | √ | √ | 从链路注销请求消息 | -| 4 | 0x9004 | √ | 数据体为空 | 从链路注销应答消息 | -| 5 | 0x9005 | √ | 数据体为空 | 从链路连接保持请求消息 | -| 6 | 0x9006 | √ | 数据体为空 | 从链路连接保持应答消息 | +| 4 | 0x9004 | √ | √ | 从链路注销应答消息 | +| 5 | 0x9005 | √ | √ | 从链路连接保持请求消息 | +| 6 | 0x9006 | √ | √ | 从链路连接保持应答消息 | | 7 | 0x9007 | √ | √ | 从链路断开通知消息 | | 8 | 0x9008 | √ | √ | 上级平台主动关闭链路通知消息 | @@ -363,34 +363,34 @@ Platform=AnyCpu Server=True |序号|消息ID|完成情况|测试情况|消息体名称| |:------:|:------:|:------:|:------:|:------:| | 1 | 0x1200 | √ | √ | 主链路动态信息交换消息 | -| 2 | 0x1201 | √ | √ | 上传车辆注册信息 | +| 2 | 0x1201 | √ | √ | 上传车辆注册信息(809补充协议文档) | | 3 | 0x1202 | √ | √ | 实时上传车辆定位信息 | | 4 | 0x1203 | √ | √ | 车辆定位信息自动补报 | -| 5 | 0x1205 | √ | 数据体为空 | 启动车辆定位信息交换应答消息 | -| 6 | 0x1206 | √ | 数据体为空 | 结束车辆定位信息交换应答消息 | +| 5 | 0x1205 | √ | √ | 启动车辆定位信息交换应答消息 | +| 6 | 0x1206 | √ | √ | 结束车辆定位信息交换应答消息 | | 7 | 0x1207 | √ | √ | 申请交换指定车辆定位信息请求消息 | -| 8 | 0x1208 | √ | 数据体为空 | 取消交换指定车辆定位信息请求 | +| 8 | 0x1208 | √ | √ | 取消交换指定车辆定位信息请求 | | 9 | 0x1209 | √ | √ | 补发车辆定位信息请求 | | 10 | 0x120A | √ | √ | 上报车辆驾驶员身份识别信息应答 | | 11 | 0x120B | √ | √ | 上报车辆电子运单应答 | -| 12 | 0x120C | √ | x | 主动上报驾驶员身份信息 | -| 13 | 0x120D | √ | x | 主动上报车辆电子运单信息 | +| 12 | 0x120C | √ | √ | 主动上报驾驶员身份信息(809补充协议文档) | +| 13 | 0x120D | √ | √ | 主动上报车辆电子运单信息(809补充协议文档) | #### 从链路动态信息交换消息 |序号|消息ID|完成情况|测试情况|消息体名称| |:------:|:------:|:------:|:------:|:------:| | 1 | 0x9200 | √ | √ | 从链路动态信息交换消息 | -| 2 | 0x9202 | √ | x | 交换车辆定位信息消息 | -| 3 | 0x9203 | √ | x | 车辆定位信息交换补发消息 | -| 4 | 0x9204 | √ | x | 交换车辆静态信息消息 | -| 5 | 0x9205 | √ | x | 启动车辆定位信息交换请求消息 | -| 6 | 0x9206 | √ | x | 结束车辆定位信息交换请求消息 | -| 7 | 0x9207 | √ | x | 申请交换指定车辆定位信息应答消息 | -| 8 | 0x9208 | √ | x | 取消申请交换指定车辆定位信息应答消息 | -| 9 | 0x9209 | √ | x | 补发车辆定位信息应答消息 | -| 10 | 0x920A | √ | x | 上报驾驶员身份识别信息请求消息 | -| 11 | 0x920B | √ | x | 上报车辆电子运单请求消息 | +| 2 | 0x9202 | √ | √(0x1202) | 交换车辆定位信息消息(809补充协议文档) | +| 3 | 0x9203 | √ | √(0x1203) | 车辆定位信息交换补发消息 | +| 4 | 0x9204 | √ | √ | 交换车辆静态信息消息 | +| 5 | 0x9205 | √ | √ | 启动车辆定位信息交换请求消息 | +| 6 | 0x9206 | √ | √ | 结束车辆定位信息交换请求消息 | +| 7 | 0x9207 | √ | √ | 申请交换指定车辆定位信息应答消息 | +| 8 | 0x9208 | √ | √ | 取消申请交换指定车辆定位信息应答消息 | +| 9 | 0x9209 | √ | √ | 补发车辆定位信息应答消息 | +| 10 | 0x920A | √ | √ | 上报驾驶员身份识别信息请求消息 | +| 11 | 0x920B | √ | √ | 上报车辆电子运单请求消息 | ### 平台间信息交互类 @@ -399,16 +399,16 @@ Platform=AnyCpu Server=True |序号|消息ID|完成情况|测试情况|消息体名称| |:------:|:------:|:------:|:------:|:------:| | 1 | 0x1300 | √ | √ | 主链路平台间信息交互消息 | -| 2 | 0x1301 | √ | √ | 平台查岗应答消息 | -| 3 | 0x1302 | √ | x | 下发平台间报文应答消息 | +| 2 | 0x1301 | √ | √ | 平台查岗应答消息(809补充协议文档) | +| 3 | 0x1302 | √ | √ | 下发平台间报文应答消息(809补充协议文档) | #### 从链路平台间信息交互消息 |序号|消息ID|完成情况|测试情况|消息体名称| |:------:|:------:|:------:|:------:|:------:| -| 1 | 0x9300 | √ | x | 从链路平台间信息交互消息 | -| 2 | 0x9301 | √ | x | 平台查岗请求 | -| 3 | 0x9302 | √ | x | 下发平台间报文请求 | +| 1 | 0x9300 | √ | √ | 从链路平台间信息交互消息 | +| 2 | 0x9301 | √ | √ | 平台查岗请求(809补充协议文档) | +| 3 | 0x9302 | √ | √ | 下发平台间报文请求(809补充协议文档) | ### 车辆报警信息交互类 @@ -417,9 +417,9 @@ Platform=AnyCpu Server=True |序号|消息ID|完成情况|测试情况|消息体名称| |:------:|:------:|:------:|:------:|:------:| | 1 | 0x1400 | √ | √ | 主链路平台间信息交互消息 | -| 2 | 0x1401 | √ | x | 报警督办应答消息 | +| 2 | 0x1401 | √ | √ | 报警督办应答消息 | | 3 | 0x1402 | √ | √ | 上报报警信息消息 | -| 4 | 0x1403 | √ | √ | 主动上报报警处理结果信息 | +| 4 | 0x1403 | √ | √ | 主动上报报警处理结果信息(809补充协议文档) | #### 从链路报警信息交互消息 @@ -427,8 +427,8 @@ Platform=AnyCpu Server=True |:------:|:------:|:------:|:------:|:------:| | 1 | 0x9400 | √ | √ | 主链路平台间信息交互消息 | | 2 | 0x9401 | √ | √ | 报警督办请求 | -| 3 | 0x9402 | √ | x | 报警预警 | -| 4 | 0x9403 | √ | x | 实时交换报警信息 | +| 3 | 0x9402 | √ | √ | 报警预警 | +| 4 | 0x9403 | √ | √ | 实时交换报警信息 | ### 车辆监管类 @@ -437,22 +437,22 @@ Platform=AnyCpu Server=True |序号|消息ID|完成情况|测试情况|消息体名称| |:------:|:------:|:------:|:------:|:------:| | 1 | 0x1500 | √ | √ | 主链路车辆监管消息 | -| 2 | 0x1501 | √ | x | 车辆单向监听应答 | +| 2 | 0x1501 | √ | √ | 车辆单向监听应答 | | 3 | 0x1502 | √ | √ | 车辆拍照应答 | -| 4 | 0x1503 | √ | x | 下发车辆报文应答 | -| 5 | 0x1504 | √ | √ | 上报车辆行驶记录应答 | -| 6 | 0x1505 | √ | x | 车辆应急接入监管平台应答消息 | +| 4 | 0x1503 | √ | √ | 下发车辆报文应答 | +| 5 | 0x1504 | √ | √ | 上报车辆行驶记录应答(809补充协议文档) | +| 6 | 0x1505 | √ | √ | 车辆应急接入监管平台应答消息 | #### 从链路车辆监管消息 |序号|消息ID|完成情况|测试情况|消息体名称| |:------:|:------:|:------:|:------:|:------:| | 1 | 0x9500 | √ | √ | 从链路车辆监管消息 | -| 2 | 0x9501 | √ | x | 车辆单向监听请求 | -| 3 | 0x9502 | √ | x | 车辆拍照请求 | -| 4 | 0x9503 | √ | x | 下发车辆报文请求 | -| 5 | 0x9504 | √ | √ | 上报车辆行驶记录请求 | -| 6 | 0x9505 | √ | √ | 车辆应急接入监管平台请求消息 | +| 2 | 0x9501 | √ | √ | 车辆单向监听请求 | +| 3 | 0x9502 | √ | √ | 车辆拍照请求 | +| 4 | 0x9503 | √ | √ | 下发车辆报文请求 | +| 5 | 0x9504 | √ | √ | 上报车辆行驶记录请求(809补充协议文档) | +| 6 | 0x9505 | √ | √ | 车辆应急接入监管平台请求消息(809补充协议文档) | ### 车辆静态信息交换类 @@ -468,4 +468,4 @@ Platform=AnyCpu Server=True |序号|消息ID|完成情况|测试情况|消息体名称| |:------:|:------:|:------:|:------:|:------:| | 1 | 0x9600 | √ | √ | 从链路静态信息交换消息 | -| 2 | 0x9601 | √ | 数据体为空 | 补报车辆静态信息应答 | +| 2 | 0x9601 | √ | √ | 补报车辆静态信息应答 | diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1200_0x120CTest.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1200_0x120CTest.cs new file mode 100644 index 0000000..e799992 --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1200_0x120CTest.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x1200_0x120CTest + { + [Fact] + public void Test1() + { + JT809_0x1200_0x120C jT809_0X1200_0X120C = new JT809_0x1200_0x120C + { + DriverID="1234567890123", + DriverName="smallchi", + Licence="3210987654321", + OrgName = "gov" + }; + var hex = JT809Serializer.Serialize(jT809_0X1200_0X120C).ToHexString(); + Assert.Equal("736D616C6C6368690000000000000000313233343536373839303132330000000000000033323130393837363534333231000000000000000000000000000000000000000000000000000000676F760000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", hex); + } + + [Fact] + public void Test2() + { + var bytes = "736D616C6C6368690000000000000000313233343536373839303132330000000000000033323130393837363534333231000000000000000000000000000000000000000000000000000000676F760000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".ToHexBytes(); + JT809_0x1200_0x120C jT809_0X1200_0X120C = JT809Serializer.Deserialize(bytes); + Assert.Equal("1234567890123", jT809_0X1200_0X120C.DriverID); + Assert.Equal("smallchi", jT809_0X1200_0X120C.DriverName); + Assert.Equal("3210987654321", jT809_0X1200_0X120C.Licence); + Assert.Equal("gov", jT809_0X1200_0X120C.OrgName); + } + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1200_0x120DTest.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1200_0x120DTest.cs new file mode 100644 index 0000000..3c82737 --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1200_0x120DTest.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x1200_0x120DTest + { + [Fact] + public void Test1() + { + JT809_0x1200_0x120D jT809_0X1200_0X120D = new JT809_0x1200_0x120D + { + EwaybillInfo="asd123456asd" + }; + var hex = JT809Serializer.Serialize(jT809_0X1200_0X120D).ToHexString(); + Assert.Equal("0000000C617364313233343536617364", hex); + } + + [Fact] + public void Test2() + { + var bytes = "00 00 00 0C 61 73 64 31 32 33 34 35 36 61 73 64".ToHexBytes(); + JT809_0x1200_0x120D jT809_0X1200_0X120D = JT809Serializer.Deserialize(bytes); + Assert.Equal("asd123456asd", jT809_0X1200_0X120D.EwaybillInfo); + Assert.Equal((uint)12, jT809_0X1200_0X120D.EwaybillLength); + } + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1300_0x1302Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1300_0x1302Test.cs new file mode 100644 index 0000000..ffe1af5 --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1300_0x1302Test.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x1300_0x1302Test + { + [Fact] + public void Test1() + { + JT809_0x1300_0x1302 jT809_0x1300_0x1302 = new JT809_0x1300_0x1302 + { + InfoID = 1234 + }; + var hex = JT809Serializer.Serialize(jT809_0x1300_0x1302).ToHexString(); + Assert.Equal("000004D2", hex); + } + + [Fact] + public void Test2() + { + var bytes = "000004D2".ToHexBytes(); + JT809_0x1300_0x1302 jT809_0x1300_0x1302 = JT809Serializer.Deserialize(bytes); + Assert.Equal((uint)1234, jT809_0x1300_0x1302.InfoID); + } + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1400_0x1401Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1400_0x1401Test.cs new file mode 100644 index 0000000..7fbe90a --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1400_0x1401Test.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; +using JT809.Protocol.JT809Enums; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x1400_0x1401Test + { + [Fact] + public void Test1() + { + JT809_0x1400_0x1401 jT809_0x1400_0x1401 = new JT809_0x1400_0x1401 + { + SupervisionID=9898, + Result= JT809_0x1401_Result.处理中 + }; + var hex = JT809Serializer.Serialize(jT809_0x1400_0x1401).ToHexString(); + Assert.Equal("000026AA00", hex); + } + + [Fact] + public void Test2() + { + var bytes = "000026AA00".ToHexBytes(); + JT809_0x1400_0x1401 jT809_0x1400_0x1401 = JT809Serializer.Deserialize(bytes); + Assert.Equal(JT809_0x1401_Result.处理中, jT809_0x1400_0x1401.Result); + Assert.Equal((uint)9898, jT809_0x1400_0x1401.SupervisionID); + + } + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1500_0x1501Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1500_0x1501Test.cs new file mode 100644 index 0000000..06316c1 --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1500_0x1501Test.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; +using JT809.Protocol.JT809Enums; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x1500_0x1501Test + { + [Fact] + public void Test1() + { + JT809_0x1500_0x1501 jT809_0X1500_0X1501 = new JT809_0x1500_0x1501 + { + Result= JT809_0x1501_Result.监听成功 + }; + var hex = JT809Serializer.Serialize(jT809_0X1500_0X1501).ToHexString(); + Assert.Equal("00",hex); + } + + [Fact] + public void Test2() + { + var bytes = "00".ToHexBytes(); + JT809_0x1500_0x1501 jT809_0X1500_0X1501 = JT809Serializer.Deserialize(bytes); + Assert.Equal(JT809_0x1501_Result.监听成功, jT809_0X1500_0X1501.Result); + } + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1500_0x1503Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1500_0x1503Test.cs new file mode 100644 index 0000000..2e11bd3 --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1500_0x1503Test.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; +using JT809.Protocol.JT809Enums; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x1500_0x1503Test + { + [Fact] + public void Test1() + { + JT809_0x1500_0x1503 jT809_0X1500_0X1503 = new JT809_0x1500_0x1503 + { + MsgID=9999, + Result= JT809_0x1503_Result.下发成功 + }; + var hex = JT809Serializer.Serialize(jT809_0X1500_0X1503).ToHexString(); + Assert.Equal("0000270F00", hex); + } + + [Fact] + public void Test2() + { + var bytes = "0000270F00".ToHexBytes(); + JT809_0x1500_0x1503 jT809_0X1500_0X1503 = JT809Serializer.Deserialize(bytes); + Assert.Equal(JT809_0x1503_Result.下发成功, jT809_0X1500_0X1503.Result); + Assert.Equal((uint)9999, jT809_0X1500_0X1503.MsgID); + } + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1500_0x1505Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1500_0x1505Test.cs new file mode 100644 index 0000000..d34f6cf --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1500_0x1505Test.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; +using JT809.Protocol.JT809Enums; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x1500_0x1505Test + { + [Fact] + public void Test1() + { + JT809_0x1500_0x1505 jT809_0X1500_0X1505 = new JT809_0x1500_0x1505 + { + Result= JT809_0x1505_Result.无该车辆 + }; + var hex = JT809Serializer.Serialize(jT809_0X1500_0X1505).ToHexString(); + Assert.Equal("01",hex); + } + + [Fact] + public void Test2() + { + var bytes = "01".ToHexBytes(); + JT809_0x1500_0x1505 jT809_0X1500_0X1505 = JT809Serializer.Deserialize(bytes); + Assert.Equal(JT809_0x1505_Result.无该车辆, jT809_0X1500_0X1505.Result); + } + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9204Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9204Test.cs new file mode 100644 index 0000000..3a86c7e --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9204Test.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; +using JT809.Protocol.JT809Enums; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x9200_0x9204Test + { + [Fact] + public void Test1() + { + JT809_0x9200_0x9204 jT809_0X9200_0X9204 = new JT809_0x9200_0x9204 + { + CarInfo= "车辆信息" + }; + var hex = JT809Serializer.Serialize(jT809_0X9200_0X9204).ToHexString(); + Assert.Equal("B3B5C1BED0C5CFA2", hex); + } + + [Fact] + public void Test2() + { + var bytes = "B3B5C1BED0C5CFA2".ToHexBytes(); + JT809_0x9200_0x9204 jT809_0X9200_0X9204 = JT809Serializer.Deserialize(bytes); + Assert.Equal("车辆信息", jT809_0X9200_0X9204.CarInfo); + } + + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9205Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9205Test.cs new file mode 100644 index 0000000..b39623c --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9205Test.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; +using JT809.Protocol.JT809Enums; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x9200_0x9205Test + { + [Fact] + public void Test1() + { + JT809_0x9200_0x9205 jT809_0X9200_0X9205 = new JT809_0x9200_0x9205 + { + ReasonCode= JT809_0x9205_ReasonCode.应急状态下车辆定位信息回传 + }; + var hex = JT809Serializer.Serialize(jT809_0X9200_0X9205).ToHexString(); + Assert.Equal("02", hex); + } + + [Fact] + public void Test2() + { + var bytes = "02".ToHexBytes(); + JT809_0x9200_0x9205 jT809_0X9200_0X9205 = JT809Serializer.Deserialize(bytes); + Assert.Equal(JT809_0x9205_ReasonCode.应急状态下车辆定位信息回传, jT809_0X9200_0X9205.ReasonCode); + } + + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9206Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9206Test.cs new file mode 100644 index 0000000..5dbf355 --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9206Test.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; +using JT809.Protocol.JT809Enums; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x9200_0x9206Test + { + [Fact] + public void Test1() + { + JT809_0x9200_0x9206 jT809_0X9200_0X9206 = new JT809_0x9200_0x9206 + { + ReasonCode= JT809_0x9206_ReasonCode.紧急监控完成 + }; + var hex = JT809Serializer.Serialize(jT809_0X9200_0X9206).ToHexString(); + Assert.Equal("02", hex); + } + + [Fact] + public void Test2() + { + var bytes = "02".ToHexBytes(); + JT809_0x9200_0x9206 jT809_0X9200_0X9206 = JT809Serializer.Deserialize(bytes); + Assert.Equal(JT809_0x9206_ReasonCode.紧急监控完成, jT809_0X9200_0X9206.ReasonCode); + } + + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9207Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9207Test.cs new file mode 100644 index 0000000..074d012 --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9207Test.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; +using JT809.Protocol.JT809Enums; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x9200_0x9207Test + { + [Fact] + public void Test1() + { + JT809_0x9200_0x9207 jT809_0X9200_0X9207 = new JT809_0x9200_0x9207 + { + Result= JT809_0x9207_Result.申请成功 + }; + var hex = JT809Serializer.Serialize(jT809_0X9200_0X9207).ToHexString(); + Assert.Equal("00", hex); + } + + [Fact] + public void Test2() + { + var bytes = "00".ToHexBytes(); + JT809_0x9200_0x9207 jT809_0X9200_0X9207 = JT809Serializer.Deserialize(bytes); + Assert.Equal(JT809_0x9207_Result.申请成功, jT809_0X9200_0X9207.Result); + } + + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9208Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9208Test.cs new file mode 100644 index 0000000..bb7b51e --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9208Test.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; +using JT809.Protocol.JT809Enums; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x9200_0x9208Test + { + [Fact] + public void Test1() + { + JT809_0x9200_0x9208 jT809_0X9200_0X9208 = new JT809_0x9200_0x9208 + { + Result= JT809_0x9208_Result.其它 + }; + var hex = JT809Serializer.Serialize(jT809_0X9200_0X9208).ToHexString(); + Assert.Equal("02", hex); + } + + [Fact] + public void Test2() + { + var bytes = "02".ToHexBytes(); + JT809_0x9200_0x9208 jT809_0X9200_0X9208 = JT809Serializer.Deserialize(bytes); + Assert.Equal(JT809_0x9208_Result.其它, jT809_0X9200_0X9208.Result); + } + + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9209Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9209Test.cs new file mode 100644 index 0000000..5f921ac --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9200_0x9209Test.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; +using JT809.Protocol.JT809Enums; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x9200_0x9209Test + { + [Fact] + public void Test1() + { + JT809_0x9200_0x9209 jT809_0X9200_0X9209 = new JT809_0x9200_0x9209 + { + Result= JT809_0x9209_Result.成功_上级平台即刻补发 + }; + var hex = JT809Serializer.Serialize(jT809_0X9200_0X9209).ToHexString(); + Assert.Equal("00", hex); + } + + [Fact] + public void Test2() + { + var bytes = "00".ToHexBytes(); + JT809_0x9200_0x9209 jT809_0X9200_0X9209 = JT809Serializer.Deserialize(bytes); + Assert.Equal(JT809_0x9209_Result.成功_上级平台即刻补发, jT809_0X9200_0X9209.Result); + } + + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9300_0x9302Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9300_0x9302Test.cs new file mode 100644 index 0000000..5ed9bc4 --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9300_0x9302Test.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; +using JT809.Protocol.JT809Enums; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x9300_0x9302Test + { + [Fact] + public void Test1() + { + JT809_0x9300_0x9302 jT809_0X9300_0X9302 = new JT809_0x9300_0x9302 + { + ObjectType= JT809_0x9302_ObjectType.下级平台所属单一平台, + ObjectID="afdasf3", + InfoID=1234, + InfoContent= "下级平台所属单一平台" + }; + var hex = JT809Serializer.Serialize(jT809_0X9300_0X9302).ToHexString(); + Assert.Equal("00616664617366330000000000000004D200000014CFC2BCB6C6BDCCA8CBF9CAF4B5A5D2BBC6BDCCA8", hex); + } + + [Fact] + public void Test2() + { + var bytes = "00616664617366330000000000000004D200000014CFC2BCB6C6BDCCA8CBF9CAF4B5A5D2BBC6BDCCA8".ToHexBytes(); + JT809_0x9300_0x9302 jT809_0X9300_0X9302 = JT809Serializer.Deserialize(bytes); + Assert.Equal(JT809_0x9302_ObjectType.下级平台所属单一平台, jT809_0X9300_0X9302.ObjectType); + Assert.Equal("afdasf3", jT809_0X9300_0X9302.ObjectID); + Assert.Equal((uint)1234, jT809_0X9300_0X9302.InfoID); + Assert.Equal("下级平台所属单一平台", jT809_0X9300_0X9302.InfoContent); + Assert.Equal((uint)20, jT809_0X9300_0X9302.InfoLength); + } + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9400_0x9402Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9400_0x9402Test.cs new file mode 100644 index 0000000..e5cd457 --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9400_0x9402Test.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; +using JT809.Protocol.JT809Enums; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x9400_0x9402Test + { + [Fact] + public void Test1() + { + JT809_0x9400_0x9402 jT809_0x9400_0x9402 = new JT809_0x9400_0x9402 + { + WarnSrc= JT809WarnSrc.车载终端, + WarnType= JT809WarnType.劫警, + WarnTime=DateTime.Parse("2018-11-11 10:24:00"), + WarnContent= "劫警", + }; + var hex = JT809Serializer.Serialize(jT809_0x9400_0x9402).ToHexString(); + Assert.Equal("01000A000000005BE792C000000004BDD9BEAF", hex); + } + + [Fact] + public void Test2() + { + var bytes = "01000A000000005BE792C000000004BDD9BEAF".ToHexBytes(); + JT809_0x9400_0x9402 jT809_0x9400_0x9402 = JT809Serializer.Deserialize(bytes); + Assert.Equal(JT809WarnSrc.车载终端, jT809_0x9400_0x9402.WarnSrc); + Assert.Equal(JT809WarnType.劫警, jT809_0x9400_0x9402.WarnType); + Assert.Equal(DateTime.Parse("2018-11-11 10:24:00"), jT809_0x9400_0x9402.WarnTime); + Assert.Equal("劫警", jT809_0x9400_0x9402.WarnContent); + Assert.Equal((uint)4, jT809_0x9400_0x9402.WarnLength); + } + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9400_0x9403Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9400_0x9403Test.cs new file mode 100644 index 0000000..8d4f89b --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9400_0x9403Test.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; +using JT809.Protocol.JT809Enums; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x9400_0x9403Test + { + [Fact] + public void Test1() + { + JT809_0x9400_0x9403 jT809_0x9400_0x9403 = new JT809_0x9400_0x9403 + { + WarnSrc= JT809WarnSrc.车载终端, + WarnType= JT809WarnType.疲劳驾驶报警, + WarnTime=DateTime.Parse("2018-11-11 10:24:00"), + WarnContent= "疲劳驾驶报警", + }; + var hex = JT809Serializer.Serialize(jT809_0x9400_0x9403).ToHexString(); + Assert.Equal("010002000000005BE792C00000000CC6A3C0CDBCDDCABBB1A8BEAF", hex); + } + + [Fact] + public void Test2() + { + var bytes = "010002000000005BE792C00000000CC6A3C0CDBCDDCABBB1A8BEAF".ToHexBytes(); + JT809_0x9400_0x9403 jT809_0x9400_0x9403 = JT809Serializer.Deserialize(bytes); + Assert.Equal(JT809WarnSrc.车载终端, jT809_0x9400_0x9403.WarnSrc); + Assert.Equal(JT809WarnType.疲劳驾驶报警, jT809_0x9400_0x9403.WarnType); + Assert.Equal(DateTime.Parse("2018-11-11 10:24:00"), jT809_0x9400_0x9403.WarnTime); + Assert.Equal("疲劳驾驶报警", jT809_0x9400_0x9403.WarnContent); + Assert.Equal((uint)12, jT809_0x9400_0x9403.WarnLength); + } + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9501Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9501Test.cs new file mode 100644 index 0000000..a9cb181 --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9501Test.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x9500_0x9501Test + { + [Fact] + public void Test1() + { + JT809_0x9500_0x9501 jT809_0X9500_0X9501 = new JT809_0x9500_0x9501 + { + MonitorTel="123456789" + }; + var hex = JT809Serializer.Serialize(jT809_0X9500_0X9501).ToHexString(); + Assert.Equal("3132333435363738390000000000000000000000", hex); + } + + [Fact] + public void Test2() + { + var bytes = "3132333435363738390000000000000000000000".ToHexBytes(); + JT809_0x9500_0x9501 jT809_0X9500_0X9501 = JT809Serializer.Deserialize(bytes); + Assert.Equal("123456789", jT809_0X9500_0X9501.MonitorTel); + } + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9502Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9502Test.cs new file mode 100644 index 0000000..2082786 --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9502Test.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x9500_0x9502Test + { + [Fact] + public void Test1() + { + JT809_0x9500_0x9502 jT809_0X9500_0X9502 = new JT809_0x9500_0x9502 + { + LensID=0x09, + SizeType=0x01 + }; + var hex = JT809Serializer.Serialize(jT809_0X9500_0X9502).ToHexString(); + Assert.Equal("0901", hex); + } + + [Fact] + public void Test2() + { + var bytes = "0901".ToHexBytes(); + JT809_0x9500_0x9502 jT809_0X9500_0X9502 = JT809Serializer.Deserialize(bytes); + Assert.Equal(0x09, jT809_0X9500_0X9502.LensID); + Assert.Equal(0x01, jT809_0X9500_0X9502.SizeType); + } + } +} diff --git a/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9503Test.cs b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9503Test.cs new file mode 100644 index 0000000..fdbe666 --- /dev/null +++ b/src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x9500_0x9503Test.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JT809.Protocol; +using JT809.Protocol.JT809Extensions; +using JT809.Protocol.JT809MessageBody; +using JT809.Protocol.JT809Exceptions; +using JT809.Protocol.JT809SubMessageBody; + +namespace JT809.Protocol.Test.JT809SubMessageBody +{ + public class JT809_0x9500_0x9503Test + { + [Fact] + public void Test1() + { + JT809_0x9500_0x9503 jT809_0X9500_0X9503 = new JT809_0x9500_0x9503 + { + MsgSequence=333, + MsgPriority=2, + MsgContent="汉_sfdf3dfs" + }; + var hex = JT809Serializer.Serialize(jT809_0X9500_0X9503).ToHexString(); + Assert.Equal("0000014D020000000BBABA5F7366646633646673", hex); + } + + [Fact] + public void Test2() + { + var bytes = "0000014D020000000BBABA5F7366646633646673".ToHexBytes(); + JT809_0x9500_0x9503 jT809_0X9500_0X9503 = JT809Serializer.Deserialize(bytes); + Assert.Equal((uint)333, jT809_0X9500_0X9503.MsgSequence); + Assert.Equal(2, jT809_0X9500_0X9503.MsgPriority); + Assert.Equal((uint)11, jT809_0X9500_0X9503.MsgLength); + Assert.Equal("汉_sfdf3dfs", jT809_0X9500_0X9503.MsgContent); + } + } +} diff --git a/src/JT809.Protocol/JT809.Protocol.csproj b/src/JT809.Protocol/JT809.Protocol.csproj index a0fda73..64eee92 100644 --- a/src/JT809.Protocol/JT809.Protocol.csproj +++ b/src/JT809.Protocol/JT809.Protocol.csproj @@ -14,7 +14,7 @@ https://github.com/SmallChi/JT809 https://github.com/SmallChi/JT809/blob/master/LICENSE true - 1.0.8 + 1.1.0 diff --git a/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x1200_0x1203Formatter.cs b/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x1200_0x1203Formatter.cs index 3bbf25d..4366b2a 100644 --- a/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x1200_0x1203Formatter.cs +++ b/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x1200_0x1203Formatter.cs @@ -16,9 +16,9 @@ namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters int offset = 0; JT809_0x1200_0x1203 jT809_0X1200_0X1203 = new JT809_0x1200_0x1203(); jT809_0X1200_0X1203.GNSSCount= JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); + jT809_0X1200_0X1203.GNSS = new List(); if (jT809_0X1200_0X1203.GNSSCount > 0) { - jT809_0X1200_0X1203.GNSS = new List(); int bufReadSize; int tempOffset = 0; for (int i = 0; i < jT809_0X1200_0X1203.GNSSCount; i++) diff --git a/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9200_0x9203Formatter.cs b/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9200_0x9203Formatter.cs index 571fbec..c05b09d 100644 --- a/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9200_0x9203Formatter.cs +++ b/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9200_0x9203Formatter.cs @@ -16,9 +16,9 @@ namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters int offset = 0; JT809_0x9200_0x9203 jT809_0X1200_0x9203 = new JT809_0x9200_0x9203(); jT809_0X1200_0x9203.GNSSCount= JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); + jT809_0X1200_0x9203.GNSS = new List(); if (jT809_0X1200_0x9203.GNSSCount > 0) { - jT809_0X1200_0x9203.GNSS = new List(); int bufReadSize; int tempOffset = 0; for (int i = 0; i < jT809_0X1200_0x9203.GNSSCount; i++) diff --git a/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9400_0x9402Formatter.cs b/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9400_0x9402Formatter.cs index 12b0c30..ba043d9 100644 --- a/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9400_0x9402Formatter.cs +++ b/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9400_0x9402Formatter.cs @@ -14,7 +14,7 @@ namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters int offset = 0; JT809_0x9400_0x9402 jT809_0X9400_0X9402 = new JT809_0x9400_0x9402(); jT809_0X9400_0X9402.WarnSrc = (JT809Enums.JT809WarnSrc)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); - jT809_0X9400_0X9402.WarnType = JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); + jT809_0X9400_0X9402.WarnType = (JT809Enums.JT809WarnType)JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); jT809_0X9400_0X9402.WarnTime = JT809BinaryExtensions.ReadUTCDateTimeLittle(bytes, ref offset); jT809_0X9400_0X9402.WarnLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); jT809_0X9400_0X9402.WarnContent = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset,(int)jT809_0X9400_0X9402.WarnLength); @@ -25,7 +25,7 @@ namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters public int Serialize(ref byte[] bytes, int offset, JT809_0x9400_0x9402 value) { offset += JT809BinaryExtensions.WriteByteLittle(bytes, offset, (byte)value.WarnSrc); - offset += JT809BinaryExtensions.WriteUInt16Little(bytes, offset, value.WarnType); + offset += JT809BinaryExtensions.WriteUInt16Little(bytes, offset, (ushort)value.WarnType); offset += JT809BinaryExtensions.WriteUTCDateTimeLittle(bytes, offset, value.WarnTime); // 先计算内容长度(汉字为两个字节) offset += 4; diff --git a/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9400_0x9403Formatter.cs b/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9400_0x9403Formatter.cs index b91c01a..4ccddc9 100644 --- a/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9400_0x9403Formatter.cs +++ b/src/JT809.Protocol/JT809Formatters/JT809SubMessageBodyFormatters/JT809_0x9400_0x9403Formatter.cs @@ -14,7 +14,7 @@ namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters int offset = 0; JT809_0x9400_0x9403 jT809_0X9400_0X9403 = new JT809_0x9400_0x9403(); jT809_0X9400_0X9403.WarnSrc = (JT809Enums.JT809WarnSrc)JT809BinaryExtensions.ReadByteLittle(bytes, ref offset); - jT809_0X9400_0X9403.WarnType = JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); + jT809_0X9400_0X9403.WarnType = (JT809Enums.JT809WarnType)JT809BinaryExtensions.ReadUInt16Little(bytes, ref offset); jT809_0X9400_0X9403.WarnTime = JT809BinaryExtensions.ReadUTCDateTimeLittle(bytes, ref offset); jT809_0X9400_0X9403.WarnLength = JT809BinaryExtensions.ReadUInt32Little(bytes, ref offset); jT809_0X9400_0X9403.WarnContent = JT809BinaryExtensions.ReadStringLittle(bytes, ref offset, (int)jT809_0X9400_0X9403.WarnLength); @@ -25,7 +25,7 @@ namespace JT809.Protocol.JT809Formatters.JT809SubMessageBodyFormatters public int Serialize(ref byte[] bytes, int offset, JT809_0x9400_0x9403 value) { offset += JT809BinaryExtensions.WriteByteLittle(bytes, offset, (byte)value.WarnSrc); - offset += JT809BinaryExtensions.WriteUInt16Little(bytes, offset, value.WarnType); + offset += JT809BinaryExtensions.WriteUInt16Little(bytes, offset, (ushort)value.WarnType); offset += JT809BinaryExtensions.WriteUTCDateTimeLittle(bytes, offset, value.WarnTime); // 先计算内容长度(汉字为两个字节) offset += 4; diff --git a/src/JT809.Protocol/JT809SubMessageBody/JT809_0x1200_0x1203.cs b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x1200_0x1203.cs index fc6ad3b..370cc86 100644 --- a/src/JT809.Protocol/JT809SubMessageBody/JT809_0x1200_0x1203.cs +++ b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x1200_0x1203.cs @@ -26,6 +26,6 @@ namespace JT809.Protocol.JT809SubMessageBody /// /// 卫星定位数据集合 /// - public IList GNSS { get; set; } + public List GNSS { get; set; } } } diff --git a/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9200_0x9203.cs b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9200_0x9203.cs index 2a2c71a..3ad22d0 100644 --- a/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9200_0x9203.cs +++ b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9200_0x9203.cs @@ -21,6 +21,6 @@ namespace JT809.Protocol.JT809SubMessageBody /// /// 卫星定位数据集合 /// - public IList GNSS { get; set; } + public List GNSS { get; set; } } } diff --git a/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9200_0x9204.cs b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9200_0x9204.cs index 7c6e8ce..f184d04 100644 --- a/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9200_0x9204.cs +++ b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9200_0x9204.cs @@ -15,7 +15,7 @@ namespace JT809.Protocol.JT809SubMessageBody public class JT809_0x9200_0x9204 { /// - /// 车牌号 + /// 车辆信息 /// public string CarInfo { get; set; } } diff --git a/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9400_0x9402.cs b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9400_0x9402.cs index a7f8760..f55dbc6 100644 --- a/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9400_0x9402.cs +++ b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9400_0x9402.cs @@ -23,7 +23,7 @@ namespace JT809.Protocol.JT809SubMessageBody /// /// 报警类型 /// - public ushort WarnType { get; set; } + public JT809WarnType WarnType { get; set; } /// /// 报警时间 UTCDateTime /// diff --git a/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9400_0x9403.cs b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9400_0x9403.cs index 21c11fe..7d5971f 100644 --- a/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9400_0x9403.cs +++ b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9400_0x9403.cs @@ -23,7 +23,7 @@ namespace JT809.Protocol.JT809SubMessageBody /// /// 报警类型 /// - public ushort WarnType { get; set; } + public JT809WarnType WarnType { get; set; } /// /// 报警时间 /// diff --git a/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9500_0x9502.cs b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9500_0x9502.cs index e6d8813..12cddbf 100644 --- a/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9500_0x9502.cs +++ b/src/JT809.Protocol/JT809SubMessageBody/JT809_0x9500_0x9502.cs @@ -20,6 +20,14 @@ namespace JT809.Protocol.JT809SubMessageBody public byte LensID { get; set; } /// /// 图片大小 + /// Ox01:320x240: + /// Ox02:640x480: + /// Ox03;:800x600: + /// Ox04:1024x768: + /// Ox05:176x 144[QCIF]; + /// 0x06:704x288[CIF]; + /// 0x07:704x288[HALF D]; + /// Ox08:704576[DI] /// public byte SizeType { get; set; } }