public JT808_0x0704 Deserialize(ReadOnlySpan <byte> bytes, out int readSize)
        {
            int          offset       = 0;
            JT808_0x0704 jT808_0X0704 = new JT808_0x0704
            {
                Count        = JT808BinaryExtensions.ReadUInt16Little(bytes, ref offset),
                LocationType = (JT808_0x0704.BatchLocationType)JT808BinaryExtensions.ReadByteLittle(bytes, ref offset)
            };
            List <JT808_0x0200> jT808_0X0200s = new List <JT808_0x0200>();
            int bufReadSize;

            for (int i = 0; i < jT808_0X0704.Count; i++)
            {
                int buflen = JT808BinaryExtensions.ReadUInt16Little(bytes, ref offset);
                //offset = offset + 2;
                try
                {
                    JT808_0x0200 jT808_0X0200 = JT808FormatterExtensions.GetFormatter <JT808_0x0200>().Deserialize(bytes.Slice(offset, buflen), out bufReadSize);
                    jT808_0X0200s.Add(jT808_0X0200);
                }
                catch (Exception)
                {
                }
                offset = offset + buflen;
            }
            jT808_0X0704.Positions = jT808_0X0200s;
            readSize = offset;
            return(jT808_0X0704);
        }
Ejemplo n.º 2
0
        public void Test1()
        {
            JT808_0x0200 jT808UploadLocationRequest = new JT808_0x0200
            {
                AlarmFlag  = 1,
                Altitude   = 40,
                GPSTime    = DateTime.Parse("2018-07-15 10:10:10"),
                Lat        = 12222222,
                Lng        = 132444444,
                Speed      = 60,
                Direction  = 0,
                StatusFlag = 2,
                JT808LocationAttachData = new Dictionary <byte, JT808_0x0200_BodyBase>()
            };

            jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x01, new JT808_0x0200_0x01
            {
                Mileage = 100
            });
            jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x02, new JT808_0x0200_0x02
            {
                Oil = 55
            });
            var hex = JT808Serializer.Serialize(jT808UploadLocationRequest).ToHexString();

            Assert.Equal("000000010000000200BA7F0E07E4F11C0028003C000018071510101001040000006402020037", hex);
        }
Ejemplo n.º 3
0
 public void TestJT808_0x0200()
 {
     for (int i = 0; i < N; i++)
     {
         JT808Package jT808Package = new JT808Package();
         jT808Package.Header = new JT808Header
         {
             MsgId           = MsgId,
             MsgNum          = 8888,
             TerminalPhoneNo = "112233445566",
         };
         JT808_0x0200 jT808UploadLocationRequest = new JT808_0x0200();
         jT808UploadLocationRequest.AlarmFlag  = 1;
         jT808UploadLocationRequest.Altitude   = 40;
         jT808UploadLocationRequest.GPSTime    = DateTime.Parse("2018-07-15 10:10:10");
         jT808UploadLocationRequest.Lat        = 12222222;
         jT808UploadLocationRequest.Lng        = 132444444;
         jT808UploadLocationRequest.Speed      = 60;
         jT808UploadLocationRequest.Direction  = 0;
         jT808UploadLocationRequest.StatusFlag = 2;
         jT808UploadLocationRequest.JT808LocationAttachData = new Dictionary <byte, JT808_0x0200_BodyBase>();
         jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x01, new JT808_0x0200_0x01
         {
             Mileage = 100
         });
         jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x02, new JT808_0x0200_0x02
         {
             Oil = 55
         });
         jT808Package.Bodies = jT808UploadLocationRequest;
         var result = JT808Serializer.Serialize(jT808Package);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 位置信息汇报
        /// </summary>
        /// <returns></returns>
        static JT808Package GetJT808PositionData()
        {
            JT808Package jT808Package = new JT808Package();

            jT808Package.Header = new JT808Header
            {
                MsgId           = (ushort)JT808.Protocol.Enums.JT808MsgId.位置信息汇报,
                ManualMsgNum    = 0,
                TerminalPhoneNo = "123456789012"
            };

            JT808_0x0200 jT808_0x0200 = new JT808_0x0200();

            jT808_0x0200.AlarmFlag  = 1;
            jT808_0x0200.Altitude   = 40;
            jT808_0x0200.GPSTime    = DateTime.Parse("2018-10-15 10:10:10");
            jT808_0x0200.Lat        = 12222222;
            jT808_0x0200.Lng        = 132444444;
            jT808_0x0200.Speed      = 60;
            jT808_0x0200.Direction  = 0;
            jT808_0x0200.StatusFlag = 2;
            jT808_0x0200.CustomLocationAttachData = new Dictionary <byte, JT808_0x0200_CustomBodyBase>();

            jT808Package.Bodies = jT808_0x0200;

            return(jT808Package);
        }
Ejemplo n.º 5
0
        public void Test5_1()
        {
            JT808Package jT808Package = new JT808Package();

            jT808Package.Header = new JT808Header
            {
                MsgId           = Enums.JT808MsgId.位置信息汇报.ToUInt16Value(),
                MsgNum          = 8888,
                TerminalPhoneNo = "112233445566",
                //MessageBodyProperty=new JT808MessageBodyProperty(38),
            };
            JT808_0x0200 jT808UploadLocationRequest = new JT808_0x0200
            {
                AlarmFlag  = 1,
                Altitude   = 40,
                GPSTime    = DateTime.Parse("2018-07-15 10:10:10"),
                Lat        = 12222222,
                Lng        = 132444444,
                Speed      = 60,
                Direction  = 0,
                StatusFlag = 2,
                JT808LocationAttachData = new Dictionary <byte, JT808_0x0200_BodyBase>()
            };

            jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x01, new JT808_0x0200_0x01
            {
                Mileage = 100
            });
            jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x02, new JT808_0x0200_0x02
            {
                Oil = 55
            });
            jT808Package.Bodies = jT808UploadLocationRequest;
            var hex = JT808Serializer.Serialize(jT808Package).ToHexString();
        }
Ejemplo n.º 6
0
        public void Test2_1_1()
        {
            byte[] bytes        = "7E0200006A0011223344550001000000010000000200BA7F0E07E4F11C0028003C000021083018171001040000006402020037DF42000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000677E".ToHexBytes();
            var    jT808Package = JT808Serializer.Deserialize <JT808Package>(bytes);

            Assert.Equal(Enums.JT808MsgId.位置信息汇报.ToValue(), jT808Package.Header.MsgId);
            Assert.Equal(1u, jT808Package.Header.MsgNum);
            Assert.Equal("1122334455", jT808Package.Header.TerminalPhoneNo);
            JT808_0x0200 jT808UploadLocationRequest = (JT808_0x0200)jT808Package.Bodies;

            Assert.Equal(1u, jT808UploadLocationRequest.AlarmFlag);
            Assert.Equal(40u, jT808UploadLocationRequest.Altitude);
            Assert.Equal(DateTime.Parse("2021-08-30 18:17:10"), jT808UploadLocationRequest.GPSTime);
            Assert.Equal(12222222, jT808UploadLocationRequest.Lat);
            Assert.Equal(132444444, jT808UploadLocationRequest.Lng);
            Assert.Equal(60, jT808UploadLocationRequest.Speed);
            Assert.Equal(2u, jT808UploadLocationRequest.StatusFlag);
            Assert.Equal(100, ((JT808_0x0200_0x01)jT808UploadLocationRequest.BasicLocationAttachData[JT808Constants.JT808_0x0200_0x01]).Mileage);
            Assert.Equal(55, ((JT808_0x0200_0x02)jT808UploadLocationRequest.BasicLocationAttachData[JT808Constants.JT808_0x0200_0x02]).Oil);
            var jT808LocationAttachImpl0XDF = (JT808LocationAttachImpl0xDF)jT808UploadLocationRequest.CustomLocationAttachData[0xDF];

            Assert.Equal(0xDF, jT808LocationAttachImpl0XDF.AttachInfoId);
            Assert.Equal(new byte[66], jT808LocationAttachImpl0XDF.TestValue);
            Assert.Equal(66u, jT808LocationAttachImpl0XDF.AttachInfoLength);
        }
Ejemplo n.º 7
0
Archivo: Demo2.cs Proyecto: rench/JT808
        public void Test1()
        {
            //1.转成byte数组
            byte[] bytes = "7E 02 00 00 26 12 34 56 78 90 12 00 7D 02 00 00 00 01 00 00 00 02 00 BA 7F 0E 07 E4 F1 1C 00 28 00 3C 00 00 18 10 15 10 10 10 01 04 00 00 00 64 02 02 00 7D 01 13 7E".ToHexBytes();

            //2.将数组反序列化
            var jT808Package = JT808Serializer.Deserialize <JT808Package>(bytes);

            //3.数据包头
            Assert.Equal(Enums.JT808MsgId.位置信息汇报.ToValue(), jT808Package.Header.MsgId);
            Assert.Equal(38, jT808Package.Header.MessageBodyProperty.DataLength);
            Assert.Equal(126, jT808Package.Header.MsgNum);
            Assert.Equal("123456789012", jT808Package.Header.TerminalPhoneNo);
            Assert.False(jT808Package.Header.MessageBodyProperty.IsPackge);
            Assert.Equal(0, jT808Package.Header.MessageBodyProperty.PackageIndex);
            Assert.Equal(0, jT808Package.Header.MessageBodyProperty.PackgeCount);
            Assert.Equal(JT808EncryptMethod.None, jT808Package.Header.MessageBodyProperty.Encrypt);

            //4.数据包体
            JT808_0x0200 jT808_0x0200 = (JT808_0x0200)jT808Package.Bodies;

            Assert.Equal((uint)1, jT808_0x0200.AlarmFlag);
            Assert.Equal((uint)40, jT808_0x0200.Altitude);
            Assert.Equal(DateTime.Parse("2018-10-15 10:10:10"), jT808_0x0200.GPSTime);
            Assert.Equal(12222222, jT808_0x0200.Lat);
            Assert.Equal(132444444, jT808_0x0200.Lng);
            Assert.Equal(60, jT808_0x0200.Speed);
            Assert.Equal(0, jT808_0x0200.Direction);
            Assert.Equal((uint)2, jT808_0x0200.StatusFlag);
            //4.1.附加信息1
            Assert.Equal(100, ((JT808_0x0200_0x01)jT808_0x0200.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x01]).Mileage);
            //4.2.附加信息2
            Assert.Equal(125, ((JT808_0x0200_0x02)jT808_0x0200.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x02]).Oil);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 位置信息汇报
        /// </summary>
        /// <param name="client"></param>
        /// <param name="bodies"></param>
        /// <param name="minBufferSize"></param>
        public static void Send(this JT808TcpClient client, JT808_0x0200 bodies, int minBufferSize = 200)
        {
            JT808Header header = new JT808Header();

            header.MsgId = JT808MsgId.位置信息汇报.ToUInt16Value();
            client.Send(header, bodies, minBufferSize);
        }
Ejemplo n.º 9
0
        public void Test_Mix_2()
        {
            byte[] bytes        = "7E020002050011223344550001000000010000000200BA7F0E07E4F11C0028003C000021083018171001040000006402020037DF4200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000DE4200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000DD0042000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000620000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000CA01FFCB02FFFECD02FFFE587E".ToHexBytes();
            var    jT808Package = JT808Serializer.Deserialize <JT808Package>(bytes);

            Assert.Equal(Enums.JT808MsgId.位置信息汇报.ToValue(), jT808Package.Header.MsgId);
            Assert.Equal(1u, jT808Package.Header.MsgNum);
            Assert.Equal("1122334455", jT808Package.Header.TerminalPhoneNo);
            JT808_0x0200 jT808UploadLocationRequest = (JT808_0x0200)jT808Package.Bodies;

            Assert.Equal(1u, jT808UploadLocationRequest.AlarmFlag);
            Assert.Equal(40u, jT808UploadLocationRequest.Altitude);
            Assert.Equal(DateTime.Parse("2021-08-30 18:17:10"), jT808UploadLocationRequest.GPSTime);
            Assert.Equal(12222222, jT808UploadLocationRequest.Lat);
            Assert.Equal(132444444, jT808UploadLocationRequest.Lng);
            Assert.Equal(60, jT808UploadLocationRequest.Speed);
            Assert.Equal(2u, jT808UploadLocationRequest.StatusFlag);
            Assert.Equal(100, ((JT808_0x0200_0x01)jT808UploadLocationRequest.BasicLocationAttachData[JT808Constants.JT808_0x0200_0x01]).Mileage);
            Assert.Equal(55, ((JT808_0x0200_0x02)jT808UploadLocationRequest.BasicLocationAttachData[JT808Constants.JT808_0x0200_0x02]).Oil);

            var jT808LocationAttachImpl0X62 = (JT808LocationAttachImpl0x62)jT808UploadLocationRequest.CustomLocationAttachData4[0x62];

            Assert.Equal(0x62, jT808LocationAttachImpl0X62.AttachInfoId);
            Assert.Equal(new byte[256], jT808LocationAttachImpl0X62.Data);
            Assert.Equal(256u, jT808LocationAttachImpl0X62.AttachInfoLength);

            var jT808LocationAttachImpl0XDE = (JT808LocationAttachImpl0xDE)jT808UploadLocationRequest.CustomLocationAttachData2[0xDE];

            Assert.Equal(0xDE, jT808LocationAttachImpl0XDE.AttachInfoId);
            Assert.Equal(new byte[66], jT808LocationAttachImpl0XDE.TestValue);
            Assert.Equal(66u, jT808LocationAttachImpl0XDE.AttachInfoLength);

            var jT808LocationAttachImpl0XDD = (JT808LocationAttachImpl0xDD)jT808UploadLocationRequest.CustomLocationAttachData3[0xDD];

            Assert.Equal(0xDD, jT808LocationAttachImpl0XDD.AttachInfoId);
            Assert.Equal(new byte[66], jT808LocationAttachImpl0XDD.TestValue);
            Assert.Equal(66u, jT808LocationAttachImpl0XDD.AttachInfoLength);

            var jT808LocationAttachImpl0XDF = (JT808LocationAttachImpl0xDF)jT808UploadLocationRequest.CustomLocationAttachData[0xDF];

            Assert.Equal(0xDF, jT808LocationAttachImpl0XDF.AttachInfoId);
            Assert.Equal(new byte[66], jT808LocationAttachImpl0XDF.TestValue);
            Assert.Equal(66u, jT808LocationAttachImpl0XDF.AttachInfoLength);

            Assert.True(jT808UploadLocationRequest.UnknownLocationAttachData.ContainsKey(0xCA));
            Assert.True(jT808UploadLocationRequest.UnknownLocationAttachData.ContainsKey(0xCB));
            Assert.Equal(new byte[3] {
                0xCA, 0x1, 0xFF
            }, jT808UploadLocationRequest.UnknownLocationAttachData[0xCA]);
            Assert.Equal(new byte[4] {
                0xCB, 0x2, 0xFF, 0xFE
            }, jT808UploadLocationRequest.UnknownLocationAttachData[0xCB]);
            //理论上组包的时候不会添加异常的原始数据下去
            Assert.Equal(new byte[4] {
                0xCD, 0x2, 0xFF, 0xFE
            }, jT808UploadLocationRequest.UnknownLocationAttachData[0xCD]);
            Assert.Empty(jT808UploadLocationRequest.ExceptionLocationAttachOriginalData);
        }
Ejemplo n.º 10
0
        public void Serializer()
        {
            JT808_0x0200 jT808UploadLocationRequest = new JT808_0x0200
            {
                AlarmFlag  = 1,
                Altitude   = 40,
                GPSTime    = DateTime.Parse("2018-07-15 10:10:10"),
                Lat        = 12222222,
                Lng        = 132444444,
                Speed      = 60,
                Direction  = 0,
                StatusFlag = 2,
                BasicLocationAttachData = new Dictionary <byte, JT808_0x0200_BodyBase>()
            };

            jT808UploadLocationRequest.BasicLocationAttachData.Add(JT808_YueBiao_Constants.JT808_0X0200_0x66, new JT808_0x0200_0x66
            {
                AlarmId             = 1,
                AlarmIdentification = new Metadata.AlarmIdentificationProperty
                {
                    AttachCount = 2,
                    SN          = 3,
                    TerminalId  = "4444444",
                    Time        = Convert.ToDateTime("2019-12-10 18:31:00"),
                    Retain1     = 5,
                    Retain2     = 6
                },
                AlarmTime         = Convert.ToDateTime("2019-12-11 18:31:00"),
                Altitude          = 7,
                AlarmOrEventCount = 2,
                AlarmOrEvents     = new List <Metadata.AlarmOrEventProperty> {
                    new Metadata.AlarmOrEventProperty {
                        AlarmOrEventType          = 1,
                        BatteryLevel              = 2,
                        TirePressure              = 3,
                        TirePressureAlarmPosition = 4,
                        TireTemperature           = 5
                    },
                    new Metadata.AlarmOrEventProperty {
                        AlarmOrEventType          = 6,
                        BatteryLevel              = 7,
                        TirePressure              = 8,
                        TirePressureAlarmPosition = 9,
                        TireTemperature           = 10
                    }
                },
                FlagState    = 12,
                Latitude     = 13,
                Longitude    = 14,
                Speed        = 17,
                VehicleState = 19
            });
            var hex = JT808Serializer.Serialize(jT808UploadLocationRequest).ToHexString();

            Assert.Equal("000000010000000200BA7F0E07E4F11C0028003C00001807151010106655000000010C1100070000000D0000000E1912111831000013343434343434340000000000000000000000000000000000000000000000191210183100030205060200040001000300050002000900060008000A0007", hex);
        }
Ejemplo n.º 11
0
        public void LatTest1_2()
        {
            byte[]       bodys = "0000000110000000FF4580F207E4F11C0028003C0000180715101010".ToHexBytes();
            JT808_0x0200 jT808UploadLocationRequest = JT808Serializer.Deserialize <JT808_0x0200>(bodys);

            Assert.Equal(1u, jT808UploadLocationRequest.AlarmFlag);
            Assert.Equal((uint)0x10000000, jT808UploadLocationRequest.StatusFlag);
            Assert.Equal(DateTime.Parse("2018-07-15 10:10:10"), jT808UploadLocationRequest.GPSTime);
            Assert.Equal(-12222222, jT808UploadLocationRequest.Lat);
            Assert.Equal(132444444, jT808UploadLocationRequest.Lng);
            Assert.Equal(60, jT808UploadLocationRequest.Speed); //‭402653184‬
        }
Ejemplo n.º 12
0
        public void LngTest3_2()
        {
            byte[]       bodys = "000000010800660100BA7F0EF81B0EE40028003C0000180715101010".ToHexBytes();
            JT808_0x0200 jT808UploadLocationRequest = JT808Serializer.Deserialize <JT808_0x0200>(bodys);

            Assert.Equal(1u, jT808UploadLocationRequest.AlarmFlag);
            Assert.Equal((uint)(0x8000000 | 0x6601), jT808UploadLocationRequest.StatusFlag);
            Assert.Equal(DateTime.Parse("2018-07-15 10:10:10"), jT808UploadLocationRequest.GPSTime);
            Assert.Equal(12222222, jT808UploadLocationRequest.Lat);
            Assert.Equal(-132444444, jT808UploadLocationRequest.Lng);
            Assert.Equal(60, jT808UploadLocationRequest.Speed); //‭402653184‬
        }
Ejemplo n.º 13
0
        public void Test_Repeat_1()
        {
            JT808Package jT808Package = new JT808Package();

            jT808Package.Header = new JT808Header
            {
                MsgId           = Enums.JT808MsgId.位置信息汇报.ToUInt16Value(),
                ManualMsgNum    = 1,
                TerminalPhoneNo = "1122334455",
            };
            JT808_0x0200 jT808UploadLocationRequest = new JT808_0x0200
            {
                AlarmFlag  = 1,
                Altitude   = 40,
                GPSTime    = DateTime.Parse("2021-08-30 18:17:10"),
                Lat        = 12222222,
                Lng        = 132444444,
                Speed      = 60,
                Direction  = 0,
                StatusFlag = 2,
                BasicLocationAttachData             = new Dictionary <byte, JT808_0x0200_BodyBase>(),
                CustomLocationAttachData            = new Dictionary <byte, JT808_0x0200_CustomBodyBase>(),
                CustomLocationAttachData2           = new Dictionary <ushort, JT808_0x0200_CustomBodyBase2>(),
                CustomLocationAttachData3           = new Dictionary <ushort, JT808_0x0200_CustomBodyBase3>(),
                CustomLocationAttachData4           = new Dictionary <byte, JT808_0x0200_CustomBodyBase4>(),
                UnknownLocationAttachData           = new Dictionary <ushort, byte[]>(),
                ExceptionLocationAttachOriginalData = new List <byte[]>()
            };

            jT808UploadLocationRequest.BasicLocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01
            {
                Mileage = 100
            });
            jT808UploadLocationRequest.BasicLocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02
            {
                Oil = 55
            });
            jT808UploadLocationRequest.CustomLocationAttachData.Add(0xDF, new JT808LocationAttachImpl0xDF
            {
                TestValue = new byte[66]
            });
            jT808UploadLocationRequest.UnknownLocationAttachData.Add(0xDF, new byte[3] {
                0xDF, 0x1, 0xFF
            });
            jT808UploadLocationRequest.UnknownLocationAttachData.Add(0xCB, new byte[4] {
                0xCB, 0x2, 0xFF, 0xFE
            });
            jT808Package.Bodies = jT808UploadLocationRequest;
            var hex = JT808Serializer.Serialize(jT808Package).ToHexString();

            Assert.Equal("7E020000710011223344550001000000010000000200BA7F0E07E4F11C0028003C000021083018171001040000006402020037DF42000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000DF01FFCB02FFFE957E", hex);
        }
Ejemplo n.º 14
0
        public void Test_0x15_2()
        {
            byte[]       bodys = "000000010000000200BA7F0E07E4F11C0028003C0000200131202020150400000003".ToHexBytes();
            JT808_0x0200 jT808UploadLocationRequest = JT808Serializer.Deserialize <JT808_0x0200>(bodys);

            Assert.Equal((uint)1, jT808UploadLocationRequest.AlarmFlag);
            Assert.Equal(DateTime.Parse("2020-01-31 20:20:20"), jT808UploadLocationRequest.GPSTime);
            Assert.Equal(12222222, jT808UploadLocationRequest.Lat);
            Assert.Equal(132444444, jT808UploadLocationRequest.Lng);
            Assert.Equal(60, jT808UploadLocationRequest.Speed);
            Assert.Equal((uint)2, jT808UploadLocationRequest.StatusFlag);
            Assert.Equal(3u, ((JT808_0x0200_0x15)jT808UploadLocationRequest.BasicLocationAttachData[JT808_JT1078_Constants.JT808_0X0200_0x15]).VideoSignalLoseAlarmStatus);
        }
Ejemplo n.º 15
0
        public void Test_0x14_2()
        {
            byte[]       bodys = "000000010000000200BA7F0E07E4F11C0028003C000020013120202014040000000A".ToHexBytes();
            JT808_0x0200 jT808UploadLocationRequest = JT808Serializer.Deserialize <JT808_0x0200>(bodys);

            Assert.Equal((uint)1, jT808UploadLocationRequest.AlarmFlag);
            Assert.Equal(DateTime.Parse("2020-01-31 20:20:20"), jT808UploadLocationRequest.GPSTime);
            Assert.Equal(12222222, jT808UploadLocationRequest.Lat);
            Assert.Equal(132444444, jT808UploadLocationRequest.Lng);
            Assert.Equal(60, jT808UploadLocationRequest.Speed);
            Assert.Equal((uint)2, jT808UploadLocationRequest.StatusFlag);
            Assert.Equal((uint)(VideoRelateAlarmType.视频信号遮挡报警 | VideoRelateAlarmType.其他视频设备故障报警), ((JT808_0x0200_0x14)jT808UploadLocationRequest.BasicLocationAttachData[JT808_JT1078_Constants.JT808_0X0200_0x14]).VideoRelateAlarm);
        }
Ejemplo n.º 16
0
        public void Test3()
        {
            //00 00 00 01
            //00 00 00 02
            //00 BA 7F 0E
            //07 E4 F1 1C
            //00 28
            //00 3C
            //00 00
            //18 07 15 10 10 10
            //01
            //  04
            //      00 00 00 64
            //02
            //  02
            //      00 37
            //06
            //  0D
            //      00 00 00 12 01 73 6D 61 6C 6C 63 68 69"
            JT808_0x0200 jT808UploadLocationRequest = new JT808_0x0200
            {
                AlarmFlag  = 1,
                Altitude   = 40,
                GPSTime    = DateTime.Parse("2018-07-15 10:10:10"),
                Lat        = 12222222,
                Lng        = 132444444,
                Speed      = 60,
                Direction  = 0,
                StatusFlag = 2,
                JT808LocationAttachData       = new Dictionary <byte, JT808_0x0200_BodyBase>(),
                JT808CustomLocationAttachData = new Dictionary <byte, JT808_0x0200_CustomBodyBase>()
            };

            jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01
            {
                Mileage = 100
            });
            jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02
            {
                Oil = 55
            });
            jT808UploadLocationRequest.JT808CustomLocationAttachData.Add(0x06, new JT808LocationAttachImpl0x06
            {
                Age      = 18,
                Gender   = 1,
                UserName = "******"
            });
            var hex = JT808Serializer.Serialize(jT808UploadLocationRequest).ToHexString();

            Assert.Equal("000000010000000200BA7F0E07E4F11C0028003C000018071510101001040000006402020037060D0000001201736D616C6C636869", hex);
        }
Ejemplo n.º 17
0
        public void Test1_1()
        {
            byte[]       bodys = "000000010000000200BA7F0E07E4F11C0028003C0000210403111010000400010203000C303132333435363738393132".ToHexBytes();
            JT808_0x0200 jT808UploadLocationRequest = JT808Serializer.Deserialize <JT808_0x0200>(bodys);

            Assert.Equal((uint)1, jT808UploadLocationRequest.AlarmFlag);
            Assert.Equal(DateTime.Parse("2021-04-03 11:10:10"), jT808UploadLocationRequest.GPSTime);
            Assert.Equal(12222222, jT808UploadLocationRequest.Lat);
            Assert.Equal(132444444, jT808UploadLocationRequest.Lng);
            Assert.Equal(60, jT808UploadLocationRequest.Speed);
            Assert.Equal((uint)2, jT808UploadLocationRequest.StatusFlag);
            Assert.Equal(new byte[] { 0, 1, 2, 3 }, ((JT808LocationAttachImpl0x00)jT808UploadLocationRequest.JT808CustomLocationAttachData[0x00]).TestValue);
            Assert.Equal("012345678912", ((JT808LocationAttachImpl0x00)jT808UploadLocationRequest.ExceptionLocationAttachData[0]).TestId);
        }
Ejemplo n.º 18
0
        public void Test2()
        {
            byte[]       bodys = "00 00 00 01 00 00 00 02 00 BA 7F 0E 07 E4 F1 1C 00 28 00 3C 00 00 18 07 15 10 10 10 01 04 00 00 00 64 02 02 00 37".ToHexBytes();
            JT808_0x0200 jT808UploadLocationRequest = JT808Serializer.Deserialize <JT808_0x0200>(bodys);

            Assert.Equal((uint)1, jT808UploadLocationRequest.AlarmFlag);
            Assert.Equal(DateTime.Parse("2018-07-15 10:10:10"), jT808UploadLocationRequest.GPSTime);
            Assert.Equal(12222222, jT808UploadLocationRequest.Lat);
            Assert.Equal(132444444, jT808UploadLocationRequest.Lng);
            Assert.Equal(60, jT808UploadLocationRequest.Speed);
            Assert.Equal((uint)2, jT808UploadLocationRequest.StatusFlag);
            Assert.Equal(100, ((JT808_0x0200_0x01)jT808UploadLocationRequest.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x01]).Mileage);
            Assert.Equal(55, ((JT808_0x0200_0x02)jT808UploadLocationRequest.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x02]).Oil);
        }
Ejemplo n.º 19
0
        public void Test5()
        {
            //7E
            //02 00
            //00 33
            //11 22 33 44 55 66
            //22 B8
            //00 00 00 01
            //00 00 00 02
            //00 BA 7F 0E
            //07 E4 F1 1C
            //00 28
            //00 3C
            //00 00
            //18 07 15 10 10 10
            //01
            //  04
            //     00 00 00 64
            //02
            //   02
            //     00 37
            //42 7E


            byte[] bytes        = "7E 02 00 00 26 11 22 33 44 55 66 22 B8 00 00 00 01 00 00 00 02 00 BA 7F 0E 07 E4 F1 1C 00 28 00 3C 00 00 18 07 15 10 10 10 01 04 00 00 00 64 02 02 00 37 57 7E".ToHexBytes();
            var    jT808Package = JT808Serializer.Deserialize <JT808Package>(bytes);

            Assert.Equal(Enums.JT808MsgId.位置信息汇报.ToValue(), jT808Package.Header.MsgId);

            Assert.Equal(38, jT808Package.Header.MessageBodyProperty.DataLength);
            Assert.Equal(8888, jT808Package.Header.MsgNum);
            Assert.Equal("112233445566", jT808Package.Header.TerminalPhoneNo);
            //Assert.Equal(1, jT808Package.Header.MessageBodyProperty.DataLength);
            Assert.False(jT808Package.Header.MessageBodyProperty.IsPackge);
            Assert.Equal(0, jT808Package.Header.MessageBodyProperty.PackageIndex);
            Assert.Equal(0, jT808Package.Header.MessageBodyProperty.PackgeCount);
            Assert.Equal(JT808EncryptMethod.None, jT808Package.Header.MessageBodyProperty.Encrypt);

            JT808_0x0200 jT808UploadLocationRequest = (JT808_0x0200)jT808Package.Bodies;

            Assert.Equal((uint)1, jT808UploadLocationRequest.AlarmFlag);
            Assert.Equal(DateTime.Parse("2018-07-15 10:10:10"), jT808UploadLocationRequest.GPSTime);
            Assert.Equal(12222222, jT808UploadLocationRequest.Lat);
            Assert.Equal(132444444, jT808UploadLocationRequest.Lng);
            Assert.Equal(60, jT808UploadLocationRequest.Speed);
            Assert.Equal((uint)2, jT808UploadLocationRequest.StatusFlag);
            Assert.Equal(100, ((JT808_0x0200_0x01)jT808UploadLocationRequest.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x01]).Mileage);
            Assert.Equal(55, ((JT808_0x0200_0x02)jT808UploadLocationRequest.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x02]).Oil);
        }
Ejemplo n.º 20
0
        public void Test2()
        {
            byte[]       bodys = "000000010000000200BA7F0E07E4F11C0028003C00001807151010101404000000641504000000641604000000641702006418020064".ToHexBytes();
            JT808_0x0200 jT808UploadLocationRequest = JT808Serializer.Deserialize <JT808_0x0200>(bodys);

            Assert.Equal(1u, jT808UploadLocationRequest.AlarmFlag);
            Assert.Equal(DateTime.Parse("2018-07-15 10:10:10"), jT808UploadLocationRequest.GPSTime);
            Assert.Equal(12222222, jT808UploadLocationRequest.Lat);
            Assert.Equal(132444444, jT808UploadLocationRequest.Lng);
            Assert.Equal(60, jT808UploadLocationRequest.Speed);
            Assert.Equal(2u, jT808UploadLocationRequest.StatusFlag);
            Assert.Equal(100u, ((JT808_0x0200_0x14)jT808UploadLocationRequest.JT808LocationAttachData[0x14]).VideoRelateAlarm);
            Assert.Equal(100u, ((JT808_0x0200_0x15)jT808UploadLocationRequest.JT808LocationAttachData[0x15]).VideoSignalLoseAlarmStatus);
            Assert.Equal(100u, ((JT808_0x0200_0x16)jT808UploadLocationRequest.JT808LocationAttachData[0x16]).VideoSignalOcclusionAlarmStatus);
            Assert.Equal(100u, ((JT808_0x0200_0x17)jT808UploadLocationRequest.JT808LocationAttachData[0x17]).StorageFaultAlarmStatus);
            Assert.Equal(100u, ((JT808_0x0200_0x18)jT808UploadLocationRequest.JT808LocationAttachData[0x18]).AbnormalDrivingBehaviorAlarmInfo);
        }
Ejemplo n.º 21
0
        public void Serializer()
        {
            JT808_0x0200 jT808UploadLocationRequest = new JT808_0x0200
            {
                AlarmFlag  = 1,
                Altitude   = 40,
                GPSTime    = DateTime.Parse("2018-07-15 10:10:10"),
                Lat        = 12222222,
                Lng        = 132444444,
                Speed      = 60,
                Direction  = 0,
                StatusFlag = 2,
                BasicLocationAttachData = new Dictionary <byte, JT808_0x0200_BodyBase>()
            };

            jT808UploadLocationRequest.BasicLocationAttachData.Add(JT808_YueBiao_Constants.JT808_0X0200_0x64, new JT808_0x0200_0x64
            {
                AlarmId             = 1,
                AlarmIdentification = new Metadata.AlarmIdentificationProperty
                {
                    AttachCount = 2,
                    SN          = 3,
                    TerminalId  = "4444444",
                    Time        = Convert.ToDateTime("2019-12-10 18:31:00"),
                    Retain1     = 5,
                    Retain2     = 6
                },
                AlarmLevel                   = 5,
                AlarmOrEventType             = 6,
                AlarmTime                    = Convert.ToDateTime("2019-12-11 18:31:00"),
                Altitude                     = 7,
                CarOrPedestrianDistanceAhead = 10,
                DeviateType                  = 11,
                FlagState                    = 12,
                Latitude                     = 13,
                Longitude                    = 14,
                RoadSignIdentificationData   = 15,
                RoadSignIdentificationType   = 16,
                Speed        = 17,
                VehicleSpeed = 18,
                VehicleState = 19
            });
            var hex = JT808Serializer.Serialize(jT808UploadLocationRequest).ToHexString();

            Assert.Equal("000000010000000200BA7F0E07E4F11C0028003C00001807151010106447000000010C0605120A0B100F1100070000000D0000000E191211183100001334343434343434000000000000000000000000000000000000000000000019121018310003020506", hex);
        }
Ejemplo n.º 22
0
        public void Test3()
        {
            //00 00 00 01
            //00 00 00 02
            //00 BA 7F 0E
            //07 E4 F1 1C
            //00 28
            //00 3C
            //00 00
            //18 07 15 10 10 10
            //01
            //  04
            //      00 00 00 64
            //02
            //  02
            //      00 37
            //06
            //  0D
            //      00 00 00 12 01 00 00 00 00 00 00 00 00"
            JT808_0x0200 jT808UploadLocationRequest = new JT808_0x0200();

            jT808UploadLocationRequest.AlarmFlag  = 1;
            jT808UploadLocationRequest.Altitude   = 40;
            jT808UploadLocationRequest.GPSTime    = DateTime.Parse("2018-07-15 10:10:10");
            jT808UploadLocationRequest.Lat        = 12222222;
            jT808UploadLocationRequest.Lng        = 132444444;
            jT808UploadLocationRequest.Speed      = 60;
            jT808UploadLocationRequest.Direction  = 0;
            jT808UploadLocationRequest.StatusFlag = 2;
            jT808UploadLocationRequest.JT808LocationAttachData = new Dictionary <byte, JT808LocationAttachBase>();
            jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808LocationAttachBase.AttachId0x01, new JT808LocationAttachImpl0x01
            {
                Mileage = 100
            });
            jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808LocationAttachBase.AttachId0x02, new JT808LocationAttachImpl0x02
            {
                Oil = 55
            });
            jT808UploadLocationRequest.JT808LocationAttachData.Add(0x06, new JT808LocationAttachImpl0x06
            {
                Age      = 18,
                Gender   = 1,
                UserName = "******"
            });
            var hex = JT808Serializer.Serialize(jT808UploadLocationRequest).ToHexString();
        }
Ejemplo n.º 23
0
        public void Test1()
        {
            JT808Package jT808Package = new JT808Package();

            jT808Package.Header = new JT808Header
            {
                MsgId           = Enums.JT808MsgId.位置信息汇报.ToUInt16Value(),
                ManualMsgNum    = 126,
                TerminalPhoneNo = "123456789012"
            };

            JT808_0x0200 jT808_0x0200 = new JT808_0x0200
            {
                AlarmFlag  = 1,
                Altitude   = 40,
                GPSTime    = DateTime.Parse("2018-10-15 10:10:10"),
                Lat        = 12222222,
                Lng        = 132444444,
                Speed      = 60,
                Direction  = 0,
                StatusFlag = 2,
                BasicLocationAttachData = new Dictionary <byte, JT808_0x0200_BodyBase>()
            };

            jT808_0x0200.BasicLocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01
            {
                Mileage = 100
            });

            jT808_0x0200.BasicLocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02
            {
                Oil = 125
            });

            jT808Package.Bodies = jT808_0x0200;

            byte[] data = JT808Serializer.Serialize(jT808Package);

            var hex = data.ToHexString();

            //"7E020000261234567890120001000000010000000200BA7F0E07E4F11C0028003C00001810151010100104000000640202007D016C7E"
            Assert.Equal("7E02000026123456789012007D02000000010000000200BA7F0E07E4F11C0028003C00001810151010100104000000640202007D01137E", hex);
            // 输出结果Hex:
            // 7E 02 00 00 26 12 34 56 78 90 12 00 7D 02 00 00 00 01 00 00 00 02 00 BA 7F 0E 07 E4 F1 1C 00 28 00 3C 00 00 18 10 15 10 10 10 01 04 00 00 00 64 02 02 00 7D 01 13 7E
        }
Ejemplo n.º 24
0
        public void Test7()
        {
            //"附加信息列表": [
            //  {
            //    "[01]附加信息Id": 1,
            //    "[04]附加信息长度": 4,
            //    "[000024C7]里程": 9415
            //  },
            //  {
            //    "[2B]附加信息Id": 43,
            //    "[04]附加信息长度": 4,
            //    "[0B290B29]模拟量": 187239209
            //  },
            //  {
            //     "[30]附加信息Id": 48,
            //    "[01]附加信息长度": 1,
            //    "[17]无线通信网络信号强度": 23
            //  },
            //  {
            //    "[31]附加信息Id": 49,
            //    "[01]附加信息长度": 1,
            //    "[1B]GNSS定位卫星数": 27
            //  },
            //  {
            //    "[00]未知附加信息Id": 0,                        坑爹,相同的
            //    "[04]未知附加信息长度": 4,
            //    "未知附加信息": "000400CE0B29"
            //  },
            //  {
            //    "[00]未知附加信息Id": 0,                        坑爹,相同的
            //    "[0C]未知附加信息长度": 12,
            //    "未知附加信息": "000C00B289860620150013559848"
            //  },
            //  {
            //    "[EB]未知附加信息Id": 235,
            //    "[0E]未知附加信息长度": 14,
            //    "未知附加信息": "EB0E000C00B289860620150013559848"
            //  }
            //]
            byte[]       bodys   = "7E020000520111111111100002000000000000000301789B3406238AFA0000018B00F62104020046090104000024C72B040B290B2930011731011B000400CE0B29000C00B289860620150013559848EB0E000C00B2898606201500135598486C7E".ToHexBytes();
            var          package = JT808Serializer1.Deserialize(bodys);
            JT808_0x0200 jT808UploadLocationRequest = (JT808_0x0200)package.Bodies;

            Assert.Single(jT808UploadLocationRequest.ExceptionLocationAttachOriginalData);
        }
Ejemplo n.º 25
0
        public void Test4()
        {
            // 1.添加自定义附加信息扩展 AddJT808LocationAttachMethod
            byte[]       bodys = "00 00 00 01 00 00 00 02 00 BA 7F 0E 07 E4 F1 1C 00 28 00 3C 00 00 18 07 15 10 10 10 01 04 00 00 00 64 02 02 00 37 06 0D 00 00 00 12 01 73 6D 61 6C 6C 63 68 69".ToHexBytes();
            JT808_0x0200 jT808UploadLocationRequest = JT808Serializer.Deserialize <JT808_0x0200>(bodys);

            Assert.Equal((uint)1, jT808UploadLocationRequest.AlarmFlag);
            Assert.Equal(DateTime.Parse("2018-07-15 10:10:10"), jT808UploadLocationRequest.GPSTime);
            Assert.Equal(12222222, jT808UploadLocationRequest.Lat);
            Assert.Equal(132444444, jT808UploadLocationRequest.Lng);
            Assert.Equal(60, jT808UploadLocationRequest.Speed);
            Assert.Equal((uint)2, jT808UploadLocationRequest.StatusFlag);
            Assert.Equal(100, ((JT808LocationAttachImpl0x01)jT808UploadLocationRequest.JT808LocationAttachData[JT808LocationAttachBase.AttachId0x01]).Mileage);
            Assert.Equal(55, ((JT808LocationAttachImpl0x02)jT808UploadLocationRequest.JT808LocationAttachData[JT808LocationAttachBase.AttachId0x02]).Oil);
            Assert.Equal(18, ((JT808LocationAttachImpl0x06)jT808UploadLocationRequest.JT808LocationAttachData[0x06]).Age);
            Assert.Equal(1, ((JT808LocationAttachImpl0x06)jT808UploadLocationRequest.JT808LocationAttachData[0x06]).Gender);
            Assert.Equal("smallchi", ((JT808LocationAttachImpl0x06)jT808UploadLocationRequest.JT808LocationAttachData[0x06]).UserName);
        }
Ejemplo n.º 26
0
        public void LngTest3_1()
        {
            JT808_0x0200 jT808UploadLocationRequest = new JT808_0x0200
            {
                AlarmFlag = 1,
                Altitude  = 40,
                GPSTime   = DateTime.Parse("2018-07-15 10:10:10"),
                Lat       = 12222222,
                Lng       = -132444444,
                Speed     = 60,
                Direction = 0,
                JT808LocationAttachData = new Dictionary <byte, JT808_0x0200_BodyBase>()
            };

            jT808UploadLocationRequest.StatusFlag = 0x8000000 | 0x6601;
            var hex = JT808Serializer.Serialize(jT808UploadLocationRequest).ToHexString();

            Assert.Equal("000000010800660100BA7F0EF81B0EE40028003C0000180715101010", hex);
        }
Ejemplo n.º 27
0
        public void LatTest1_1()
        {
            JT808_0x0200 jT808UploadLocationRequest = new JT808_0x0200
            {
                AlarmFlag = 1,
                Altitude  = 40,
                GPSTime   = DateTime.Parse("2018-07-15 10:10:10"),
                Lat       = -12222222,
                Lng       = 132444444,
                Speed     = 60,
                Direction = 0,
                JT808LocationAttachData = new Dictionary <byte, JT808_0x0200_BodyBase>()
            };

            jT808UploadLocationRequest.StatusFlag = 0x10000000;
            var hex = JT808Serializer.Serialize(jT808UploadLocationRequest).ToHexString();

            Assert.Equal("0000000110000000FF4580F207E4F11C0028003C0000180715101010", hex);
        }
Ejemplo n.º 28
0
        public void Test1()
        {
            JT808Package jT808Package = new JT808Package
            {
                Header = new JT808Header
                {
                    MsgId           = Enums.JT808MsgId.位置信息查询应答.ToUInt16Value(),
                    ManualMsgNum    = 8888,
                    TerminalPhoneNo = "112233445566",
                }
            };
            JT808_0x0201 jT808_0X0201 = new JT808_0x0201
            {
                ReplyMsgNum = 12345
            };
            JT808_0x0200 jT808UploadLocationRequest = new JT808_0x0200
            {
                AlarmFlag  = 1,
                Altitude   = 40,
                GPSTime    = DateTime.Parse("2018-07-15 10:10:10"),
                Lat        = 12222222,
                Lng        = 132444444,
                Speed      = 60,
                Direction  = 0,
                StatusFlag = 2,
                JT808LocationAttachData = new Dictionary <byte, JT808_0x0200_BodyBase>()
            };

            jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01
            {
                Mileage = 100
            });
            jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02
            {
                Oil = 55
            });
            jT808_0X0201.Position = jT808UploadLocationRequest;
            jT808Package.Bodies   = jT808_0X0201;
            var hex = JT808Serializer.Serialize(jT808Package).ToHexString();

            Assert.Equal("7E0201002811223344556622B83039000000010000000200BA7F0E07E4F11C0028003C000018071510101001040000006402020037517E".Length, hex.Length);
            Assert.Equal("7E0201002811223344556622B83039000000010000000200BA7F0E07E4F11C0028003C000018071510101001040000006402020037517E", hex);
        }
Ejemplo n.º 29
0
        public void Demo1()
        {
            JT808Package jT808Package = new JT808Package();

            jT808Package.Header = new JT808Header
            {
                MsgId           = Enums.JT808MsgId.位置信息汇报.ToUInt16Value(),
                MsgNum          = 126,
                TerminalPhoneNo = "123456789012"
            };

            JT808_0x0200 jT808_0x0200 = new JT808_0x0200();

            jT808_0x0200.AlarmFlag  = 1;
            jT808_0x0200.Altitude   = 40;
            jT808_0x0200.GPSTime    = DateTime.Parse("2018-10-15 10:10:10");
            jT808_0x0200.Lat        = 12222222;
            jT808_0x0200.Lng        = 132444444;
            jT808_0x0200.Speed      = 60;
            jT808_0x0200.Direction  = 0;
            jT808_0x0200.StatusFlag = 2;
            jT808_0x0200.JT808LocationAttachData = new Dictionary <byte, JT808LocationAttachBase>();

            jT808_0x0200.JT808LocationAttachData.Add(JT808LocationAttachBase.AttachId0x01, new JT808LocationAttachImpl0x01
            {
                Mileage = 100
            });

            jT808_0x0200.JT808LocationAttachData.Add(JT808LocationAttachBase.AttachId0x02, new JT808LocationAttachImpl0x02
            {
                Oil = 125
            });

            jT808Package.Bodies = jT808_0x0200;

            byte[] data = JT808Serializer.Serialize(jT808Package);

            var hex = data.ToHexString();

            Assert.Equal("7E02000026123456789012007D02000000010000000200BA7F0E07E4F11C0028003C00001810151010100104000000640202007D01137E", hex);
            // 输出结果Hex:
            // 7E 02 00 00 26 12 34 56 78 90 12 00 7D 02 00 00 00 01 00 00 00 02 00 BA 7F 0E 07 E4 F1 1C 00 28 00 3C 00 00 18 10 15 10 10 10 01 04 00 00 00 64 02 02 00 7D 01 13 7E
        }
Ejemplo n.º 30
0
        public void Test_2019_3()
        {
            JT808_0x0200 jT808UploadLocationRequest = new JT808_0x0200
            {
                AlarmFlag  = 1,
                Altitude   = 40,
                GPSTime    = DateTime.Parse("2018-07-15 10:10:10"),
                Lat        = 12222222,
                Lng        = 132444444,
                Speed      = 60,
                Direction  = 0,
                StatusFlag = 2,
                BasicLocationAttachData = new Dictionary <byte, JT808_0x0200_BodyBase>()
            };

            jT808UploadLocationRequest.BasicLocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01
            {
                Mileage = 100
            });
            jT808UploadLocationRequest.BasicLocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02
            {
                Oil = 55
            });
            var jt808_0x0200Hex = JT808_2019_Serializer.Serialize(jT808UploadLocationRequest, JT808.Protocol.Enums.JT808Version.JTT2019);

            JT809_0x1200_0x1202 jT809_0X1200_0X1202 = new JT809_0x1200_0x1202();

            jT809_0X1200_0X1202.VehiclePosition_2019 = new Metadata.JT809VehiclePositionProperties_2019
            {
                Encrypt     = JT809_VehiclePositionEncrypt.已加密,
                GnssData    = jt808_0x0200Hex,
                PlatformId1 = "11111111111",
                Alarm1      = 1,
                PlatformId2 = "22222222222",
                Alarm2      = 2,
                PlatformId3 = "33333333333",
                Alarm3      = 3,
            };
            var hex = JT809_2019_Serializer.Serialize(jT809_0X1200_0X1202).ToHexString();

            Assert.Equal("0100000026000000010000000200BA7F0E07E4F11C0028003C000018071510101001040000006402020037313131313131313131313100000001323232323232323232323200000002333333333333333333333300000003", hex);
        }