@@ -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<byte, JTNE_0x02_Body>(); | |||
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>(); | |||
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<JTNE_0x03>(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); | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_Body> { | |||
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<JTNE_0x81_Body> { | |||
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<JTNE_0x80Reply>(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<JTNE_0x80Reply_Body> { | |||
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<JTNE_0x81_Body> { | |||
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<JTNE_0x80Reply>(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<JTNE_0x80Reply_Body> { | |||
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<JTNE_0x81_Body> { | |||
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<JTNE_0x80Reply>(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<JTNE_0x80Reply_Body> { | |||
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<JTNE_0x81_Body> { | |||
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<JTNE_0x80Reply_Body> { | |||
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<JTNE_0x81_Body> { | |||
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<JTNE_0x80Reply>(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<JTNE_0x80Reply_Body> { | |||
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<JTNE_0x81_Body> { | |||
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<JTNE_0x80Reply_Body> { | |||
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<JTNE_0x81_Body> { | |||
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<JTNE_0x80Reply>(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<JTNE_0x80Reply_Body> { | |||
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<JTNE_0x81_Body> { | |||
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<JTNE_0x80Reply>(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<JTNE_0x80Reply_Body> { | |||
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<JTNE_0x81_Body> { | |||
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)); | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_Body> { | |||
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<JTNE_0x81_Body> { | |||
new JTNE_0x80Reply_0x80{ | |||
ParamValue=6 | |||
}, | |||
new JTNE_0x80Reply_0x81{ | |||
ParamLength=6, | |||
ParamValue=new byte[]{ 1,2,3,4,5,6 } | |||
} | |||
} | |||
}; | |||
jTNE_0x80Reply.JTNE_Reply0x80 = jTNE_0X81; | |||
var hex = JTNESerializer.Serialize(jTNE_0x80Reply).ToHexString(); | |||
Assert.Equal("13011617373802800681010203040506", hex); | |||
} | |||
[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<JTNE_0x80Reply>(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<JTNE_0x80Reply_Body> { | |||
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<JTNE_0x81_Body> { | |||
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; } | |||
@@ -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<JTNE_0x81_Body> { | |||
new JTNE_0x81_0x01{ | |||
@@ -31,7 +31,7 @@ namespace JTNE.Protocol.Test.MessageBody | |||
{ | |||
var data = "1301161737380101000A".ToHexBytes(); | |||
JTNE_0x81 jTNE_0X81 = JTNESerializer.Deserialize<JTNE_0x81>(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<JTNE_0x81_Body> { | |||
new JTNE_0x81_0x02{ | |||
@@ -62,7 +62,7 @@ namespace JTNE.Protocol.Test.MessageBody | |||
{ | |||
var data = "13011617373801020014".ToHexBytes(); | |||
JTNE_0x81 jTNE_0X81 = JTNESerializer.Deserialize<JTNE_0x81>(data); | |||
Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X81.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<JTNE_0x81_Body> { | |||
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<JTNE_0x81>(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<JTNE_0x81_Body> { | |||
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<JTNE_0x81_Body> { | |||
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<JTNE_0x81>(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<JTNE_0x81_Body> { | |||
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<JTNE_0x81_Body> { | |||
new JTNE_0x81_0x03{ | |||
@@ -173,7 +173,7 @@ namespace JTNE.Protocol.Test.MessageBody | |||
{ | |||
var data = "1301161737380103001E".ToHexBytes(); | |||
JTNE_0x81 jTNE_0X81 = JTNESerializer.Deserialize<JTNE_0x81>(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<JTNE_0x81_Body> { | |||
new JTNE_0x81_0x01{ | |||
@@ -235,7 +235,7 @@ namespace JTNE.Protocol.Test.MessageBody | |||
{ | |||
var data = "1301161737380C01000A02001403001E06002807616263646508313233343509320A003C0B00460C500F005A1001".ToHexBytes(); | |||
JTNE_0x81 jTNE_0X81 = JTNESerializer.Deserialize<JTNE_0x81>(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<JTNE_0x81_Body> { | |||
new JTNE_0x81_0x01{ | |||
@@ -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<JTNE_0x81_Body> { | |||
new JTNE_0x81_0x80{ | |||
@@ -45,7 +45,7 @@ namespace JTNE.Protocol.Test.MessageBody | |||
var data = "13011617373802800681010203040506".ToHexBytes(); | |||
JTNE_0x81 jTNE_0X81 = JTNESerializer.Deserialize<JTNE_0x81>(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<JTNE_0x81_Body> { | |||
new JTNE_0x81_0x80{ | |||
@@ -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<JTNE_0x03> | |||
{ | |||
public JTNE_0x03 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||
{ | |||
JTNE_0x03 jTNE_0X03 = new JTNE_0x03(); | |||
jTNE_0X03.Supplement= JTNEFormatterExtensions.GetFormatter<JTNE_0x02>().Deserialize(bytes, out readSize); | |||
return jTNE_0X03; | |||
} | |||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x03 value) | |||
{ | |||
offset = JTNEFormatterExtensions.GetFormatter<JTNE_0x02>().Serialize(ref bytes, offset,value.Supplement); | |||
return offset; | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_0x01> | |||
{ | |||
public JTNE_0x80Reply_0x01 Deserialize(ReadOnlySpan<byte> 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; | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_0x02> | |||
{ | |||
public JTNE_0x80Reply_0x02 Deserialize(ReadOnlySpan<byte> 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; | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_0x03> | |||
{ | |||
public JTNE_0x80Reply_0x03 Deserialize(ReadOnlySpan<byte> 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; | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_0x04> | |||
{ | |||
public JTNE_0x80Reply_0x04 Deserialize(ReadOnlySpan<byte> 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; | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_0x05> | |||
{ | |||
public JTNE_0x80Reply_0x05 Deserialize(ReadOnlySpan<byte> 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; | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_0x06> | |||
{ | |||
public JTNE_0x80Reply_0x06 Deserialize(ReadOnlySpan<byte> 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; | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_0x07> | |||
{ | |||
public JTNE_0x80Reply_0x07 Deserialize(ReadOnlySpan<byte> 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; | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_0x08> | |||
{ | |||
public JTNE_0x80Reply_0x08 Deserialize(ReadOnlySpan<byte> 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; | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_0x09> | |||
{ | |||
public JTNE_0x80Reply_0x09 Deserialize(ReadOnlySpan<byte> 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; | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_0x0A> | |||
{ | |||
public JTNE_0x80Reply_0x0A Deserialize(ReadOnlySpan<byte> 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; | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_0x0B> | |||
{ | |||
public JTNE_0x80Reply_0x0B Deserialize(ReadOnlySpan<byte> 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; | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_0x0C> | |||
{ | |||
public JTNE_0x80Reply_0x0C Deserialize(ReadOnlySpan<byte> 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; | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_0x0D> | |||
{ | |||
public JTNE_0x80Reply_0x0D Deserialize(ReadOnlySpan<byte> 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; | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_0x0E> | |||
{ | |||
public JTNE_0x80Reply_0x0E Deserialize(ReadOnlySpan<byte> 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; | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_0x0F> | |||
{ | |||
public JTNE_0x80Reply_0x0F Deserialize(ReadOnlySpan<byte> 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; | |||
} | |||
} | |||
} |
@@ -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<JTNE_0x80Reply_0x10> | |||
{ | |||
public JTNE_0x80Reply_0x10 Deserialize(ReadOnlySpan<byte> 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; | |||
} | |||
} | |||
} |
@@ -11,51 +11,14 @@ namespace JTNE.Protocol.Formatters.MessageBodyFormatters | |||
{ | |||
public JTNE_0x80Reply Deserialize(ReadOnlySpan<byte> 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<byte> readOnlySpan = new ReadOnlySpan<byte>(); | |||
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<JTNE_0x80Reply_Body> { JTNEFormatterResolverExtensions.JTNEDynamicDeserialize(JTNEFormatterExtensions.GetFormatter(type), readOnlySpan, out readSubBodySize) }; | |||
} | |||
} | |||
offset = offset + readSubBodySize; | |||
} | |||
readSize = offset; | |||
jTNE_0x80Reply.JTNE_Reply0x80 = JTNEFormatterExtensions.GetFormatter<JTNE_0x81>().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<JTNE_0x81>().Serialize(ref bytes, offset,value.JTNE_Reply0x80); | |||
return offset; | |||
} | |||
} | |||
@@ -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) | |||
{ | |||
@@ -26,12 +26,45 @@ | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x80Reply_0x01Formatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x80Reply_0x02Formatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x80Reply_0x03Formatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x80Reply_0x04Formatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x80Reply_0x05Formatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x80Reply_0x06Formatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x80Reply_0x07Formatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x80Reply_0x08Formatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x80Reply_0x09Formatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x80Reply_0x0AFormatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x80Reply_0x0BFormatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x80Reply_0x0CFormatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x80Reply_0x0DFormatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x80Reply_0x0EFormatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x80Reply_0x0FFormatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x80Reply_0x10Formatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x82_0x00Formatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x82_0x02Formatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x82_0x03Formatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x82_0x04Formatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x82_0x05Formatter.cs" /> | |||
<Compile Remove="Formatters\MessageBodyFormatters\JTNE_0x82_0x07Formatter.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_0x01.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_0x02.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_0x03.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_0x04.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_0x05.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_0x06.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_0x07.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_0x08.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_0x09.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_0x0A.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_0x0B.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_0x0C.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_0x0D.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_0x0E.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_0x0F.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_0x10.cs" /> | |||
<Compile Remove="MessageBody\JTNE_0x80Reply_Body.cs" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -132,34 +132,6 @@ namespace JTNE.Protocol | |||
/// | |||
/// </summary> | |||
/// <param name="typeCode">自定义类型编码</param> | |||
/// <param name="type">继承JTNE.Protocol.MessageBody.JTNE_0x80Reply_Body</param> | |||
/// <returns></returns> | |||
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; | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="typeCode">自定义类型编码</param> | |||
/// <param name="type">继承JTNE.Protocol.MessageBody.JTNE_0x80Reply_Body</param> | |||
/// <returns></returns> | |||
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; | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="typeCode">自定义类型编码</param> | |||
/// <param name="type">继承JTNE.Protocol.MessageBody.JTNE_0x81_Body</param> | |||
/// <returns></returns> | |||
public JTNEGlobalConfigs Register_JTNE0x82CustomBody(byte typeCode, Type type) | |||
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 实时信息上报 | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x03_Formatter))] | |||
public class JTNE_0x03 : JTNEBodies | |||
{ | |||
public JTNE_0x02 Supplement { get; set; } | |||
} | |||
} |
@@ -13,16 +13,8 @@ namespace JTNE.Protocol.MessageBody | |||
public class JTNE_0x80Reply : JTNEBodies | |||
{ | |||
/// <summary> | |||
/// 响应查询时间 | |||
/// | |||
/// </summary> | |||
public DateTime ReplyTime { get; set; } | |||
/// <summary> | |||
/// 参数总数 | |||
/// </summary> | |||
public byte ParamNum { get; set; } | |||
/// <summary> | |||
/// 参数列表 | |||
/// </summary> | |||
public List<JTNE_0x80Reply_Body> ParamList { get; set; } | |||
public JTNE_0x81 JTNE_Reply0x80 { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 车载终端本地存储时间周期,有效值范围:0~60 000(表示0ms~60 000ms)最小计量单元:1ms | |||
/// 0x81_0x01 | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x01Formatter))] | |||
public class JTNE_0x80Reply_0x01: JTNE_0x80Reply_Body | |||
{ | |||
public override byte ParamId { get; set; } = 0x01; | |||
/// <summary> | |||
/// 数据 长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } = 2; | |||
/// <summary> | |||
/// 车载终端本地存储时间周期,(表示0ms~60 000ms)最小计量单元:1ms | |||
/// </summary> | |||
public ushort ParamValue { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 正常时,信息上报时间周期,有效值范围:1~600(表示1s~600s) 最小计量单元:1s | |||
/// 0x81_0x02 | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x02Formatter))] | |||
public class JTNE_0x80Reply_0x02: JTNE_0x80Reply_Body | |||
{ | |||
public override byte ParamId { get; set; } = 0x02; | |||
/// <summary> | |||
/// 数据 长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } = 2; | |||
/// <summary> | |||
/// 正常时,信息上报时间周期,有效值范围:1~600(表示1s~600s) 最小计量单元:1s | |||
/// </summary> | |||
public ushort ParamValue { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 出现报警时,信息上报时间周期,有效值范围:0~60 000(表示0ms~60 000ms) | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x03Formatter))] | |||
public class JTNE_0x80Reply_0x03: JTNE_0x80Reply_Body | |||
{ | |||
public override byte ParamId { get; set; } = 0x03; | |||
/// <summary> | |||
/// 数据 长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } = 2; | |||
/// <summary> | |||
///出现报警时,信息上报时间周期,有效值范围:0~60 000(表示0ms~60 000ms) | |||
/// </summary> | |||
public ushort ParamValue { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 远程服务和管理平台域名长度M | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x04Formatter))] | |||
public class JTNE_0x80Reply_0x04: JTNE_0x80Reply_Body | |||
{ | |||
public override byte ParamId { get; set; } = 0x04; | |||
/// <summary> | |||
/// 数据 长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } = 1; | |||
/// <summary> | |||
///远程服务和管理平台域名长度M | |||
/// </summary> | |||
public byte ParamValue { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 远程服务和管理平台域名 | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x05Formatter))] | |||
public class JTNE_0x80Reply_0x05: JTNE_0x80Reply_Body | |||
{ | |||
public override byte ParamId { get; set; } = 0x05; | |||
/// <summary> | |||
/// 数据 长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } | |||
/// <summary> | |||
///远程服务和管理平台域名 | |||
/// </summary> | |||
public byte[] ParamValue { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 远程服务和管理平台端口,有效值范围:0~65531 | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x06Formatter))] | |||
public class JTNE_0x80Reply_0x06: JTNE_0x80Reply_Body | |||
{ | |||
public override byte ParamId { get; set; } = 0x06; | |||
/// <summary> | |||
/// 数据 长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } = 2; | |||
/// <summary> | |||
///远程服务和管理平台端口,有效值范围:0~65531 | |||
/// </summary> | |||
public ushort ParamValue { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 硬件版本,车载终端厂商自行定义 | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x07Formatter))] | |||
public class JTNE_0x80Reply_0x07: JTNE_0x80Reply_Body | |||
{ | |||
public override byte ParamId { get; set; } = 0x07; | |||
/// <summary> | |||
/// 数据 长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } = 5; | |||
/// <summary> | |||
///硬件版本,车载终端厂商自行定义 数据长度= 5; | |||
/// </summary> | |||
public string ParamValue { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 固件版本,车载终端厂商自行定义 | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x08Formatter))] | |||
public class JTNE_0x80Reply_0x08: JTNE_0x80Reply_Body | |||
{ | |||
public override byte ParamId { get; set; } = 0x08; | |||
/// <summary> | |||
/// 数据 长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } = 5; | |||
/// <summary> | |||
///固件版本,车载终端厂商自行定义 | |||
/// </summary> | |||
public string ParamValue { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 车载终端心跳发送周期,有效值范围:1~240(表示1s~240s) | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x09Formatter))] | |||
public class JTNE_0x80Reply_0x09: JTNE_0x80Reply_Body | |||
{ | |||
public override byte ParamId { get; set; } = 0x09; | |||
/// <summary> | |||
/// 数据 长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } = 1; | |||
/// <summary> | |||
/// 车载终端心跳发送周期,有效值范围:1~240(表示1s~240s) | |||
/// </summary> | |||
public byte ParamValue { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 终端应答超时时间,有效值范围:1~600(表示1s~600s) | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x0AFormatter))] | |||
public class JTNE_0x80Reply_0x0A: JTNE_0x80Reply_Body | |||
{ | |||
public override byte ParamId { get; set; } = 0x0A; | |||
/// <summary> | |||
/// 数据 长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } = 2; | |||
/// <summary> | |||
///终端应答超时时间,有效值范围:1~600(表示1s~600s) | |||
/// </summary> | |||
public ushort ParamValue { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 平台应答超时时间,有效值范围:1~600(表示1s~600s) | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x0BFormatter))] | |||
public class JTNE_0x80Reply_0x0B: JTNE_0x80Reply_Body | |||
{ | |||
public override byte ParamId { get; set; } = 0x0B; | |||
/// <summary> | |||
/// 数据 长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } = 2; | |||
/// <summary> | |||
///平台应答超时时间,有效值范围:1~600(表示1s~600s) | |||
/// </summary> | |||
public ushort ParamValue { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 连续三次登入失败后,到下一次登入的时间间隔。有效值范围:1~240(表示1min~240min) | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x0CFormatter))] | |||
public class JTNE_0x80Reply_0x0C: JTNE_0x80Reply_Body | |||
{ | |||
public override byte ParamId { get; set; } = 0x0C; | |||
/// <summary> | |||
/// 数据 长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } = 1; | |||
/// <summary> | |||
/// 连续三次登入失败后,到下一次登入的时间间隔。有效值范围:1~240(表示1min~240min) | |||
/// </summary> | |||
public byte ParamValue { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 公共平台域名长度N | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x0DFormatter))] | |||
public class JTNE_0x80Reply_0x0D: JTNE_0x80Reply_Body | |||
{ | |||
public override byte ParamId { get; set; } = 0x0D; | |||
/// <summary> | |||
/// 数据 长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } = 1; | |||
/// <summary> | |||
///公共平台域名长度N | |||
/// </summary> | |||
public byte ParamValue { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 公共平台域名 | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x0EFormatter))] | |||
public class JTNE_0x80Reply_0x0E: JTNE_0x80Reply_Body | |||
{ | |||
public override byte ParamId { get; set; } = 0x0E; | |||
/// <summary> | |||
/// 数据 长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } | |||
/// <summary> | |||
///公共平台域名 | |||
/// </summary> | |||
public byte[] ParamValue { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 公共平台端口,有效值访问:0~65531 | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x0FFormatter))] | |||
public class JTNE_0x80Reply_0x0F: JTNE_0x80Reply_Body | |||
{ | |||
public override byte ParamId { get; set; } = 0x0F; | |||
/// <summary> | |||
/// 数据 长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } = 2; | |||
/// <summary> | |||
///公共平台端口,有效值访问:0~65531 | |||
/// </summary> | |||
public ushort ParamValue { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 是否处于抽样监测中 0x01 表示是 0x02 表示否 | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x10Formatter))] | |||
public class JTNE_0x80Reply_0x10: JTNE_0x80Reply_Body | |||
{ | |||
public override byte ParamId { get; set; } = 0x10; | |||
/// <summary> | |||
/// 数据 长度 | |||
/// </summary> | |||
public override byte ParamLength { get; set; } = 1; | |||
/// <summary> | |||
/// 是否处于抽样监测中 0x01 表示是 0x02 表示否 | |||
/// </summary> | |||
public byte ParamValue { get; set; } | |||
} | |||
} |
@@ -7,7 +7,7 @@ using System.Text; | |||
namespace JTNE.Protocol.MessageBody | |||
{ | |||
/// <summary> | |||
/// 参数查询 | |||
/// 参数查询响应 | |||
/// </summary> | |||
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; | |||
} | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="DependerParamId">依赖者</param> | |||
/// <param name="DependedParamId">被依赖者</param> | |||
internal static void AddJTNE_0x80ReplyLengthOfADependOnValueOfBMethod(byte DependerParamId, byte DependedParamId) | |||
{ | |||
if (!JTNE_0x80ReplyLengthOfADependOnValueOfB.ContainsKey(DependerParamId)) | |||
{ | |||
JTNE_0x80ReplyLengthOfADependOnValueOfB.Add(DependerParamId, DependedParamId); | |||
} | |||
else | |||
{ | |||
JTNE_0x80ReplyLengthOfADependOnValueOfB[DependerParamId] = DependedParamId; | |||
} | |||
} | |||
} | |||
} |
@@ -7,15 +7,15 @@ using System.Text; | |||
namespace JTNE.Protocol.MessageBody | |||
{ | |||
/// <summary> | |||
/// 参数查询 | |||
/// 参数设置 | |||
/// </summary> | |||
[JTNEFormatter(typeof(JTNE_0x81_Formatter))] | |||
public class JTNE_0x81 : JTNEBodies | |||
{ | |||
/// <summary> | |||
/// 设置时间 | |||
/// 操作时间 | |||
/// </summary> | |||
public DateTime SetTime { get; set; } | |||
public DateTime OperateTime { get; set; } | |||
/// <summary> | |||
/// 参数总数 | |||
/// </summary> | |||
@@ -7,7 +7,7 @@ using System.Text; | |||
namespace JTNE.Protocol.MessageBody | |||
{ | |||
/// <summary> | |||
/// 参数查询 | |||
/// 参数设置 | |||
/// </summary> | |||
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; | |||
} | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="DependerParamId">依赖者</param> | |||
/// <param name="DependedParamId">被依赖者</param> | |||
internal static void AddJTNE_0x81LengthOfADependOnValueOfBMethod(byte DependerParamId, byte DependedParamId) | |||
{ | |||
if (!JTNE_0x81LengthOfADependOnValueOfB.ContainsKey(DependerParamId)) | |||
{ | |||
JTNE_0x81LengthOfADependOnValueOfB.Add(DependerParamId, DependedParamId); | |||
} | |||
else | |||
{ | |||
JTNE_0x81LengthOfADependOnValueOfB[DependerParamId] = DependedParamId; | |||
} | |||
} | |||
} | |||
} |
@@ -7,7 +7,7 @@ using System.Text; | |||
namespace JTNE.Protocol.MessageBody | |||
{ | |||
/// <summary> | |||
/// 参数查询 | |||
/// 终端控制 | |||
/// </summary> | |||
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; | |||
} | |||
} | |||
} | |||
} |