@@ -0,0 +1,280 @@ | |||||
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_0x80ReplyTest | |||||
{ | |||||
[Fact] | |||||
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{ | |||||
ParamId=0x01, | |||||
ParamLength=2, | |||||
ParamValue=10 | |||||
} | |||||
}; | |||||
var hex = JTNESerializer.Serialize(jTNE_0x80Reply).ToHexString(); | |||||
Assert.Equal("1301161737380101000A", hex); | |||||
} | |||||
[Fact] | |||||
public void Test1_1() | |||||
{ | |||||
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 | |||||
{ | |||||
ParamId = 0x01, | |||||
ParamLength = 2, | |||||
ParamValue = 10 | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.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{ | |||||
ParamId=0x02, | |||||
ParamLength=2, | |||||
ParamValue=20 | |||||
} | |||||
}; | |||||
var hex = JTNESerializer.Serialize(jTNE_0x80Reply).ToHexString(); | |||||
Assert.Equal("13011617373801020014", hex); | |||||
} | |||||
[Fact] | |||||
public void Test2_1() | |||||
{ | |||||
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 | |||||
{ | |||||
ParamId = 0x02, | |||||
ParamLength = 2, | |||||
ParamValue = 20 | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.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{ | |||||
ParamValue=8 | |||||
},new JTNE_0x80Reply_0x05{ | |||||
ParamValue=new byte[]{ 1, 2, 3, 4, 5, 6, 7, 8 } | |||||
}, | |||||
new JTNE_0x80Reply_0x06{ | |||||
ParamValue=40 | |||||
} | |||||
}; | |||||
jTNE_0x80Reply.ParamNum =(byte)jTNE_0x80Reply.ParamList.Count; | |||||
var hex = JTNESerializer.Serialize(jTNE_0x80Reply).ToHexString(); | |||||
Assert.Equal("130116173738030408050102030405060708060028", hex); | |||||
} | |||||
[Fact] | |||||
public void Test4_1() | |||||
{ | |||||
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{ | |||||
ParamValue=8 | |||||
},new JTNE_0x80Reply_0x05{ | |||||
ParamValue=new byte[]{1,2,3,4,5,6,7,8 }, | |||||
ParamLength=8 | |||||
}, new JTNE_0x80Reply_0x06{ | |||||
ParamValue=40 | |||||
} | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.ParamList)); | |||||
} | |||||
[Fact] | |||||
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{ | |||||
ParamValue=8 | |||||
},new JTNE_0x80Reply_0x0E{ | |||||
ParamValue=new byte[]{ 1, 2, 3, 4, 5, 6, 7, 8 } | |||||
}, | |||||
new JTNE_0x80Reply_0x0F{ | |||||
ParamValue=40 | |||||
} | |||||
}; | |||||
jTNE_0x80Reply.ParamNum = (byte)jTNE_0x80Reply.ParamList.Count; | |||||
var hex = JTNESerializer.Serialize(jTNE_0x80Reply).ToHexString(); | |||||
Assert.Equal("130116173738030D080E01020304050607080F0028", hex); | |||||
} | |||||
[Fact] | |||||
public void Test5_1() | |||||
{ | |||||
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{ | |||||
ParamValue=8 | |||||
},new JTNE_0x80Reply_0x0E{ | |||||
ParamValue=new byte[]{1,2,3,4,5,6,7,8 }, | |||||
ParamLength=8 | |||||
}, new JTNE_0x80Reply_0x0F{ | |||||
ParamValue=40 | |||||
} | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.ParamList)); | |||||
} | |||||
[Fact] | |||||
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{ | |||||
ParamId=0x03, | |||||
ParamLength=2, | |||||
ParamValue=30 | |||||
} | |||||
}; | |||||
var hex = JTNESerializer.Serialize(jTNE_0x80Reply).ToHexString(); | |||||
Assert.Equal("1301161737380103001E", hex); | |||||
} | |||||
[Fact] | |||||
public void Test3_1() | |||||
{ | |||||
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 | |||||
{ | |||||
ParamId = 0x03, | |||||
ParamLength = 2, | |||||
ParamValue = 30 | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.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{ | |||||
ParamValue=10 | |||||
}, | |||||
new JTNE_0x80Reply_0x02{ | |||||
ParamValue=20 | |||||
}, | |||||
new JTNE_0x80Reply_0x03{ | |||||
ParamValue=30 | |||||
}, | |||||
new JTNE_0x80Reply_0x06{ | |||||
ParamValue=40 | |||||
}, | |||||
new JTNE_0x80Reply_0x07{ | |||||
ParamValue="abcde" | |||||
}, | |||||
new JTNE_0x80Reply_0x08{ | |||||
ParamValue="12345" | |||||
}, | |||||
new JTNE_0x80Reply_0x09{ | |||||
ParamValue=50 | |||||
}, | |||||
new JTNE_0x80Reply_0x0A{ | |||||
ParamValue=60 | |||||
}, | |||||
new JTNE_0x80Reply_0x0B{ | |||||
ParamValue=70 | |||||
}, | |||||
new JTNE_0x80Reply_0x0C{ | |||||
ParamValue=80 | |||||
}, | |||||
new JTNE_0x80Reply_0x0F{ | |||||
ParamValue=90 | |||||
}, | |||||
new JTNE_0x80Reply_0x10{ | |||||
ParamValue=0x01 | |||||
} | |||||
}; | |||||
var hex = JTNESerializer.Serialize(jTNE_0x80Reply).ToHexString(); | |||||
Assert.Equal("1301161737380C01000A02001403001E06002807616263646508313233343509320A003C0B00460C500F005A1001", hex); | |||||
} | |||||
[Fact] | |||||
public void TestAll_1() | |||||
{ | |||||
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{ | |||||
ParamValue=10 | |||||
}, | |||||
new JTNE_0x80Reply_0x02{ | |||||
ParamValue=20 | |||||
}, | |||||
new JTNE_0x80Reply_0x03{ | |||||
ParamValue=30 | |||||
}, | |||||
new JTNE_0x80Reply_0x06{ | |||||
ParamValue=40 | |||||
}, | |||||
new JTNE_0x80Reply_0x07{ | |||||
ParamValue="abcde" | |||||
}, | |||||
new JTNE_0x80Reply_0x08{ | |||||
ParamValue="12345" | |||||
}, | |||||
new JTNE_0x80Reply_0x09{ | |||||
ParamValue=50 | |||||
}, | |||||
new JTNE_0x80Reply_0x0A{ | |||||
ParamValue=60 | |||||
}, | |||||
new JTNE_0x80Reply_0x0B{ | |||||
ParamValue=70 | |||||
}, | |||||
new JTNE_0x80Reply_0x0C{ | |||||
ParamValue=80 | |||||
}, | |||||
new JTNE_0x80Reply_0x0F{ | |||||
ParamValue=90 | |||||
}, | |||||
new JTNE_0x80Reply_0x10{ | |||||
ParamValue=0x01 | |||||
} | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.ParamList)); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,108 @@ | |||||
using JTNE.Protocol.MessageBody; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using Xunit; | |||||
using JTNE.Protocol.Extensions; | |||||
using JTNE.Protocol.Formatters; | |||||
using JTNE.Protocol.Attributes; | |||||
namespace JTNE.Protocol.Test.MessageBody | |||||
{ | |||||
public class JTNE_0x80Reply_CustomBodyTest | |||||
{ | |||||
[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); | |||||
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{ | |||||
ParamValue=6 | |||||
}, | |||||
new JTNE_0x80Reply_0x81{ | |||||
ParamLength=6, | |||||
ParamValue=new byte[]{ 1,2,3,4,5,6 } | |||||
} | |||||
}; | |||||
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); | |||||
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> { | |||||
new JTNE_0x80Reply_0x80{ | |||||
ParamValue=6 | |||||
}, | |||||
new JTNE_0x80Reply_0x81{ | |||||
ParamLength=6, | |||||
ParamValue=new byte[]{ 1,2,3,4,5,6 } | |||||
} | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x80Reply.ParamList)); | |||||
} | |||||
} | |||||
[JTNEFormatter(typeof(JTNE_0x80Reply_0x80Formatter))] | |||||
public class JTNE_0x80Reply_0x80 : JTNE_0x80Reply_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 override byte ParamId { get; set; } = 0x81; | |||||
public override byte ParamLength { get; set; } | |||||
public byte[] ParamValue { get; set; } | |||||
} | |||||
public class JTNE_0x80Reply_0x80Formatter : IJTNEFormatter<JTNE_0x80Reply_0x80> | |||||
{ | |||||
public JTNE_0x80Reply_0x80 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x80Reply_0x80 jTNE_0x80Reply_0x80 = new JTNE_0x80Reply_0x80(); | |||||
jTNE_0x80Reply_0x80.ParamValue = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x80Reply_0x80; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x80 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
public class JTNE_0x80Reply_0x81Formatter : IJTNEFormatter<JTNE_0x80Reply_0x81> | |||||
{ | |||||
public JTNE_0x80Reply_0x81 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x80Reply_0x81 jTNE_0x80Reply_0x80Reply = new JTNE_0x80Reply_0x81(); | |||||
jTNE_0x80Reply_0x80Reply.ParamValue = JTNEBinaryExtensions.ReadBytesLittle(bytes, ref offset); | |||||
jTNE_0x80Reply_0x80Reply.ParamLength = (byte)bytes.Length; | |||||
readSize = offset; | |||||
return jTNE_0x80Reply_0x80Reply; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x80Reply_0x81 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteBytesLittle(bytes, offset, value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,33 @@ | |||||
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_0x80Test | |||||
{ | |||||
[Fact] | |||||
public void Test1() | |||||
{ | |||||
JTNE_0x80 jTNE_0X80 = new JTNE_0x80(); | |||||
jTNE_0X80.QueryTime = DateTime.Parse("2019-01-22 23:55:56"); | |||||
jTNE_0X80.ParamNum = 2; | |||||
jTNE_0X80.ParamList = new byte[] {0x01,0x02 }; | |||||
var hex = JTNESerializer.Serialize(jTNE_0X80).ToHexString(); | |||||
Assert.Equal("130116173738020102", hex); | |||||
} | |||||
[Fact] | |||||
public void Test2() | |||||
{ | |||||
var data = "130116173738020102".ToHexBytes(); | |||||
JTNE_0x80 jTNE_0X80 = JTNESerializer.Deserialize<JTNE_0x80>(data); | |||||
Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X80.QueryTime); | |||||
Assert.Equal(2, jTNE_0X80.ParamNum); | |||||
Assert.Equal(new byte[] { 0x01, 0x02 }, jTNE_0X80.ParamList); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,280 @@ | |||||
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_0x81Test | |||||
{ | |||||
[Fact] | |||||
public void Test1() | |||||
{ | |||||
JTNE_0x81 jTNE_0X81 = new JTNE_0x81(); | |||||
jTNE_0X81.SetTime = DateTime.Parse("2019-01-22 23:55:56"); | |||||
jTNE_0X81.ParamNum = 1; | |||||
jTNE_0X81.ParamList = new List<JTNE_0x81_Body> { | |||||
new JTNE_0x81_0x01{ | |||||
ParamId=0x01, | |||||
ParamLength=2, | |||||
ParamValue=10 | |||||
} | |||||
}; | |||||
var hex = JTNESerializer.Serialize(jTNE_0X81).ToHexString(); | |||||
Assert.Equal("1301161737380101000A", hex); | |||||
} | |||||
[Fact] | |||||
public void Test1_1() | |||||
{ | |||||
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(1, jTNE_0X81.ParamNum); | |||||
Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject( new JTNE_0x81_0x01 | |||||
{ | |||||
ParamId = 0x01, | |||||
ParamLength = 2, | |||||
ParamValue = 10 | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0X81.ParamList[0] )); | |||||
} | |||||
[Fact] | |||||
public void Test2() | |||||
{ | |||||
JTNE_0x81 jTNE_0X81 = new JTNE_0x81(); | |||||
jTNE_0X81.SetTime = DateTime.Parse("2019-01-22 23:55:56"); | |||||
jTNE_0X81.ParamNum = 1; | |||||
jTNE_0X81.ParamList = new List<JTNE_0x81_Body> { | |||||
new JTNE_0x81_0x02{ | |||||
ParamId=0x02, | |||||
ParamLength=2, | |||||
ParamValue=20 | |||||
} | |||||
}; | |||||
var hex = JTNESerializer.Serialize(jTNE_0X81).ToHexString(); | |||||
Assert.Equal("13011617373801020014", hex); | |||||
} | |||||
[Fact] | |||||
public void Test2_1() | |||||
{ | |||||
var data = "13011617373801020014".ToHexBytes(); | |||||
JTNE_0x81 jTNE_0X81 = JTNESerializer.Deserialize<JTNE_0x81>(data); | |||||
Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X81.SetTime); | |||||
Assert.Equal(1, jTNE_0X81.ParamNum); | |||||
Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new JTNE_0x81_0x02 | |||||
{ | |||||
ParamId = 0x02, | |||||
ParamLength = 2, | |||||
ParamValue = 20 | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0X81.ParamList[0])); | |||||
} | |||||
[Fact] | |||||
public void Test4() | |||||
{ | |||||
JTNE_0x81 jTNE_0X81 = new JTNE_0x81(); | |||||
jTNE_0X81.SetTime = DateTime.Parse("2019-01-22 23:55:56"); | |||||
jTNE_0X81.ParamList = new List<JTNE_0x81_Body> { | |||||
new JTNE_0x81_0x04{ | |||||
ParamValue=8 | |||||
},new JTNE_0x81_0x05{ | |||||
ParamValue=new byte[]{ 1, 2, 3, 4, 5, 6, 7, 8 } | |||||
}, | |||||
new JTNE_0x81_0x06{ | |||||
ParamValue=40 | |||||
} | |||||
}; | |||||
jTNE_0X81.ParamNum =(byte)jTNE_0X81.ParamList.Count; | |||||
var hex = JTNESerializer.Serialize(jTNE_0X81).ToHexString(); | |||||
Assert.Equal("130116173738030408050102030405060708060028", hex); | |||||
} | |||||
[Fact] | |||||
public void Test4_1() | |||||
{ | |||||
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(jTNE_0X81.ParamList.Count, jTNE_0X81.ParamNum); | |||||
Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new List<JTNE_0x81_Body> { | |||||
new JTNE_0x81_0x04{ | |||||
ParamValue=8 | |||||
},new JTNE_0x81_0x05{ | |||||
ParamValue=new byte[]{1,2,3,4,5,6,7,8 }, | |||||
ParamLength=8 | |||||
}, new JTNE_0x81_0x06{ | |||||
ParamValue=40 | |||||
} | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0X81.ParamList)); | |||||
} | |||||
[Fact] | |||||
public void Test5() | |||||
{ | |||||
JTNE_0x81 jTNE_0X81 = new JTNE_0x81(); | |||||
jTNE_0X81.SetTime = DateTime.Parse("2019-01-22 23:55:56"); | |||||
jTNE_0X81.ParamList = new List<JTNE_0x81_Body> { | |||||
new JTNE_0x81_0x0D{ | |||||
ParamValue=8 | |||||
},new JTNE_0x81_0x0E{ | |||||
ParamValue=new byte[]{ 1, 2, 3, 4, 5, 6, 7, 8 } | |||||
}, | |||||
new JTNE_0x81_0x0F{ | |||||
ParamValue=40 | |||||
} | |||||
}; | |||||
jTNE_0X81.ParamNum = (byte)jTNE_0X81.ParamList.Count; | |||||
var hex = JTNESerializer.Serialize(jTNE_0X81).ToHexString(); | |||||
Assert.Equal("130116173738030D080E01020304050607080F0028", hex); | |||||
} | |||||
[Fact] | |||||
public void Test5_1() | |||||
{ | |||||
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(jTNE_0X81.ParamList.Count, jTNE_0X81.ParamNum); | |||||
Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new List<JTNE_0x81_Body> { | |||||
new JTNE_0x81_0x0D{ | |||||
ParamValue=8 | |||||
},new JTNE_0x81_0x0E{ | |||||
ParamValue=new byte[]{1,2,3,4,5,6,7,8 }, | |||||
ParamLength=8 | |||||
}, new JTNE_0x81_0x0F{ | |||||
ParamValue=40 | |||||
} | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0X81.ParamList)); | |||||
} | |||||
[Fact] | |||||
public void Test3() | |||||
{ | |||||
JTNE_0x81 jTNE_0X81 = new JTNE_0x81(); | |||||
jTNE_0X81.SetTime = DateTime.Parse("2019-01-22 23:55:56"); | |||||
jTNE_0X81.ParamNum = 1; | |||||
jTNE_0X81.ParamList = new List<JTNE_0x81_Body> { | |||||
new JTNE_0x81_0x03{ | |||||
ParamId=0x03, | |||||
ParamLength=2, | |||||
ParamValue=30 | |||||
} | |||||
}; | |||||
var hex = JTNESerializer.Serialize(jTNE_0X81).ToHexString(); | |||||
Assert.Equal("1301161737380103001E", hex); | |||||
} | |||||
[Fact] | |||||
public void Test3_1() | |||||
{ | |||||
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(1, jTNE_0X81.ParamNum); | |||||
Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new JTNE_0x81_0x03 | |||||
{ | |||||
ParamId = 0x03, | |||||
ParamLength = 2, | |||||
ParamValue = 30 | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0X81.ParamList[0])); | |||||
} | |||||
[Fact] | |||||
public void TestAll() | |||||
{ | |||||
JTNE_0x81 jTNE_0X81 = new JTNE_0x81(); | |||||
jTNE_0X81.SetTime = DateTime.Parse("2019-01-22 23:55:56"); | |||||
jTNE_0X81.ParamNum = 12; | |||||
jTNE_0X81.ParamList = new List<JTNE_0x81_Body> { | |||||
new JTNE_0x81_0x01{ | |||||
ParamValue=10 | |||||
}, | |||||
new JTNE_0x81_0x02{ | |||||
ParamValue=20 | |||||
}, | |||||
new JTNE_0x81_0x03{ | |||||
ParamValue=30 | |||||
}, | |||||
new JTNE_0x81_0x06{ | |||||
ParamValue=40 | |||||
}, | |||||
new JTNE_0x81_0x07{ | |||||
ParamValue="abcde" | |||||
}, | |||||
new JTNE_0x81_0x08{ | |||||
ParamValue="12345" | |||||
}, | |||||
new JTNE_0x81_0x09{ | |||||
ParamValue=50 | |||||
}, | |||||
new JTNE_0x81_0x0A{ | |||||
ParamValue=60 | |||||
}, | |||||
new JTNE_0x81_0x0B{ | |||||
ParamValue=70 | |||||
}, | |||||
new JTNE_0x81_0x0C{ | |||||
ParamValue=80 | |||||
}, | |||||
new JTNE_0x81_0x0F{ | |||||
ParamValue=90 | |||||
}, | |||||
new JTNE_0x81_0x10{ | |||||
ParamValue=0x01 | |||||
} | |||||
}; | |||||
var hex = JTNESerializer.Serialize(jTNE_0X81).ToHexString(); | |||||
Assert.Equal("1301161737380C01000A02001403001E06002807616263646508313233343509320A003C0B00460C500F005A1001", hex); | |||||
} | |||||
[Fact] | |||||
public void TestAll_1() | |||||
{ | |||||
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(12, jTNE_0X81.ParamNum); | |||||
Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new List<JTNE_0x81_Body> { | |||||
new JTNE_0x81_0x01{ | |||||
ParamValue=10 | |||||
}, | |||||
new JTNE_0x81_0x02{ | |||||
ParamValue=20 | |||||
}, | |||||
new JTNE_0x81_0x03{ | |||||
ParamValue=30 | |||||
}, | |||||
new JTNE_0x81_0x06{ | |||||
ParamValue=40 | |||||
}, | |||||
new JTNE_0x81_0x07{ | |||||
ParamValue="abcde" | |||||
}, | |||||
new JTNE_0x81_0x08{ | |||||
ParamValue="12345" | |||||
}, | |||||
new JTNE_0x81_0x09{ | |||||
ParamValue=50 | |||||
}, | |||||
new JTNE_0x81_0x0A{ | |||||
ParamValue=60 | |||||
}, | |||||
new JTNE_0x81_0x0B{ | |||||
ParamValue=70 | |||||
}, | |||||
new JTNE_0x81_0x0C{ | |||||
ParamValue=80 | |||||
}, | |||||
new JTNE_0x81_0x0F{ | |||||
ParamValue=90 | |||||
}, | |||||
new JTNE_0x81_0x10{ | |||||
ParamValue=0x01 | |||||
} | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0X81.ParamList)); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,111 @@ | |||||
using JTNE.Protocol.MessageBody; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using Xunit; | |||||
using JTNE.Protocol.Extensions; | |||||
using JTNE.Protocol.Formatters; | |||||
using JTNE.Protocol.Attributes; | |||||
namespace JTNE.Protocol.Test.MessageBody | |||||
{ | |||||
public class JTNE_0x81_CustomBodyTest | |||||
{ | |||||
[Fact] | |||||
public void Test1() | |||||
{ | |||||
JTNEGlobalConfigs.Instance.Register_JTNE0x81CustomBody(0x80, typeof(JTNE_0x81_0x80)); | |||||
JTNEGlobalConfigs.Instance.Register_JTNE0x81CustomBody(0x81, typeof(JTNE_0x81_0x81)); | |||||
JTNEGlobalConfigs.Instance.Register_JTNE0x81CustomDepenedBody(0x81, 0x80); | |||||
JTNE_0x81 jTNE_0X81 = new JTNE_0x81(); | |||||
jTNE_0X81.SetTime = DateTime.Parse("2019-01-22 23:55:56"); | |||||
jTNE_0X81.ParamNum = 2; | |||||
jTNE_0X81.ParamList = new List<JTNE_0x81_Body> { | |||||
new JTNE_0x81_0x80{ | |||||
ParamValue=6 | |||||
}, | |||||
new JTNE_0x81_0x81{ | |||||
ParamLength=6, | |||||
ParamValue=new byte[]{ 1,2,3,4,5,6 } | |||||
} | |||||
}; | |||||
var hex = JTNESerializer.Serialize(jTNE_0X81).ToHexString(); | |||||
Assert.Equal("13011617373802800681010203040506", hex); | |||||
} | |||||
[Fact] | |||||
public void Test1_1() | |||||
{ | |||||
JTNEGlobalConfigs.Instance.Register_JTNE0x81CustomBody(0x80, typeof(JTNE_0x81_0x80)); | |||||
JTNEGlobalConfigs.Instance.Register_JTNE0x81CustomBody(0x81, typeof(JTNE_0x81_0x81)); | |||||
JTNEGlobalConfigs.Instance.Register_JTNE0x81CustomDepenedBody(0x81, 0x80); | |||||
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(jTNE_0X81.ParamList.Count, jTNE_0X81.ParamNum); | |||||
Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new List<JTNE_0x81_Body> { | |||||
new JTNE_0x81_0x80{ | |||||
ParamValue=6 | |||||
}, | |||||
new JTNE_0x81_0x81{ | |||||
ParamLength=6, | |||||
ParamValue=new byte[]{ 1,2,3,4,5,6 } | |||||
} | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0X81.ParamList)); | |||||
} | |||||
} | |||||
[JTNEFormatter(typeof(JTNE_0x81_0x80Formatter))] | |||||
public class JTNE_0x81_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_0x81_0x81Formatter))] | |||||
public class JTNE_0x81_0x81 : JTNE_0x81_Body | |||||
{ | |||||
public override byte ParamId { get; set; } = 0x81; | |||||
public override byte ParamLength { get; set; } | |||||
public byte[] ParamValue { get; set; } | |||||
} | |||||
public class JTNE_0x81_0x80Formatter : IJTNEFormatter<JTNE_0x81_0x80> | |||||
{ | |||||
public JTNE_0x81_0x80 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x80 jTNE_0x81_0x80 = new JTNE_0x81_0x80(); | |||||
jTNE_0x81_0x80.ParamValue = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x81_0x80; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x80 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
public class JTNE_0x81_0x81Formatter : IJTNEFormatter<JTNE_0x81_0x81> | |||||
{ | |||||
public JTNE_0x81_0x81 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x81 jTNE_0x81_0x81 = new JTNE_0x81_0x81(); | |||||
jTNE_0x81_0x81.ParamValue = JTNEBinaryExtensions.ReadBytesLittle(bytes, ref offset); | |||||
jTNE_0x81_0x81.ParamLength = (byte)bytes.Length; | |||||
readSize = offset; | |||||
return jTNE_0x81_0x81; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x81 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteBytesLittle(bytes, offset, value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,113 @@ | |||||
using JTNE.Protocol.MessageBody; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using Xunit; | |||||
using JTNE.Protocol.Extensions; | |||||
using System.Linq; | |||||
namespace JTNE.Protocol.Test.MessageBody | |||||
{ | |||||
public class JTNE_0x82Test | |||||
{ | |||||
[Fact] | |||||
public void Test1() | |||||
{ | |||||
JTNE_0x82 jTNE_0X82 = new JTNE_0x82(); | |||||
jTNE_0X82.ControlTime = DateTime.Parse("2019-01-22 23:55:56"); | |||||
jTNE_0X82.ParamID =0x02; | |||||
var hex = JTNESerializer.Serialize(jTNE_0X82).ToHexString(); | |||||
Assert.Equal("13011617373802", hex); | |||||
} | |||||
[Fact] | |||||
public void Test2() | |||||
{ | |||||
var data = "13011617373802".ToHexBytes(); | |||||
JTNE_0x82 jTNE_0X82 = JTNESerializer.Deserialize<JTNE_0x82>(data); | |||||
Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X82.ControlTime); | |||||
Assert.Equal(0x02, jTNE_0X82.ParamID); | |||||
} | |||||
[Fact] | |||||
public void Test3() | |||||
{ | |||||
JTNE_0x82 jTNE_0X82 = new JTNE_0x82(); | |||||
jTNE_0X82.ControlTime = DateTime.Parse("2019-01-22 23:55:56"); | |||||
jTNE_0X82.ParamID = 0x01; | |||||
jTNE_0X82.Parameter = new JTNE_0x82_0x01 { | |||||
UpgradeCommand = new Metadata.UpgradeCommand { | |||||
DialName="TK", | |||||
DialUserName="TKUser", | |||||
DialUserPwd="TKPwd", | |||||
FirmwareVersion="1.0", | |||||
HardwareVersion="2.0", | |||||
ManufacturerID= "ManufacturerName", | |||||
ServerAddress="http://www.baidu.com:8383", | |||||
ServerUrl= JTNEGlobalConfigs.Instance.Encoding.GetBytes("bd.com"), | |||||
ServerPort=8383, | |||||
ConnectTimeLimit=10 | |||||
} | |||||
}; | |||||
var hex = JTNESerializer.Serialize(jTNE_0X82).ToHexString(); | |||||
Assert.Equal("13011617373801687474703A2F2F7777772E62616964752E636F6D3A383338333B544B3B544B557365723B544B5077643B62642E636F6D3B383338333B4D616E7566616374757265724E616D653B322E303B312E303B3130", hex); | |||||
} | |||||
[Fact] | |||||
public void Test4() | |||||
{ | |||||
var data = "13011617373801687474703A2F2F7777772E62616964752E636F6D3A383338333B544B3B544B557365723B544B5077643B62642E636F6D3B383338333B4D616E7566616374757265724E616D653B322E303B312E303B3130".ToHexBytes(); | |||||
JTNE_0x82 jTNE_0X82 = JTNESerializer.Deserialize<JTNE_0x82>(data); | |||||
Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X82.ControlTime); | |||||
Assert.Equal(0x01, jTNE_0X82.ParamID); | |||||
Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new JTNE_0x82_0x01 | |||||
{ | |||||
UpgradeCommand = new Metadata.UpgradeCommand | |||||
{ | |||||
DialName = "TK", | |||||
DialUserName = "TKUser", | |||||
DialUserPwd = "TKPwd", | |||||
FirmwareVersion = "1.0", | |||||
HardwareVersion = "2.0", | |||||
ManufacturerID = "ManufacturerName", | |||||
ServerAddress = "http://www.baidu.com:8383", | |||||
ServerUrl = JTNEGlobalConfigs.Instance.Encoding.GetBytes("bd.com"), | |||||
ServerPort = 8383, | |||||
ConnectTimeLimit = 10 | |||||
} | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0X82.Parameter)); | |||||
} | |||||
[Fact] | |||||
public void Test5() | |||||
{ | |||||
JTNE_0x82 jTNE_0X82 = new JTNE_0x82(); | |||||
jTNE_0X82.ControlTime = DateTime.Parse("2019-01-22 23:55:56"); | |||||
jTNE_0X82.ParamID = 0x06; | |||||
jTNE_0X82.Parameter = new JTNE_0x82_0x06 | |||||
{ | |||||
AlarmCommand=new Metadata.AlarmCommand { | |||||
AlarmLevel= Enums.JTNEAlarmLevel.一级报警 | |||||
} | |||||
}; | |||||
var hex = JTNESerializer.Serialize(jTNE_0X82).ToHexString(); | |||||
Assert.Equal("1301161737380601", hex); | |||||
} | |||||
[Fact] | |||||
public void Test6() | |||||
{ | |||||
var data = "1301161737380601".ToHexBytes(); | |||||
JTNE_0x82 jTNE_0X82 = JTNESerializer.Deserialize<JTNE_0x82>(data); | |||||
Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X82.ControlTime); | |||||
Assert.Equal(0x06, jTNE_0X82.ParamID); | |||||
Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new JTNE_0x82_0x06 | |||||
{ | |||||
AlarmCommand = new Metadata.AlarmCommand | |||||
{ | |||||
AlarmLevel = Enums.JTNEAlarmLevel.一级报警 | |||||
} | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0X82.Parameter)); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,68 @@ | |||||
using JTNE.Protocol.MessageBody; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
using Xunit; | |||||
using JTNE.Protocol.Extensions; | |||||
using JTNE.Protocol.Formatters; | |||||
using JTNE.Protocol.Attributes; | |||||
namespace JTNE.Protocol.Test.MessageBody | |||||
{ | |||||
public class JTNE_0x82_CustomBodyTest | |||||
{ | |||||
[Fact] | |||||
public void Test1() | |||||
{ | |||||
JTNEGlobalConfigs.Instance.Register_JTNE0x82CustomBody(0x80, typeof(JTNE_0x82_0x80)); | |||||
JTNE_0x82 jTNE_0X82 = new JTNE_0x82(); | |||||
jTNE_0X82.ControlTime = DateTime.Parse("2019-01-22 23:55:56"); | |||||
jTNE_0X82.ParamID = 0x80; | |||||
jTNE_0X82.Parameter = new JTNE_0x82_0x80 | |||||
{ | |||||
ParamValue=100 | |||||
}; | |||||
var hex = JTNESerializer.Serialize(jTNE_0X82).ToHexString(); | |||||
Assert.Equal("1301161737388064", hex); | |||||
} | |||||
[Fact] | |||||
public void Test1_1() | |||||
{ | |||||
JTNEGlobalConfigs.Instance.Register_JTNE0x82CustomBody(0x80, typeof(JTNE_0x82_0x80)); | |||||
var data = "1301161737388064".ToHexBytes(); | |||||
JTNE_0x82 jTNE_0x82 = JTNESerializer.Deserialize<JTNE_0x82>(data); | |||||
Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0x82.ControlTime); | |||||
Assert.Equal(Newtonsoft.Json.JsonConvert.SerializeObject(new JTNE_0x82_0x80 | |||||
{ | |||||
ParamValue = 100 | |||||
}), Newtonsoft.Json.JsonConvert.SerializeObject(jTNE_0x82.Parameter)); | |||||
} | |||||
} | |||||
[JTNEFormatter(typeof(JTNE_0x82_0x80Formatter))] | |||||
public class JTNE_0x82_0x80 : JTNE_0x82_Body | |||||
{ | |||||
public override byte ParamId { get; set; }= 0x80; | |||||
public override byte ParamLength { get; set; } = 1; | |||||
public byte ParamValue { get; set; } | |||||
} | |||||
public class JTNE_0x82_0x80Formatter : IJTNEFormatter<JTNE_0x82_0x80> | |||||
{ | |||||
public JTNE_0x82_0x80 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x82_0x80 jTNE_0x82_0x80 = new JTNE_0x82_0x80(); | |||||
jTNE_0x82_0x80.ParamValue = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x82_0x80; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x82_0x80 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,18 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JTNE.Protocol.Enums | |||||
{ | |||||
/// <summary> | |||||
/// 报警等级 | |||||
/// </summary> | |||||
public enum JTNEAlarmLevel : byte | |||||
{ | |||||
无报警 = 0x00, | |||||
一级报警 = 0x01, | |||||
二级报警 = 0x02, | |||||
三级报警 = 0x03, | |||||
无效数据 = 0xFF, | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,27 @@ | |||||
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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,27 @@ | |||||
| |||||
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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,27 @@ | |||||
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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,62 @@ | |||||
using JTNE.Protocol.Extensions; | |||||
using JTNE.Protocol.MessageBody; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
namespace JTNE.Protocol.Formatters.MessageBodyFormatters | |||||
{ | |||||
public class JTNE_0x80Reply_Formatter : IJTNEFormatter<JTNE_0x80Reply> | |||||
{ | |||||
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; | |||||
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); | |||||
} | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,30 @@ | |||||
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_0x80_Formatter : IJTNEFormatter<JTNE_0x80> | |||||
{ | |||||
public JTNE_0x80 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x80 jTNE_0X80 = new JTNE_0x80(); | |||||
jTNE_0X80.QueryTime = JTNEBinaryExtensions.ReadDateTime6Little(bytes, ref offset); | |||||
jTNE_0X80.ParamNum = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
jTNE_0X80.ParamList = JTNEBinaryExtensions.ReadBytesLittle(bytes, ref offset, jTNE_0X80.ParamNum); | |||||
readSize = offset; | |||||
return jTNE_0X80; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x80 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteDateTime6Little(bytes, offset, value.QueryTime); | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamNum); | |||||
offset += JTNEBinaryExtensions.WriteBytesLittle(bytes, offset,value.ParamList); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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_0x81_0x01Formatter : IJTNEFormatter<JTNE_0x81_0x01> | |||||
{ | |||||
public JTNE_0x81_0x01 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x01 jTNE_0x81_0x01 = new JTNE_0x81_0x01(); | |||||
jTNE_0x81_0x01.ParamValue = JTNEBinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x81_0x01; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x01 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteUInt16Little(bytes, offset, value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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_0x81_0x02Formatter : IJTNEFormatter<JTNE_0x81_0x02> | |||||
{ | |||||
public JTNE_0x81_0x02 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x02 jTNE_0x81_0x02= new JTNE_0x81_0x02(); | |||||
jTNE_0x81_0x02.ParamValue = JTNEBinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x81_0x02; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x02 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteUInt16Little(bytes, offset, value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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_0x81_0x03Formatter : IJTNEFormatter<JTNE_0x81_0x03> | |||||
{ | |||||
public JTNE_0x81_0x03 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x03 jTNE_0x81_0x03= new JTNE_0x81_0x03(); | |||||
jTNE_0x81_0x03.ParamValue = JTNEBinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x81_0x03; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x03 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteUInt16Little(bytes, offset, value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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_0x81_0x04Formatter : IJTNEFormatter<JTNE_0x81_0x04> | |||||
{ | |||||
public JTNE_0x81_0x04 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x04 jTNE_0x81_0x04 = new JTNE_0x81_0x04(); | |||||
jTNE_0x81_0x04.ParamValue = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x81_0x04; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x04 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,27 @@ | |||||
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_0x81_0x05Formatter : IJTNEFormatter<JTNE_0x81_0x05> | |||||
{ | |||||
public JTNE_0x81_0x05 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x05 jTNE_0x81_0x05 = new JTNE_0x81_0x05(); | |||||
jTNE_0x81_0x05.ParamValue = JTNEBinaryExtensions.ReadBytesLittle(bytes, ref offset); | |||||
jTNE_0x81_0x05.ParamLength = (byte)bytes.Length; | |||||
readSize = offset; | |||||
return jTNE_0x81_0x05; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x05 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteBytesLittle(bytes, offset, value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,27 @@ | |||||
| |||||
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_0x81_0x06Formatter : IJTNEFormatter<JTNE_0x81_0x06> | |||||
{ | |||||
public JTNE_0x81_0x06 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x06 jTNE_0x81_0x06 = new JTNE_0x81_0x06(); | |||||
jTNE_0x81_0x06.ParamValue = JTNEBinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x81_0x06; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x06 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteUInt16Little(bytes, offset, value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,28 @@ | |||||
| |||||
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_0x81_0x07Formatter : IJTNEFormatter<JTNE_0x81_0x07> | |||||
{ | |||||
public JTNE_0x81_0x07 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x07 jTNE_0x81_0x07 = new JTNE_0x81_0x07(); | |||||
jTNE_0x81_0x07.ParamValue = JTNEBinaryExtensions.ReadStringLittle(bytes, ref offset, jTNE_0x81_0x07.ParamLength); | |||||
readSize = offset; | |||||
return jTNE_0x81_0x07; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x07 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteStringLittle(bytes, offset, value.ParamValue,value.ParamLength); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,29 @@ | |||||
| |||||
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_0x81_0x08Formatter : IJTNEFormatter<JTNE_0x81_0x08> | |||||
{ | |||||
public JTNE_0x81_0x08 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x08 jTNE_0x81_0x08 = new JTNE_0x81_0x08(); | |||||
jTNE_0x81_0x08.ParamValue = JTNEBinaryExtensions.ReadStringLittle(bytes, ref offset, jTNE_0x81_0x08.ParamLength); | |||||
readSize = offset; | |||||
return jTNE_0x81_0x08; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x08 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteStringLittle(bytes, offset, value.ParamValue,value.ParamLength); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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_0x81_0x09Formatter : IJTNEFormatter<JTNE_0x81_0x09> | |||||
{ | |||||
public JTNE_0x81_0x09 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x09 jTNE_0x81_0x09 = new JTNE_0x81_0x09(); | |||||
jTNE_0x81_0x09.ParamValue = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x81_0x09; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x09 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset,value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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_0x81_0x0AFormatter : IJTNEFormatter<JTNE_0x81_0x0A> | |||||
{ | |||||
public JTNE_0x81_0x0A Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x0A jTNE_0x81_0x0A = new JTNE_0x81_0x0A(); | |||||
jTNE_0x81_0x0A.ParamValue = JTNEBinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x81_0x0A; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x0A value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteUInt16Little(bytes, offset, value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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_0x81_0x0BFormatter : IJTNEFormatter<JTNE_0x81_0x0B> | |||||
{ | |||||
public JTNE_0x81_0x0B Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x0B jTNE_0x81_0x0B = new JTNE_0x81_0x0B(); | |||||
jTNE_0x81_0x0B.ParamValue = JTNEBinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x81_0x0B; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x0B value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteUInt16Little(bytes, offset, value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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_0x81_0x0CFormatter : IJTNEFormatter<JTNE_0x81_0x0C> | |||||
{ | |||||
public JTNE_0x81_0x0C Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x0C jTNE_0x81_0x0C = new JTNE_0x81_0x0C(); | |||||
jTNE_0x81_0x0C.ParamValue = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x81_0x0C; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x0C value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset,value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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_0x81_0x0DFormatter : IJTNEFormatter<JTNE_0x81_0x0D> | |||||
{ | |||||
public JTNE_0x81_0x0D Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x0D jTNE_0x81_0x0D = new JTNE_0x81_0x0D(); | |||||
jTNE_0x81_0x0D.ParamValue = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x81_0x0D; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x0D value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,27 @@ | |||||
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_0x81_0x0EFormatter : IJTNEFormatter<JTNE_0x81_0x0E> | |||||
{ | |||||
public JTNE_0x81_0x0E Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x0E jTNE_0x81_0x0E= new JTNE_0x81_0x0E(); | |||||
jTNE_0x81_0x0E.ParamValue = JTNEBinaryExtensions.ReadBytesLittle(bytes, ref offset); | |||||
jTNE_0x81_0x0E.ParamLength = (byte)bytes.Length; | |||||
readSize = offset; | |||||
return jTNE_0x81_0x0E; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x0E value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteBytesLittle(bytes, offset, value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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_0x81_0x0FFormatter : IJTNEFormatter<JTNE_0x81_0x0F> | |||||
{ | |||||
public JTNE_0x81_0x0F Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x0F jTNE_0x81_0x0F = new JTNE_0x81_0x0F(); | |||||
jTNE_0x81_0x0F.ParamValue = JTNEBinaryExtensions.ReadUInt16Little(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x81_0x0F; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x0F value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteUInt16Little(bytes, offset, value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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_0x81_0x10Formatter : IJTNEFormatter<JTNE_0x81_0x10> | |||||
{ | |||||
public JTNE_0x81_0x10 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81_0x10 jTNE_0x81_0x10 = new JTNE_0x81_0x10(); | |||||
jTNE_0x81_0x10.ParamValue = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x81_0x10; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81_0x10 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset,value.ParamValue); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,62 @@ | |||||
using JTNE.Protocol.Extensions; | |||||
using JTNE.Protocol.MessageBody; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
namespace JTNE.Protocol.Formatters.MessageBodyFormatters | |||||
{ | |||||
public class JTNE_0x81_Formatter : IJTNEFormatter<JTNE_0x81> | |||||
{ | |||||
public JTNE_0x81 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x81 jTNE_0X81 = new JTNE_0x81(); | |||||
jTNE_0X81.SetTime = JTNEBinaryExtensions.ReadDateTime6Little(bytes, ref offset); | |||||
jTNE_0X81.ParamNum = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
for (int i = 0; i < jTNE_0X81.ParamNum; i++) | |||||
{ | |||||
var paramId = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset);//参数ID | |||||
int readSubBodySize = 0; | |||||
if (JTNE_0x81_Body.JTNE_0x81Method.TryGetValue(paramId, out Type type)) | |||||
{ | |||||
ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(); | |||||
if (JTNE_0x81_Body.JTNE_0x81LengthOfADependOnValueOfB.TryGetValue(paramId, out byte dependOnParamId)) { | |||||
var length = jTNE_0X81.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_0X81.ParamList != null) | |||||
{ | |||||
jTNE_0X81.ParamList.Add(JTNEFormatterResolverExtensions.JTNEDynamicDeserialize(JTNEFormatterExtensions.GetFormatter(type), readOnlySpan, out readSubBodySize)); | |||||
} | |||||
else | |||||
{ | |||||
jTNE_0X81.ParamList = new List<JTNE_0x81_Body> { JTNEFormatterResolverExtensions.JTNEDynamicDeserialize(JTNEFormatterExtensions.GetFormatter(type), readOnlySpan, out readSubBodySize) }; | |||||
} | |||||
} | |||||
offset = offset + readSubBodySize; | |||||
} | |||||
readSize = offset; | |||||
return jTNE_0X81; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x81 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteDateTime6Little(bytes, offset, value.SetTime); | |||||
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); | |||||
} | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,27 @@ | |||||
using JTNE.Protocol.Enums; | |||||
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_0x82_0x00Formatter : IJTNEFormatter<JTNE_0x82_0x00> | |||||
{ | |||||
public JTNE_0x82_0x00 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x82_0x00 jTNE_0x82_0x00 = new JTNE_0x82_0x00(); | |||||
jTNE_0x82_0x00.ParamId=JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x82_0x00; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x82_0x00 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamId); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,44 @@ | |||||
using JTNE.Protocol.Extensions; | |||||
using JTNE.Protocol.MessageBody; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
namespace JTNE.Protocol.Formatters.MessageBodyFormatters | |||||
{ | |||||
public class JTNE_0x82_0x01Formatter : IJTNEFormatter<JTNE_0x82_0x01> | |||||
{ | |||||
public JTNE_0x82_0x01 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x82_0x01 jTNE_0x82_0x01 = new JTNE_0x82_0x01(); | |||||
string res = JTNEBinaryExtensions.ReadStringLittle(bytes, ref offset); | |||||
string[] upgradeCommands = res.Split(';'); | |||||
jTNE_0x82_0x01.UpgradeCommand = new Metadata.UpgradeCommand(); | |||||
jTNE_0x82_0x01.UpgradeCommand.ServerAddress = upgradeCommands[0]; | |||||
jTNE_0x82_0x01.UpgradeCommand.DialName = upgradeCommands[1]; | |||||
jTNE_0x82_0x01.UpgradeCommand.DialUserName = upgradeCommands[2]; | |||||
jTNE_0x82_0x01.UpgradeCommand.DialUserPwd = upgradeCommands[3]; | |||||
jTNE_0x82_0x01.UpgradeCommand.ServerUrl = JTNEGlobalConfigs.Instance.Encoding.GetBytes(upgradeCommands[4]); | |||||
if (ushort.TryParse(upgradeCommands[5], out ushort serverPort)) | |||||
{ | |||||
jTNE_0x82_0x01.UpgradeCommand.ServerPort = serverPort; | |||||
} | |||||
jTNE_0x82_0x01.UpgradeCommand.ManufacturerID = upgradeCommands[6]; | |||||
jTNE_0x82_0x01.UpgradeCommand.HardwareVersion = upgradeCommands[7]; | |||||
jTNE_0x82_0x01.UpgradeCommand.FirmwareVersion = upgradeCommands[8]; | |||||
if (ushort.TryParse(upgradeCommands[9], out ushort connectTimeLimit)){ | |||||
jTNE_0x82_0x01.UpgradeCommand.ConnectTimeLimit = connectTimeLimit; | |||||
} | |||||
readSize = offset; | |||||
return jTNE_0x82_0x01; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x82_0x01 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteStringLittle(bytes, offset, value.UpgradeCommand.ToString()); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,27 @@ | |||||
using JTNE.Protocol.Enums; | |||||
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_0x82_0x02Formatter : IJTNEFormatter<JTNE_0x82_0x02> | |||||
{ | |||||
public JTNE_0x82_0x02 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x82_0x02 jTNE_0x82_0x02 = new JTNE_0x82_0x02(); | |||||
jTNE_0x82_0x02.ParamId=JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x82_0x02; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x82_0x02 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamId); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,27 @@ | |||||
using JTNE.Protocol.Enums; | |||||
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_0x82_0x03Formatter : IJTNEFormatter<JTNE_0x82_0x03> | |||||
{ | |||||
public JTNE_0x82_0x03 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x82_0x03 jTNE_0x82_0x03 = new JTNE_0x82_0x03(); | |||||
jTNE_0x82_0x03.ParamId= JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x82_0x03; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x82_0x03 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamId); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,28 @@ | |||||
using JTNE.Protocol.Enums; | |||||
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_0x82_0x04Formatter : IJTNEFormatter<JTNE_0x82_0x04> | |||||
{ | |||||
public JTNE_0x82_0x04 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x82_0x04 jTNE_0x82_0x04 = new JTNE_0x82_0x04(); | |||||
jTNE_0x82_0x04.ParamId=JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x82_0x04; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x82_0x04 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamId); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,28 @@ | |||||
using JTNE.Protocol.Enums; | |||||
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_0x82_0x05Formatter : IJTNEFormatter<JTNE_0x82_0x05> | |||||
{ | |||||
public JTNE_0x82_0x05 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x82_0x05 jTNE_0x82_0x05 = new JTNE_0x82_0x05(); | |||||
jTNE_0x82_0x05.ParamId=JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x82_0x05; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x82_0x05 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamId); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,32 @@ | |||||
using JTNE.Protocol.Enums; | |||||
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_0x82_0x06Formatter : IJTNEFormatter<JTNE_0x82_0x06> | |||||
{ | |||||
public JTNE_0x82_0x06 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x82_0x06 jTNE_0x82_0x06 = new JTNE_0x82_0x06(); | |||||
jTNE_0x82_0x06.AlarmCommand = new Metadata.AlarmCommand(); | |||||
jTNE_0x82_0x06.AlarmCommand.AlarmLevel= (JTNEAlarmLevel)JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x82_0x06; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x82_0x06 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.AlarmCommand.AlarmLevel.ToByteValue()); | |||||
//if (!string.IsNullOrEmpty(value.AlarmCommand.Alarm)) { | |||||
// offset += JTNEBinaryExtensions.WriteStringLittle(bytes, offset, value.AlarmCommand.Alarm); | |||||
//} | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,28 @@ | |||||
using JTNE.Protocol.Enums; | |||||
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_0x82_0x07Formatter : IJTNEFormatter<JTNE_0x82_0x07> | |||||
{ | |||||
public JTNE_0x82_0x07 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x82_0x07 jTNE_0x82_0x07 = new JTNE_0x82_0x07(); | |||||
jTNE_0x82_0x07.ParamId=JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset); | |||||
readSize = offset; | |||||
return jTNE_0x82_0x07; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x82_0x07 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamId); | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,39 @@ | |||||
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_0x82_Formatter : IJTNEFormatter<JTNE_0x82> | |||||
{ | |||||
public JTNE_0x82 Deserialize(ReadOnlySpan<byte> bytes, out int readSize) | |||||
{ | |||||
int offset = 0; | |||||
JTNE_0x82 jTNE_0x82 = new JTNE_0x82(); | |||||
jTNE_0x82.ControlTime = JTNEBinaryExtensions.ReadDateTime6Little(bytes, ref offset); | |||||
jTNE_0x82.ParamID = JTNEBinaryExtensions.ReadByteLittle(bytes, ref offset);//参数ID | |||||
if (JTNE_0x82_Body.JTNE_0x82Method.TryGetValue(jTNE_0x82.ParamID, out Type type)) | |||||
{ | |||||
int readSubBodySize = 0; | |||||
jTNE_0x82.Parameter = JTNEFormatterResolverExtensions.JTNEDynamicDeserialize(JTNEFormatterExtensions.GetFormatter(type), bytes.Slice(offset), out readSubBodySize); | |||||
offset = offset + readSubBodySize; | |||||
} | |||||
readSize = offset; | |||||
return jTNE_0x82; | |||||
} | |||||
public int Serialize(ref byte[] bytes, int offset, JTNE_0x82 value) | |||||
{ | |||||
offset += JTNEBinaryExtensions.WriteDateTime6Little(bytes, offset, value.ControlTime); | |||||
offset += JTNEBinaryExtensions.WriteByteLittle(bytes, offset, value.ParamID); | |||||
if (JTNE_0x82_Body.JTNE_0x82Method.TryGetValue(value.ParamID, out Type type)) | |||||
{ | |||||
offset =JTNEFormatterResolverExtensions.JTNEDynamicSerialize(JTNEFormatterExtensions.GetFormatter(type),ref bytes, offset, value.Parameter); | |||||
} | |||||
return offset; | |||||
} | |||||
} | |||||
} |
@@ -25,6 +25,15 @@ | |||||
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\JTNE.Protocol.xml</DocumentationFile> | <DocumentationFile>bin\$(Configuration)\$(TargetFramework)\JTNE.Protocol.xml</DocumentationFile> | ||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | |||||
<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" /> | |||||
</ItemGroup> | |||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" /> | <PackageReference Include="Microsoft.CSharp" Version="4.5.0" /> | ||||
<PackageReference Include="System.Buffers" Version="4.5.0" /> | <PackageReference Include="System.Buffers" Version="4.5.0" /> | ||||
@@ -101,6 +101,76 @@ namespace JTNE.Protocol | |||||
return instance.Value; | return instance.Value; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// | |||||
/// </summary> | |||||
/// <param name="typeCode">自定义类型编码</param> | |||||
/// <param name="type">继承JTNE.Protocol.MessageBody.JTNE_0x81_Body</param> | |||||
/// <returns></returns> | |||||
public JTNEGlobalConfigs Register_JTNE0x81CustomBody(byte typeCode, Type type) | |||||
{ | |||||
if (!JTNE_0x81_Body.JTNE_0x81Method.ContainsKey(typeCode)) | |||||
{ | |||||
JTNE_0x81_Body.JTNE_0x81Method.Add(typeCode, type); | |||||
} | |||||
return instance.Value; | |||||
} | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
/// <param name="typeCode">自定义类型编码</param> | |||||
/// <param name="type">继承JTNE.Protocol.MessageBody.JTNE_0x81_Body</param> | |||||
/// <returns></returns> | |||||
public JTNEGlobalConfigs Register_JTNE0x81CustomDepenedBody(byte DependerParamId, byte DependedParamId) | |||||
{ | |||||
if (!JTNE_0x81_Body.JTNE_0x81LengthOfADependOnValueOfB.ContainsKey(DependerParamId)) | |||||
{ | |||||
JTNE_0x81_Body.JTNE_0x81LengthOfADependOnValueOfB.Add(DependerParamId, DependedParamId); | |||||
} | |||||
return instance.Value; | |||||
} | |||||
/// <summary> | |||||
/// | |||||
/// </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) | |||||
{ | |||||
if (!JTNE_0x82_Body.JTNE_0x82Method.ContainsKey(typeCode)) | |||||
{ | |||||
JTNE_0x82_Body.JTNE_0x82Method.Add(typeCode, type); | |||||
} | |||||
return instance.Value; | |||||
} | |||||
/// <summary> | |||||
/// 设置跳过校验码 | /// 设置跳过校验码 | ||||
/// 场景:测试的时候,可能需要手动改数据,所以测试的时候有用 | /// 场景:测试的时候,可能需要手动改数据,所以测试的时候有用 | ||||
/// </summary> | /// </summary> | ||||
@@ -0,0 +1,28 @@ | |||||
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_0x80_Formatter))] | |||||
public class JTNE_0x80 : JTNEBodies | |||||
{ | |||||
/// <summary> | |||||
/// 查询时间 | |||||
/// </summary> | |||||
public DateTime QueryTime { get; set; } | |||||
/// <summary> | |||||
/// 参数总数 | |||||
/// </summary> | |||||
public byte ParamNum { get; set; } | |||||
/// <summary> | |||||
/// 参数列表 | |||||
/// </summary> | |||||
public byte[] ParamList { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,28 @@ | |||||
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_Formatter))] | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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; } | |||||
} | |||||
} |
@@ -0,0 +1,165 @@ | |||||
using JTNE.Protocol.Attributes; | |||||
using JTNE.Protocol.Formatters.MessageBodyFormatters; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JTNE.Protocol.MessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 参数查询 | |||||
/// </summary> | |||||
public abstract class JTNE_0x80Reply_Body | |||||
{ | |||||
/// <summary> | |||||
/// 车载终端本地存储时间周期,有效值范围:0~60 000(表示0ms~60 000ms) | |||||
/// 最小计量单元:1ms | |||||
/// 0xFF,0xFE表示异常,0xFF,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x80Reply_0x01_Type = 0x01; | |||||
/// <summary> | |||||
/// 正常时,信息上报时间周期,有效值范围:1~600(表示1s~600s) | |||||
/// 最小计量单元:1s | |||||
/// 0xFF,0xFE表示异常,0xFF,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x80Reply_0x02_Type = 0x02; | |||||
/// <summary> | |||||
/// 出现报警时,信息上报时间周期,有效值范围:0~60 000(表示0ms~60 000ms) | |||||
/// 最小计量单元:1ms | |||||
/// 0xFF,0xFE表示异常,0xFF,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x80Reply_0x03_Type = 0x03; | |||||
/// <summary> | |||||
/// 远程服务和管理平台域名长度M | |||||
/// </summary> | |||||
public const byte JTNE_0x80Reply_0x04_Type = 0x04; | |||||
/// <summary> | |||||
/// 远程服务和管理平台域名 | |||||
/// </summary> | |||||
public const byte JTNE_0x80Reply_0x05_Type = 0x05; | |||||
/// <summary> | |||||
/// 远程服务和管理平台端口,有效值范围:0~65531 | |||||
/// 0xFF,0xFE表示异常,0xFF,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x80Reply_0x06_Type = 0x06; | |||||
/// <summary> | |||||
/// 硬件版本,车载终端厂商自行定义 | |||||
/// </summary> | |||||
public const byte JTNE_0x80Reply_0x07_Type = 0x07; | |||||
/// <summary> | |||||
/// 固件版本,车载终端厂商自行定义 | |||||
/// </summary> | |||||
public const byte JTNE_0x80Reply_0x08_Type = 0x08; | |||||
/// <summary> | |||||
/// 车载终端心跳发送周期,有效值范围:1~240(表示1s~240s) | |||||
/// 最小计量单元:1s | |||||
/// 0xFE表示异常,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x80Reply_0x09_Type = 0x09; | |||||
/// <summary> | |||||
/// 终端应答超时时间,有效值范围:1~600(表示1s~600s) | |||||
/// 最小计量单元:1s | |||||
/// 0xFF,0xFE表示异常,0xFF,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x80Reply_0x0A_Type = 0x0A; | |||||
/// <summary> | |||||
///平台应答超时时间,有效值范围:1~600(表示1s~600s) | |||||
/// 最小计量单元:1s | |||||
/// 0xFF,0xFE表示异常,0xFF,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x80Reply_0x0B_Type = 0x0B; | |||||
/// <summary> | |||||
/// 连续三次登入失败后,到下一次登入的时间间隔。有效值范围:1~240(表示1min~240min) | |||||
/// 最小计量单元:1min | |||||
/// 0xFE表示异常,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x80Reply_0x0C_Type = 0x0C; | |||||
/// <summary> | |||||
/// 公共平台域名长度N | |||||
/// </summary> | |||||
public const byte JTNE_0x80Reply_0x0D_Type = 0x0D; | |||||
/// <summary> | |||||
/// 公共平台域名 | |||||
/// </summary> | |||||
public const byte JTNE_0x80Reply_0x0E_Type = 0x0E; | |||||
/// <summary> | |||||
/// 公共平台端口,有效值访问:0~65531 | |||||
/// 0xFF,0xFE表示异常,0xFF,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x80Reply_0x0F_Type = 0x0F; | |||||
/// <summary> | |||||
/// 是否处于抽样监测中 | |||||
/// 0x01 表示是 0x02 表示否 | |||||
/// 0xFE表示异常,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x80Reply_0x10_Type = 0x10; | |||||
internal static IDictionary<byte, Type> JTNE_0x80ReplyMethod { get; private set; } | |||||
/// <summary> | |||||
/// A对象的长度,依赖于B对象的值 (数据长度为byte类型) | |||||
/// </summary> | |||||
internal static IDictionary<byte, byte> JTNE_0x80ReplyLengthOfADependOnValueOfB { get; private set; } | |||||
/// <summary> | |||||
/// 参数 ID | |||||
/// </summary> | |||||
public abstract byte ParamId { get; set; } | |||||
/// <summary> | |||||
/// 参数长度 | |||||
/// </summary> | |||||
public abstract byte ParamLength { get; set; } | |||||
static JTNE_0x80Reply_Body() | |||||
{ | |||||
JTNE_0x80ReplyMethod = new Dictionary<byte, Type>(); | |||||
JTNE_0x80ReplyMethod.Add(JTNE_0x80Reply_0x01_Type, typeof(JTNE_0x80Reply_0x01)); | |||||
JTNE_0x80ReplyMethod.Add(JTNE_0x80Reply_0x02_Type, typeof(JTNE_0x80Reply_0x02)); | |||||
JTNE_0x80ReplyMethod.Add(JTNE_0x80Reply_0x03_Type, typeof(JTNE_0x80Reply_0x03)); | |||||
JTNE_0x80ReplyMethod.Add(JTNE_0x80Reply_0x04_Type, typeof(JTNE_0x80Reply_0x04)); | |||||
JTNE_0x80ReplyMethod.Add(JTNE_0x80Reply_0x05_Type, typeof(JTNE_0x80Reply_0x05)); | |||||
JTNE_0x80ReplyMethod.Add(JTNE_0x80Reply_0x06_Type, typeof(JTNE_0x80Reply_0x06)); | |||||
JTNE_0x80ReplyMethod.Add(JTNE_0x80Reply_0x07_Type, typeof(JTNE_0x80Reply_0x07)); | |||||
JTNE_0x80ReplyMethod.Add(JTNE_0x80Reply_0x08_Type, typeof(JTNE_0x80Reply_0x08)); | |||||
JTNE_0x80ReplyMethod.Add(JTNE_0x80Reply_0x09_Type, typeof(JTNE_0x80Reply_0x09)); | |||||
JTNE_0x80ReplyMethod.Add(JTNE_0x80Reply_0x0A_Type, typeof(JTNE_0x80Reply_0x0A)); | |||||
JTNE_0x80ReplyMethod.Add(JTNE_0x80Reply_0x0B_Type, typeof(JTNE_0x80Reply_0x0B)); | |||||
JTNE_0x80ReplyMethod.Add(JTNE_0x80Reply_0x0C_Type, typeof(JTNE_0x80Reply_0x0C)); | |||||
JTNE_0x80ReplyMethod.Add(JTNE_0x80Reply_0x0D_Type, typeof(JTNE_0x80Reply_0x0D)); | |||||
JTNE_0x80ReplyMethod.Add(JTNE_0x80Reply_0x0E_Type, typeof(JTNE_0x80Reply_0x0E)); | |||||
JTNE_0x80ReplyMethod.Add(JTNE_0x80Reply_0x0F_Type, typeof(JTNE_0x80Reply_0x0F)); | |||||
JTNE_0x80ReplyMethod.Add(JTNE_0x80Reply_0x10_Type, typeof(JTNE_0x80Reply_0x10)); | |||||
JTNE_0x80ReplyLengthOfADependOnValueOfB = new Dictionary<byte, byte>(); | |||||
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; | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,28 @@ | |||||
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_0x81_Formatter))] | |||||
public class JTNE_0x81 : JTNEBodies | |||||
{ | |||||
/// <summary> | |||||
/// 设置时间 | |||||
/// </summary> | |||||
public DateTime SetTime { get; set; } | |||||
/// <summary> | |||||
/// 参数总数 | |||||
/// </summary> | |||||
public byte ParamNum { get; set; } | |||||
/// <summary> | |||||
/// 参数列表 | |||||
/// </summary> | |||||
public List<JTNE_0x81_Body> ParamList { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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_0x81_0x01Formatter))] | |||||
public class JTNE_0x81_0x01: JTNE_0x81_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; } | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
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_0x81_0x02Formatter))] | |||||
public class JTNE_0x81_0x02: JTNE_0x81_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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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_0x81_0x03Formatter))] | |||||
public class JTNE_0x81_0x03: JTNE_0x81_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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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_0x81_0x04Formatter))] | |||||
public class JTNE_0x81_0x04: JTNE_0x81_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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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_0x81_0x05Formatter))] | |||||
public class JTNE_0x81_0x05: JTNE_0x81_Body | |||||
{ | |||||
public override byte ParamId { get; set; } = 0x05; | |||||
/// <summary> | |||||
/// 数据 长度 | |||||
/// </summary> | |||||
public override byte ParamLength { get; set; } | |||||
/// <summary> | |||||
///远程服务和管理平台域名 | |||||
/// </summary> | |||||
public byte[] ParamValue { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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_0x81_0x06Formatter))] | |||||
public class JTNE_0x81_0x06: JTNE_0x81_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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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_0x81_0x07Formatter))] | |||||
public class JTNE_0x81_0x07: JTNE_0x81_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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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_0x81_0x08Formatter))] | |||||
public class JTNE_0x81_0x08: JTNE_0x81_Body | |||||
{ | |||||
public override byte ParamId { get; set; } = 0x08; | |||||
/// <summary> | |||||
/// 数据 长度 | |||||
/// </summary> | |||||
public override byte ParamLength { get; set; } = 5; | |||||
/// <summary> | |||||
///固件版本,车载终端厂商自行定义 | |||||
/// </summary> | |||||
public string ParamValue { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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_0x81_0x09Formatter))] | |||||
public class JTNE_0x81_0x09: JTNE_0x81_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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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_0x81_0x0AFormatter))] | |||||
public class JTNE_0x81_0x0A: JTNE_0x81_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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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_0x81_0x0BFormatter))] | |||||
public class JTNE_0x81_0x0B: JTNE_0x81_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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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_0x81_0x0CFormatter))] | |||||
public class JTNE_0x81_0x0C: JTNE_0x81_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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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_0x81_0x0DFormatter))] | |||||
public class JTNE_0x81_0x0D: JTNE_0x81_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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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_0x81_0x0EFormatter))] | |||||
public class JTNE_0x81_0x0E: JTNE_0x81_Body | |||||
{ | |||||
public override byte ParamId { get; set; } = 0x0E; | |||||
/// <summary> | |||||
/// 数据 长度 | |||||
/// </summary> | |||||
public override byte ParamLength { get; set; } | |||||
/// <summary> | |||||
///公共平台域名 | |||||
/// </summary> | |||||
public byte[] ParamValue { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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_0x81_0x0FFormatter))] | |||||
public class JTNE_0x81_0x0F: JTNE_0x81_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; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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_0x81_0x10Formatter))] | |||||
public class JTNE_0x81_0x10: JTNE_0x81_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; } | |||||
} | |||||
} |
@@ -0,0 +1,165 @@ | |||||
using JTNE.Protocol.Attributes; | |||||
using JTNE.Protocol.Formatters.MessageBodyFormatters; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JTNE.Protocol.MessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 参数查询 | |||||
/// </summary> | |||||
public abstract class JTNE_0x81_Body | |||||
{ | |||||
/// <summary> | |||||
/// 车载终端本地存储时间周期,有效值范围:0~60 000(表示0ms~60 000ms) | |||||
/// 最小计量单元:1ms | |||||
/// 0xFF,0xFE表示异常,0xFF,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x81_0x01_Type = 0x01; | |||||
/// <summary> | |||||
/// 正常时,信息上报时间周期,有效值范围:1~600(表示1s~600s) | |||||
/// 最小计量单元:1s | |||||
/// 0xFF,0xFE表示异常,0xFF,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x81_0x02_Type = 0x02; | |||||
/// <summary> | |||||
/// 出现报警时,信息上报时间周期,有效值范围:0~60 000(表示0ms~60 000ms) | |||||
/// 最小计量单元:1ms | |||||
/// 0xFF,0xFE表示异常,0xFF,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x81_0x03_Type = 0x03; | |||||
/// <summary> | |||||
/// 远程服务和管理平台域名长度M | |||||
/// </summary> | |||||
public const byte JTNE_0x81_0x04_Type = 0x04; | |||||
/// <summary> | |||||
/// 远程服务和管理平台域名 | |||||
/// </summary> | |||||
public const byte JTNE_0x81_0x05_Type = 0x05; | |||||
/// <summary> | |||||
/// 远程服务和管理平台端口,有效值范围:0~65531 | |||||
/// 0xFF,0xFE表示异常,0xFF,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x81_0x06_Type = 0x06; | |||||
/// <summary> | |||||
/// 硬件版本,车载终端厂商自行定义 | |||||
/// </summary> | |||||
public const byte JTNE_0x81_0x07_Type = 0x07; | |||||
/// <summary> | |||||
/// 固件版本,车载终端厂商自行定义 | |||||
/// </summary> | |||||
public const byte JTNE_0x81_0x08_Type = 0x08; | |||||
/// <summary> | |||||
/// 车载终端心跳发送周期,有效值范围:1~240(表示1s~240s) | |||||
/// 最小计量单元:1s | |||||
/// 0xFE表示异常,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x81_0x09_Type = 0x09; | |||||
/// <summary> | |||||
/// 终端应答超时时间,有效值范围:1~600(表示1s~600s) | |||||
/// 最小计量单元:1s | |||||
/// 0xFF,0xFE表示异常,0xFF,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x81_0x0A_Type = 0x0A; | |||||
/// <summary> | |||||
///平台应答超时时间,有效值范围:1~600(表示1s~600s) | |||||
/// 最小计量单元:1s | |||||
/// 0xFF,0xFE表示异常,0xFF,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x81_0x0B_Type = 0x0B; | |||||
/// <summary> | |||||
/// 连续三次登入失败后,到下一次登入的时间间隔。有效值范围:1~240(表示1min~240min) | |||||
/// 最小计量单元:1min | |||||
/// 0xFE表示异常,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x81_0x0C_Type = 0x0C; | |||||
/// <summary> | |||||
/// 公共平台域名长度N | |||||
/// </summary> | |||||
public const byte JTNE_0x81_0x0D_Type = 0x0D; | |||||
/// <summary> | |||||
/// 公共平台域名 | |||||
/// </summary> | |||||
public const byte JTNE_0x81_0x0E_Type = 0x0E; | |||||
/// <summary> | |||||
/// 公共平台端口,有效值访问:0~65531 | |||||
/// 0xFF,0xFE表示异常,0xFF,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x81_0x0F_Type = 0x0F; | |||||
/// <summary> | |||||
/// 是否处于抽样监测中 | |||||
/// 0x01 表示是 0x02 表示否 | |||||
/// 0xFE表示异常,0xFF表示无效 | |||||
/// </summary> | |||||
public const byte JTNE_0x81_0x10_Type = 0x10; | |||||
internal static IDictionary<byte, Type> JTNE_0x81Method { get; private set; } | |||||
/// <summary> | |||||
/// A对象的长度,依赖于B对象的值 (数据长度为byte类型) | |||||
/// </summary> | |||||
internal static IDictionary<byte, byte> JTNE_0x81LengthOfADependOnValueOfB { get; private set; } | |||||
/// <summary> | |||||
/// 参数 ID | |||||
/// </summary> | |||||
public abstract byte ParamId { get; set; } | |||||
/// <summary> | |||||
/// 参数长度 | |||||
/// </summary> | |||||
public abstract byte ParamLength { get; set; } | |||||
static JTNE_0x81_Body() | |||||
{ | |||||
JTNE_0x81Method = new Dictionary<byte, Type>(); | |||||
JTNE_0x81Method.Add(JTNE_0x81_0x01_Type, typeof(JTNE_0x81_0x01)); | |||||
JTNE_0x81Method.Add(JTNE_0x81_0x02_Type, typeof(JTNE_0x81_0x02)); | |||||
JTNE_0x81Method.Add(JTNE_0x81_0x03_Type, typeof(JTNE_0x81_0x03)); | |||||
JTNE_0x81Method.Add(JTNE_0x81_0x04_Type, typeof(JTNE_0x81_0x04)); | |||||
JTNE_0x81Method.Add(JTNE_0x81_0x05_Type, typeof(JTNE_0x81_0x05)); | |||||
JTNE_0x81Method.Add(JTNE_0x81_0x06_Type, typeof(JTNE_0x81_0x06)); | |||||
JTNE_0x81Method.Add(JTNE_0x81_0x07_Type, typeof(JTNE_0x81_0x07)); | |||||
JTNE_0x81Method.Add(JTNE_0x81_0x08_Type, typeof(JTNE_0x81_0x08)); | |||||
JTNE_0x81Method.Add(JTNE_0x81_0x09_Type, typeof(JTNE_0x81_0x09)); | |||||
JTNE_0x81Method.Add(JTNE_0x81_0x0A_Type, typeof(JTNE_0x81_0x0A)); | |||||
JTNE_0x81Method.Add(JTNE_0x81_0x0B_Type, typeof(JTNE_0x81_0x0B)); | |||||
JTNE_0x81Method.Add(JTNE_0x81_0x0C_Type, typeof(JTNE_0x81_0x0C)); | |||||
JTNE_0x81Method.Add(JTNE_0x81_0x0D_Type, typeof(JTNE_0x81_0x0D)); | |||||
JTNE_0x81Method.Add(JTNE_0x81_0x0E_Type, typeof(JTNE_0x81_0x0E)); | |||||
JTNE_0x81Method.Add(JTNE_0x81_0x0F_Type, typeof(JTNE_0x81_0x0F)); | |||||
JTNE_0x81Method.Add(JTNE_0x81_0x10_Type, typeof(JTNE_0x81_0x10)); | |||||
JTNE_0x81LengthOfADependOnValueOfB = new Dictionary<byte, byte>(); | |||||
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; | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,28 @@ | |||||
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_0x82_Formatter))] | |||||
public class JTNE_0x82 : JTNEBodies | |||||
{ | |||||
/// <summary> | |||||
/// 控制时间 | |||||
/// </summary> | |||||
public DateTime ControlTime { get; set; } | |||||
/// <summary> | |||||
/// 参数 | |||||
/// </summary> | |||||
public byte ParamID { get; set; } | |||||
/// <summary> | |||||
/// 参数 | |||||
/// </summary> | |||||
public JTNE_0x82_Body Parameter { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,24 @@ | |||||
using JTNE.Protocol.Attributes; | |||||
using JTNE.Protocol.Formatters.MessageBodyFormatters; | |||||
using JTNE.Protocol.Metadata; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JTNE.Protocol.MessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 远程升级:根据需要组合升级参数,参数之间用半角分号分割。 | |||||
/// 指令如下:“URL地址;拨号点名称;拨号用户名;拨号密码;地址;端口;生产厂商代码 | |||||
/// ;硬件版本;固件版本;连接到升级服务器时限" | |||||
/// 如某个参数无值,则为空 | |||||
/// 远程升级操作建议但不限于采用FTP方式进行操作,数据定义见表B.16 | |||||
/// </summary> | |||||
[JTNEFormatter(typeof(JTNE_0x82_0x01Formatter))] | |||||
public class JTNE_0x82_0x01 : JTNE_0x82_Body | |||||
{ | |||||
public override byte ParamId { get; set; } = 0x01; | |||||
public override byte ParamLength { get; set; } | |||||
public UpgradeCommand UpgradeCommand { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,21 @@ | |||||
using JTNE.Protocol.Attributes; | |||||
using JTNE.Protocol.Formatters.MessageBodyFormatters; | |||||
using JTNE.Protocol.Metadata; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JTNE.Protocol.MessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 车载终端报警 | |||||
/// </summary> | |||||
[JTNEFormatter(typeof(JTNE_0x82_0x06Formatter))] | |||||
public class JTNE_0x82_0x06 : JTNE_0x82_Body | |||||
{ | |||||
public override byte ParamId { get; set; } = 0x06; | |||||
public override byte ParamLength { get; set; } | |||||
public AlarmCommand AlarmCommand { get; set; } | |||||
} | |||||
} | |||||
@@ -0,0 +1,83 @@ | |||||
using JTNE.Protocol.Attributes; | |||||
using JTNE.Protocol.Formatters.MessageBodyFormatters; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JTNE.Protocol.MessageBody | |||||
{ | |||||
/// <summary> | |||||
/// 参数查询 | |||||
/// </summary> | |||||
public class JTNE_0x82_Body | |||||
{ | |||||
/// <summary> | |||||
/// 未用 | |||||
/// </summary> | |||||
public const byte JTNE_0x82_0x00_Type = 0x00; | |||||
/// <summary> | |||||
/// 远程升级:根据需要组合升级参数,参数之间用半角分号分割。 | |||||
/// 指令如下:“URL地址;拨号点名称;拨号用户名;拨号密码;地址;端口;生产厂商代码 | |||||
/// ;硬件版本;固件版本;连接到升级服务器时限" | |||||
/// 如某个参数无值,则为空 | |||||
/// 远程升级操作建议但不限于采用FTP方式进行操作,数据定义见表B.16 | |||||
/// </summary> | |||||
public const byte JTNE_0x82_0x01_Type = 0x01; | |||||
/// <summary> | |||||
/// 车载终端关机 | |||||
/// </summary> | |||||
public const byte JTNE_0x82_0x02_Type = 0x02; | |||||
/// <summary> | |||||
/// 车载终端复位 | |||||
/// </summary> | |||||
public const byte JTNE_0x82_0x03_Type = 0x03; | |||||
/// <summary> | |||||
/// 车载终端恢复出厂设置,其中包括本地存储时间周期,信息上报时间周期,心跳发送时间周期,终端应答超时时间等 | |||||
/// </summary> | |||||
public const byte JTNE_0x82_0x04_Type = 0x04; | |||||
/// <summary> | |||||
/// 断开数据通信链路 | |||||
/// </summary> | |||||
public const byte JTNE_0x82_0x05_Type = 0x05; | |||||
/// <summary> | |||||
/// 车载终端报警 | |||||
/// 报警命令参数数据格式和定义见表B.17 | |||||
/// </summary> | |||||
public const byte JTNE_0x82_0x06_Type = 0x06; | |||||
/// <summary> | |||||
/// 开启抽样监测链路 | |||||
/// </summary> | |||||
public const byte JTNE_0x82_0x07_Type = 0x07; | |||||
public static IDictionary<byte, Type> JTNE_0x82Method { get; private set; } | |||||
/// <summary> | |||||
/// 参数 ID | |||||
/// </summary> | |||||
public virtual byte ParamId { get; set; } | |||||
/// <summary> | |||||
/// 参数长度 | |||||
/// </summary> | |||||
public virtual byte ParamLength { get; set; } | |||||
static JTNE_0x82_Body() | |||||
{ | |||||
JTNE_0x82Method = new Dictionary<byte, Type>(); | |||||
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; | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,22 @@ | |||||
using JTNE.Protocol.Enums; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JTNE.Protocol.Metadata | |||||
{ | |||||
/// <summary> | |||||
/// 升级命令 | |||||
/// </summary> | |||||
public class AlarmCommand | |||||
{ | |||||
/// <summary> | |||||
/// 报警等级 | |||||
/// </summary> | |||||
public JTNEAlarmLevel AlarmLevel { get; set; } | |||||
/// <summary> | |||||
/// 报警信息 | |||||
/// </summary> | |||||
public string Alarm { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,64 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Text; | |||||
namespace JTNE.Protocol.Metadata | |||||
{ | |||||
/// <summary> | |||||
/// 升级命令 | |||||
/// </summary> | |||||
public class UpgradeCommand | |||||
{ | |||||
/// <summary> | |||||
/// 拨号点名称 | |||||
/// 升级服务器的APN,无线通信拨号访问点 | |||||
/// 如果网络制式为CDMA,则该值为PPP连接拨号号码 | |||||
/// </summary> | |||||
public string DialName { get; set; } | |||||
/// <summary> | |||||
/// 拨号用户名 | |||||
/// </summary> | |||||
public string DialUserName { get; set; } | |||||
/// <summary> | |||||
/// 拨号用户名 | |||||
/// </summary> | |||||
public string DialUserPwd { get; set; } | |||||
/// <summary> | |||||
/// 升级服务器地址 | |||||
/// IP或域名 IPV4的前2个字节为0 | |||||
/// </summary> | |||||
public byte[] ServerUrl { get; set; } | |||||
/// <summary> | |||||
/// 升级服务器端口 | |||||
/// </summary> | |||||
public ushort ServerPort { get; set; } | |||||
/// <summary> | |||||
/// 车载终端制造商ID | |||||
/// </summary> | |||||
public string ManufacturerID { get; set; } | |||||
/// <summary> | |||||
/// 硬件版本 | |||||
/// </summary> | |||||
public string HardwareVersion { get; set; } | |||||
/// <summary> | |||||
/// 固件版本 | |||||
/// </summary> | |||||
public string FirmwareVersion { get; set; } | |||||
/// <summary> | |||||
/// 升级URL地址,完整URL地址 | |||||
/// 宜使用FTP协议,通过FTP协议从FTP服务器上获取新的软件 | |||||
/// </summary> | |||||
public string ServerAddress { get; set; } | |||||
/// <summary> | |||||
/// 连接到升级服务器时限 | |||||
/// 有效值范围:0~60 000(表示0min~60 000min)最小计量单元:1min | |||||
/// 在车载终端接收到升级命令后的有效期截止前,车载终端连回远程服务和管理平台 | |||||
/// </summary> | |||||
public ushort ConnectTimeLimit { get; set; } | |||||
public override string ToString() | |||||
{ | |||||
return $"{ServerAddress};{DialName};{DialUserName};{DialUserPwd};{JTNEGlobalConfigs.Instance.Encoding.GetString(ServerUrl)};{ServerPort};{ManufacturerID};{HardwareVersion};{FirmwareVersion};{ConnectTimeLimit}"; | |||||
} | |||||
} | |||||
} |