|
|
@@ -1,4 +1,5 @@ |
|
|
|
using JT808.Protocol.Extensions; |
|
|
|
using JT808.Protocol.Enums; |
|
|
|
using JT808.Protocol.Extensions; |
|
|
|
using JT808.Protocol.MessageBody; |
|
|
|
using Xunit; |
|
|
|
|
|
|
@@ -10,23 +11,40 @@ namespace JT808.Protocol.Test.MessageBody |
|
|
|
[Fact] |
|
|
|
public void Test1() |
|
|
|
{ |
|
|
|
JT808_0x8800 jT808_0X8800 = new JT808_0x8800 |
|
|
|
JT808Package jT808Package = new JT808Package |
|
|
|
{ |
|
|
|
MultimediaId = 129, |
|
|
|
RetransmitPackageIds = new byte[] { 0x01, 0x02, 0x03, 0x04 } |
|
|
|
Header = new JT808Header |
|
|
|
{ |
|
|
|
MsgId= (ushort)JT808MsgId.多媒体数据上传应答, |
|
|
|
TerminalPhoneNo="123456789", |
|
|
|
}, |
|
|
|
Bodies = new JT808_0x8800 |
|
|
|
{ |
|
|
|
MultimediaId = 129, |
|
|
|
RetransmitPackageIds = new byte[] { 0x01, 0x02, 0x03, 0x04 } |
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
string hex = JT808Serializer.Serialize(jT808_0X8800).ToHexString(); |
|
|
|
Assert.Equal("000000810201020304", hex); |
|
|
|
string hex = JT808Serializer.Serialize(jT808Package).ToHexString(); |
|
|
|
Assert.Equal("7E8800000900012345678900010000008102010203048E7E", hex); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Test2() |
|
|
|
{ |
|
|
|
byte[] bytes = "000000810201020304".ToHexBytes(); |
|
|
|
JT808_0x8800 jT808_0X8800 = JT808Serializer.Deserialize<JT808_0x8800>(bytes); |
|
|
|
byte[] bytes = "7E8800000900012345678900010000008102010203048E7E".ToHexBytes(); |
|
|
|
var jt808Package = JT808Serializer.Deserialize<JT808Package>(bytes); |
|
|
|
JT808_0x8800 jT808_0X8800 = jt808Package.Bodies as JT808_0x8800; |
|
|
|
Assert.Equal((uint)129, jT808_0X8800.MultimediaId); |
|
|
|
Assert.Equal(2, jT808_0X8800.RetransmitPackageCount); |
|
|
|
Assert.Equal(new byte[] { 0x01, 0x02, 0x03, 0x04 }, jT808_0X8800.RetransmitPackageIds); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Test3() |
|
|
|
{ |
|
|
|
byte[] bytes = "7E8800000900012345678900010000008102010203048E7E".ToHexBytes(); |
|
|
|
string json = JT808Serializer.Analyze<JT808Package>(bytes); |
|
|
|
} |
|
|
|
} |
|
|
|
} |