示例#1
0
        public void Test2()
        {
            var            data           = "07110000159D03000003E8000003E9000003EA03000007D0000007D1000007D20300000BB800000BB900000BBA0300000FA000000FA100000FA2".ToHexBytes();
            JTNE_0x02_0x07 jTNE_0X02_0X07 = JTNESerializer.Deserialize <JTNE_0x02_0x07>(data);

            Assert.Equal(JTNE_0x02_Body.JTNE_0x02_0x07, jTNE_0X02_0X07.TypeCode);
            Assert.Equal(0x11, jTNE_0X02_0X07.AlarmLevel);
            Assert.Equal(3, jTNE_0X02_0X07.AlarmBatteryOthers.Count);
            Assert.Equal(new List <uint>
            {
                1000, 1001, 1002
            }, jTNE_0X02_0X07.AlarmBatteryOthers);
            Assert.Equal(3, jTNE_0X02_0X07.AlarmEls.Count);
            Assert.Equal(new List <uint>
            {
                2000, 2001, 2002
            }, jTNE_0X02_0X07.AlarmEls);
            Assert.Equal(3, jTNE_0X02_0X07.AlarmEngines.Count);
            Assert.Equal(new List <uint>
            {
                3000, 3001, 3002
            }, jTNE_0X02_0X07.AlarmEngines);
            Assert.Equal(3, jTNE_0X02_0X07.AlarmOthers.Count);
            Assert.Equal(new List <uint>
            {
                4000, 4001, 4002
            }, jTNE_0X02_0X07.AlarmOthers);
        }
示例#2
0
 public void JTNE_0x02_Deserialize()
 {
     for (int i = 0; i < N; i++)
     {
         JTNEPackage jTNEPackage = JTNESerializer.Deserialize(bytes);
     }
 }
示例#3
0
        public void Test2()
        {
            var            data           = "0202010201004100370300EC0064020302004202360508580065".ToHexBytes();
            JTNE_0x02_0x02 jTNE_0X02_0X02 = JTNESerializer.Deserialize <JTNE_0x02_0x02>(data);

            Assert.Equal(JTNE_0x02_Body.JTNE_0x02_0x02, jTNE_0X02_0X02.TypeCode);
            Assert.Equal(2, jTNE_0X02_0X02.ElectricalCount);
            Metadata.Electrical electrical1 = jTNE_0X02_0X02.Electricals[0];
            Assert.Equal(0x01, electrical1.ElControlTemp);
            Assert.Equal(100, electrical1.ElCurrent);
            Assert.Equal(0x01, electrical1.ElNo);
            Assert.Equal(65, electrical1.ElSpeed);
            Assert.Equal(0x02, electrical1.ElStatus);
            Assert.Equal(0x03, electrical1.ElTemp);
            Assert.Equal(55, electrical1.ElTorque);
            Assert.Equal(236, electrical1.ElVoltage);
            Metadata.Electrical electrical2 = jTNE_0X02_0X02.Electricals[1];
            Assert.Equal(0x02, electrical2.ElControlTemp);
            Assert.Equal(101, electrical2.ElCurrent);
            Assert.Equal(0x02, electrical2.ElNo);
            Assert.Equal(66, electrical2.ElSpeed);
            Assert.Equal(0x03, electrical2.ElStatus);
            Assert.Equal(0x05, electrical2.ElTemp);
            Assert.Equal(566, electrical2.ElTorque);
            Assert.Equal(2136, electrical2.ElVoltage);
        }
示例#4
0
 protected override void ChannelRead0(IChannelHandlerContext ctx, byte[] msg)
 {
     try
     {
         JTNEPackage jtNePackage = JTNESerializer.Deserialize(msg);
         jTNETcpAtomicCounterService.MsgSuccessIncrement();
         if (logger.IsEnabled(LogLevel.Debug))
         {
             //logger.LogDebug(JsonConvert.SerializeObject(jtNePackage));
             logger.LogDebug("accept package success count<<<" + jTNETcpAtomicCounterService.MsgSuccessCount.ToString());
         }
     }
     catch (JTNE.Protocol.Exceptions.JTNEException ex)
     {
         jTNETcpAtomicCounterService.MsgFailIncrement();
         if (logger.IsEnabled(LogLevel.Error))
         {
             logger.LogError("accept package fail count<<<" + jTNETcpAtomicCounterService.MsgFailCount.ToString());
             logger.LogError(ex, "accept msg<<<" + ByteBufferUtil.HexDump(msg));
         }
     }
     catch (Exception ex)
     {
         jTNETcpAtomicCounterService.MsgFailIncrement();
         if (logger.IsEnabled(LogLevel.Error))
         {
             logger.LogError("accept package fail count<<<" + jTNETcpAtomicCounterService.MsgFailCount.ToString());
             logger.LogError(ex, "accept msg<<<" + ByteBufferUtil.HexDump(msg));
         }
     }
 }
示例#5
0
        public void Test1()
        {
            JTNE_0x02_0x09 jTNE_0X02_0X09 = new JTNE_0x02_0x09();

            jTNE_0X02_0X09.BatteryTemperatures = new List <Metadata.BatteryTemperature>();

            Metadata.BatteryTemperature batteryTemperature1 = new Metadata.BatteryTemperature();
            batteryTemperature1.BatteryAssemblyNo = 0x01;
            batteryTemperature1.Temperatures      = new byte[]
            {
                0x01, 0x02, 0x03, 0x04
            };

            Metadata.BatteryTemperature batteryTemperature2 = new Metadata.BatteryTemperature();
            batteryTemperature2.BatteryAssemblyNo = 0x02;
            batteryTemperature2.Temperatures      = new byte[]
            {
                0x05, 0x06, 0x07, 0x08
            };

            jTNE_0X02_0X09.BatteryTemperatures.Add(batteryTemperature1);
            jTNE_0X02_0X09.BatteryTemperatures.Add(batteryTemperature2);
            var hex = JTNESerializer.Serialize(jTNE_0X02_0X09).ToHexString();

            Assert.Equal("09020100040102030402000405060708", hex);
        }
示例#6
0
        public void Test1()
        {
            JTNEGlobalConfigs.Instance.Register_JTNE0x81CustomBody(0x80, typeof(JTNE_0x80Reply_0x80));
            JTNEGlobalConfigs.Instance.Register_JTNE0x81CustomBody(0x81, typeof(JTNE_0x80Reply_0x81));
            JTNEGlobalConfigs.Instance.Register_JTNE0x81CustomDepenedBody(0x81, 0x80);

            JTNE_0x80Reply jTNE_0x80Reply = new JTNE_0x80Reply();
            JTNE_0x81      jTNE_0X81      = new JTNE_0x81 {
                OperateTime = DateTime.Parse("2019-01-22 23:55:56"),
                ParamNum    = 2,
                ParamList   = new List <JTNE_0x81_Body> {
                    new JTNE_0x80Reply_0x80 {
                        ParamValue = 6
                    },
                    new JTNE_0x80Reply_0x81 {
                        ParamLength = 6,
                        ParamValue  = new byte[] { 1, 2, 3, 4, 5, 6 }
                    }
                }
            };

            jTNE_0x80Reply.JTNE_Reply0x80 = jTNE_0X81;
            var hex = JTNESerializer.Serialize(jTNE_0x80Reply).ToHexString();

            Assert.Equal("13011617373802800681010203040506", hex);
        }
        public void Test4()
        {
            JTNEGlobalConfigs.Instance.SetDataBodiesEncrypt((msgId) =>
            {
                switch (msgId)
                {
                case 0x03:
                    return(new Default_AES128EncryptImpl());

                default:
                    return(default);
                }
            });
            var         data        = "232301FE31323334353637383900000000000000000300307C9AAF67FB9408A75FAFC1C87F1E2AECD79DDAB8219016A5DD0911283922805EF450045EA3611C0D5CFBFD8F2581CEED30".ToHexBytes();
            JTNEPackage jTNEPackage = JTNESerializer.Deserialize(data);

            Assert.Equal(JTNEAskId.CMD.ToByteValue(), jTNEPackage.AskId);
            Assert.Equal(JTNEMsgId.login.ToByteValue(), jTNEPackage.MsgId);
            Assert.Equal("123456789", jTNEPackage.VIN);
            Assert.Equal(JTNEEncryptMethod.AES128.ToByteValue(), jTNEPackage.EncryptMethod);

            JTNE_0x01 jTNE_0X01 = jTNEPackage.Bodies as JTNE_0x01;

            Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X01.PDATime);
            Assert.Equal(1, jTNE_0X01.LoginNum);
            Assert.Equal(0x04, jTNE_0X01.BatteryLength);
            Assert.Equal("12345678998765432100", jTNE_0X01.SIM);
            Assert.Equal(3, jTNE_0X01.BatteryCount);
            Assert.Equal("1234", jTNE_0X01.BatteryNos[0]);
            Assert.Equal("4567", jTNE_0X01.BatteryNos[1]);
            Assert.Equal("9870", jTNE_0X01.BatteryNos[2]);
        }
示例#8
0
        public void Test2()
        {
            var            data           = "0802010002007B0037006F03006F00DE014D03000504D2004200DE0301BC022B029A".ToHexBytes();
            JTNE_0x02_0x08 jTNE_0X02_0X08 = JTNESerializer.Deserialize <JTNE_0x02_0x08>(data);

            Assert.Equal(JTNE_0x02_Body.JTNE_0x02_0x08, jTNE_0X02_0X08.TypeCode);
            Assert.Equal(2, jTNE_0X02_0X08.BatteryAssemblyCount);

            Metadata.BatteryAssembly batteryAssembly1 = jTNE_0X02_0X08.BatteryAssemblies[0];
            Assert.Equal(123, batteryAssembly1.BatteryAssemblyCurrent);
            Assert.Equal(0x01, batteryAssembly1.BatteryAssemblyNo);
            Assert.Equal(0x02, batteryAssembly1.BatteryAssemblyVoltage);
            Assert.Equal(55, batteryAssembly1.SingleBatteryCount);
            Assert.Equal(111, batteryAssembly1.ThisSingleBatteryBeginNo);
            Assert.Equal(3, batteryAssembly1.ThisSingleBatteryBeginCount);
            Assert.Equal(new List <ushort> {
                111, 222, 333
            }, batteryAssembly1.SingleBatteryVoltages);

            Metadata.BatteryAssembly batteryAssembly2 = jTNE_0X02_0X08.BatteryAssemblies[1];
            Assert.Equal(1234, batteryAssembly2.BatteryAssemblyCurrent);
            Assert.Equal(0x03, batteryAssembly2.BatteryAssemblyNo);
            Assert.Equal(0x05, batteryAssembly2.BatteryAssemblyVoltage);
            Assert.Equal(66, batteryAssembly2.SingleBatteryCount);
            Assert.Equal(222, batteryAssembly2.ThisSingleBatteryBeginNo);
            Assert.Equal(3, batteryAssembly2.ThisSingleBatteryBeginCount);
            Assert.Equal(new List <ushort> {
                444, 555, 666
            }, batteryAssembly2.SingleBatteryVoltages);
        }
示例#9
0
        public void Test1()
        {
            JTNE_0x02_0x07 jTNE_0X02_0X07 = new JTNE_0x02_0x07();

            jTNE_0X02_0X07.AlarmBatteryFlag   = 5533;
            jTNE_0X02_0X07.AlarmLevel         = 0x11;
            jTNE_0X02_0X07.AlarmBatteryOthers = new List <uint>
            {
                1000, 1001, 1002
            };
            jTNE_0X02_0X07.AlarmEls = new List <uint>
            {
                2000, 2001, 2002
            };
            jTNE_0X02_0X07.AlarmEngines = new List <uint>
            {
                3000, 3001, 3002
            };
            jTNE_0X02_0X07.AlarmOthers = new List <uint>
            {
                4000, 4001, 4002
            };
            var hex = JTNESerializer.Serialize(jTNE_0X02_0X07).ToHexString();

            Assert.Equal("07110000159D03000003E8000003E9000003EA03000007D0000007D1000007D20300000BB800000BB900000BBA0300000FA000000FA100000FA2", hex);
        }
示例#10
0
        public void Test1()
        {
            JTNE_0x02_0x08 jTNE_0X02_0X08 = new JTNE_0x02_0x08();

            jTNE_0X02_0X08.BatteryAssemblies = new List <Metadata.BatteryAssembly>();
            Metadata.BatteryAssembly batteryAssembly1 = new Metadata.BatteryAssembly();
            batteryAssembly1.BatteryAssemblyCurrent      = 123;
            batteryAssembly1.BatteryAssemblyNo           = 0x01;
            batteryAssembly1.BatteryAssemblyVoltage      = 0x02;
            batteryAssembly1.SingleBatteryCount          = 55;
            batteryAssembly1.ThisSingleBatteryBeginCount = 0x02;
            batteryAssembly1.ThisSingleBatteryBeginNo    = 111;
            batteryAssembly1.SingleBatteryVoltages       = new List <ushort> {
                111, 222, 333
            };
            Metadata.BatteryAssembly batteryAssembly2 = new Metadata.BatteryAssembly();
            batteryAssembly2.BatteryAssemblyCurrent      = 1234;
            batteryAssembly2.BatteryAssemblyNo           = 0x03;
            batteryAssembly2.BatteryAssemblyVoltage      = 0x05;
            batteryAssembly2.SingleBatteryCount          = 66;
            batteryAssembly2.ThisSingleBatteryBeginCount = 0x02;
            batteryAssembly2.ThisSingleBatteryBeginNo    = 222;
            batteryAssembly2.SingleBatteryVoltages       = new List <ushort> {
                444, 555, 666
            };
            jTNE_0X02_0X08.BatteryAssemblies.Add(batteryAssembly1);
            jTNE_0X02_0X08.BatteryAssemblies.Add(batteryAssembly2);
            var hex = JTNESerializer.Serialize(jTNE_0X02_0X08).ToHexString();

            Assert.Equal("0802010002007B0037006F03006F00DE014D03000504D2004200DE0301BC022B029A", hex);
        }
示例#11
0
        public void Test1()
        {
            JTNE_0x02_0x02 jTNE_0X02_0X02 = new JTNE_0x02_0x02();

            jTNE_0X02_0X02.Electricals = new List <Metadata.Electrical>();
            Metadata.Electrical electrical1 = new Metadata.Electrical();
            electrical1.ElControlTemp = 0x01;
            electrical1.ElCurrent     = 100;
            electrical1.ElNo          = 0x01;
            electrical1.ElSpeed       = 65;
            electrical1.ElStatus      = 0x02;
            electrical1.ElTemp        = 0x03;
            electrical1.ElTorque      = 55;
            electrical1.ElVoltage     = 236;
            Metadata.Electrical electrical2 = new Metadata.Electrical();
            electrical2.ElControlTemp = 0x02;
            electrical2.ElCurrent     = 101;
            electrical2.ElNo          = 0x02;
            electrical2.ElSpeed       = 66;
            electrical2.ElStatus      = 0x03;
            electrical2.ElTemp        = 0x05;
            electrical2.ElTorque      = 566;
            electrical2.ElVoltage     = 2136;
            jTNE_0X02_0X02.Electricals.Add(electrical1);
            jTNE_0X02_0X02.Electricals.Add(electrical2);
            var hex = JTNESerializer.Serialize(jTNE_0X02_0X02).ToHexString();

            Assert.Equal("0202010201004100370300EC0064020302004202360508580065", hex);
        }
示例#12
0
        public void Test2()
        {
            var       data      = "1301161737381A0A".ToHexBytes();
            JTNE_0x06 jTNE_0X06 = JTNESerializer.Deserialize <JTNE_0x06>(data);

            Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X06.LogoutTime);
            Assert.Equal(6666, jTNE_0X06.LogoutNum);
        }
示例#13
0
        public void Test2()
        {
            var       data      = "130116173738115C".ToHexBytes();
            JTNE_0x04 jTNE_0X04 = JTNESerializer.Deserialize <JTNE_0x04>(data);

            Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X04.LogoutTime);
            Assert.Equal(4444, jTNE_0X04.LogoutNum);
        }
示例#14
0
        public void Test2()
        {
            var       data      = "13011617373802".ToHexBytes();
            JTNE_0x82 jTNE_0X82 = JTNESerializer.Deserialize <JTNE_0x82>(data);

            Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X82.ControlTime);
            Assert.Equal(0x02, jTNE_0X82.ParamID);
        }
        public void Test2()
        {
            var         data        = "232308FE3132333435363738390000000000000000010000C6".ToHexBytes();
            JTNEPackage jTNEPackage = JTNESerializer.Deserialize(data);

            Assert.Equal(JTNEAskId.CMD.ToByteValue(), jTNEPackage.AskId);
            Assert.Equal(JTNEMsgId.checktime.ToByteValue(), jTNEPackage.MsgId);
            Assert.Equal("123456789", jTNEPackage.VIN);
            Assert.Null(jTNEPackage.Bodies);
        }
示例#16
0
        public void Test1()
        {
            JTNE_0x04 jTNE_0X04 = new JTNE_0x04();

            jTNE_0X04.LogoutTime = DateTime.Parse("2019-01-22 23:55:56");
            jTNE_0X04.LogoutNum  = 4444;
            var hex = JTNESerializer.Serialize(jTNE_0X04).ToHexString();

            Assert.Equal("130116173738115C", hex);
        }
示例#17
0
        public void Test2()
        {
            var            data           = "040100CB0066".ToHexBytes();
            JTNE_0x02_0x04 jTNE_0X02_0X04 = JTNESerializer.Deserialize <JTNE_0x02_0x04>(data);

            Assert.Equal(JTNE_0x02_Body.JTNE_0x02_0x04, jTNE_0X02_0X04.TypeCode);
            Assert.Equal(0x01, jTNE_0X02_0X04.EngineStatus);
            Assert.Equal(102, jTNE_0X02_0X04.FuelRate);
            Assert.Equal(203, jTNE_0X02_0X04.Revs);
        }
示例#18
0
        public void Test2()
        {
            var            data           = "05010031AD030012D1CB".ToHexBytes();
            JTNE_0x02_0x05 jTNE_0X02_0X05 = JTNESerializer.Deserialize <JTNE_0x02_0x05>(data);

            Assert.Equal(JTNE_0x02_Body.JTNE_0x02_0x05, jTNE_0X02_0X05.TypeCode);
            Assert.Equal((uint)1233355, jTNE_0X02_0X05.Lat);
            Assert.Equal((uint)3255555, jTNE_0X02_0X05.Lng);
            Assert.Equal(0x01, jTNE_0X02_0X05.PositioStatus);
        }
示例#19
0
        public void Test1()
        {
            JTNE_0x82 jTNE_0X82 = new JTNE_0x82();

            jTNE_0X82.ControlTime = DateTime.Parse("2019-01-22 23:55:56");
            jTNE_0X82.ParamID     = 0x02;
            var hex = JTNESerializer.Serialize(jTNE_0X82).ToHexString();

            Assert.Equal("13011617373802", hex);
        }
示例#20
0
        public void Test1()
        {
            JTNE_0x06 jTNE_0X06 = new JTNE_0x06();

            jTNE_0X06.LogoutTime = DateTime.Parse("2019-01-22 23:55:56");
            jTNE_0X06.LogoutNum  = 6666;
            var hex = JTNESerializer.Serialize(jTNE_0X06).ToHexString();

            Assert.Equal("1301161737381A0A", hex);
        }
示例#21
0
        public void Test2()
        {
            var       data      = "1301161737381A0A536D616C6C43686935313800313233343536373839303132333435363738390000".ToHexBytes();
            JTNE_0x05 jTNE_0X05 = JTNESerializer.Deserialize <JTNE_0x05>(data);

            Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X05.LoginTime);
            Assert.Equal(6666, jTNE_0X05.LoginNum);
            Assert.Equal("SmallChi518", jTNE_0X05.PlatformUserName);
            Assert.Equal("1234567890123456789", jTNE_0X05.PlatformPassword);
            Assert.Equal(0x00, jTNE_0X05.EncryptMethod);
        }
        public void Test1()
        {
            JTNEPackage jTNEPackage = new JTNEPackage();

            jTNEPackage.AskId = JTNEAskId.CMD.ToByteValue();
            jTNEPackage.MsgId = JTNEMsgId.checktime.ToByteValue();
            jTNEPackage.VIN   = "123456789";
            var hex = JTNESerializer.Serialize(jTNEPackage).ToHexString();

            Assert.Equal("232308FE3132333435363738390000000000000000010000C6", hex);
        }
示例#23
0
        public void Test1()
        {
            JTNE_0x02_0x05 jTNE_0X02_0X05 = new JTNE_0x02_0x05();

            jTNE_0X02_0X05.Lat           = 1233355;
            jTNE_0X02_0X05.Lng           = 3255555;
            jTNE_0X02_0X05.PositioStatus = 0x01;
            var hex = JTNESerializer.Serialize(jTNE_0X02_0X05).ToHexString();

            Assert.Equal("05010031AD030012D1CB", hex);
        }
示例#24
0
        public void Test1()
        {
            JTNE_0x02_0x04 jTNE_0X02_0X04 = new JTNE_0x02_0x04();

            jTNE_0X02_0X04.EngineStatus = 0x01;
            jTNE_0X02_0X04.FuelRate     = 102;
            jTNE_0X02_0X04.Revs         = 203;
            var hex = JTNESerializer.Serialize(jTNE_0X02_0X04).ToHexString();

            Assert.Equal("040100CB0066", hex);
        }
示例#25
0
        public void Test1()
        {
            JTNE_0x05 jTNE_0X05 = new JTNE_0x05();

            jTNE_0X05.LoginTime        = DateTime.Parse("2019-01-22 23:55:56");
            jTNE_0X05.LoginNum         = 6666;
            jTNE_0X05.PlatformUserName = "******";
            jTNE_0X05.PlatformPassword = "******";
            jTNE_0X05.EncryptMethod    = 0x00;
            var hex = JTNESerializer.Serialize(jTNE_0X05).ToHexString();

            Assert.Equal("1301161737381A0A536D616C6C43686935313800313233343536373839303132333435363738390000", hex);
        }
        public void Test2()
        {
            var         data        = "232306FE31323334353637383900000000000000000100081301171737380001DC".ToHexBytes();
            JTNEPackage jTNEPackage = JTNESerializer.Deserialize(data);

            Assert.Equal(JTNEAskId.CMD.ToByteValue(), jTNEPackage.AskId);
            Assert.Equal(JTNEMsgId.platformlogout.ToByteValue(), jTNEPackage.MsgId);
            Assert.Equal("123456789", jTNEPackage.VIN);
            JTNE_0x06 jTNE_0X06 = jTNEPackage.Bodies as JTNE_0x06;

            Assert.Equal(DateTime.Parse("2019-01-23 23:55:56"), jTNE_0X06.LogoutTime);
            Assert.Equal(1, jTNE_0X06.LogoutNum);
        }
        public void Test1_1()
        {
            JTNEGlobalConfigs.Instance.Register_JTNE0x82CustomBody(0x80, typeof(JTNE_0x82_0x80));

            var       data      = "1301161737388064".ToHexBytes();
            JTNE_0x82 jTNE_0x82 = JTNESerializer.Deserialize <JTNE_0x82>(data);

            Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0x82.ControlTime);
            Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new JTNE_0x82_0x80
            {
                ParamValue = 100
            }), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x82.Parameter));
        }
示例#28
0
        public void TestAll()
        {
            JTNE_0x80Reply jTNE_0x80Reply = new JTNE_0x80Reply();
            JTNE_0x81      jTNE_0X81      = new JTNE_0x81 {
                OperateTime = DateTime.Parse("2019-01-22 23:55:56"),
                ParamNum    = 12,
                ParamList   = new List <JTNE_0x81_Body> {
                    new JTNE_0x81_0x01 {
                        ParamValue = 10
                    },
                    new JTNE_0x81_0x02 {
                        ParamValue = 20
                    },
                    new JTNE_0x81_0x03 {
                        ParamValue = 30
                    },
                    new JTNE_0x81_0x06 {
                        ParamValue = 40
                    },
                    new JTNE_0x81_0x07 {
                        ParamValue = "abcde"
                    },
                    new JTNE_0x81_0x08 {
                        ParamValue = "12345"
                    },
                    new JTNE_0x81_0x09 {
                        ParamValue = 50
                    },
                    new JTNE_0x81_0x0A {
                        ParamValue = 60
                    },
                    new JTNE_0x81_0x0B {
                        ParamValue = 70
                    },
                    new JTNE_0x81_0x0C {
                        ParamValue = 80
                    },
                    new JTNE_0x81_0x0F {
                        ParamValue = 90
                    },
                    new JTNE_0x81_0x10 {
                        ParamValue = 0x01
                    }
                }
            };

            jTNE_0x80Reply.JTNE_Reply0x80 = jTNE_0X81;
            var hex = JTNESerializer.Serialize(jTNE_0x80Reply).ToHexString();

            Assert.Equal("1301161737380C01000A02001403001E06002807616263646508313233343509320A003C0B00460C500F005A1001", hex);
        }
示例#29
0
        public void Test2()
        {
            var       data      = "130116173738000131323334353637383939383736353433323130300304313233343435363739383730".ToHexBytes();
            JTNE_0x01 jTNE_0X01 = JTNESerializer.Deserialize <JTNE_0x01>(data);

            Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X01.PDATime);
            Assert.Equal(1, jTNE_0X01.LoginNum);
            Assert.Equal(0x04, jTNE_0X01.BatteryLength);
            Assert.Equal("12345678998765432100", jTNE_0X01.SIM);
            Assert.Equal(3, jTNE_0X01.BatteryCount);
            Assert.Equal("1234", jTNE_0X01.BatteryNos[0]);
            Assert.Equal("4567", jTNE_0X01.BatteryNos[1]);
            Assert.Equal("9870", jTNE_0X01.BatteryNos[2]);
        }
示例#30
0
        public void Test2_1()
        {
            var       data      = "13011617373801020014".ToHexBytes();
            JTNE_0x81 jTNE_0X81 = JTNESerializer.Deserialize <JTNE_0x81>(data);

            Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X81.OperateTime);
            Assert.Equal(1, jTNE_0X81.ParamNum);
            Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new JTNE_0x81_0x02
            {
                ParamId     = 0x02,
                ParamLength = 2,
                ParamValue  = 20
            }), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0X81.ParamList[0]));
        }