public void Test2011_2() { byte[] bytes = "30510002007B01000000010000000200BA7F0E07E4F11C0028003C0000181116202020027C00000000010000000200BA7F0E07E4F11C0028003C0000181116222222".ToHexBytes(); JT808_0x0802 jT808_0X0802 = JT808Serializer.Deserialize <JT808_0x0802>(bytes); Assert.Equal(12369, jT808_0X0802.MsgNum); Assert.Equal(2, jT808_0X0802.MultimediaItemCount); Assert.Equal(123, jT808_0X0802.MultimediaSearchItems[0].ChannelId); Assert.Equal(JT808EventItemCoding.定时动作.ToByteValue(), jT808_0X0802.MultimediaSearchItems[0].EventItemCoding); Assert.Equal(JT808MultimediaType.图像.ToByteValue(), jT808_0X0802.MultimediaSearchItems[0].MultimediaType); Assert.Equal((uint)1, jT808_0X0802.MultimediaSearchItems[0].Position.AlarmFlag); Assert.Equal((ushort)40, jT808_0X0802.MultimediaSearchItems[0].Position.Altitude); Assert.Equal(DateTime.Parse("2018-11-16 20:20:20"), jT808_0X0802.MultimediaSearchItems[0].Position.GPSTime); Assert.Equal(12222222, jT808_0X0802.MultimediaSearchItems[0].Position.Lat); Assert.Equal(132444444, jT808_0X0802.MultimediaSearchItems[0].Position.Lng); Assert.Equal((ushort)60, jT808_0X0802.MultimediaSearchItems[0].Position.Speed); Assert.Equal((ushort)0, jT808_0X0802.MultimediaSearchItems[0].Position.Direction); Assert.Equal((uint)2, jT808_0X0802.MultimediaSearchItems[0].Position.StatusFlag); Assert.Equal(124, jT808_0X0802.MultimediaSearchItems[1].ChannelId); Assert.Equal(JT808EventItemCoding.平台下发指令.ToByteValue(), jT808_0X0802.MultimediaSearchItems[1].EventItemCoding); Assert.Equal(JT808MultimediaType.视频.ToByteValue(), jT808_0X0802.MultimediaSearchItems[1].MultimediaType); Assert.Equal((uint)1, jT808_0X0802.MultimediaSearchItems[1].Position.AlarmFlag); Assert.Equal((ushort)40, jT808_0X0802.MultimediaSearchItems[1].Position.Altitude); Assert.Equal(DateTime.Parse("2018-11-16 22:22:22"), jT808_0X0802.MultimediaSearchItems[1].Position.GPSTime); Assert.Equal(12222222, jT808_0X0802.MultimediaSearchItems[1].Position.Lat); Assert.Equal(132444444, jT808_0X0802.MultimediaSearchItems[1].Position.Lng); Assert.Equal((ushort)60, jT808_0X0802.MultimediaSearchItems[1].Position.Speed); Assert.Equal((ushort)0, jT808_0X0802.MultimediaSearchItems[1].Position.Direction); Assert.Equal((uint)2, jT808_0X0802.MultimediaSearchItems[1].Position.StatusFlag); }
public void Test1() { JT808_0x0802 jT808_0X0802 = new JT808_0x0802 { MsgNum = 12369, MultimediaSearchItems = new List <JT808MultimediaSearchProperty>() }; jT808_0X0802.MultimediaSearchItems.Add(new JT808MultimediaSearchProperty() { ChannelId = 123, EventItemCoding = JT808EventItemCoding.定时动作.ToByteValue(), MultimediaId = 258, MultimediaType = JT808MultimediaType.图像.ToByteValue(), Position = new JT808_0x0200() { AlarmFlag = 1, Altitude = 40, GPSTime = DateTime.Parse("2018-11-16 20:20:20"), Lat = 12222222, Lng = 132444444, Speed = 60, Direction = 0, StatusFlag = 2, } }); jT808_0X0802.MultimediaSearchItems.Add(new JT808MultimediaSearchProperty() { ChannelId = 124, EventItemCoding = JT808EventItemCoding.平台下发指令.ToByteValue(), MultimediaId = 259, MultimediaType = JT808MultimediaType.视频.ToByteValue(), Position = new JT808_0x0200() { AlarmFlag = 1, Altitude = 40, GPSTime = DateTime.Parse("2018-11-16 22:22:22"), Lat = 12222222, Lng = 132444444, Speed = 60, Direction = 0, StatusFlag = 2, } }); string hex = JT808Serializer.Serialize(jT808_0X0802).ToHexString(); Assert.Equal("3051000200000102007B01000000010000000200BA7F0E07E4F11C0028003C000018111620202000000103027C00000000010000000200BA7F0E07E4F11C0028003C0000181116222222", hex); }