diff --git a/src/JTNE.Protocol.Test/MessageBody/JTNE_0x03Test.cs b/src/JTNE.Protocol.Test/MessageBody/JTNE_0x03Test.cs new file mode 100644 index 0000000..67adebf --- /dev/null +++ b/src/JTNE.Protocol.Test/MessageBody/JTNE_0x03Test.cs @@ -0,0 +1,144 @@ +using JTNE.Protocol.MessageBody; +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; +using JTNE.Protocol.Extensions; + +namespace JTNE.Protocol.Test.MessageBody +{ + public class JTNE_0x03Test + { + [Fact] + public void Test1() + { + JTNE_0x03 jTNE_0X03 = new JTNE_0x03(); + JTNE_0x02 jTNE_0X02 = new JTNE_0x02(); + jTNE_0X02.Values = new Dictionary(); + + JTNE_0x02_0x01 jTNE_0X02_0X01 = new JTNE_0x02_0x01(); + jTNE_0X02_0X01.Accelerator = 0x02; + jTNE_0X02_0X01.Brakes = 0x03; + jTNE_0X02_0X01.CarStatus = 0x04; + jTNE_0X02_0X01.ChargeStatus = 0x05; + jTNE_0X02_0X01.DCStatus = 0x06; + jTNE_0X02_0X01.OperationMode = 0x07; + jTNE_0X02_0X01.Resistance = 123; + jTNE_0X02_0X01.SOC = 0x03; + jTNE_0X02_0X01.Speed = 58; + jTNE_0X02_0X01.Stall = 0x02; + jTNE_0X02_0X01.TotalDis = 6666; + jTNE_0X02_0X01.TotalTemp = 99; + jTNE_0X02_0X01.TotalVoltage = 100; + jTNE_0X02.Values.Add(JTNE_0x02_Body.JTNE_0x02_0x01, jTNE_0X02_0X01); + + JTNE_0x02_0x02 jTNE_0X02_0X02 = new JTNE_0x02_0x02(); + jTNE_0X02_0X02.Electricals = new List(); + 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); + jTNE_0X02.Values.Add(JTNE_0x02_Body.JTNE_0x02_0x02, jTNE_0X02_0X02); + + JTNE_0x02_0x03 jTNE_0X02_0X03 = new JTNE_0x02_0x03(); + jTNE_0X02_0X03.DCStatus = 0x02; + jTNE_0X02_0X03.FuelBatteryCurrent = 111; + jTNE_0X02_0X03.FuelBatteryVoltage = 2222; + jTNE_0X02_0X03.FuelConsumptionRate = 3222; + jTNE_0X02_0X03.HydrogenSystemMaxConcentrations = 6666; + jTNE_0X02_0X03.HydrogenSystemMaxConcentrationsNo = 0x56; + jTNE_0X02_0X03.HydrogenSystemMaxPressure = 3336; + jTNE_0X02_0X03.HydrogenSystemMaxPressureNo = 0x65; + jTNE_0X02_0X03.HydrogenSystemMaxTemp = 3355; + jTNE_0X02_0X03.HydrogenSystemMaxTempNo = 0x22; + jTNE_0X02_0X03.Temperatures = new byte[] + { + 0x01,0x02,0x03 + }; + jTNE_0X02.Values.Add(JTNE_0x02_Body.JTNE_0x02_0x03, jTNE_0X02_0X03); + jTNE_0X03.Supplement = jTNE_0X02; + var hex = JTNESerializer.Serialize(jTNE_0X03).ToHexString(); + //01 04 05 07 00 3A 00 00 1A 0A 00 64 00 63 03 06 02 00 7B 02 03 -21 + //02 02 01 02 01 00 41 00 37 03 00 EC 00 64 02 03 02 00 42 02 36 05 08 58 00 65 -26 + //03 08 AE 00 6F 0C 96 00 03 01 02 03 0D 1B 22 1A 0A 56 0D 08 65 02 + Assert.Equal("01040507003A00001A0A00640063030602007B02030202010201004100370300EC00640203020042023605085800650308AE006F0C9600030102030D1B221A0A560D086502", hex); + } + + [Fact] + public void Test2() + { + var data = "01040507003A00001A0A00640063030602007B02030202010201004100370300EC00640203020042023605085800650308AE006F0C9600030102030D1B221A0A560D086502".ToHexBytes(); + JTNE_0x03 jTNE_0X03 = JTNESerializer.Deserialize(data); + JTNE_0x02 jTNE_0X02 = jTNE_0X03.Supplement; + JTNE_0x02_0x01 jTNE_0X02_0X01 = jTNE_0X02.Values[JTNE_0x02_Body.JTNE_0x02_0x01] as JTNE_0x02_0x01; + Assert.Equal(JTNE_0x02_Body.JTNE_0x02_0x01, jTNE_0X02_0X01.TypeCode); + Assert.Equal(0x02, jTNE_0X02_0X01.Accelerator); + Assert.Equal(0x03, jTNE_0X02_0X01.Brakes); + Assert.Equal(0x04, jTNE_0X02_0X01.CarStatus); + Assert.Equal(0x05, jTNE_0X02_0X01.ChargeStatus); + Assert.Equal(0x06, jTNE_0X02_0X01.DCStatus); + Assert.Equal(0x07, jTNE_0X02_0X01.OperationMode); + Assert.Equal(123, jTNE_0X02_0X01.Resistance); + Assert.Equal(0x03, jTNE_0X02_0X01.SOC); + Assert.Equal(58, jTNE_0X02_0X01.Speed); + Assert.Equal(0x02, jTNE_0X02_0X01.Stall); + Assert.Equal((uint)6666, jTNE_0X02_0X01.TotalDis); + Assert.Equal(99, jTNE_0X02_0X01.TotalTemp); + Assert.Equal(100, jTNE_0X02_0X01.TotalVoltage); + + + JTNE_0x02_0x02 jTNE_0X02_0X02 = jTNE_0X02.Values[JTNE_0x02_Body.JTNE_0x02_0x02] as JTNE_0x02_0x02; + 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); + + JTNE_0x02_0x03 jTNE_0X02_0X03 = jTNE_0X02.Values[JTNE_0x02_Body.JTNE_0x02_0x03] as JTNE_0x02_0x03; + + Assert.Equal(JTNE_0x02_Body.JTNE_0x02_0x03, jTNE_0X02_0X03.TypeCode); + Assert.Equal(0x02, jTNE_0X02_0X03.DCStatus); + Assert.Equal(111, jTNE_0X02_0X03.FuelBatteryCurrent); + Assert.Equal(2222, jTNE_0X02_0X03.FuelBatteryVoltage); + Assert.Equal(3222, jTNE_0X02_0X03.FuelConsumptionRate); + Assert.Equal(6666, jTNE_0X02_0X03.HydrogenSystemMaxConcentrations); + Assert.Equal(0x56, jTNE_0X02_0X03.HydrogenSystemMaxConcentrationsNo); + Assert.Equal(3336, jTNE_0X02_0X03.HydrogenSystemMaxPressure); + Assert.Equal(0x65, jTNE_0X02_0X03.HydrogenSystemMaxPressureNo); + Assert.Equal(3355, jTNE_0X02_0X03.HydrogenSystemMaxTemp); + Assert.Equal(0x22, jTNE_0X02_0X03.HydrogenSystemMaxTempNo); + Assert.Equal(new byte[] { 0x01, 0x02, 0x03 }, jTNE_0X02_0X03.Temperatures); + } + } +} diff --git a/src/JTNE.Protocol.Test/MessageBody/JTNE_0x80ReplyTest.cs b/src/JTNE.Protocol.Test/MessageBody/JTNE_0x80ReplyTest.cs index 8f648a4..41685ca 100644 --- a/src/JTNE.Protocol.Test/MessageBody/JTNE_0x80ReplyTest.cs +++ b/src/JTNE.Protocol.Test/MessageBody/JTNE_0x80ReplyTest.cs @@ -13,15 +13,19 @@ namespace JTNE.Protocol.Test.MessageBody public void Test1() { JTNE_0x80Reply jTNE_0x80Reply = new JTNE_0x80Reply(); - jTNE_0x80Reply.ReplyTime = DateTime.Parse("2019-01-22 23:55:56"); - jTNE_0x80Reply.ParamNum = 1; - jTNE_0x80Reply.ParamList = new List { - new JTNE_0x80Reply_0x01{ + JTNE_0x81 jTNE_0X81 = new JTNE_0x81 + { + OperateTime = DateTime.Parse("2019-01-22 23:55:56"), + ParamNum = 1, + ParamList = new List { + new JTNE_0x81_0x01{ ParamId=0x01, ParamLength=2, ParamValue=10 } + } }; + jTNE_0x80Reply.JTNE_Reply0x80 = jTNE_0X81; var hex = JTNESerializer.Serialize(jTNE_0x80Reply).ToHexString(); Assert.Equal("1301161737380101000A", hex); } @@ -31,28 +35,32 @@ namespace JTNE.Protocol.Test.MessageBody { var data = "1301161737380101000A".ToHexBytes(); JTNE_0x80Reply jTNE_0x80Reply = JTNESerializer.Deserialize(data); - Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0x80Reply.ReplyTime); - Assert.Equal(1, jTNE_0x80Reply.ParamNum); - Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject( new JTNE_0x80Reply_0x01 + Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0x80Reply.JTNE_Reply0x80.OperateTime); + Assert.Equal(1, jTNE_0x80Reply.JTNE_Reply0x80.ParamNum); + Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject( new JTNE_0x81_0x01 { ParamId = 0x01, ParamLength = 2, ParamValue = 10 - }), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.ParamList[0] )); + }), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.JTNE_Reply0x80.ParamList[0])); } [Fact] public void Test2() { JTNE_0x80Reply jTNE_0x80Reply = new JTNE_0x80Reply(); - jTNE_0x80Reply.ReplyTime = DateTime.Parse("2019-01-22 23:55:56"); - jTNE_0x80Reply.ParamNum = 1; - jTNE_0x80Reply.ParamList = new List { - new JTNE_0x80Reply_0x02{ + JTNE_0x81 jTNE_0X81 = new JTNE_0x81 + { + OperateTime = DateTime.Parse("2019-01-22 23:55:56"), + ParamNum = 1, + ParamList = new List { + new JTNE_0x81_0x02{ ParamId=0x02, ParamLength=2, ParamValue=20 } + } }; + jTNE_0x80Reply.JTNE_Reply0x80 = jTNE_0X81; var hex = JTNESerializer.Serialize(jTNE_0x80Reply).ToHexString(); Assert.Equal("13011617373801020014", hex); } @@ -62,31 +70,35 @@ namespace JTNE.Protocol.Test.MessageBody { var data = "13011617373801020014".ToHexBytes(); JTNE_0x80Reply jTNE_0x80Reply = JTNESerializer.Deserialize(data); - Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0x80Reply.ReplyTime); - Assert.Equal(1, jTNE_0x80Reply.ParamNum); - Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new JTNE_0x80Reply_0x02 + Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0x80Reply.JTNE_Reply0x80.OperateTime); + Assert.Equal(1, jTNE_0x80Reply.JTNE_Reply0x80.ParamNum); + Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new JTNE_0x81_0x02 { ParamId = 0x02, ParamLength = 2, ParamValue = 20 - }), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.ParamList[0])); + }), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.JTNE_Reply0x80.ParamList[0])); } [Fact] public void Test4() { JTNE_0x80Reply jTNE_0x80Reply = new JTNE_0x80Reply(); - jTNE_0x80Reply.ReplyTime = DateTime.Parse("2019-01-22 23:55:56"); - jTNE_0x80Reply.ParamList = new List { - new JTNE_0x80Reply_0x04{ + JTNE_0x81 jTNE_0X81 = new JTNE_0x81 + { + OperateTime = DateTime.Parse("2019-01-22 23:55:56"), + ParamNum=3, + ParamList = new List { + new JTNE_0x81_0x04{ ParamValue=8 - },new JTNE_0x80Reply_0x05{ + },new JTNE_0x81_0x05{ ParamValue=new byte[]{ 1, 2, 3, 4, 5, 6, 7, 8 } }, - new JTNE_0x80Reply_0x06{ + new JTNE_0x81_0x06{ ParamValue=40 } + } }; - jTNE_0x80Reply.ParamNum =(byte)jTNE_0x80Reply.ParamList.Count; + jTNE_0x80Reply.JTNE_Reply0x80 = jTNE_0X81; var hex = JTNESerializer.Serialize(jTNE_0x80Reply).ToHexString(); Assert.Equal("130116173738030408050102030405060708060028", hex); } @@ -96,18 +108,18 @@ namespace JTNE.Protocol.Test.MessageBody { var data = "130116173738030408050102030405060708060028".ToHexBytes(); JTNE_0x80Reply jTNE_0x80Reply = JTNESerializer.Deserialize(data); - Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0x80Reply.ReplyTime); - Assert.Equal(jTNE_0x80Reply.ParamList.Count, jTNE_0x80Reply.ParamNum); - Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new List { - new JTNE_0x80Reply_0x04{ + Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0x80Reply.JTNE_Reply0x80.OperateTime); + Assert.Equal(jTNE_0x80Reply.JTNE_Reply0x80.ParamList.Count, jTNE_0x80Reply.JTNE_Reply0x80.ParamNum); + Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new List { + new JTNE_0x81_0x04{ ParamValue=8 - },new JTNE_0x80Reply_0x05{ + },new JTNE_0x81_0x05{ ParamValue=new byte[]{1,2,3,4,5,6,7,8 }, ParamLength=8 - }, new JTNE_0x80Reply_0x06{ + }, new JTNE_0x81_0x06{ ParamValue=40 } - }), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.ParamList)); + }), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.JTNE_Reply0x80.ParamList)); } @@ -115,18 +127,22 @@ namespace JTNE.Protocol.Test.MessageBody public void Test5() { JTNE_0x80Reply jTNE_0x80Reply = new JTNE_0x80Reply(); - jTNE_0x80Reply.ReplyTime = DateTime.Parse("2019-01-22 23:55:56"); - jTNE_0x80Reply.ParamList = new List { - new JTNE_0x80Reply_0x0D{ + JTNE_0x81 jTNE_0X81 = new JTNE_0x81 + { + OperateTime = DateTime.Parse("2019-01-22 23:55:56"), + ParamNum=3, + ParamList = new List { + new JTNE_0x81_0x0D{ ParamValue=8 - },new JTNE_0x80Reply_0x0E{ + },new JTNE_0x81_0x0E{ ParamValue=new byte[]{ 1, 2, 3, 4, 5, 6, 7, 8 } }, - new JTNE_0x80Reply_0x0F{ + new JTNE_0x81_0x0F{ ParamValue=40 } + } }; - jTNE_0x80Reply.ParamNum = (byte)jTNE_0x80Reply.ParamList.Count; + jTNE_0x80Reply.JTNE_Reply0x80 = jTNE_0X81; var hex = JTNESerializer.Serialize(jTNE_0x80Reply).ToHexString(); Assert.Equal("130116173738030D080E01020304050607080F0028", hex); } @@ -136,18 +152,18 @@ namespace JTNE.Protocol.Test.MessageBody { var data = "130116173738030D080E01020304050607080F0028".ToHexBytes(); JTNE_0x80Reply jTNE_0x80Reply = JTNESerializer.Deserialize(data); - Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0x80Reply.ReplyTime); - Assert.Equal(jTNE_0x80Reply.ParamList.Count, jTNE_0x80Reply.ParamNum); - Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new List { - new JTNE_0x80Reply_0x0D{ + Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0x80Reply.JTNE_Reply0x80.OperateTime); + Assert.Equal(jTNE_0x80Reply.JTNE_Reply0x80.ParamList.Count, jTNE_0x80Reply.JTNE_Reply0x80.ParamNum); + Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new List { + new JTNE_0x81_0x0D{ ParamValue=8 - },new JTNE_0x80Reply_0x0E{ + },new JTNE_0x81_0x0E{ ParamValue=new byte[]{1,2,3,4,5,6,7,8 }, ParamLength=8 - }, new JTNE_0x80Reply_0x0F{ + }, new JTNE_0x81_0x0F{ ParamValue=40 } - }), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.ParamList)); + }), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.JTNE_Reply0x80.ParamList)); } @@ -155,15 +171,18 @@ namespace JTNE.Protocol.Test.MessageBody public void Test3() { JTNE_0x80Reply jTNE_0x80Reply = new JTNE_0x80Reply(); - jTNE_0x80Reply.ReplyTime = DateTime.Parse("2019-01-22 23:55:56"); - jTNE_0x80Reply.ParamNum = 1; - jTNE_0x80Reply.ParamList = new List { - new JTNE_0x80Reply_0x03{ + JTNE_0x81 jTNE_0X81 = new JTNE_0x81 { + OperateTime= DateTime.Parse("2019-01-22 23:55:56"), + ParamNum=1, + ParamList = new List { + new JTNE_0x81_0x03{ ParamId=0x03, ParamLength=2, ParamValue=30 } + } }; + jTNE_0x80Reply.JTNE_Reply0x80 = jTNE_0X81; var hex = JTNESerializer.Serialize(jTNE_0x80Reply).ToHexString(); Assert.Equal("1301161737380103001E", hex); } @@ -173,59 +192,62 @@ namespace JTNE.Protocol.Test.MessageBody { var data = "1301161737380103001E".ToHexBytes(); JTNE_0x80Reply jTNE_0x80Reply = JTNESerializer.Deserialize(data); - Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0x80Reply.ReplyTime); - Assert.Equal(1, jTNE_0x80Reply.ParamNum); - Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new JTNE_0x80Reply_0x03 + Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0x80Reply.JTNE_Reply0x80.OperateTime); + Assert.Equal(1, jTNE_0x80Reply.JTNE_Reply0x80.ParamNum); + Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new JTNE_0x81_0x03 { ParamId = 0x03, ParamLength = 2, ParamValue = 30 - }), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.ParamList[0])); + }), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.JTNE_Reply0x80.ParamList[0])); } [Fact] public void TestAll() { JTNE_0x80Reply jTNE_0x80Reply = new JTNE_0x80Reply(); - jTNE_0x80Reply.ReplyTime = DateTime.Parse("2019-01-22 23:55:56"); - jTNE_0x80Reply.ParamNum = 12; - jTNE_0x80Reply.ParamList = new List { - new JTNE_0x80Reply_0x01{ + JTNE_0x81 jTNE_0X81 = new JTNE_0x81 { + OperateTime = DateTime.Parse("2019-01-22 23:55:56"), + ParamNum=12, + ParamList = new List { + new JTNE_0x81_0x01{ ParamValue=10 }, - new JTNE_0x80Reply_0x02{ + new JTNE_0x81_0x02{ ParamValue=20 }, - new JTNE_0x80Reply_0x03{ + new JTNE_0x81_0x03{ ParamValue=30 }, - new JTNE_0x80Reply_0x06{ + new JTNE_0x81_0x06{ ParamValue=40 }, - new JTNE_0x80Reply_0x07{ + new JTNE_0x81_0x07{ ParamValue="abcde" }, - new JTNE_0x80Reply_0x08{ + new JTNE_0x81_0x08{ ParamValue="12345" }, - new JTNE_0x80Reply_0x09{ + new JTNE_0x81_0x09{ ParamValue=50 }, - new JTNE_0x80Reply_0x0A{ + new JTNE_0x81_0x0A{ ParamValue=60 }, - new JTNE_0x80Reply_0x0B{ + new JTNE_0x81_0x0B{ ParamValue=70 }, - new JTNE_0x80Reply_0x0C{ + new JTNE_0x81_0x0C{ ParamValue=80 }, - new JTNE_0x80Reply_0x0F{ + new JTNE_0x81_0x0F{ ParamValue=90 }, - new JTNE_0x80Reply_0x10{ + new JTNE_0x81_0x10{ ParamValue=0x01 } + } }; + jTNE_0x80Reply.JTNE_Reply0x80 = jTNE_0X81; var hex = JTNESerializer.Serialize(jTNE_0x80Reply).ToHexString(); Assert.Equal("1301161737380C01000A02001403001E06002807616263646508313233343509320A003C0B00460C500F005A1001", hex); } @@ -235,46 +257,46 @@ namespace JTNE.Protocol.Test.MessageBody { var data = "1301161737380C01000A02001403001E06002807616263646508313233343509320A003C0B00460C500F005A1001".ToHexBytes(); JTNE_0x80Reply jTNE_0x80Reply = JTNESerializer.Deserialize(data); - Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0x80Reply.ReplyTime); - Assert.Equal(12, jTNE_0x80Reply.ParamNum); - Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new List { - new JTNE_0x80Reply_0x01{ + Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0x80Reply.JTNE_Reply0x80.OperateTime); + Assert.Equal(12, jTNE_0x80Reply.JTNE_Reply0x80.ParamNum); + Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new List { + new JTNE_0x81_0x01{ ParamValue=10 }, - new JTNE_0x80Reply_0x02{ + new JTNE_0x81_0x02{ ParamValue=20 }, - new JTNE_0x80Reply_0x03{ + new JTNE_0x81_0x03{ ParamValue=30 }, - new JTNE_0x80Reply_0x06{ + new JTNE_0x81_0x06{ ParamValue=40 }, - new JTNE_0x80Reply_0x07{ + new JTNE_0x81_0x07{ ParamValue="abcde" }, - new JTNE_0x80Reply_0x08{ + new JTNE_0x81_0x08{ ParamValue="12345" }, - new JTNE_0x80Reply_0x09{ + new JTNE_0x81_0x09{ ParamValue=50 }, - new JTNE_0x80Reply_0x0A{ + new JTNE_0x81_0x0A{ ParamValue=60 }, - new JTNE_0x80Reply_0x0B{ + new JTNE_0x81_0x0B{ ParamValue=70 }, - new JTNE_0x80Reply_0x0C{ + new JTNE_0x81_0x0C{ ParamValue=80 }, - new JTNE_0x80Reply_0x0F{ + new JTNE_0x81_0x0F{ ParamValue=90 }, - new JTNE_0x80Reply_0x10{ + new JTNE_0x81_0x10{ ParamValue=0x01 } - }), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.ParamList)); + }), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.JTNE_Reply0x80.ParamList)); } } } diff --git a/src/JTNE.Protocol.Test/MessageBody/JTNE_0x80Reply_CustomBodyTest.cs b/src/JTNE.Protocol.Test/MessageBody/JTNE_0x80Reply_CustomBodyTest.cs index f69ad03..b912998 100644 --- a/src/JTNE.Protocol.Test/MessageBody/JTNE_0x80Reply_CustomBodyTest.cs +++ b/src/JTNE.Protocol.Test/MessageBody/JTNE_0x80Reply_CustomBodyTest.cs @@ -14,37 +14,40 @@ namespace JTNE.Protocol.Test.MessageBody [Fact] public void Test1() { - JTNEGlobalConfigs.Instance.Register_JTNE0x80ReplyCustomBody(0x80, typeof(JTNE_0x80Reply_0x80)); - JTNEGlobalConfigs.Instance.Register_JTNE0x80ReplyCustomBody(0x81, typeof(JTNE_0x80Reply_0x81)); - JTNEGlobalConfigs.Instance.Register_JTNE0x80ReplyCustomDepenedBody(0x81, 0x80); + 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_0x80Reply.ReplyTime = DateTime.Parse("2019-01-22 23:55:56"); - jTNE_0x80Reply.ParamNum = 2; - jTNE_0x80Reply.ParamList = new List { - new JTNE_0x80Reply_0x80{ + JTNE_0x81 jTNE_0X81 = new JTNE_0x81 { + OperateTime= DateTime.Parse("2019-01-22 23:55:56"), + ParamNum=2, + ParamList = new List { + 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); } [Fact] public void Test1_1() { - JTNEGlobalConfigs.Instance.Register_JTNE0x80ReplyCustomBody(0x80, typeof(JTNE_0x80Reply_0x80)); - JTNEGlobalConfigs.Instance.Register_JTNE0x80ReplyCustomBody(0x81, typeof(JTNE_0x80Reply_0x81)); - JTNEGlobalConfigs.Instance.Register_JTNE0x80ReplyCustomDepenedBody(0x81, 0x80); + JTNEGlobalConfigs.Instance.Register_JTNE0x81CustomBody(0x80, typeof(JTNE_0x80Reply_0x80)); + JTNEGlobalConfigs.Instance.Register_JTNE0x81CustomBody(0x81, typeof(JTNE_0x80Reply_0x81)); + JTNEGlobalConfigs.Instance.Register_JTNE0x81CustomDepenedBody(0x81, 0x80); var data = "13011617373802800681010203040506".ToHexBytes(); JTNE_0x80Reply jTNE_0x80Reply = JTNESerializer.Deserialize(data); - Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0x80Reply.ReplyTime); - Assert.Equal(jTNE_0x80Reply.ParamList.Count, jTNE_0x80Reply.ParamNum); - Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new List { + Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0x80Reply.JTNE_Reply0x80.OperateTime); + Assert.Equal(jTNE_0x80Reply.JTNE_Reply0x80.ParamList.Count, jTNE_0x80Reply.JTNE_Reply0x80.ParamNum); + Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new List { new JTNE_0x80Reply_0x80{ ParamValue=6 }, @@ -52,18 +55,18 @@ namespace JTNE.Protocol.Test.MessageBody ParamLength=6, ParamValue=new byte[]{ 1,2,3,4,5,6 } } - }), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.ParamList)); + }), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.JTNE_Reply0x80.ParamList)); } } [JTNEFormatter(typeof(JTNE_0x80Reply_0x80Formatter))] - public class JTNE_0x80Reply_0x80 : JTNE_0x80Reply_Body + public class JTNE_0x80Reply_0x80 : JTNE_0x81_Body { public override byte ParamId { get; set; }= 0x80; public override byte ParamLength { get; set; } = 1; public byte ParamValue { get; set; } } [JTNEFormatter(typeof(JTNE_0x80Reply_0x81Formatter))] - public class JTNE_0x80Reply_0x81 : JTNE_0x80Reply_Body + public class JTNE_0x80Reply_0x81 : JTNE_0x81_Body { public override byte ParamId { get; set; } = 0x81; public override byte ParamLength { get; set; } diff --git a/src/JTNE.Protocol.Test/MessageBody/JTNE_0x81Test.cs b/src/JTNE.Protocol.Test/MessageBody/JTNE_0x81Test.cs index f135fee..14bcc7c 100644 --- a/src/JTNE.Protocol.Test/MessageBody/JTNE_0x81Test.cs +++ b/src/JTNE.Protocol.Test/MessageBody/JTNE_0x81Test.cs @@ -13,7 +13,7 @@ namespace JTNE.Protocol.Test.MessageBody public void Test1() { JTNE_0x81 jTNE_0X81 = new JTNE_0x81(); - jTNE_0X81.SetTime = DateTime.Parse("2019-01-22 23:55:56"); + jTNE_0X81.OperateTime = DateTime.Parse("2019-01-22 23:55:56"); jTNE_0X81.ParamNum = 1; jTNE_0X81.ParamList = new List { new JTNE_0x81_0x01{ @@ -31,7 +31,7 @@ namespace JTNE.Protocol.Test.MessageBody { var data = "1301161737380101000A".ToHexBytes(); JTNE_0x81 jTNE_0X81 = JTNESerializer.Deserialize(data); - Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X81.SetTime); + 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_0x01 { @@ -44,7 +44,7 @@ namespace JTNE.Protocol.Test.MessageBody public void Test2() { JTNE_0x81 jTNE_0X81 = new JTNE_0x81(); - jTNE_0X81.SetTime = DateTime.Parse("2019-01-22 23:55:56"); + jTNE_0X81.OperateTime = DateTime.Parse("2019-01-22 23:55:56"); jTNE_0X81.ParamNum = 1; jTNE_0X81.ParamList = new List { new JTNE_0x81_0x02{ @@ -62,7 +62,7 @@ namespace JTNE.Protocol.Test.MessageBody { var data = "13011617373801020014".ToHexBytes(); JTNE_0x81 jTNE_0X81 = JTNESerializer.Deserialize(data); - Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X81.SetTime); + 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 { @@ -75,7 +75,7 @@ namespace JTNE.Protocol.Test.MessageBody public void Test4() { JTNE_0x81 jTNE_0X81 = new JTNE_0x81(); - jTNE_0X81.SetTime = DateTime.Parse("2019-01-22 23:55:56"); + jTNE_0X81.OperateTime = DateTime.Parse("2019-01-22 23:55:56"); jTNE_0X81.ParamList = new List { new JTNE_0x81_0x04{ ParamValue=8 @@ -96,7 +96,7 @@ namespace JTNE.Protocol.Test.MessageBody { var data = "130116173738030408050102030405060708060028".ToHexBytes(); JTNE_0x81 jTNE_0X81 = JTNESerializer.Deserialize(data); - Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X81.SetTime); + Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X81.OperateTime); Assert.Equal(jTNE_0X81.ParamList.Count, jTNE_0X81.ParamNum); Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new List { new JTNE_0x81_0x04{ @@ -115,7 +115,7 @@ namespace JTNE.Protocol.Test.MessageBody public void Test5() { JTNE_0x81 jTNE_0X81 = new JTNE_0x81(); - jTNE_0X81.SetTime = DateTime.Parse("2019-01-22 23:55:56"); + jTNE_0X81.OperateTime = DateTime.Parse("2019-01-22 23:55:56"); jTNE_0X81.ParamList = new List { new JTNE_0x81_0x0D{ ParamValue=8 @@ -136,7 +136,7 @@ namespace JTNE.Protocol.Test.MessageBody { var data = "130116173738030D080E01020304050607080F0028".ToHexBytes(); JTNE_0x81 jTNE_0X81 = JTNESerializer.Deserialize(data); - Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X81.SetTime); + Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X81.OperateTime); Assert.Equal(jTNE_0X81.ParamList.Count, jTNE_0X81.ParamNum); Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new List { new JTNE_0x81_0x0D{ @@ -155,7 +155,7 @@ namespace JTNE.Protocol.Test.MessageBody public void Test3() { JTNE_0x81 jTNE_0X81 = new JTNE_0x81(); - jTNE_0X81.SetTime = DateTime.Parse("2019-01-22 23:55:56"); + jTNE_0X81.OperateTime = DateTime.Parse("2019-01-22 23:55:56"); jTNE_0X81.ParamNum = 1; jTNE_0X81.ParamList = new List { new JTNE_0x81_0x03{ @@ -173,7 +173,7 @@ namespace JTNE.Protocol.Test.MessageBody { var data = "1301161737380103001E".ToHexBytes(); JTNE_0x81 jTNE_0X81 = JTNESerializer.Deserialize(data); - Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X81.SetTime); + 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_0x03 { @@ -186,7 +186,7 @@ namespace JTNE.Protocol.Test.MessageBody public void TestAll() { JTNE_0x81 jTNE_0X81 = new JTNE_0x81(); - jTNE_0X81.SetTime = DateTime.Parse("2019-01-22 23:55:56"); + jTNE_0X81.OperateTime = DateTime.Parse("2019-01-22 23:55:56"); jTNE_0X81.ParamNum = 12; jTNE_0X81.ParamList = new List { new JTNE_0x81_0x01{ @@ -235,7 +235,7 @@ namespace JTNE.Protocol.Test.MessageBody { var data = "1301161737380C01000A02001403001E06002807616263646508313233343509320A003C0B00460C500F005A1001".ToHexBytes(); JTNE_0x81 jTNE_0X81 = JTNESerializer.Deserialize(data); - Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X81.SetTime); + Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X81.OperateTime); Assert.Equal(12, jTNE_0X81.ParamNum); Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new List { new JTNE_0x81_0x01{ diff --git a/src/JTNE.Protocol.Test/MessageBody/JTNE_0x81_CustomBodyTest.cs b/src/JTNE.Protocol.Test/MessageBody/JTNE_0x81_CustomBodyTest.cs index 8d304da..ed95bff 100644 --- a/src/JTNE.Protocol.Test/MessageBody/JTNE_0x81_CustomBodyTest.cs +++ b/src/JTNE.Protocol.Test/MessageBody/JTNE_0x81_CustomBodyTest.cs @@ -22,7 +22,7 @@ namespace JTNE.Protocol.Test.MessageBody JTNE_0x81 jTNE_0X81 = new JTNE_0x81(); - jTNE_0X81.SetTime = DateTime.Parse("2019-01-22 23:55:56"); + jTNE_0X81.OperateTime = DateTime.Parse("2019-01-22 23:55:56"); jTNE_0X81.ParamNum = 2; jTNE_0X81.ParamList = new List { new JTNE_0x81_0x80{ @@ -45,7 +45,7 @@ namespace JTNE.Protocol.Test.MessageBody var data = "13011617373802800681010203040506".ToHexBytes(); JTNE_0x81 jTNE_0X81 = JTNESerializer.Deserialize(data); - Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X81.SetTime); + Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X81.OperateTime); Assert.Equal(jTNE_0X81.ParamList.Count, jTNE_0X81.ParamNum); Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new List { new JTNE_0x81_0x80{ diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x03_Formatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x03_Formatter.cs new file mode 100644 index 0000000..e0cdc5a --- /dev/null +++ b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x03_Formatter.cs @@ -0,0 +1,24 @@ +using JTNE.Protocol.Extensions; +using JTNE.Protocol.MessageBody; +using System; +using System.Collections.Generic; +using System.Text; + +namespace JTNE.Protocol.Formatters.MessageBodyFormatters +{ + public class JTNE_0x03_Formatter : IJTNEFormatter + { + public JTNE_0x03 Deserialize(ReadOnlySpan bytes, out int readSize) + { + JTNE_0x03 jTNE_0X03 = new JTNE_0x03(); + jTNE_0X03.Supplement= JTNEFormatterExtensions.GetFormatter().Deserialize(bytes, out readSize); + return jTNE_0X03; + } + + public int Serialize(ref byte[] bytes, int offset, JTNE_0x03 value) + { + offset = JTNEFormatterExtensions.GetFormatter().Serialize(ref bytes, offset,value.Supplement); + return offset; + } + } +} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x01Formatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x01Formatter.cs deleted file mode 100644 index 65c08fd..0000000 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x01Formatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JTNE.Protocol.Extensions; -using JTNE.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.Formatters.MessageBodyFormatters -{ - public class JTNE_0x80Reply_0x01Formatter : IJTNEFormatter - { - public JTNE_0x80Reply_0x01 Deserialize(ReadOnlySpan bytes, out int readSize) - { - int offset = 0; - JTNE_0x80Reply_0x01 jTNE_0x80Reply_0x01 = new JTNE_0x80Reply_0x01(); - jTNE_0x80Reply_0x01.ParamValue = JTNEBinaryExtensions.ReadUInt16Little(bytes, ref offset); - readSize = offset; - return jTNE_0x80Reply_0x01; - } - - public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x01 value) - { - offset += JTNEBinaryExtensions.WriteUInt16Little(bytes, offset, value.ParamValue); - return offset; - } - } -} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x02Formatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x02Formatter.cs deleted file mode 100644 index 2ea9489..0000000 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x02Formatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JTNE.Protocol.Extensions; -using JTNE.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.Formatters.MessageBodyFormatters -{ - public class JTNE_0x80Reply_0x02Formatter : IJTNEFormatter - { - public JTNE_0x80Reply_0x02 Deserialize(ReadOnlySpan bytes, out int readSize) - { - int offset = 0; - JTNE_0x80Reply_0x02 jTNE_0x80Reply_0x02 = new JTNE_0x80Reply_0x02(); - jTNE_0x80Reply_0x02.ParamValue = JTNEBinaryExtensions.ReadUInt16Little(bytes, ref offset); - readSize = offset; - return jTNE_0x80Reply_0x02; - } - - public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x02 value) - { - offset += JTNEBinaryExtensions.WriteUInt16Little(bytes, offset, value.ParamValue); - return offset; - } - } -} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x03Formatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x03Formatter.cs deleted file mode 100644 index e5c321d..0000000 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x03Formatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JTNE.Protocol.Extensions; -using JTNE.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.Formatters.MessageBodyFormatters -{ - public class JTNE_0x80Reply_0x03Formatter : IJTNEFormatter - { - public JTNE_0x80Reply_0x03 Deserialize(ReadOnlySpan bytes, out int readSize) - { - int offset = 0; - JTNE_0x80Reply_0x03 jTNE_0x80Reply_0x03 = new JTNE_0x80Reply_0x03(); - jTNE_0x80Reply_0x03.ParamValue = JTNEBinaryExtensions.ReadUInt16Little(bytes, ref offset); - readSize = offset; - return jTNE_0x80Reply_0x03; - } - - public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x03 value) - { - offset += JTNEBinaryExtensions.WriteUInt16Little(bytes, offset, value.ParamValue); - return offset; - } - } -} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x04Formatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x04Formatter.cs deleted file mode 100644 index c13ed48..0000000 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x04Formatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JTNE.Protocol.Extensions; -using JTNE.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.Formatters.MessageBodyFormatters -{ - public class JTNE_0x80Reply_0x04Formatter : IJTNEFormatter - { - public JTNE_0x80Reply_0x04 Deserialize(ReadOnlySpan bytes, out int readSize) - { - int offset = 0; - JTNE_0x80Reply_0x04 jTNE_0x80Reply_0x04 = new JTNE_0x80Reply_0x04(); - jTNE_0x80Reply_0x04.ParamValue = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); - readSize = offset; - return jTNE_0x80Reply_0x04; - } - - public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x04 value) - { - offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamValue); - return offset; - } - } -} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x05Formatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x05Formatter.cs deleted file mode 100644 index d2cc1a0..0000000 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x05Formatter.cs +++ /dev/null @@ -1,27 +0,0 @@ -using JTNE.Protocol.Extensions; -using JTNE.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.Formatters.MessageBodyFormatters -{ - public class JTNE_0x80Reply_0x05Formatter : IJTNEFormatter - { - public JTNE_0x80Reply_0x05 Deserialize(ReadOnlySpan bytes, out int readSize) - { - int offset = 0; - JTNE_0x80Reply_0x05 jTNE_0x80Reply_0x05 = new JTNE_0x80Reply_0x05(); - jTNE_0x80Reply_0x05.ParamValue = JTNEBinaryExtensions.ReadBytesLittle(bytes, ref offset); - jTNE_0x80Reply_0x05.ParamLength = (byte)bytes.Length; - readSize = offset; - return jTNE_0x80Reply_0x05; - } - - public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x05 value) - { - offset += JTNEBinaryExtensions.WriteBytesLittle(bytes, offset, value.ParamValue); - return offset; - } - } -} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x06Formatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x06Formatter.cs deleted file mode 100644 index 94a9e3c..0000000 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x06Formatter.cs +++ /dev/null @@ -1,27 +0,0 @@ - -using JTNE.Protocol.Extensions; -using JTNE.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.Formatters.MessageBodyFormatters -{ - public class JTNE_0x80Reply_0x06Formatter : IJTNEFormatter - { - public JTNE_0x80Reply_0x06 Deserialize(ReadOnlySpan bytes, out int readSize) - { - int offset = 0; - JTNE_0x80Reply_0x06 jTNE_0x80Reply_0x06 = new JTNE_0x80Reply_0x06(); - jTNE_0x80Reply_0x06.ParamValue = JTNEBinaryExtensions.ReadUInt16Little(bytes, ref offset); - readSize = offset; - return jTNE_0x80Reply_0x06; - } - - public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x06 value) - { - offset += JTNEBinaryExtensions.WriteUInt16Little(bytes, offset, value.ParamValue); - return offset; - } - } -} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x07Formatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x07Formatter.cs deleted file mode 100644 index cd15ea6..0000000 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x07Formatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JTNE.Protocol.Extensions; -using JTNE.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.Formatters.MessageBodyFormatters -{ - public class JTNE_0x80Reply_0x07Formatter : IJTNEFormatter - { - public JTNE_0x80Reply_0x07 Deserialize(ReadOnlySpan bytes, out int readSize) - { - int offset = 0; - JTNE_0x80Reply_0x07 jTNE_0x80Reply_0x07 = new JTNE_0x80Reply_0x07(); - jTNE_0x80Reply_0x07.ParamValue = JTNEBinaryExtensions.ReadStringLittle(bytes, ref offset, jTNE_0x80Reply_0x07.ParamLength); - readSize = offset; - return jTNE_0x80Reply_0x07; - } - - public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x07 value) - { - offset += JTNEBinaryExtensions.WriteStringLittle(bytes, offset, value.ParamValue,value.ParamLength); - return offset; - } - } -} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x08Formatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x08Formatter.cs deleted file mode 100644 index 5876b42..0000000 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x08Formatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JTNE.Protocol.Extensions; -using JTNE.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.Formatters.MessageBodyFormatters -{ - public class JTNE_0x80Reply_0x08Formatter : IJTNEFormatter - { - public JTNE_0x80Reply_0x08 Deserialize(ReadOnlySpan bytes, out int readSize) - { - int offset = 0; - JTNE_0x80Reply_0x08 jTNE_0x80Reply_0x08 = new JTNE_0x80Reply_0x08(); - jTNE_0x80Reply_0x08.ParamValue = JTNEBinaryExtensions.ReadStringLittle(bytes, ref offset, jTNE_0x80Reply_0x08.ParamLength); - readSize = offset; - return jTNE_0x80Reply_0x08; - } - - public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x08 value) - { - offset += JTNEBinaryExtensions.WriteStringLittle(bytes, offset, value.ParamValue,value.ParamLength); - return offset; - } - } -} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x09Formatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x09Formatter.cs deleted file mode 100644 index aaca7ed..0000000 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x09Formatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JTNE.Protocol.Extensions; -using JTNE.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.Formatters.MessageBodyFormatters -{ - public class JTNE_0x80Reply_0x09Formatter : IJTNEFormatter - { - public JTNE_0x80Reply_0x09 Deserialize(ReadOnlySpan bytes, out int readSize) - { - int offset = 0; - JTNE_0x80Reply_0x09 jTNE_0x80Reply_0x09 = new JTNE_0x80Reply_0x09(); - jTNE_0x80Reply_0x09.ParamValue = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); - readSize = offset; - return jTNE_0x80Reply_0x09; - } - - public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x09 value) - { - offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset,value.ParamValue); - return offset; - } - } -} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0AFormatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0AFormatter.cs deleted file mode 100644 index 54b3ced..0000000 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0AFormatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JTNE.Protocol.Extensions; -using JTNE.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.Formatters.MessageBodyFormatters -{ - public class JTNE_0x80Reply_0x0AFormatter : IJTNEFormatter - { - public JTNE_0x80Reply_0x0A Deserialize(ReadOnlySpan bytes, out int readSize) - { - int offset = 0; - JTNE_0x80Reply_0x0A jTNE_0x80Reply_0x0A = new JTNE_0x80Reply_0x0A(); - jTNE_0x80Reply_0x0A.ParamValue = JTNEBinaryExtensions.ReadUInt16Little(bytes, ref offset); - readSize = offset; - return jTNE_0x80Reply_0x0A; - } - - public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x0A value) - { - offset += JTNEBinaryExtensions.WriteUInt16Little(bytes, offset, value.ParamValue); - return offset; - } - } -} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0BFormatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0BFormatter.cs deleted file mode 100644 index 851ebdf..0000000 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0BFormatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JTNE.Protocol.Extensions; -using JTNE.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.Formatters.MessageBodyFormatters -{ - public class JTNE_0x80Reply_0x0BFormatter : IJTNEFormatter - { - public JTNE_0x80Reply_0x0B Deserialize(ReadOnlySpan bytes, out int readSize) - { - int offset = 0; - JTNE_0x80Reply_0x0B jTNE_0x80Reply_0x0B = new JTNE_0x80Reply_0x0B(); - jTNE_0x80Reply_0x0B.ParamValue = JTNEBinaryExtensions.ReadUInt16Little(bytes, ref offset); - readSize = offset; - return jTNE_0x80Reply_0x0B; - } - - public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x0B value) - { - offset += JTNEBinaryExtensions.WriteUInt16Little(bytes, offset, value.ParamValue); - return offset; - } - } -} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0CFormatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0CFormatter.cs deleted file mode 100644 index b5b5938..0000000 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0CFormatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JTNE.Protocol.Extensions; -using JTNE.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.Formatters.MessageBodyFormatters -{ - public class JTNE_0x80Reply_0x0CFormatter : IJTNEFormatter - { - public JTNE_0x80Reply_0x0C Deserialize(ReadOnlySpan bytes, out int readSize) - { - int offset = 0; - JTNE_0x80Reply_0x0C jTNE_0x80Reply_0x0C = new JTNE_0x80Reply_0x0C(); - jTNE_0x80Reply_0x0C.ParamValue = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); - readSize = offset; - return jTNE_0x80Reply_0x0C; - } - - public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x0C value) - { - offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset,value.ParamValue); - return offset; - } - } -} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0DFormatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0DFormatter.cs deleted file mode 100644 index 15a9a91..0000000 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0DFormatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JTNE.Protocol.Extensions; -using JTNE.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.Formatters.MessageBodyFormatters -{ - public class JTNE_0x80Reply_0x0DFormatter : IJTNEFormatter - { - public JTNE_0x80Reply_0x0D Deserialize(ReadOnlySpan bytes, out int readSize) - { - int offset = 0; - JTNE_0x80Reply_0x0D jTNE_0x80Reply_0x0D = new JTNE_0x80Reply_0x0D(); - jTNE_0x80Reply_0x0D.ParamValue = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); - readSize = offset; - return jTNE_0x80Reply_0x0D; - } - - public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x0D value) - { - offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamValue); - return offset; - } - } -} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0EFormatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0EFormatter.cs deleted file mode 100644 index b38eb0e..0000000 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0EFormatter.cs +++ /dev/null @@ -1,27 +0,0 @@ -using JTNE.Protocol.Extensions; -using JTNE.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.Formatters.MessageBodyFormatters -{ - public class JTNE_0x80Reply_0x0EFormatter : IJTNEFormatter - { - public JTNE_0x80Reply_0x0E Deserialize(ReadOnlySpan bytes, out int readSize) - { - int offset = 0; - JTNE_0x80Reply_0x0E jTNE_0x80Reply_0x0E= new JTNE_0x80Reply_0x0E(); - jTNE_0x80Reply_0x0E.ParamValue = JTNEBinaryExtensions.ReadBytesLittle(bytes, ref offset); - jTNE_0x80Reply_0x0E.ParamLength = (byte)bytes.Length; - readSize = offset; - return jTNE_0x80Reply_0x0E; - } - - public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x0E value) - { - offset += JTNEBinaryExtensions.WriteBytesLittle(bytes, offset, value.ParamValue); - return offset; - } - } -} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0FFormatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0FFormatter.cs deleted file mode 100644 index b737598..0000000 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x0FFormatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JTNE.Protocol.Extensions; -using JTNE.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.Formatters.MessageBodyFormatters -{ - public class JTNE_0x80Reply_0x0FFormatter : IJTNEFormatter - { - public JTNE_0x80Reply_0x0F Deserialize(ReadOnlySpan bytes, out int readSize) - { - int offset = 0; - JTNE_0x80Reply_0x0F jTNE_0x80Reply_0x0F = new JTNE_0x80Reply_0x0F(); - jTNE_0x80Reply_0x0F.ParamValue = JTNEBinaryExtensions.ReadUInt16Little(bytes, ref offset); - readSize = offset; - return jTNE_0x80Reply_0x0F; - } - - public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x0F value) - { - offset += JTNEBinaryExtensions.WriteUInt16Little(bytes, offset, value.ParamValue); - return offset; - } - } -} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x10Formatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x10Formatter.cs deleted file mode 100644 index 73ea999..0000000 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_0x10Formatter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JTNE.Protocol.Extensions; -using JTNE.Protocol.MessageBody; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.Formatters.MessageBodyFormatters -{ - public class JTNE_0x80Reply_0x10Formatter : IJTNEFormatter - { - public JTNE_0x80Reply_0x10 Deserialize(ReadOnlySpan bytes, out int readSize) - { - int offset = 0; - JTNE_0x80Reply_0x10 jTNE_0x80Reply_0x10 = new JTNE_0x80Reply_0x10(); - jTNE_0x80Reply_0x10.ParamValue = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); - readSize = offset; - return jTNE_0x80Reply_0x10; - } - - public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x10 value) - { - offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset,value.ParamValue); - return offset; - } - } -} diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_Formatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_Formatter.cs index e81a9d7..554ba4b 100644 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_Formatter.cs +++ b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x80Reply_Formatter.cs @@ -11,51 +11,14 @@ namespace JTNE.Protocol.Formatters.MessageBodyFormatters { public JTNE_0x80Reply Deserialize(ReadOnlySpan bytes, out int readSize) { - int offset = 0; JTNE_0x80Reply jTNE_0x80Reply = new JTNE_0x80Reply(); - jTNE_0x80Reply.ReplyTime = JTNEBinaryExtensions.ReadDateTime6Little(bytes, ref offset); - jTNE_0x80Reply.ParamNum = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); - for (int i = 0; i < jTNE_0x80Reply.ParamNum; i++) - { - var paramId = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset);//参数ID - int readSubBodySize = 0; - if (JTNE_0x80Reply_Body.JTNE_0x80ReplyMethod.TryGetValue(paramId, out Type type)) - { - ReadOnlySpan readOnlySpan = new ReadOnlySpan(); - if (JTNE_0x80Reply_Body.JTNE_0x80ReplyLengthOfADependOnValueOfB.TryGetValue(paramId, out byte dependOnParamId)) { - var length = jTNE_0x80Reply.ParamList.FirstOrDefault(m => m.ParamId== dependOnParamId).ParamLength; - int tempOffset = 0; - int lengthVal = JTNEBinaryExtensions.ReadByteLittle(bytes.Slice(offset - length - 1, length), ref tempOffset); - readOnlySpan = bytes.Slice(offset, lengthVal); - } - else { - readOnlySpan = bytes.Slice(offset); - } - if (jTNE_0x80Reply.ParamList != null) - { - jTNE_0x80Reply.ParamList.Add(JTNEFormatterResolverExtensions.JTNEDynamicDeserialize(JTNEFormatterExtensions.GetFormatter(type), readOnlySpan, out readSubBodySize)); - } - else - { - jTNE_0x80Reply.ParamList = new List { JTNEFormatterResolverExtensions.JTNEDynamicDeserialize(JTNEFormatterExtensions.GetFormatter(type), readOnlySpan, out readSubBodySize) }; - } - } - offset = offset + readSubBodySize; - } - readSize = offset; + jTNE_0x80Reply.JTNE_Reply0x80 = JTNEFormatterExtensions.GetFormatter().Deserialize(bytes, out readSize); return jTNE_0x80Reply; } public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply value) { - offset += JTNEBinaryExtensions.WriteDateTime6Little(bytes, offset, value.ReplyTime); - offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamNum); - foreach (var item in value.ParamList) - { - offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, item.ParamId); - object obj = JTNEFormatterExtensions.GetFormatter(item.GetType()); - offset = JTNEFormatterResolverExtensions.JTNEDynamicSerialize(obj, ref bytes, offset, item); - } + offset=JTNEFormatterExtensions.GetFormatter().Serialize(ref bytes, offset,value.JTNE_Reply0x80); return offset; } } diff --git a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x81_Formatter.cs b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x81_Formatter.cs index 0c60b9d..832c92f 100644 --- a/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x81_Formatter.cs +++ b/src/JTNE.Protocol/Formatters/MessageBodyFormatters/JTNE_0x81_Formatter.cs @@ -13,7 +13,7 @@ namespace JTNE.Protocol.Formatters.MessageBodyFormatters { int offset = 0; JTNE_0x81 jTNE_0X81 = new JTNE_0x81(); - jTNE_0X81.SetTime = JTNEBinaryExtensions.ReadDateTime6Little(bytes, ref offset); + jTNE_0X81.OperateTime = JTNEBinaryExtensions.ReadDateTime6Little(bytes, ref offset); jTNE_0X81.ParamNum = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); for (int i = 0; i < jTNE_0X81.ParamNum; i++) { @@ -48,7 +48,7 @@ namespace JTNE.Protocol.Formatters.MessageBodyFormatters public int Serialize(ref byte[] bytes, int offset, JTNE_0x81 value) { - offset += JTNEBinaryExtensions.WriteDateTime6Little(bytes, offset, value.SetTime); + offset += JTNEBinaryExtensions.WriteDateTime6Little(bytes, offset, value.OperateTime); offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamNum); foreach (var item in value.ParamList) { diff --git a/src/JTNE.Protocol/JTNE.Protocol.csproj b/src/JTNE.Protocol/JTNE.Protocol.csproj index df631e5..307c4aa 100644 --- a/src/JTNE.Protocol/JTNE.Protocol.csproj +++ b/src/JTNE.Protocol/JTNE.Protocol.csproj @@ -26,12 +26,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/JTNE.Protocol/JTNEGlobalConfigs.cs b/src/JTNE.Protocol/JTNEGlobalConfigs.cs index 83d3567..48a5e3e 100644 --- a/src/JTNE.Protocol/JTNEGlobalConfigs.cs +++ b/src/JTNE.Protocol/JTNEGlobalConfigs.cs @@ -132,34 +132,6 @@ namespace JTNE.Protocol /// /// /// 自定义类型编码 - /// 继承JTNE.Protocol.MessageBody.JTNE_0x80Reply_Body - /// - public JTNEGlobalConfigs Register_JTNE0x80ReplyCustomBody(byte typeCode, Type type) - { - if (!JTNE_0x80Reply_Body.JTNE_0x80ReplyMethod.ContainsKey(typeCode)) - { - JTNE_0x80Reply_Body.JTNE_0x80ReplyMethod.Add(typeCode, type); - } - return instance.Value; - } - /// - /// - /// - /// 自定义类型编码 - /// 继承JTNE.Protocol.MessageBody.JTNE_0x80Reply_Body - /// - public JTNEGlobalConfigs Register_JTNE0x80ReplyCustomDepenedBody(byte DependerParamId, byte DependedParamId) - { - if (!JTNE_0x80Reply_Body.JTNE_0x80ReplyLengthOfADependOnValueOfB.ContainsKey(DependerParamId)) - { - JTNE_0x80Reply_Body.JTNE_0x80ReplyLengthOfADependOnValueOfB.Add(DependerParamId, DependedParamId); - } - return instance.Value; - } - /// - /// - /// - /// 自定义类型编码 /// 继承JTNE.Protocol.MessageBody.JTNE_0x81_Body /// public JTNEGlobalConfigs Register_JTNE0x82CustomBody(byte typeCode, Type type) diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x03.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x03.cs new file mode 100644 index 0000000..a5ea0a9 --- /dev/null +++ b/src/JTNE.Protocol/MessageBody/JTNE_0x03.cs @@ -0,0 +1,17 @@ +using JTNE.Protocol.Attributes; +using JTNE.Protocol.Formatters.MessageBodyFormatters; +using System; +using System.Collections.Generic; +using System.Text; + +namespace JTNE.Protocol.MessageBody +{ + /// + /// 实时信息上报 + /// + [JTNEFormatter(typeof(JTNE_0x03_Formatter))] + public class JTNE_0x03 : JTNEBodies + { + public JTNE_0x02 Supplement { get; set; } + } +} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply.cs index 9c5dd08..28d6e2d 100644 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply.cs +++ b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply.cs @@ -13,16 +13,8 @@ namespace JTNE.Protocol.MessageBody public class JTNE_0x80Reply : JTNEBodies { /// - /// 响应查询时间 + /// /// - public DateTime ReplyTime { get; set; } - /// - /// 参数总数 - /// - public byte ParamNum { get; set; } - /// - /// 参数列表 - /// - public List ParamList { get; set; } + public JTNE_0x81 JTNE_Reply0x80 { get; set; } } } diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x01.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x01.cs deleted file mode 100644 index eb4f1b0..0000000 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x01.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JTNE.Protocol.Attributes; -using JTNE.Protocol.Formatters.MessageBodyFormatters; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.MessageBody -{ - /// - /// 车载终端本地存储时间周期,有效值范围:0~60 000(表示0ms~60 000ms)最小计量单元:1ms - /// 0x81_0x01 - /// - [JTNEFormatter(typeof(JTNE_0x80Reply_0x01Formatter))] - public class JTNE_0x80Reply_0x01: JTNE_0x80Reply_Body - { - public override byte ParamId { get; set; } = 0x01; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 2; - /// - /// 车载终端本地存储时间周期,(表示0ms~60 000ms)最小计量单元:1ms - /// - public ushort ParamValue { get; set; } - } -} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x02.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x02.cs deleted file mode 100644 index 9109fdb..0000000 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x02.cs +++ /dev/null @@ -1,26 +0,0 @@ -using JTNE.Protocol.Attributes; -using JTNE.Protocol.Formatters.MessageBodyFormatters; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.MessageBody -{ - /// - /// 正常时,信息上报时间周期,有效值范围:1~600(表示1s~600s) 最小计量单元:1s - /// 0x81_0x02 - /// - [JTNEFormatter(typeof(JTNE_0x80Reply_0x02Formatter))] - public class JTNE_0x80Reply_0x02: JTNE_0x80Reply_Body - { - public override byte ParamId { get; set; } = 0x02; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 2; - /// - /// 正常时,信息上报时间周期,有效值范围:1~600(表示1s~600s) 最小计量单元:1s - /// - public ushort ParamValue { get; set; } - } -} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x03.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x03.cs deleted file mode 100644 index 8ca4298..0000000 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x03.cs +++ /dev/null @@ -1,25 +0,0 @@ -using JTNE.Protocol.Attributes; -using JTNE.Protocol.Formatters.MessageBodyFormatters; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.MessageBody -{ - /// - /// 出现报警时,信息上报时间周期,有效值范围:0~60 000(表示0ms~60 000ms) - /// - [JTNEFormatter(typeof(JTNE_0x80Reply_0x03Formatter))] - public class JTNE_0x80Reply_0x03: JTNE_0x80Reply_Body - { - public override byte ParamId { get; set; } = 0x03; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 2; - /// - ///出现报警时,信息上报时间周期,有效值范围:0~60 000(表示0ms~60 000ms) - /// - public ushort ParamValue { get; set; } - } -} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x04.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x04.cs deleted file mode 100644 index 32fdb0e..0000000 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x04.cs +++ /dev/null @@ -1,25 +0,0 @@ -using JTNE.Protocol.Attributes; -using JTNE.Protocol.Formatters.MessageBodyFormatters; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.MessageBody -{ - /// - /// 远程服务和管理平台域名长度M - /// - [JTNEFormatter(typeof(JTNE_0x80Reply_0x04Formatter))] - public class JTNE_0x80Reply_0x04: JTNE_0x80Reply_Body - { - public override byte ParamId { get; set; } = 0x04; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 1; - /// - ///远程服务和管理平台域名长度M - /// - public byte ParamValue { get; set; } - } -} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x05.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x05.cs deleted file mode 100644 index 8c14a74..0000000 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x05.cs +++ /dev/null @@ -1,25 +0,0 @@ -using JTNE.Protocol.Attributes; -using JTNE.Protocol.Formatters.MessageBodyFormatters; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.MessageBody -{ - /// - /// 远程服务和管理平台域名 - /// - [JTNEFormatter(typeof(JTNE_0x80Reply_0x05Formatter))] - public class JTNE_0x80Reply_0x05: JTNE_0x80Reply_Body - { - public override byte ParamId { get; set; } = 0x05; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } - /// - ///远程服务和管理平台域名 - /// - public byte[] ParamValue { get; set; } - } -} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x06.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x06.cs deleted file mode 100644 index 1e5e31c..0000000 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x06.cs +++ /dev/null @@ -1,25 +0,0 @@ -using JTNE.Protocol.Attributes; -using JTNE.Protocol.Formatters.MessageBodyFormatters; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.MessageBody -{ - /// - /// 远程服务和管理平台端口,有效值范围:0~65531 - /// - [JTNEFormatter(typeof(JTNE_0x80Reply_0x06Formatter))] - public class JTNE_0x80Reply_0x06: JTNE_0x80Reply_Body - { - public override byte ParamId { get; set; } = 0x06; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 2; - /// - ///远程服务和管理平台端口,有效值范围:0~65531 - /// - public ushort ParamValue { get; set; } - } -} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x07.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x07.cs deleted file mode 100644 index 724efb8..0000000 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x07.cs +++ /dev/null @@ -1,25 +0,0 @@ -using JTNE.Protocol.Attributes; -using JTNE.Protocol.Formatters.MessageBodyFormatters; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.MessageBody -{ - /// - /// 硬件版本,车载终端厂商自行定义 - /// - [JTNEFormatter(typeof(JTNE_0x80Reply_0x07Formatter))] - public class JTNE_0x80Reply_0x07: JTNE_0x80Reply_Body - { - public override byte ParamId { get; set; } = 0x07; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 5; - /// - ///硬件版本,车载终端厂商自行定义 数据长度= 5; - /// - public string ParamValue { get; set; } - } -} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x08.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x08.cs deleted file mode 100644 index 364e54f..0000000 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x08.cs +++ /dev/null @@ -1,25 +0,0 @@ -using JTNE.Protocol.Attributes; -using JTNE.Protocol.Formatters.MessageBodyFormatters; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.MessageBody -{ - /// - /// 固件版本,车载终端厂商自行定义 - /// - [JTNEFormatter(typeof(JTNE_0x80Reply_0x08Formatter))] - public class JTNE_0x80Reply_0x08: JTNE_0x80Reply_Body - { - public override byte ParamId { get; set; } = 0x08; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 5; - /// - ///固件版本,车载终端厂商自行定义 - /// - public string ParamValue { get; set; } - } -} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x09.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x09.cs deleted file mode 100644 index 3385c9e..0000000 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x09.cs +++ /dev/null @@ -1,25 +0,0 @@ -using JTNE.Protocol.Attributes; -using JTNE.Protocol.Formatters.MessageBodyFormatters; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.MessageBody -{ - /// - /// 车载终端心跳发送周期,有效值范围:1~240(表示1s~240s) - /// - [JTNEFormatter(typeof(JTNE_0x80Reply_0x09Formatter))] - public class JTNE_0x80Reply_0x09: JTNE_0x80Reply_Body - { - public override byte ParamId { get; set; } = 0x09; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 1; - /// - /// 车载终端心跳发送周期,有效值范围:1~240(表示1s~240s) - /// - public byte ParamValue { get; set; } - } -} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0A.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0A.cs deleted file mode 100644 index 49bf2f5..0000000 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0A.cs +++ /dev/null @@ -1,25 +0,0 @@ -using JTNE.Protocol.Attributes; -using JTNE.Protocol.Formatters.MessageBodyFormatters; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.MessageBody -{ - /// - /// 终端应答超时时间,有效值范围:1~600(表示1s~600s) - /// - [JTNEFormatter(typeof(JTNE_0x80Reply_0x0AFormatter))] - public class JTNE_0x80Reply_0x0A: JTNE_0x80Reply_Body - { - public override byte ParamId { get; set; } = 0x0A; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 2; - /// - ///终端应答超时时间,有效值范围:1~600(表示1s~600s) - /// - public ushort ParamValue { get; set; } - } -} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0B.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0B.cs deleted file mode 100644 index c0a6fd8..0000000 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0B.cs +++ /dev/null @@ -1,25 +0,0 @@ -using JTNE.Protocol.Attributes; -using JTNE.Protocol.Formatters.MessageBodyFormatters; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.MessageBody -{ - /// - /// 平台应答超时时间,有效值范围:1~600(表示1s~600s) - /// - [JTNEFormatter(typeof(JTNE_0x80Reply_0x0BFormatter))] - public class JTNE_0x80Reply_0x0B: JTNE_0x80Reply_Body - { - public override byte ParamId { get; set; } = 0x0B; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 2; - /// - ///平台应答超时时间,有效值范围:1~600(表示1s~600s) - /// - public ushort ParamValue { get; set; } - } -} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0C.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0C.cs deleted file mode 100644 index 90b8dff..0000000 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0C.cs +++ /dev/null @@ -1,25 +0,0 @@ -using JTNE.Protocol.Attributes; -using JTNE.Protocol.Formatters.MessageBodyFormatters; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.MessageBody -{ - /// - /// 连续三次登入失败后,到下一次登入的时间间隔。有效值范围:1~240(表示1min~240min) - /// - [JTNEFormatter(typeof(JTNE_0x80Reply_0x0CFormatter))] - public class JTNE_0x80Reply_0x0C: JTNE_0x80Reply_Body - { - public override byte ParamId { get; set; } = 0x0C; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 1; - /// - /// 连续三次登入失败后,到下一次登入的时间间隔。有效值范围:1~240(表示1min~240min) - /// - public byte ParamValue { get; set; } - } -} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0D.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0D.cs deleted file mode 100644 index 29b23c2..0000000 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0D.cs +++ /dev/null @@ -1,25 +0,0 @@ -using JTNE.Protocol.Attributes; -using JTNE.Protocol.Formatters.MessageBodyFormatters; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.MessageBody -{ - /// - /// 公共平台域名长度N - /// - [JTNEFormatter(typeof(JTNE_0x80Reply_0x0DFormatter))] - public class JTNE_0x80Reply_0x0D: JTNE_0x80Reply_Body - { - public override byte ParamId { get; set; } = 0x0D; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 1; - /// - ///公共平台域名长度N - /// - public byte ParamValue { get; set; } - } -} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0E.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0E.cs deleted file mode 100644 index 1a4edb9..0000000 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0E.cs +++ /dev/null @@ -1,25 +0,0 @@ -using JTNE.Protocol.Attributes; -using JTNE.Protocol.Formatters.MessageBodyFormatters; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.MessageBody -{ - /// - /// 公共平台域名 - /// - [JTNEFormatter(typeof(JTNE_0x80Reply_0x0EFormatter))] - public class JTNE_0x80Reply_0x0E: JTNE_0x80Reply_Body - { - public override byte ParamId { get; set; } = 0x0E; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } - /// - ///公共平台域名 - /// - public byte[] ParamValue { get; set; } - } -} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0F.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0F.cs deleted file mode 100644 index 5b6ce32..0000000 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x0F.cs +++ /dev/null @@ -1,25 +0,0 @@ -using JTNE.Protocol.Attributes; -using JTNE.Protocol.Formatters.MessageBodyFormatters; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.MessageBody -{ - /// - /// 公共平台端口,有效值访问:0~65531 - /// - [JTNEFormatter(typeof(JTNE_0x80Reply_0x0FFormatter))] - public class JTNE_0x80Reply_0x0F: JTNE_0x80Reply_Body - { - public override byte ParamId { get; set; } = 0x0F; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 2; - /// - ///公共平台端口,有效值访问:0~65531 - /// - public ushort ParamValue { get; set; } - } -} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x10.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x10.cs deleted file mode 100644 index 6972185..0000000 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_0x10.cs +++ /dev/null @@ -1,25 +0,0 @@ -using JTNE.Protocol.Attributes; -using JTNE.Protocol.Formatters.MessageBodyFormatters; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JTNE.Protocol.MessageBody -{ - /// - /// 是否处于抽样监测中 0x01 表示是 0x02 表示否 - /// - [JTNEFormatter(typeof(JTNE_0x80Reply_0x10Formatter))] - public class JTNE_0x80Reply_0x10: JTNE_0x80Reply_Body - { - public override byte ParamId { get; set; } = 0x10; - /// - /// 数据 长度 - /// - public override byte ParamLength { get; set; } = 1; - /// - /// 是否处于抽样监测中 0x01 表示是 0x02 表示否 - /// - public byte ParamValue { get; set; } - } -} diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_Body.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_Body.cs index 0d87f8a..7696d92 100644 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_Body.cs +++ b/src/JTNE.Protocol/MessageBody/JTNE_0x80Reply_Body.cs @@ -7,7 +7,7 @@ using System.Text; namespace JTNE.Protocol.MessageBody { /// - /// 参数查询 + /// 参数查询响应 /// public abstract class JTNE_0x80Reply_Body { @@ -133,33 +133,5 @@ namespace JTNE.Protocol.MessageBody JTNE_0x80ReplyLengthOfADependOnValueOfB.Add(JTNE_0x80Reply_0x05_Type, JTNE_0x80Reply_0x04_Type); JTNE_0x80ReplyLengthOfADependOnValueOfB.Add(JTNE_0x80Reply_0x0E_Type, JTNE_0x80Reply_0x0D_Type); } - - internal static void AddJTNE_0x80ReplyMethod(byte paramId, Type type) - { - if (!JTNE_0x80ReplyMethod.ContainsKey(paramId)) - { - JTNE_0x80ReplyMethod.Add(paramId, type); - } - else - { - JTNE_0x80ReplyMethod[paramId] = type; - } - } - /// - /// - /// - /// 依赖者 - /// 被依赖者 - internal static void AddJTNE_0x80ReplyLengthOfADependOnValueOfBMethod(byte DependerParamId, byte DependedParamId) - { - if (!JTNE_0x80ReplyLengthOfADependOnValueOfB.ContainsKey(DependerParamId)) - { - JTNE_0x80ReplyLengthOfADependOnValueOfB.Add(DependerParamId, DependedParamId); - } - else - { - JTNE_0x80ReplyLengthOfADependOnValueOfB[DependerParamId] = DependedParamId; - } - } } } diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x81.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x81.cs index 92ef3bf..e881385 100644 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x81.cs +++ b/src/JTNE.Protocol/MessageBody/JTNE_0x81.cs @@ -7,15 +7,15 @@ using System.Text; namespace JTNE.Protocol.MessageBody { /// - /// 参数查询 + /// 参数设置 /// [JTNEFormatter(typeof(JTNE_0x81_Formatter))] public class JTNE_0x81 : JTNEBodies { /// - /// 设置时间 + /// 操作时间 /// - public DateTime SetTime { get; set; } + public DateTime OperateTime { get; set; } /// /// 参数总数 /// diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x81_Body.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x81_Body.cs index 77f332b..92fbc18 100644 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x81_Body.cs +++ b/src/JTNE.Protocol/MessageBody/JTNE_0x81_Body.cs @@ -7,7 +7,7 @@ using System.Text; namespace JTNE.Protocol.MessageBody { /// - /// 参数查询 + /// 参数设置 /// public abstract class JTNE_0x81_Body { @@ -133,33 +133,5 @@ namespace JTNE.Protocol.MessageBody JTNE_0x81LengthOfADependOnValueOfB.Add(JTNE_0x81_0x05_Type, JTNE_0x81_0x04_Type); JTNE_0x81LengthOfADependOnValueOfB.Add(JTNE_0x81_0x0E_Type, JTNE_0x81_0x0D_Type); } - - internal static void AddJTNE_0x81Method(byte paramId, Type type) - { - if (!JTNE_0x81Method.ContainsKey(paramId)) - { - JTNE_0x81Method.Add(paramId, type); - } - else - { - JTNE_0x81Method[paramId] = type; - } - } - /// - /// - /// - /// 依赖者 - /// 被依赖者 - internal static void AddJTNE_0x81LengthOfADependOnValueOfBMethod(byte DependerParamId, byte DependedParamId) - { - if (!JTNE_0x81LengthOfADependOnValueOfB.ContainsKey(DependerParamId)) - { - JTNE_0x81LengthOfADependOnValueOfB.Add(DependerParamId, DependedParamId); - } - else - { - JTNE_0x81LengthOfADependOnValueOfB[DependerParamId] = DependedParamId; - } - } } } diff --git a/src/JTNE.Protocol/MessageBody/JTNE_0x82_Body.cs b/src/JTNE.Protocol/MessageBody/JTNE_0x82_Body.cs index 7a6aebb..92914fc 100644 --- a/src/JTNE.Protocol/MessageBody/JTNE_0x82_Body.cs +++ b/src/JTNE.Protocol/MessageBody/JTNE_0x82_Body.cs @@ -7,7 +7,7 @@ using System.Text; namespace JTNE.Protocol.MessageBody { /// - /// 参数查询 + /// 终端控制 /// public class JTNE_0x82_Body { @@ -67,17 +67,5 @@ namespace JTNE.Protocol.MessageBody JTNE_0x82Method.Add(JTNE_0x82_0x01_Type, typeof(JTNE_0x82_0x01)); JTNE_0x82Method.Add(JTNE_0x82_0x06_Type, typeof(JTNE_0x82_0x06)); } - - internal static void AddJTNE_0x82Method(byte paramId, Type type) - { - if (!JTNE_0x82Method.ContainsKey(paramId)) - { - JTNE_0x82Method.Add(paramId, type); - } - else - { - JTNE_0x82Method[paramId] = type; - } - } } }