public void Test2() { var data = "07110000159D03000003E8000003E9000003EA03000007D0000007D1000007D20300000BB800000BB900000BBA0300000FA000000FA100000FA2".ToHexBytes(); JTNE_0x02_0x07_Platform jTNE_0X02_0X07_Platform = JTNESerializer_Platform.Deserialize <JTNE_0x02_0x07_Platform>(data); Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x07_Platform, jTNE_0X02_0X07_Platform.TypeCode); Assert.Equal(0x11, jTNE_0X02_0X07_Platform.AlarmLevel); Assert.Equal(3, jTNE_0X02_0X07_Platform.AlarmBatteryOthers.Count); Assert.Equal(new List <uint> { 1000, 1001, 1002 }, jTNE_0X02_0X07_Platform.AlarmBatteryOthers); Assert.Equal(3, jTNE_0X02_0X07_Platform.AlarmEls.Count); Assert.Equal(new List <uint> { 2000, 2001, 2002 }, jTNE_0X02_0X07_Platform.AlarmEls); Assert.Equal(3, jTNE_0X02_0X07_Platform.AlarmEngines.Count); Assert.Equal(new List <uint> { 3000, 3001, 3002 }, jTNE_0X02_0X07_Platform.AlarmEngines); Assert.Equal(3, jTNE_0X02_0X07_Platform.AlarmOthers.Count); Assert.Equal(new List <uint> { 4000, 4001, 4002 }, jTNE_0X02_0X07_Platform.AlarmOthers); }
public void Test4() { JTNEGlobalConfigs.Instance.SetDataBodiesEncrypt((msgId) => { switch (msgId) { case 0x03: return(new Default_AES128EncryptImpl()); default: return(default); } }); var data = "232301FE31323334353637383900000000000000000300307C9AAF67FB9408A75FAFC1C87F1E2AECD79DDAB8219016A5DD0911283922805EF450045EA3611C0D5CFBFD8F2581CEED30".ToHexBytes(); JTNEPackage_Platform jTNEPackage_Platform = JTNESerializer_Platform.Deserialize(data); Assert.Equal(JTNEAskId.CMD.ToByteValue(), jTNEPackage_Platform.AskId); Assert.Equal(JTNEMsgId_Device.login.ToByteValue(), jTNEPackage_Platform.MsgId); Assert.Equal("123456789", jTNEPackage_Platform.VIN); Assert.Equal(JTNEEncryptMethod.AES128.ToByteValue(), jTNEPackage_Platform.EncryptMethod); JTNE_0x01_Platform jTNE_0X01_Platform = jTNEPackage_Platform.Bodies as JTNE_0x01_Platform; Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X01_Platform.PDATime); Assert.Equal(1, jTNE_0X01_Platform.LoginNum); Assert.Equal(0x04, jTNE_0X01_Platform.BatteryLength); Assert.Equal("12345678998765432100", jTNE_0X01_Platform.SIM); Assert.Equal(3, jTNE_0X01_Platform.BatteryCount); Assert.Equal("1234", jTNE_0X01_Platform.BatteryNos[0]); Assert.Equal("4567", jTNE_0X01_Platform.BatteryNos[1]); Assert.Equal("9870", jTNE_0X01_Platform.BatteryNos[2]); }
public void Test2() { var data = "0202010201004100370300EC0064020302004202360508580065".ToHexBytes(); JTNE_0x02_0x02_Platform jTNE_0X02_0X02_Platform = JTNESerializer_Platform.Deserialize <JTNE_0x02_0x02_Platform>(data); Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x02_Platform, jTNE_0X02_0X02_Platform.TypeCode); Assert.Equal(2, jTNE_0X02_0X02_Platform.ElectricalCount); Metadata.Electrical electrical1 = jTNE_0X02_0X02_Platform.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_Platform.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); }
public void Test2() { var data = "01040507003A00001A0A00640063030602007B0202010201004100370300EC00640203020042023605085800650308AE006F0C9600030102030D1B221A0A560D086502".ToHexBytes(); JTNE_0x03_Platform jTNE_0X03_Platform = JTNESerializer_Platform.Deserialize <JTNE_0x03_Platform>(data); JTNE_0x02_Platform jTNE_0X02_Platform = jTNE_0X03_Platform.Supplement; JTNE_0x02_0x01_Platform jTNE_0X02_0X01_Platform = jTNE_0X02_Platform.Values[JTNE_0x02_Body_Platform.JTNE_0x02_0x01_Platform] as JTNE_0x02_0x01_Platform; Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x01_Platform, jTNE_0X02_0X01_Platform.TypeCode); Assert.Equal(0x04, jTNE_0X02_0X01_Platform.CarStatus); Assert.Equal(0x05, jTNE_0X02_0X01_Platform.ChargeStatus); Assert.Equal(0x06, jTNE_0X02_0X01_Platform.DCStatus); Assert.Equal(0x07, jTNE_0X02_0X01_Platform.OperationMode); Assert.Equal(123, jTNE_0X02_0X01_Platform.Resistance); Assert.Equal(0x03, jTNE_0X02_0X01_Platform.SOC); Assert.Equal(58, jTNE_0X02_0X01_Platform.Speed); Assert.Equal(0x02, jTNE_0X02_0X01_Platform.Stall); Assert.Equal((uint)6666, jTNE_0X02_0X01_Platform.TotalDis); Assert.Equal(99, jTNE_0X02_0X01_Platform.TotalTemp); Assert.Equal(100, jTNE_0X02_0X01_Platform.TotalVoltage); JTNE_0x02_0x02_Platform jTNE_0X02_0X02_Platform = jTNE_0X02_Platform.Values[JTNE_0x02_Body_Platform.JTNE_0x02_0x02_Platform] as JTNE_0x02_0x02_Platform; Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x02_Platform, jTNE_0X02_0X02_Platform.TypeCode); Assert.Equal(2, jTNE_0X02_0X02_Platform.ElectricalCount); Metadata.Electrical electrical1 = jTNE_0X02_0X02_Platform.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_Platform.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); JTNE_0x02_0x03_Platform jTNE_0X02_0X03_Platform = jTNE_0X02_Platform.Values[JTNE_0x02_Body_Platform.JTNE_0x02_0x03_Platform] as JTNE_0x02_0x03_Platform; Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x03_Platform, jTNE_0X02_0X03_Platform.TypeCode); Assert.Equal(0x02, jTNE_0X02_0X03_Platform.DCStatus); Assert.Equal(111, jTNE_0X02_0X03_Platform.FuelBatteryCurrent); Assert.Equal(2222, jTNE_0X02_0X03_Platform.FuelBatteryVoltage); Assert.Equal(3222, jTNE_0X02_0X03_Platform.FuelConsumptionRate); Assert.Equal(6666, jTNE_0X02_0X03_Platform.HydrogenSystemMaxConcentrations); Assert.Equal(0x56, jTNE_0X02_0X03_Platform.HydrogenSystemMaxConcentrationsNo); Assert.Equal(3336, jTNE_0X02_0X03_Platform.HydrogenSystemMaxPressure); Assert.Equal(0x65, jTNE_0X02_0X03_Platform.HydrogenSystemMaxPressureNo); Assert.Equal(3355, jTNE_0X02_0X03_Platform.HydrogenSystemMaxTemp); Assert.Equal(0x22, jTNE_0X02_0X03_Platform.HydrogenSystemMaxTempNo); Assert.Equal(new byte[] { 0x01, 0x02, 0x03 }, jTNE_0X02_0X03_Platform.Temperatures); }
public void Test2() { var data = "130116173738115C".ToHexBytes(); JTNE_0x04_Platform jTNE_0X04_Platform = JTNESerializer_Platform.Deserialize <JTNE_0x04_Platform>(data); Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X04_Platform.LogoutTime); Assert.Equal(4444, jTNE_0X04_Platform.LogoutNum); }
public void Test2() { var data = "040100CB0066".ToHexBytes(); JTNE_0x02_0x04_Platform jTNE_0X02_0X04_Platform = JTNESerializer_Platform.Deserialize <JTNE_0x02_0x04_Platform>(data); Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x04_Platform, jTNE_0X02_0X04_Platform.TypeCode); Assert.Equal(0x01, jTNE_0X02_0X04_Platform.EngineStatus); Assert.Equal(102, jTNE_0X02_0X04_Platform.FuelRate); Assert.Equal(203, jTNE_0X02_0X04_Platform.Revs); }
public void Test2() { var data = "05010031AD030012D1CB".ToHexBytes(); JTNE_0x02_0x05_Platform jTNE_0X02_0X05_Platform = JTNESerializer_Platform.Deserialize <JTNE_0x02_0x05_Platform>(data); Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x05_Platform, jTNE_0X02_0X05_Platform.TypeCode); Assert.Equal((uint)1233355, jTNE_0X02_0X05_Platform.Lat); Assert.Equal((uint)3255555, jTNE_0X02_0X05_Platform.Lng); Assert.Equal(0x01, jTNE_0X02_0X05_Platform.PositioStatus); }
public void Test2() { var data = "1301161737381A0A536D616C6C43686935313800313233343536373839303132333435363738390000".ToHexBytes(); JTNE_0x05_Platform jTNE_0X05_Platform = JTNESerializer_Platform.Deserialize <JTNE_0x05_Platform>(data); Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X05_Platform.LoginTime); Assert.Equal(6666, jTNE_0X05_Platform.LoginNum); Assert.Equal("SmallChi518", jTNE_0X05_Platform.PlatformUserName); Assert.Equal("1234567890123456789", jTNE_0X05_Platform.PlatformPassword); Assert.Equal(0x00, jTNE_0X05_Platform.EncryptMethod); }
public void Test2() { var data = "232306FE31323334353637383900000000000000000100081301171737380001DC".ToHexBytes(); JTNEPackage_Platform jTNEPackage_Platform = JTNESerializer_Platform.Deserialize(data); Assert.Equal(JTNEAskId.CMD.ToByteValue(), jTNEPackage_Platform.AskId); Assert.Equal(JTNEMsgId_Platform.platformlogout.ToByteValue(), jTNEPackage_Platform.MsgId); Assert.Equal("123456789", jTNEPackage_Platform.VIN); JTNE_0x06_Platform jTNE_0X06_Platform = jTNEPackage_Platform.Bodies as JTNE_0x06_Platform; Assert.Equal(DateTime.Parse("2019-01-23 23:55:56"), jTNE_0X06_Platform.LogoutTime); Assert.Equal(1, jTNE_0X06_Platform.LogoutNum); }
public void Test2() { var data = "130116173738000131323334353637383939383736353433323130300304313233343435363739383730".ToHexBytes(); JTNE_0x01_Platform jTNE_0X01_Platform = JTNESerializer_Platform.Deserialize <JTNE_0x01_Platform>(data); Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X01_Platform.PDATime); Assert.Equal(1, jTNE_0X01_Platform.LoginNum); Assert.Equal(0x04, jTNE_0X01_Platform.BatteryLength); Assert.Equal("12345678998765432100", jTNE_0X01_Platform.SIM); Assert.Equal(3, jTNE_0X01_Platform.BatteryCount); Assert.Equal("1234", jTNE_0X01_Platform.BatteryNos[0]); Assert.Equal("4567", jTNE_0X01_Platform.BatteryNos[1]); Assert.Equal("9870", jTNE_0X01_Platform.BatteryNos[2]); }
public void Test2() { var data = "232305FE31323334353637383900000000000000000100291301171737381A0A536D616C6C43686935313800313233343536373839303132333435363738390001FF".ToHexBytes(); JTNEPackage_Platform jTNEPackage_Platform = JTNESerializer_Platform.Deserialize(data); Assert.Equal(JTNEAskId.CMD.ToByteValue(), jTNEPackage_Platform.AskId); Assert.Equal(JTNEMsgId_Platform.platformlogin.ToByteValue(), jTNEPackage_Platform.MsgId); Assert.Equal("123456789", jTNEPackage_Platform.VIN); JTNE_0x05_Platform jTNE_0X05_Platform = jTNEPackage_Platform.Bodies as JTNE_0x05_Platform; Assert.Equal(DateTime.Parse("2019-01-23 23:55:56"), jTNE_0X05_Platform.LoginTime); Assert.Equal(6666, jTNE_0X05_Platform.LoginNum); Assert.Equal("SmallChi518", jTNE_0X05_Platform.PlatformUserName); Assert.Equal("1234567890123456789", jTNE_0X05_Platform.PlatformPassword); Assert.Equal(0x01, jTNE_0X05_Platform.EncryptMethod); }
public void Test2() { var data = "061115007B07090008321242113206".ToHexBytes(); JTNE_0x02_0x06_Platform jTNE_0X02_0X06_Platform = JTNESerializer_Platform.Deserialize <JTNE_0x02_0x06_Platform>(data); Assert.Equal(0x12, jTNE_0X02_0X06_Platform.MaxTempBatteryAssemblyNo); Assert.Equal(0x32, jTNE_0X02_0X06_Platform.MaxTempProbeBatteryNo); Assert.Equal(0x42, jTNE_0X02_0X06_Platform.MaxTempProbeBatteryValue); Assert.Equal(0x11, jTNE_0X02_0X06_Platform.MaxVoltageBatteryAssemblyNo); Assert.Equal(0x15, jTNE_0X02_0X06_Platform.MaxVoltageSingleBatteryNo); Assert.Equal(123, jTNE_0X02_0X06_Platform.MaxVoltageSingleBatteryValue); Assert.Equal(0x11, jTNE_0X02_0X06_Platform.MinTempProbeBatteryNo); Assert.Equal(0x06, jTNE_0X02_0X06_Platform.MinTempProbeBatteryValue); Assert.Equal(0x07, jTNE_0X02_0X06_Platform.MinVoltageBatteryAssemblyNo); Assert.Equal(0x09, jTNE_0X02_0X06_Platform.MinVoltageSingleBatteryNo); Assert.Equal(0x08, jTNE_0X02_0X06_Platform.MinVoltageSingleBatteryValue); }
public void Test2() { var data = "01040507003A00001A0A00640063030602007B".ToHexBytes(); JTNE_0x02_0x01_Platform jTNE_0X02_0X01_Platform = JTNESerializer_Platform.Deserialize <JTNE_0x02_0x01_Platform>(data); Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x01_Platform, jTNE_0X02_0X01_Platform.TypeCode); Assert.Equal(0x04, jTNE_0X02_0X01_Platform.CarStatus); Assert.Equal(0x05, jTNE_0X02_0X01_Platform.ChargeStatus); Assert.Equal(0x06, jTNE_0X02_0X01_Platform.DCStatus); Assert.Equal(0x07, jTNE_0X02_0X01_Platform.OperationMode); Assert.Equal(123, jTNE_0X02_0X01_Platform.Resistance); Assert.Equal(0x03, jTNE_0X02_0X01_Platform.SOC); Assert.Equal(58, jTNE_0X02_0X01_Platform.Speed); Assert.Equal(0x02, jTNE_0X02_0X01_Platform.Stall); Assert.Equal((uint)6666, jTNE_0X02_0X01_Platform.TotalDis); Assert.Equal(99, jTNE_0X02_0X01_Platform.TotalTemp); Assert.Equal(100, jTNE_0X02_0X01_Platform.TotalVoltage); }
public void Test2() { var data = "0308AE006F0C9600030102030D1B221A0A560D086502".ToHexBytes(); JTNE_0x02_0x03_Platform jTNE_0X02_0X03_Platform = JTNESerializer_Platform.Deserialize <JTNE_0x02_0x03_Platform>(data); Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x03_Platform, jTNE_0X02_0X03_Platform.TypeCode); Assert.Equal(0x02, jTNE_0X02_0X03_Platform.DCStatus); Assert.Equal(111, jTNE_0X02_0X03_Platform.FuelBatteryCurrent); Assert.Equal(2222, jTNE_0X02_0X03_Platform.FuelBatteryVoltage); Assert.Equal(3222, jTNE_0X02_0X03_Platform.FuelConsumptionRate); Assert.Equal(6666, jTNE_0X02_0X03_Platform.HydrogenSystemMaxConcentrations); Assert.Equal(0x56, jTNE_0X02_0X03_Platform.HydrogenSystemMaxConcentrationsNo); Assert.Equal(3336, jTNE_0X02_0X03_Platform.HydrogenSystemMaxPressure); Assert.Equal(0x65, jTNE_0X02_0X03_Platform.HydrogenSystemMaxPressureNo); Assert.Equal(3355, jTNE_0X02_0X03_Platform.HydrogenSystemMaxTemp); Assert.Equal(0x22, jTNE_0X02_0X03_Platform.HydrogenSystemMaxTempNo); Assert.Equal(new byte [] { 0x01, 0x02, 0x03 }, jTNE_0X02_0X03_Platform.Temperatures); }
public void Test2() { var data = "232301FE313233343536373839000000000000000001002A130116173738000131323334353637383939383736353433323130300304313233343435363739383730FD".ToHexBytes(); JTNEHeaderPackage_Platform jTNEHeaderPackage_Platform = JTNESerializer_Platform.Deserialize <JTNEHeaderPackage_Platform>(data); Assert.Equal(JTNEAskId.CMD.ToByteValue(), jTNEHeaderPackage_Platform.AskId); Assert.Equal(JTNEMsgId_Platform.login.ToByteValue(), jTNEHeaderPackage_Platform.MsgId); Assert.Equal("123456789", jTNEHeaderPackage_Platform.VIN); JTNE_0x01_Platform jTNE_0X01_Platform = JTNESerializer_Platform.Deserialize <JTNE_0x01_Platform>(jTNEHeaderPackage_Platform.Bodies); Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X01_Platform.PDATime); Assert.Equal(1, jTNE_0X01_Platform.LoginNum); Assert.Equal(0x04, jTNE_0X01_Platform.BatteryLength); Assert.Equal("12345678998765432100", jTNE_0X01_Platform.SIM); Assert.Equal(3, jTNE_0X01_Platform.BatteryCount); Assert.Equal("1234", jTNE_0X01_Platform.BatteryNos[0]); Assert.Equal("4567", jTNE_0X01_Platform.BatteryNos[1]); Assert.Equal("9870", jTNE_0X01_Platform.BatteryNos[2]); }
public void Test2() { JTNEGlobalConfigs.Instance.Register_JTNE0x02CustomBody_Platform(0xA1, typeof(JTNE_0x02_0xA1_Platform)); JTNEGlobalConfigs.Instance.Register_JTNE0x02CustomBody_Platform(0xA2, typeof(JTNE_0x02_0xA2_Platform)); var data = "A1000E536D616C6C436869000000000012A20014E5B08FE6B1A0E69C89E99990E585ACE58FB80000".ToHexBytes(); JTNE_0x02_Platform jTNE_0X02_Platform = JTNESerializer_Platform.Deserialize <JTNE_0x02_Platform>(data); Assert.Empty(jTNE_0X02_Platform.Values); JTNE_0x02_0xA1_Platform jTNE_0X02_0XA1_Platform = JTNESerializer_Device.Deserialize <JTNE_0x02_0xA1_Platform>(jTNE_0X02_Platform.CusotmValues[0xA1]); Assert.Equal(0xA1, jTNE_0X02_0XA1_Platform.TypeCode); Assert.Equal(14, jTNE_0X02_0XA1_Platform.Length); Assert.Equal("SmallChi", jTNE_0X02_0XA1_Platform.UserName); Assert.Equal(18, jTNE_0X02_0XA1_Platform.Age); JTNE_0x02_0xA2_Platform jTNE_0X02_0XA2_Platform = JTNESerializer_Device.Deserialize <JTNE_0x02_0xA2_Platform>(jTNE_0X02_Platform.CusotmValues[0xA2]); Assert.Equal(0xA2, jTNE_0X02_0XA2_Platform.TypeCode); Assert.Equal(20, jTNE_0X02_0XA2_Platform.Length); Assert.Equal("小池有限公司", jTNE_0X02_0XA2_Platform.CompanyName); }
public void Test2() { var data = "23230201313233343536373839000000000000000001009C01040507003A00001A0A00640063030602007B0202010201004100370300EC00640203020042023605085800650308AE006F0C9600030102030D1B221A0A560D086502040100CB006605010031AD030012D1CB061115007B0709000832124211320607110000159D03000003E8000003E9000003EA03000007D0000007D1000007D20300000BB800000BB900000BBA0300000FA000000FA100000FA2BD".ToHexBytes(); JTNEPackage_Platform jTNEPackage_Platform = JTNESerializer_Platform.Deserialize(data); JTNE_0x02_Platform jTNE_0X02_Platform = jTNEPackage_Platform.Bodies as JTNE_0x02_Platform; JTNE_0x02_0x01_Platform jTNE_0X02_0X01_Platform = jTNE_0X02_Platform.Values[JTNE_0x02_Body_Platform.JTNE_0x02_0x01_Platform] as JTNE_0x02_0x01_Platform; Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x01_Platform, jTNE_0X02_0X01_Platform.TypeCode); Assert.Equal(0x04, jTNE_0X02_0X01_Platform.CarStatus); Assert.Equal(0x05, jTNE_0X02_0X01_Platform.ChargeStatus); Assert.Equal(0x06, jTNE_0X02_0X01_Platform.DCStatus); Assert.Equal(0x07, jTNE_0X02_0X01_Platform.OperationMode); Assert.Equal(123, jTNE_0X02_0X01_Platform.Resistance); Assert.Equal(0x03, jTNE_0X02_0X01_Platform.SOC); Assert.Equal(58, jTNE_0X02_0X01_Platform.Speed); Assert.Equal(0x02, jTNE_0X02_0X01_Platform.Stall); Assert.Equal((uint)6666, jTNE_0X02_0X01_Platform.TotalDis); Assert.Equal(99, jTNE_0X02_0X01_Platform.TotalTemp); Assert.Equal(100, jTNE_0X02_0X01_Platform.TotalVoltage); JTNE_0x02_0x02_Platform jTNE_0X02_0X02_Platform = jTNE_0X02_Platform.Values[JTNE_0x02_Body_Platform.JTNE_0x02_0x02_Platform] as JTNE_0x02_0x02_Platform; Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x02_Platform, jTNE_0X02_0X02_Platform.TypeCode); Assert.Equal(2, jTNE_0X02_0X02_Platform.ElectricalCount); Metadata.Electrical electrical1 = jTNE_0X02_0X02_Platform.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_Platform.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); JTNE_0x02_0x03_Platform jTNE_0X02_0X03_Platform = jTNE_0X02_Platform.Values[JTNE_0x02_Body_Platform.JTNE_0x02_0x03_Platform] as JTNE_0x02_0x03_Platform; Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x03_Platform, jTNE_0X02_0X03_Platform.TypeCode); Assert.Equal(0x02, jTNE_0X02_0X03_Platform.DCStatus); Assert.Equal(111, jTNE_0X02_0X03_Platform.FuelBatteryCurrent); Assert.Equal(2222, jTNE_0X02_0X03_Platform.FuelBatteryVoltage); Assert.Equal(3222, jTNE_0X02_0X03_Platform.FuelConsumptionRate); Assert.Equal(6666, jTNE_0X02_0X03_Platform.HydrogenSystemMaxConcentrations); Assert.Equal(0x56, jTNE_0X02_0X03_Platform.HydrogenSystemMaxConcentrationsNo); Assert.Equal(3336, jTNE_0X02_0X03_Platform.HydrogenSystemMaxPressure); Assert.Equal(0x65, jTNE_0X02_0X03_Platform.HydrogenSystemMaxPressureNo); Assert.Equal(3355, jTNE_0X02_0X03_Platform.HydrogenSystemMaxTemp); Assert.Equal(0x22, jTNE_0X02_0X03_Platform.HydrogenSystemMaxTempNo); Assert.Equal(new byte[] { 0x01, 0x02, 0x03 }, jTNE_0X02_0X03_Platform.Temperatures); JTNE_0x02_0x04_Platform jTNE_0X02_0X04_Platform = jTNE_0X02_Platform.Values[JTNE_0x02_Body_Platform.JTNE_0x02_0x04_Platform] as JTNE_0x02_0x04_Platform; Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x04_Platform, jTNE_0X02_0X04_Platform.TypeCode); Assert.Equal(0x01, jTNE_0X02_0X04_Platform.EngineStatus); Assert.Equal(102, jTNE_0X02_0X04_Platform.FuelRate); Assert.Equal(203, jTNE_0X02_0X04_Platform.Revs); JTNE_0x02_0x05_Platform jTNE_0X02_0X05_Platform = jTNE_0X02_Platform.Values[JTNE_0x02_Body_Platform.JTNE_0x02_0x05_Platform] as JTNE_0x02_0x05_Platform; Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x05_Platform, jTNE_0X02_0X05_Platform.TypeCode); Assert.Equal((uint)1233355, jTNE_0X02_0X05_Platform.Lat); Assert.Equal((uint)3255555, jTNE_0X02_0X05_Platform.Lng); Assert.Equal(0x01, jTNE_0X02_0X05_Platform.PositioStatus); JTNE_0x02_0x06_Platform jTNE_0X02_0X06_Platform = jTNE_0X02_Platform.Values[JTNE_0x02_Body_Platform.JTNE_0x02_0x06_Platform] as JTNE_0x02_0x06_Platform; Assert.Equal(0x12, jTNE_0X02_0X06_Platform.MaxTempBatteryAssemblyNo); Assert.Equal(0x32, jTNE_0X02_0X06_Platform.MaxTempProbeBatteryNo); Assert.Equal(0x42, jTNE_0X02_0X06_Platform.MaxTempProbeBatteryValue); Assert.Equal(0x11, jTNE_0X02_0X06_Platform.MaxVoltageBatteryAssemblyNo); Assert.Equal(0x15, jTNE_0X02_0X06_Platform.MaxVoltageSingleBatteryNo); Assert.Equal(123, jTNE_0X02_0X06_Platform.MaxVoltageSingleBatteryValue); Assert.Equal(0x11, jTNE_0X02_0X06_Platform.MinTempProbeBatteryNo); Assert.Equal(0x06, jTNE_0X02_0X06_Platform.MinTempProbeBatteryValue); Assert.Equal(0x07, jTNE_0X02_0X06_Platform.MinVoltageBatteryAssemblyNo); Assert.Equal(0x09, jTNE_0X02_0X06_Platform.MinVoltageSingleBatteryNo); Assert.Equal(0x08, jTNE_0X02_0X06_Platform.MinVoltageSingleBatteryValue); JTNE_0x02_0x07_Platform jTNE_0X02_0X07_Platform = jTNE_0X02_Platform.Values[JTNE_0x02_Body_Platform.JTNE_0x02_0x07_Platform] as JTNE_0x02_0x07_Platform; Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x07_Platform, jTNE_0X02_0X07_Platform.TypeCode); Assert.Equal(0x11, jTNE_0X02_0X07_Platform.AlarmLevel); Assert.Equal(3, jTNE_0X02_0X07_Platform.AlarmBatteryOthers.Count); Assert.Equal(new List <uint> { 1000, 1001, 1002 }, jTNE_0X02_0X07_Platform.AlarmBatteryOthers); Assert.Equal(3, jTNE_0X02_0X07_Platform.AlarmEls.Count); Assert.Equal(new List <uint> { 2000, 2001, 2002 }, jTNE_0X02_0X07_Platform.AlarmEls); Assert.Equal(3, jTNE_0X02_0X07_Platform.AlarmEngines.Count); Assert.Equal(new List <uint> { 3000, 3001, 3002 }, jTNE_0X02_0X07_Platform.AlarmEngines); Assert.Equal(3, jTNE_0X02_0X07_Platform.AlarmOthers.Count); Assert.Equal(new List <uint> { 4000, 4001, 4002 }, jTNE_0X02_0X07_Platform.AlarmOthers); }
public void Test2() { JTNEGlobalConfigs.Instance.Register_JTNE0x02CustomBody_Platform(0xA1, typeof(JTNE_0x02_0xA1_Platform)); JTNEGlobalConfigs.Instance.Register_JTNE0x02CustomBody_Platform(0xA2, typeof(JTNE_0x02_0xA2_Platform)); var data = "01040507003A00001A0A00640063030602007B0202010201004100370300EC00640203020042023605085800650308AE006F0C9600030102030D1B221A0A560D086502A1000E536D616C6C436869000000000012A20014E5B08FE6B1A0E69C89E99990E585ACE58FB80000".ToHexBytes(); JTNE_0x02_Platform jTNE_0X02_Platform = JTNESerializer_Platform.Deserialize <JTNE_0x02_Platform>(data); JTNE_0x02_0x01_Platform jTNE_0X02_0X01_Platform = jTNE_0X02_Platform.Values[JTNE_0x02_Body_Platform.JTNE_0x02_0x01_Platform] as JTNE_0x02_0x01_Platform; Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x01_Platform, jTNE_0X02_0X01_Platform.TypeCode); Assert.Equal(0x04, jTNE_0X02_0X01_Platform.CarStatus); Assert.Equal(0x05, jTNE_0X02_0X01_Platform.ChargeStatus); Assert.Equal(0x06, jTNE_0X02_0X01_Platform.DCStatus); Assert.Equal(0x07, jTNE_0X02_0X01_Platform.OperationMode); Assert.Equal(123, jTNE_0X02_0X01_Platform.Resistance); Assert.Equal(0x03, jTNE_0X02_0X01_Platform.SOC); Assert.Equal(58, jTNE_0X02_0X01_Platform.Speed); Assert.Equal(0x02, jTNE_0X02_0X01_Platform.Stall); Assert.Equal((uint)6666, jTNE_0X02_0X01_Platform.TotalDis); Assert.Equal(99, jTNE_0X02_0X01_Platform.TotalTemp); Assert.Equal(100, jTNE_0X02_0X01_Platform.TotalVoltage); JTNE_0x02_0x02_Platform jTNE_0X02_0X02_Platform = jTNE_0X02_Platform.Values[JTNE_0x02_Body_Platform.JTNE_0x02_0x02_Platform] as JTNE_0x02_0x02_Platform; Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x02_Platform, jTNE_0X02_0X02_Platform.TypeCode); Assert.Equal(2, jTNE_0X02_0X02_Platform.ElectricalCount); Metadata.Electrical electrical1 = jTNE_0X02_0X02_Platform.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_Platform.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); JTNE_0x02_0x03_Platform jTNE_0X02_0X03_Platform = jTNE_0X02_Platform.Values[JTNE_0x02_Body_Platform.JTNE_0x02_0x03_Platform] as JTNE_0x02_0x03_Platform; Assert.Equal(JTNE_0x02_Body_Platform.JTNE_0x02_0x03_Platform, jTNE_0X02_0X03_Platform.TypeCode); Assert.Equal(0x02, jTNE_0X02_0X03_Platform.DCStatus); Assert.Equal(111, jTNE_0X02_0X03_Platform.FuelBatteryCurrent); Assert.Equal(2222, jTNE_0X02_0X03_Platform.FuelBatteryVoltage); Assert.Equal(3222, jTNE_0X02_0X03_Platform.FuelConsumptionRate); Assert.Equal(6666, jTNE_0X02_0X03_Platform.HydrogenSystemMaxConcentrations); Assert.Equal(0x56, jTNE_0X02_0X03_Platform.HydrogenSystemMaxConcentrationsNo); Assert.Equal(3336, jTNE_0X02_0X03_Platform.HydrogenSystemMaxPressure); Assert.Equal(0x65, jTNE_0X02_0X03_Platform.HydrogenSystemMaxPressureNo); Assert.Equal(3355, jTNE_0X02_0X03_Platform.HydrogenSystemMaxTemp); Assert.Equal(0x22, jTNE_0X02_0X03_Platform.HydrogenSystemMaxTempNo); Assert.Equal(new byte[] { 0x01, 0x02, 0x03 }, jTNE_0X02_0X03_Platform.Temperatures); JTNE_0x02_0xA1_Platform jTNE_0X02_0XA1_Platform = JTNESerializer_Device.Deserialize <JTNE_0x02_0xA1_Platform>(jTNE_0X02_Platform.CusotmValues[0xA1]); Assert.Equal(0xA1, jTNE_0X02_0XA1_Platform.TypeCode); Assert.Equal(14, jTNE_0X02_0XA1_Platform.Length); Assert.Equal("SmallChi", jTNE_0X02_0XA1_Platform.UserName); Assert.Equal(18, jTNE_0X02_0XA1_Platform.Age); JTNE_0x02_0xA2_Platform jTNE_0X02_0XA2_Platform = JTNESerializer_Device.Deserialize <JTNE_0x02_0xA2_Platform>(jTNE_0X02_Platform.CusotmValues[0xA2]); Assert.Equal(0xA2, jTNE_0X02_0XA2_Platform.TypeCode); Assert.Equal(20, jTNE_0X02_0XA2_Platform.Length); Assert.Equal("小池有限公司", jTNE_0X02_0XA2_Platform.CompanyName); }