1.修改位置附加信息为实例工厂(为了可以扩展国标消息) 2.修改终端参数设置为实例工厂(为了可以扩展国标消息) 3.将位置附加信息和终端参数设置的常量移入JT808Constants 4.去掉老版无用文件 5.修改配置扩展的命令空间tags/v2.1.1
@@ -74,12 +74,12 @@ jT808_0x0200.Direction = 0; | |||
jT808_0x0200.StatusFlag = 2; | |||
jT808_0x0200.JT808LocationAttachData = new Dictionary<byte, JT808_0x0200_BodyBase>(); | |||
jT808_0x0200.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x01, new JT808_0x0200_0x01 | |||
jT808_0x0200.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01 | |||
{ | |||
Mileage = 100 | |||
}); | |||
jT808_0x0200.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x02, new JT808_0x0200_0x02 | |||
jT808_0x0200.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02 | |||
{ | |||
Oil = 125 | |||
}); | |||
@@ -160,9 +160,9 @@ Assert.Equal(60, jT808_0x0200.Speed); | |||
Assert.Equal(0, jT808_0x0200.Direction); | |||
Assert.Equal((uint)2, jT808_0x0200.StatusFlag); | |||
//4.1.附加信息1 | |||
Assert.Equal(100, ((JT808_0x0200_0x01)jT808_0x0200.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x01]).Mileage); | |||
Assert.Equal(100, ((JT808_0x0200_0x01)jT808_0x0200.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x01]).Mileage); | |||
//4.2.附加信息2 | |||
Assert.Equal(125, ((JT808_0x0200_0x02)jT808_0x0200.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x02]).Oil); | |||
Assert.Equal(125, ((JT808_0x0200_0x02)jT808_0x0200.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x02]).Oil); | |||
``` | |||
### 举个栗子2 | |||
@@ -58,56 +58,56 @@ namespace JT808.Protocol.Benchmark | |||
jT808UploadLocationRequest.Direction = 0; | |||
jT808UploadLocationRequest.StatusFlag = 2; | |||
jT808UploadLocationRequest.JT808LocationAttachData = new Dictionary<byte, JT808_0x0200_BodyBase>(); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x01, new JT808_0x0200_0x01 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01 | |||
{ | |||
Mileage = 100 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x02, new JT808_0x0200_0x02 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02 | |||
{ | |||
Oil = 55 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x03, new JT808_0x0200_0x03 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x03, new JT808_0x0200_0x03 | |||
{ | |||
Speed=56 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x04, new JT808_0x0200_0x04 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x04, new JT808_0x0200_0x04 | |||
{ | |||
EventId=1 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x11, new JT808_0x0200_0x11 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x11, new JT808_0x0200_0x11 | |||
{ | |||
AreaId=1, | |||
JT808PositionType= Enums.JT808PositionType.圆形区域 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x12, new JT808_0x0200_0x12 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x12, new JT808_0x0200_0x12 | |||
{ | |||
AreaId = 1, | |||
JT808PositionType = Enums.JT808PositionType.圆形区域, | |||
Direction= Enums.JT808DirectionType.出 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x13, new JT808_0x0200_0x13 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x13, new JT808_0x0200_0x13 | |||
{ | |||
DrivenRoute= Enums.JT808DrivenRouteType.过长, | |||
DrivenRouteId=2, | |||
Time=34 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x25, new JT808_0x0200_0x25 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x25, new JT808_0x0200_0x25 | |||
{ | |||
CarSignalStatus=23 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x2A, new JT808_0x0200_0x2A | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x2A, new JT808_0x0200_0x2A | |||
{ | |||
IOStatus=244 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x2B, new JT808_0x0200_0x2B | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x2B, new JT808_0x0200_0x2B | |||
{ | |||
Analog = 242 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x30, new JT808_0x0200_0x30 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x30, new JT808_0x0200_0x30 | |||
{ | |||
WiFiSignalStrength=0x02 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x31, new JT808_0x0200_0x31 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x31, new JT808_0x0200_0x31 | |||
{ | |||
GNSSCount=0x05 | |||
}); | |||
@@ -39,11 +39,11 @@ namespace JT808.Protocol.Test.MessageBody | |||
StatusFlag = 2, | |||
JT808LocationAttachData = new Dictionary<byte, JT808_0x0200_BodyBase>() | |||
}; | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x01, new JT808_0x0200_0x01 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01 | |||
{ | |||
Mileage = 100 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x02, new JT808_0x0200_0x02 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02 | |||
{ | |||
Oil = 55 | |||
}); | |||
@@ -79,11 +79,11 @@ namespace JT808.Protocol.Test.MessageBody | |||
StatusFlag = 2, | |||
JT808LocationAttachData = new Dictionary<byte, JT808_0x0200_BodyBase>() | |||
}; | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x01, new JT808_0x0200_0x01 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01 | |||
{ | |||
Mileage = 100 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x02, new JT808_0x0200_0x02 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02 | |||
{ | |||
Oil = 55 | |||
}); | |||
@@ -133,8 +133,8 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(132444444, jT808UploadLocationRequest.Lng); | |||
Assert.Equal(60, jT808UploadLocationRequest.Speed); | |||
Assert.Equal((uint)2, jT808UploadLocationRequest.StatusFlag); | |||
Assert.Equal(100, ((JT808_0x0200_0x01)jT808UploadLocationRequest.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x01]).Mileage); | |||
Assert.Equal(55, ((JT808_0x0200_0x02)jT808UploadLocationRequest.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x02]).Oil); | |||
Assert.Equal(100, ((JT808_0x0200_0x01)jT808UploadLocationRequest.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x01]).Mileage); | |||
Assert.Equal(55, ((JT808_0x0200_0x02)jT808UploadLocationRequest.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x02]).Oil); | |||
} | |||
[Fact] | |||
@@ -171,11 +171,11 @@ namespace JT808.Protocol.Test.MessageBody | |||
JT808LocationAttachData = new Dictionary<byte, JT808_0x0200_BodyBase>(), | |||
JT808CustomLocationAttachData = new Dictionary<byte, JT808_0x0200_CustomBodyBase>() | |||
}; | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x01, new JT808_0x0200_0x01 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01 | |||
{ | |||
Mileage = 100 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x02, new JT808_0x0200_0x02 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02 | |||
{ | |||
Oil = 55 | |||
}); | |||
@@ -201,8 +201,8 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(132444444, jT808UploadLocationRequest.Lng); | |||
Assert.Equal(60, jT808UploadLocationRequest.Speed); | |||
Assert.Equal((uint)2, jT808UploadLocationRequest.StatusFlag); | |||
Assert.Equal(100, ((JT808_0x0200_0x01)jT808UploadLocationRequest.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x01]).Mileage); | |||
Assert.Equal(55, ((JT808_0x0200_0x02)jT808UploadLocationRequest.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x02]).Oil); | |||
Assert.Equal(100, ((JT808_0x0200_0x01)jT808UploadLocationRequest.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x01]).Mileage); | |||
Assert.Equal(55, ((JT808_0x0200_0x02)jT808UploadLocationRequest.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x02]).Oil); | |||
var jT808LocationAttachImpl0x06 = JT808Serializer.Deserialize<JT808LocationAttachImpl0x06>(jT808UploadLocationRequest.JT808CustomLocationAttachOriginalData[0x06]); | |||
Assert.Equal(18, jT808LocationAttachImpl0x06.Age); | |||
Assert.Equal(1, jT808LocationAttachImpl0x06.Gender); | |||
@@ -232,11 +232,11 @@ namespace JT808.Protocol.Test.MessageBody | |||
StatusFlag = 2, | |||
JT808LocationAttachData = new Dictionary<byte, JT808_0x0200_BodyBase>() | |||
}; | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x01, new JT808_0x0200_0x01 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01 | |||
{ | |||
Mileage = 100 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x02, new JT808_0x0200_0x02 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02 | |||
{ | |||
Oil = 55 | |||
}); | |||
@@ -289,8 +289,8 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(132444444, jT808UploadLocationRequest.Lng); | |||
Assert.Equal(60, jT808UploadLocationRequest.Speed); | |||
Assert.Equal((uint)2, jT808UploadLocationRequest.StatusFlag); | |||
Assert.Equal(100, ((JT808_0x0200_0x01)jT808UploadLocationRequest.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x01]).Mileage); | |||
Assert.Equal(55, ((JT808_0x0200_0x02)jT808UploadLocationRequest.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x02]).Oil); | |||
Assert.Equal(100, ((JT808_0x0200_0x01)jT808UploadLocationRequest.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x01]).Mileage); | |||
Assert.Equal(55, ((JT808_0x0200_0x02)jT808UploadLocationRequest.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x02]).Oil); | |||
} | |||
[Fact] | |||
@@ -313,56 +313,56 @@ namespace JT808.Protocol.Test.MessageBody | |||
jT808UploadLocationRequest.Direction = 0; | |||
jT808UploadLocationRequest.StatusFlag = 2; | |||
jT808UploadLocationRequest.JT808LocationAttachData = new Dictionary<byte, JT808_0x0200_BodyBase>(); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x01, new JT808_0x0200_0x01 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01 | |||
{ | |||
Mileage = 100 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x02, new JT808_0x0200_0x02 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02 | |||
{ | |||
Oil = 55 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x03, new JT808_0x0200_0x03 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x03, new JT808_0x0200_0x03 | |||
{ | |||
Speed = 56 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x04, new JT808_0x0200_0x04 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x04, new JT808_0x0200_0x04 | |||
{ | |||
EventId = 1 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x11, new JT808_0x0200_0x11 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x11, new JT808_0x0200_0x11 | |||
{ | |||
AreaId = 1, | |||
JT808PositionType = Enums.JT808PositionType.圆形区域 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x12, new JT808_0x0200_0x12 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x12, new JT808_0x0200_0x12 | |||
{ | |||
AreaId = 1, | |||
JT808PositionType = Enums.JT808PositionType.圆形区域, | |||
Direction = Enums.JT808DirectionType.出 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x13, new JT808_0x0200_0x13 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x13, new JT808_0x0200_0x13 | |||
{ | |||
DrivenRoute = Enums.JT808DrivenRouteType.过长, | |||
DrivenRouteId = 2, | |||
Time = 34 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x25, new JT808_0x0200_0x25 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x25, new JT808_0x0200_0x25 | |||
{ | |||
CarSignalStatus = 23 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x2A, new JT808_0x0200_0x2A | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x2A, new JT808_0x0200_0x2A | |||
{ | |||
IOStatus = 244 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x2B, new JT808_0x0200_0x2B | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x2B, new JT808_0x0200_0x2B | |||
{ | |||
Analog = 242 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x30, new JT808_0x0200_0x30 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x30, new JT808_0x0200_0x30 | |||
{ | |||
WiFiSignalStrength = 0x02 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x31, new JT808_0x0200_0x31 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x31, new JT808_0x0200_0x31 | |||
{ | |||
GNSSCount = 0x05 | |||
}); | |||
@@ -37,11 +37,11 @@ namespace JT808.Protocol.Test.MessageBody | |||
StatusFlag = 2, | |||
JT808LocationAttachData = new Dictionary<byte, JT808_0x0200_BodyBase>() | |||
}; | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x01, new JT808_0x0200_0x01 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01 | |||
{ | |||
Mileage = 100 | |||
}); | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x02, new JT808_0x0200_0x02 | |||
jT808UploadLocationRequest.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02 | |||
{ | |||
Oil = 55 | |||
}); | |||
@@ -65,8 +65,8 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(132444444, jT808_0X0201.Position.Lng); | |||
Assert.Equal(60, jT808_0X0201.Position.Speed); | |||
Assert.Equal((uint)2, jT808_0X0201.Position.StatusFlag); | |||
Assert.Equal(100, ((JT808_0x0200_0x01)jT808_0X0201.Position.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x01]).Mileage); | |||
Assert.Equal(55, ((JT808_0x0200_0x02)jT808_0X0201.Position.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x02]).Oil); | |||
Assert.Equal(100, ((JT808_0x0200_0x01)jT808_0X0201.Position.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x01]).Mileage); | |||
Assert.Equal(55, ((JT808_0x0200_0x02)jT808_0X0201.Position.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x02]).Oil); | |||
} | |||
} | |||
} |
@@ -34,11 +34,11 @@ namespace JT808.Protocol.Test.MessageBody | |||
StatusFlag = 2, | |||
JT808LocationAttachData = new Dictionary<byte, JT808_0x0200_BodyBase>() | |||
}; | |||
JT808_0x0200_1.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x01, new JT808_0x0200_0x01 | |||
JT808_0x0200_1.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01 | |||
{ | |||
Mileage = 100 | |||
}); | |||
JT808_0x0200_1.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x02, new JT808_0x0200_0x02 | |||
JT808_0x0200_1.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02 | |||
{ | |||
Oil = 55 | |||
}); | |||
@@ -67,8 +67,8 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(0, JT808Bodies.JT808_0x0200.Direction); | |||
Assert.Equal(60, JT808Bodies.JT808_0x0200.Speed); | |||
Assert.Equal((uint)2, JT808Bodies.JT808_0x0200.StatusFlag); | |||
Assert.Equal(100, ((JT808_0x0200_0x01)JT808Bodies.JT808_0x0200.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x01]).Mileage); | |||
Assert.Equal(55, ((JT808_0x0200_0x02)JT808Bodies.JT808_0x0200.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x02]).Oil); | |||
Assert.Equal(100, ((JT808_0x0200_0x01)JT808Bodies.JT808_0x0200.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x01]).Mileage); | |||
Assert.Equal(55, ((JT808_0x0200_0x02)JT808Bodies.JT808_0x0200.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x02]).Oil); | |||
} | |||
} | |||
} |
@@ -40,11 +40,11 @@ namespace JT808.Protocol.Test.MessageBody | |||
StatusFlag = 2, | |||
JT808LocationAttachData = new Dictionary<byte, JT808_0x0200_BodyBase>() | |||
}; | |||
JT808_0x0200_1.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x01, new JT808_0x0200_0x01 | |||
JT808_0x0200_1.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01 | |||
{ | |||
Mileage = 100 | |||
}); | |||
JT808_0x0200_1.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x02, new JT808_0x0200_0x02 | |||
JT808_0x0200_1.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02 | |||
{ | |||
Oil = 55 | |||
}); | |||
@@ -64,11 +64,11 @@ namespace JT808.Protocol.Test.MessageBody | |||
StatusFlag = 1, | |||
JT808LocationAttachData = new Dictionary<byte, JT808_0x0200_BodyBase>() | |||
}; | |||
JT808_0x0200_2.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x01, new JT808_0x0200_0x01 | |||
JT808_0x0200_2.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01 | |||
{ | |||
Mileage = 96 | |||
}); | |||
JT808_0x0200_2.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x02, new JT808_0x0200_0x02 | |||
JT808_0x0200_2.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02 | |||
{ | |||
Oil = 66 | |||
}); | |||
@@ -138,8 +138,8 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(0, JT808Bodies.Positions[0].Direction); | |||
Assert.Equal(60, JT808Bodies.Positions[0].Speed); | |||
Assert.Equal((uint)2, JT808Bodies.Positions[0].StatusFlag); | |||
Assert.Equal(100, ((JT808_0x0200_0x01)JT808Bodies.Positions[0].JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x01]).Mileage); | |||
Assert.Equal(55, ((JT808_0x0200_0x02)JT808Bodies.Positions[0].JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x02]).Oil); | |||
Assert.Equal(100, ((JT808_0x0200_0x01)JT808Bodies.Positions[0].JT808LocationAttachData[JT808Constants.JT808_0x0200_0x01]).Mileage); | |||
Assert.Equal(55, ((JT808_0x0200_0x02)JT808Bodies.Positions[0].JT808LocationAttachData[JT808Constants.JT808_0x0200_0x02]).Oil); | |||
Assert.Equal((uint)2, JT808Bodies.Positions[1].AlarmFlag); | |||
Assert.Equal(DateTime.Parse("2018-07-15 10:10:30"), JT808Bodies.Positions[1].GPSTime); | |||
@@ -148,8 +148,8 @@ namespace JT808.Protocol.Test.MessageBody | |||
Assert.Equal(54, JT808Bodies.Positions[1].Speed); | |||
Assert.Equal(120, JT808Bodies.Positions[1].Direction); | |||
Assert.Equal((uint)1, JT808Bodies.Positions[1].StatusFlag); | |||
Assert.Equal(96, ((JT808_0x0200_0x01)JT808Bodies.Positions[1].JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x01]).Mileage); | |||
Assert.Equal(66, ((JT808_0x0200_0x02)JT808Bodies.Positions[1].JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x02]).Oil); | |||
Assert.Equal(96, ((JT808_0x0200_0x01)JT808Bodies.Positions[1].JT808LocationAttachData[JT808Constants.JT808_0x0200_0x01]).Mileage); | |||
Assert.Equal(66, ((JT808_0x0200_0x02)JT808Bodies.Positions[1].JT808LocationAttachData[JT808Constants.JT808_0x0200_0x02]).Oil); | |||
} | |||
} | |||
} |
@@ -45,12 +45,12 @@ namespace JT808.Protocol.Test.Simples | |||
JT808LocationAttachData = new Dictionary<byte, JT808_0x0200_BodyBase>() | |||
}; | |||
jT808_0x0200.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x01, new JT808_0x0200_0x01 | |||
jT808_0x0200.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x01, new JT808_0x0200_0x01 | |||
{ | |||
Mileage = 100 | |||
}); | |||
jT808_0x0200.JT808LocationAttachData.Add(JT808_0x0200_BodyBase.AttachId0x02, new JT808_0x0200_0x02 | |||
jT808_0x0200.JT808LocationAttachData.Add(JT808Constants.JT808_0x0200_0x02, new JT808_0x0200_0x02 | |||
{ | |||
Oil = 125 | |||
}); | |||
@@ -51,9 +51,9 @@ namespace JT808.Protocol.Test.Simples | |||
Assert.Equal(0, jT808_0x0200.Direction); | |||
Assert.Equal((uint)2, jT808_0x0200.StatusFlag); | |||
//4.1.附加信息1 | |||
Assert.Equal(100, ((JT808_0x0200_0x01)jT808_0x0200.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x01]).Mileage); | |||
Assert.Equal(100, ((JT808_0x0200_0x01)jT808_0x0200.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x01]).Mileage); | |||
//4.2.附加信息2 | |||
Assert.Equal(125, ((JT808_0x0200_0x02)jT808_0x0200.JT808LocationAttachData[JT808_0x0200_BodyBase.AttachId0x02]).Oil); | |||
Assert.Equal(125, ((JT808_0x0200_0x02)jT808_0x0200.JT808LocationAttachData[JT808Constants.JT808_0x0200_0x02]).Oil); | |||
} | |||
} | |||
} |
@@ -37,8 +37,8 @@ namespace JT808.Protocol.Test.Simples | |||
StatusFlag = 2, | |||
JT808LocationAttachData = new Dictionary<byte, JT808_0x0200_BodyBase> | |||
{ | |||
{ JT808_0x0200_BodyBase.AttachId0x01,new JT808_0x0200_0x01{Mileage = 100}}, | |||
{ JT808_0x0200_BodyBase.AttachId0x02,new JT808_0x0200_0x02{Oil = 125}} | |||
{ JT808Constants.JT808_0x0200_0x01,new JT808_0x0200_0x01{Mileage = 100}}, | |||
{ JT808Constants.JT808_0x0200_0x02,new JT808_0x0200_0x02{Oil = 125}} | |||
} | |||
}); | |||
jT808Package.Header.MsgNum = 1; | |||
@@ -4,10 +4,8 @@ using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT808.Protocol.Extensions | |||
namespace JT808.Protocol | |||
{ | |||
public static class JT808ConfigExtensions | |||
{ | |||
@@ -1,35 +0,0 @@ | |||
using JT808.Protocol.Attributes; | |||
using JT808.Protocol.Enums; | |||
using JT808.Protocol.Exceptions; | |||
using JT808.Protocol.Formatters; | |||
using JT808.Protocol.Interfaces; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Linq.Expressions; | |||
using System.Reflection; | |||
namespace JT808.Protocol.Extensions | |||
{ | |||
[Obsolete("使用JT808ConfigExtensions")] | |||
public static class JT808FormatterExtensions | |||
{ | |||
public static IJT808Formatter<T> GetFormatter<T>(IJT808Config jT808Config) | |||
{ | |||
return (IJT808Formatter<T>)GetFormatter(typeof(T), jT808Config); | |||
} | |||
public static IJT808MessagePackFormatter<T> GetMessagePackFormatter<T>(IJT808Config jT808Config) | |||
{ | |||
return (IJT808MessagePackFormatter<T>)GetFormatter(typeof(T), jT808Config); | |||
} | |||
public static object GetFormatter(Type type,IJT808Config jT808Config) | |||
{ | |||
if (!jT808Config.FormatterFactory.FormatterDict.TryGetValue(type.GUID, out var formatter)) | |||
{ | |||
throw new JT808Exception(JT808ErrorCode.NotGlobalRegisterFormatterAssembly, type.FullName); | |||
} | |||
return formatter; | |||
} | |||
} | |||
} |
@@ -1,159 +0,0 @@ | |||
using JT808.Protocol.Formatters; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Linq.Expressions; | |||
using System.Reflection; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Extensions | |||
{ | |||
/// <summary> | |||
/// | |||
/// ref http://adamsitnik.com/Span/#span-must-not-be-a-generic-type-argument | |||
/// ref http://adamsitnik.com/Span/ | |||
/// ref:MessagePack.Formatters.DynamicObjectTypeFallbackFormatter | |||
/// </summary> | |||
[Obsolete("使用JT808MessagePackFormatterResolverExtensions")] | |||
public static class JT808FormatterResolverExtensions | |||
{ | |||
delegate int JT808SerializeMethod(object dynamicFormatter, ref byte[] bytes, int offset, object value, IJT808Config config); | |||
delegate dynamic JT808DeserializeMethod(object dynamicFormatter, ReadOnlySpan<byte> bytes, out int readSize, IJT808Config config); | |||
static readonly ConcurrentDictionary<Type, (object Value, JT808SerializeMethod SerializeMethod)> jT808Serializers = new ConcurrentDictionary<Type, (object Value, JT808SerializeMethod SerializeMethod)>(); | |||
static readonly ConcurrentDictionary<Type, (object Value, JT808DeserializeMethod DeserializeMethod)> jT808Deserializes = new ConcurrentDictionary<Type, (object Value, JT808DeserializeMethod DeserializeMethod)>(); | |||
public static int JT808DynamicSerialize(object objFormatter, ref byte[] bytes, int offset, dynamic value, IJT808Config config) | |||
{ | |||
Type type = value.GetType(); | |||
var ti = type.GetTypeInfo(); | |||
(object Value, JT808SerializeMethod SerializeMethod) formatterAndDelegate; | |||
if (!jT808Serializers.TryGetValue(type, out formatterAndDelegate)) | |||
{ | |||
var t = type; | |||
{ | |||
var formatterType = typeof(IJT808Formatter<>).MakeGenericType(t); | |||
var param0 = Expression.Parameter(typeof(object), "formatter"); | |||
var param1 = Expression.Parameter(typeof(byte[]).MakeByRefType(), "bytes"); | |||
var param2 = Expression.Parameter(typeof(int), "offset"); | |||
var param3 = Expression.Parameter(typeof(object), "value"); | |||
var param4 = Expression.Parameter(typeof(IJT808Config),"config"); | |||
var serializeMethodInfo = formatterType.GetRuntimeMethod("Serialize", new[] { typeof(byte[]).MakeByRefType(), typeof(int), t, typeof(IJT808Config) }); | |||
var body = Expression.Call( | |||
Expression.Convert(param0, formatterType), | |||
serializeMethodInfo, | |||
param1, | |||
param2, | |||
ti.IsValueType ? Expression.Unbox(param3, t) : Expression.Convert(param3, t), | |||
param4); | |||
var lambda = Expression.Lambda<JT808SerializeMethod>(body, param0, param1, param2, param3, param4).Compile(); | |||
formatterAndDelegate = (objFormatter, lambda); | |||
} | |||
jT808Serializers.TryAdd(t, formatterAndDelegate); | |||
} | |||
return formatterAndDelegate.SerializeMethod(formatterAndDelegate.Value, ref bytes, offset, value, config); | |||
} | |||
public static dynamic JT808DynamicDeserialize(object objFormatter, ReadOnlySpan<byte> bytes, out int readSize, IJT808Config config) | |||
{ | |||
var type = objFormatter.GetType(); | |||
(object Value, JT808DeserializeMethod DeserializeMethod) formatterAndDelegate; | |||
if (!jT808Deserializes.TryGetValue(type, out formatterAndDelegate)) | |||
{ | |||
var t = type; | |||
{ | |||
var formatterType = typeof(IJT808Formatter<>).MakeGenericType(t); | |||
ParameterExpression param0 = Expression.Parameter(typeof(object), "formatter"); | |||
ParameterExpression param1 = Expression.Parameter(typeof(ReadOnlySpan<byte>), "bytes"); | |||
ParameterExpression param2 = Expression.Parameter(typeof(int).MakeByRefType(), "readSize"); | |||
ParameterExpression param3 = Expression.Parameter(typeof(IJT808Config), "config"); | |||
var deserializeMethodInfo = type.GetRuntimeMethod("Deserialize", new[] { typeof(ReadOnlySpan<byte>), typeof(int).MakeByRefType() , typeof(IJT808Config) }); | |||
var body = Expression.Call( | |||
Expression.Convert(param0, type), | |||
deserializeMethodInfo, | |||
param1, | |||
param2, | |||
param3 | |||
); | |||
var lambda = Expression.Lambda<JT808DeserializeMethod>(body, param0, param1, param2, param3).Compile(); | |||
formatterAndDelegate = (objFormatter, lambda); | |||
} | |||
jT808Deserializes.TryAdd(t, formatterAndDelegate); | |||
} | |||
return formatterAndDelegate.DeserializeMethod(formatterAndDelegate.Value, bytes, out readSize, config); | |||
} | |||
} | |||
/// <summary> | |||
/// | |||
/// ref http://adamsitnik.com/Span/#span-must-not-be-a-generic-type-argument | |||
/// ref http://adamsitnik.com/Span/ | |||
/// ref:MessagePack.Formatters.DynamicObjectTypeFallbackFormatter | |||
/// </summary> | |||
public static class JT808MessagePackFormatterResolverExtensions | |||
{ | |||
delegate void JT808SerializeMethod(object dynamicFormatter, ref JT808MessagePackWriter writer,object value, IJT808Config config); | |||
delegate dynamic JT808DeserializeMethod(object dynamicFormatter, ref JT808MessagePackReader reader, IJT808Config config); | |||
static readonly ConcurrentDictionary<Type, (object Value, JT808SerializeMethod SerializeMethod)> jT808Serializers = new ConcurrentDictionary<Type, (object Value, JT808SerializeMethod SerializeMethod)>(); | |||
static readonly ConcurrentDictionary<Type, (object Value, JT808DeserializeMethod DeserializeMethod)> jT808Deserializes = new ConcurrentDictionary<Type, (object Value, JT808DeserializeMethod DeserializeMethod)>(); | |||
public static void JT808DynamicSerialize(object objFormatter, ref JT808MessagePackWriter writer, object value, IJT808Config config) | |||
{ | |||
Type type = value.GetType(); | |||
var ti = type.GetTypeInfo(); | |||
// (object Value, JT808SerializeMethod SerializeMethod) formatterAndDelegate; | |||
if (!jT808Serializers.TryGetValue(type, out var formatterAndDelegate)) | |||
{ | |||
var t = type; | |||
{ | |||
var formatterType = typeof(IJT808MessagePackFormatter<>).MakeGenericType(t); | |||
var param0 = Expression.Parameter(typeof(object), "formatter"); | |||
var param1 = Expression.Parameter(typeof(JT808MessagePackWriter).MakeByRefType(), "writer"); | |||
var param2 = Expression.Parameter(typeof(object), "value"); | |||
var param3 = Expression.Parameter(typeof(IJT808Config), "config"); | |||
var serializeMethodInfo = formatterType.GetRuntimeMethod("Serialize", new[] { typeof(JT808MessagePackWriter).MakeByRefType(), t, typeof(IJT808Config) }); | |||
var body = Expression.Call( | |||
Expression.Convert(param0, formatterType), | |||
serializeMethodInfo, | |||
param1, | |||
ti.IsValueType ? Expression.Unbox(param2, t) : Expression.Convert(param2, t), | |||
param3); | |||
var lambda = Expression.Lambda<JT808SerializeMethod>(body, param0, param1, param2, param3).Compile(); | |||
formatterAndDelegate = (objFormatter, lambda); | |||
} | |||
jT808Serializers.TryAdd(t, formatterAndDelegate); | |||
} | |||
formatterAndDelegate.SerializeMethod(formatterAndDelegate.Value, ref writer, value, config); | |||
} | |||
public static dynamic JT808DynamicDeserialize(object objFormatter, ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
var type = objFormatter.GetType(); | |||
// (object Value, JT808DeserializeMethod DeserializeMethod) formatterAndDelegate; | |||
if (!jT808Deserializes.TryGetValue(type, out var formatterAndDelegate)) | |||
{ | |||
var t = type; | |||
{ | |||
var formatterType = typeof(IJT808MessagePackFormatter<>).MakeGenericType(t); | |||
ParameterExpression param0 = Expression.Parameter(typeof(object), "formatter"); | |||
ParameterExpression param1 = Expression.Parameter(typeof(JT808MessagePackReader).MakeByRefType(), "reader"); | |||
ParameterExpression param2 = Expression.Parameter(typeof(IJT808Config), "config"); | |||
var deserializeMethodInfo = type.GetRuntimeMethod("Deserialize", new[] { typeof(JT808MessagePackReader).MakeByRefType(), typeof(IJT808Config) }); | |||
var body = Expression.Call( | |||
Expression.Convert(param0, type), | |||
deserializeMethodInfo, | |||
param1, | |||
param2 | |||
); | |||
var lambda = Expression.Lambda<JT808DeserializeMethod>(body, param0, param1, param2).Compile(); | |||
formatterAndDelegate = (objFormatter, lambda); | |||
} | |||
jT808Deserializes.TryAdd(t, formatterAndDelegate); | |||
} | |||
return formatterAndDelegate.DeserializeMethod(formatterAndDelegate.Value,ref reader, config); | |||
} | |||
} | |||
} |
@@ -0,0 +1,81 @@ | |||
using JT808.Protocol.Formatters; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Linq.Expressions; | |||
using System.Reflection; | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Extensions | |||
{ | |||
/// <summary> | |||
/// | |||
/// ref http://adamsitnik.com/Span/#span-must-not-be-a-generic-type-argument | |||
/// ref http://adamsitnik.com/Span/ | |||
/// ref:MessagePack.Formatters.DynamicObjectTypeFallbackFormatter | |||
/// </summary> | |||
public static class JT808MessagePackFormatterResolverExtensions | |||
{ | |||
delegate void JT808SerializeMethod(object dynamicFormatter, ref JT808MessagePackWriter writer,object value, IJT808Config config); | |||
delegate dynamic JT808DeserializeMethod(object dynamicFormatter, ref JT808MessagePackReader reader, IJT808Config config); | |||
static readonly ConcurrentDictionary<Type, (object Value, JT808SerializeMethod SerializeMethod)> jT808Serializers = new ConcurrentDictionary<Type, (object Value, JT808SerializeMethod SerializeMethod)>(); | |||
static readonly ConcurrentDictionary<Type, (object Value, JT808DeserializeMethod DeserializeMethod)> jT808Deserializes = new ConcurrentDictionary<Type, (object Value, JT808DeserializeMethod DeserializeMethod)>(); | |||
public static void JT808DynamicSerialize(object objFormatter, ref JT808MessagePackWriter writer, object value, IJT808Config config) | |||
{ | |||
Type type = value.GetType(); | |||
var ti = type.GetTypeInfo(); | |||
// (object Value, JT808SerializeMethod SerializeMethod) formatterAndDelegate; | |||
if (!jT808Serializers.TryGetValue(type, out var formatterAndDelegate)) | |||
{ | |||
var t = type; | |||
{ | |||
var formatterType = typeof(IJT808MessagePackFormatter<>).MakeGenericType(t); | |||
var param0 = Expression.Parameter(typeof(object), "formatter"); | |||
var param1 = Expression.Parameter(typeof(JT808MessagePackWriter).MakeByRefType(), "writer"); | |||
var param2 = Expression.Parameter(typeof(object), "value"); | |||
var param3 = Expression.Parameter(typeof(IJT808Config), "config"); | |||
var serializeMethodInfo = formatterType.GetRuntimeMethod("Serialize", new[] { typeof(JT808MessagePackWriter).MakeByRefType(), t, typeof(IJT808Config) }); | |||
var body = Expression.Call( | |||
Expression.Convert(param0, formatterType), | |||
serializeMethodInfo, | |||
param1, | |||
ti.IsValueType ? Expression.Unbox(param2, t) : Expression.Convert(param2, t), | |||
param3); | |||
var lambda = Expression.Lambda<JT808SerializeMethod>(body, param0, param1, param2, param3).Compile(); | |||
formatterAndDelegate = (objFormatter, lambda); | |||
} | |||
jT808Serializers.TryAdd(t, formatterAndDelegate); | |||
} | |||
formatterAndDelegate.SerializeMethod(formatterAndDelegate.Value, ref writer, value, config); | |||
} | |||
public static dynamic JT808DynamicDeserialize(object objFormatter, ref JT808MessagePackReader reader, IJT808Config config) | |||
{ | |||
var type = objFormatter.GetType(); | |||
// (object Value, JT808DeserializeMethod DeserializeMethod) formatterAndDelegate; | |||
if (!jT808Deserializes.TryGetValue(type, out var formatterAndDelegate)) | |||
{ | |||
var t = type; | |||
{ | |||
var formatterType = typeof(IJT808MessagePackFormatter<>).MakeGenericType(t); | |||
ParameterExpression param0 = Expression.Parameter(typeof(object), "formatter"); | |||
ParameterExpression param1 = Expression.Parameter(typeof(JT808MessagePackReader).MakeByRefType(), "reader"); | |||
ParameterExpression param2 = Expression.Parameter(typeof(IJT808Config), "config"); | |||
var deserializeMethodInfo = type.GetRuntimeMethod("Deserialize", new[] { typeof(JT808MessagePackReader).MakeByRefType(), typeof(IJT808Config) }); | |||
var body = Expression.Call( | |||
Expression.Convert(param0, type), | |||
deserializeMethodInfo, | |||
param1, | |||
param2 | |||
); | |||
var lambda = Expression.Lambda<JT808DeserializeMethod>(body, param0, param1, param2).Compile(); | |||
formatterAndDelegate = (objFormatter, lambda); | |||
} | |||
jT808Deserializes.TryAdd(t, formatterAndDelegate); | |||
} | |||
return formatterAndDelegate.DeserializeMethod(formatterAndDelegate.Value,ref reader, config); | |||
} | |||
} | |||
} |
@@ -4,14 +4,6 @@ using JT808.Protocol.MessagePack; | |||
namespace JT808.Protocol.Formatters | |||
{ | |||
[Obsolete("使用IJT808MessagePackFormatter")] | |||
public interface IJT808Formatter<T>: IJT808Formatter | |||
{ | |||
T Deserialize(ReadOnlySpan<byte> bytes, out int readSize, IJT808Config config); | |||
int Serialize(ref byte[] bytes, int offset, T value, IJT808Config config); | |||
} | |||
public interface IJT808MessagePackFormatter<T> : IJT808Formatter | |||
{ | |||
void Serialize(ref JT808MessagePackWriter writer, T value, IJT808Config config); |
@@ -17,7 +17,7 @@ namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
for (int i = 0; i < jT808_0x0104.AnswerParamsCount; i++) | |||
{ | |||
var paramId = reader.ReadVirtualUInt32();//参数ID | |||
if (JT808_0x8103_BodyBase.JT808_0x8103Method.TryGetValue(paramId, out Type type)) | |||
if (config.JT808_0X8103_Factory.ParamMethods.TryGetValue(paramId, out Type type)) | |||
{ | |||
if (jT808_0x0104.ParamList != null) | |||
{ | |||
@@ -41,7 +41,7 @@ namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
ReadOnlySpan<byte> attachSpan= reader.GetVirtualReadOnlySpan(2); | |||
byte attachId = attachSpan[0]; | |||
byte attachLen = attachSpan[1]; | |||
if (JT808_0x0200_BodyBase.JT808LocationAttachMethod.TryGetValue(attachId, out Type jT808LocationAttachType)) | |||
if (config.JT808_0X0200_Factory.JT808LocationAttachMethod.TryGetValue(attachId, out Type jT808LocationAttachType)) | |||
{ | |||
object attachImplObj = config.GetMessagePackFormatterByType(jT808LocationAttachType); | |||
dynamic attachImpl = JT808MessagePackFormatterResolverExtensions.JT808DynamicDeserialize(attachImplObj,ref reader, config); | |||
@@ -22,7 +22,7 @@ namespace JT808.Protocol.Formatters.MessageBodyFormatters | |||
for (int i = 0; i < paramCount; i++) | |||
{ | |||
var paramId = reader.ReadVirtualUInt32();//参数ID | |||
if (JT808_0x8103_BodyBase.JT808_0x8103Method.TryGetValue(paramId, out Type type)) | |||
if (config.JT808_0X8103_Factory.ParamMethods.TryGetValue(paramId, out Type type)) | |||
{ | |||
object attachImplObj = config.GetMessagePackFormatterByType(type); | |||
dynamic attachImpl = JT808MessagePackFormatterResolverExtensions.JT808DynamicDeserialize(attachImplObj, ref reader, config); | |||
@@ -19,7 +19,9 @@ namespace JT808.Protocol.Interfaces | |||
Encoding = Encoding.GetEncoding("GBK"); | |||
FormatterFactory = new JT808FormatterFactory(); | |||
JT808_0X0200_Custom_Factory = new JT808_0x0200_Custom_Factory(); | |||
JT808_0X0200_Factory = new JT808_0x0200_Factory(); | |||
JT808_0X8103_Custom_Factory = new JT808_0x8103_Custom_Factory(); | |||
JT808_0X8103_Factory = new JT808_0x8103_Factory(); | |||
TerminalPhoneNoLength = 12; | |||
} | |||
public abstract string ConfigId { get; } | |||
@@ -31,7 +33,9 @@ namespace JT808.Protocol.Interfaces | |||
public virtual bool SkipCRCCode { get; set; } | |||
public virtual IJT808FormatterFactory FormatterFactory { get; set; } | |||
public virtual IJT808_0x0200_Custom_Factory JT808_0X0200_Custom_Factory { get; set; } | |||
public virtual IJT808_0x0200_Factory JT808_0X0200_Factory { get; set; } | |||
public virtual IJT808_0x8103_Custom_Factory JT808_0X8103_Custom_Factory { get; set; } | |||
public virtual IJT808_0x8103_Factory JT808_0X8103_Factory { get; set; } | |||
public virtual int TerminalPhoneNoLength { get; set; } | |||
public virtual IJT808Config Register(params Assembly[] externalAssemblies) | |||
{ | |||
@@ -36,10 +36,18 @@ namespace JT808.Protocol.Interfaces | |||
/// </summary> | |||
IJT808_0x0200_Custom_Factory JT808_0X0200_Custom_Factory { get; set; } | |||
/// <summary> | |||
/// 附加信息工厂 | |||
/// </summary> | |||
IJT808_0x0200_Factory JT808_0X0200_Factory { get; set; } | |||
/// <summary> | |||
///自定义设置终端参数工厂 | |||
/// </summary> | |||
IJT808_0x8103_Custom_Factory JT808_0X8103_Custom_Factory { get; set; } | |||
/// <summary> | |||
///设置终端参数工厂 | |||
/// </summary> | |||
IJT808_0x8103_Factory JT808_0X8103_Factory { get; set; } | |||
/// <summary> | |||
/// 统一编码 | |||
/// </summary> | |||
Encoding Encoding { get; set; } | |||
@@ -4,7 +4,7 @@ using System.Text; | |||
namespace JT808.Protocol.Interfaces | |||
{ | |||
public interface IJT808_0x0200_Custom_Factory: IJT808ExternalRegister | |||
public interface IJT808_0x0200_Custom_Factory: IJT808ExternalRegister | |||
{ | |||
HashSet<byte> AttachIds { get; } | |||
} | |||
@@ -0,0 +1,12 @@ | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT808.Protocol.Interfaces | |||
{ | |||
public interface IJT808_0x0200_Factory | |||
{ | |||
ConcurrentDictionary<byte, Type> JT808LocationAttachMethod { get; set; } | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT808.Protocol.Interfaces | |||
{ | |||
public interface IJT808_0x8103_Factory | |||
{ | |||
ConcurrentDictionary<uint, Type> ParamMethods { get; set; } | |||
} | |||
} |
@@ -0,0 +1,31 @@ | |||
using JT808.Protocol.Interfaces; | |||
using JT808.Protocol.MessageBody; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace JT808.Protocol.Internal | |||
{ | |||
class JT808_0x0200_Factory : IJT808_0x0200_Factory | |||
{ | |||
public ConcurrentDictionary<byte, Type> JT808LocationAttachMethod { get ; set; } | |||
public JT808_0x0200_Factory() | |||
{ | |||
JT808LocationAttachMethod = new ConcurrentDictionary<byte, Type>(); | |||
JT808LocationAttachMethod.TryAdd(JT808Constants.JT808_0x0200_0x01, typeof(JT808_0x0200_0x01)); | |||
JT808LocationAttachMethod.TryAdd(JT808Constants.JT808_0x0200_0x02, typeof(JT808_0x0200_0x02)); | |||
JT808LocationAttachMethod.TryAdd(JT808Constants.JT808_0x0200_0x03, typeof(JT808_0x0200_0x03)); | |||
JT808LocationAttachMethod.TryAdd(JT808Constants.JT808_0x0200_0x04, typeof(JT808_0x0200_0x04)); | |||
JT808LocationAttachMethod.TryAdd(JT808Constants.JT808_0x0200_0x11, typeof(JT808_0x0200_0x11)); | |||
JT808LocationAttachMethod.TryAdd(JT808Constants.JT808_0x0200_0x12, typeof(JT808_0x0200_0x12)); | |||
JT808LocationAttachMethod.TryAdd(JT808Constants.JT808_0x0200_0x13, typeof(JT808_0x0200_0x13)); | |||
JT808LocationAttachMethod.TryAdd(JT808Constants.JT808_0x0200_0x25, typeof(JT808_0x0200_0x25)); | |||
JT808LocationAttachMethod.TryAdd(JT808Constants.JT808_0x0200_0x2A, typeof(JT808_0x0200_0x2A)); | |||
JT808LocationAttachMethod.TryAdd(JT808Constants.JT808_0x0200_0x2B, typeof(JT808_0x0200_0x2B)); | |||
JT808LocationAttachMethod.TryAdd(JT808Constants.JT808_0x0200_0x30, typeof(JT808_0x0200_0x30)); | |||
JT808LocationAttachMethod.TryAdd(JT808Constants.JT808_0x0200_0x31, typeof(JT808_0x0200_0x31)); | |||
} | |||
} | |||
} |
@@ -0,0 +1,101 @@ | |||
using JT808.Protocol.MessageBody; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Reflection; | |||
using System.Text; | |||
namespace JT808.Protocol.Interfaces | |||
{ | |||
class JT808_0x8103_Factory : IJT808_0x8103_Factory | |||
{ | |||
public JT808_0x8103_Factory() | |||
{ | |||
ParamMethods = new ConcurrentDictionary<uint, Type>(); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0001, typeof(JT808_0x8103_0x0001)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0002, typeof(JT808_0x8103_0x0002)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0003, typeof(JT808_0x8103_0x0003)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0004, typeof(JT808_0x8103_0x0004)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0005, typeof(JT808_0x8103_0x0005)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0006, typeof(JT808_0x8103_0x0006)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0007, typeof(JT808_0x8103_0x0007)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0010, typeof(JT808_0x8103_0x0010)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0011, typeof(JT808_0x8103_0x0011)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0012, typeof(JT808_0x8103_0x0012)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0013, typeof(JT808_0x8103_0x0013)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0014, typeof(JT808_0x8103_0x0014)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0015, typeof(JT808_0x8103_0x0015)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0016, typeof(JT808_0x8103_0x0016)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0017, typeof(JT808_0x8103_0x0017)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0018, typeof(JT808_0x8103_0x0018)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0019, typeof(JT808_0x8103_0x0019)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x001A, typeof(JT808_0x8103_0x001A)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x001B, typeof(JT808_0x8103_0x001B)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x001C, typeof(JT808_0x8103_0x001C)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x001D, typeof(JT808_0x8103_0x001D)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0020, typeof(JT808_0x8103_0x0020)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0021, typeof(JT808_0x8103_0x0021)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0022, typeof(JT808_0x8103_0x0022)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0027, typeof(JT808_0x8103_0x0027)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0028, typeof(JT808_0x8103_0x0028)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0029, typeof(JT808_0x8103_0x0029)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x002C, typeof(JT808_0x8103_0x002C)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x002D, typeof(JT808_0x8103_0x002D)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x002E, typeof(JT808_0x8103_0x002E)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x002F, typeof(JT808_0x8103_0x002F)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0030, typeof(JT808_0x8103_0x0030)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0031, typeof(JT808_0x8103_0x0031)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0040, typeof(JT808_0x8103_0x0040)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0041, typeof(JT808_0x8103_0x0041)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0042, typeof(JT808_0x8103_0x0042)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0043, typeof(JT808_0x8103_0x0043)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0044, typeof(JT808_0x8103_0x0044)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0045, typeof(JT808_0x8103_0x0045)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0046, typeof(JT808_0x8103_0x0046)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0047, typeof(JT808_0x8103_0x0047)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0048, typeof(JT808_0x8103_0x0048)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0049, typeof(JT808_0x8103_0x0049)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0050, typeof(JT808_0x8103_0x0050)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0051, typeof(JT808_0x8103_0x0051)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0052, typeof(JT808_0x8103_0x0052)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0053, typeof(JT808_0x8103_0x0053)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0054, typeof(JT808_0x8103_0x0054)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0055, typeof(JT808_0x8103_0x0055)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0056, typeof(JT808_0x8103_0x0056)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0057, typeof(JT808_0x8103_0x0057)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0058, typeof(JT808_0x8103_0x0058)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0059, typeof(JT808_0x8103_0x0059)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x005A, typeof(JT808_0x8103_0x005A)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x005B, typeof(JT808_0x8103_0x005B)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x005C, typeof(JT808_0x8103_0x005C)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x005D, typeof(JT808_0x8103_0x005D)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x005E, typeof(JT808_0x8103_0x005E)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0064, typeof(JT808_0x8103_0x0064)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0065, typeof(JT808_0x8103_0x0065)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0070, typeof(JT808_0x8103_0x0070)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0071, typeof(JT808_0x8103_0x0081)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0072, typeof(JT808_0x8103_0x0072)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0073, typeof(JT808_0x8103_0x0073)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0074, typeof(JT808_0x8103_0x0074)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0080, typeof(JT808_0x8103_0x0080)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0081, typeof(JT808_0x8103_0x0081)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0082, typeof(JT808_0x8103_0x0082)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0083, typeof(JT808_0x8103_0x0083)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0084, typeof(JT808_0x8103_0x0084)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0090, typeof(JT808_0x8103_0x0090)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0091, typeof(JT808_0x8103_0x0091)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0092, typeof(JT808_0x8103_0x0092)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0093, typeof(JT808_0x8103_0x0093)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0094, typeof(JT808_0x8103_0x0094)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0095, typeof(JT808_0x8103_0x0095)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0100, typeof(JT808_0x8103_0x0100)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0101, typeof(JT808_0x8103_0x0101)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0102, typeof(JT808_0x8103_0x0102)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0103, typeof(JT808_0x8103_0x0103)); | |||
ParamMethods.TryAdd(JT808Constants.JT808_0x8103_0x0110, typeof(JT808_0x8103_0x0110)); | |||
} | |||
public ConcurrentDictionary<uint, Type> ParamMethods { get; set; } | |||
} | |||
} |
@@ -8,13 +8,14 @@ | |||
<Product>JT808</Product> | |||
<Description>JT808协议、GB808协议、道路运输车辆卫星定位系统-北斗兼容车载终端通讯协议</Description> | |||
<PackageReleaseNotes>JT808协议、GB808协议、道路运输车辆卫星定位系统-北斗兼容车载终端通讯协议</PackageReleaseNotes> | |||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance> | |||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> | |||
<RepositoryUrl>https://github.com/SmallChi/JT808</RepositoryUrl> | |||
<PackageProjectUrl>https://github.com/SmallChi/JT808</PackageProjectUrl> | |||
<licenseUrl>https://github.com/SmallChi/JT808/blob/master/LICENSE</licenseUrl> | |||
<license>https://github.com/SmallChi/JT808/blob/master/LICENSE</license> | |||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | |||
<Version>2.1.0</Version> | |||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild> | |||
<Version>2.1.1</Version> | |||
<PackageLicenseFile>LICENSE</PackageLicenseFile> | |||
</PropertyGroup> | |||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | |||
<DocumentationFile>bin\Release\netstandard2.0\JT808.Protocol.xml</DocumentationFile> | |||
@@ -27,6 +28,10 @@ | |||
<Compile Remove="Metadata\JT808LocationAttachProperties\**" /> | |||
<EmbeddedResource Remove="Metadata\JT808LocationAttachProperties\**" /> | |||
<None Remove="Metadata\JT808LocationAttachProperties\**" /> | |||
<None Include="..\..\LICENSE"> | |||
<Pack>True</Pack> | |||
<PackagePath></PackagePath> | |||
</None> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -17,5 +17,371 @@ namespace JT808.Protocol | |||
public const int DateLimitYear = 2000; | |||
public static readonly DateTime UTCBaseTime = new DateTime(1970, 1, 1); | |||
public static Encoding Encoding { get;} | |||
public const byte JT808_0x0200_0x01 = 0x01; | |||
public const byte JT808_0x0200_0x02 = 0x02; | |||
public const byte JT808_0x0200_0x03 = 0x03; | |||
public const byte JT808_0x0200_0x04 = 0x04; | |||
public const byte JT808_0x0200_0x11 = 0x11; | |||
public const byte JT808_0x0200_0x12 = 0x12; | |||
public const byte JT808_0x0200_0x13 = 0x13; | |||
public const byte JT808_0x0200_0x25 = 0x25; | |||
public const byte JT808_0x0200_0x2A = 0x2A; | |||
public const byte JT808_0x0200_0x2B = 0x2B; | |||
public const byte JT808_0x0200_0x30 = 0x30; | |||
public const byte JT808_0x0200_0x31 = 0x31; | |||
/// <summary> | |||
/// 终端心跳发送间隔,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0001 = 0x0001; | |||
/// <summary> | |||
/// TCP 消息应答超时时间,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0002 = 0x0002; | |||
/// <summary> | |||
/// TCP 消息重传次数 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0003 = 0x0003; | |||
/// <summary> | |||
/// UDP 消息应答超时时间,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0004 = 0x0004; | |||
/// <summary> | |||
/// UDP 消息重传次数 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0005 = 0x0005; | |||
/// <summary> | |||
/// SMS 消息应答超时时间,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0006 = 0x0006; | |||
/// <summary> | |||
/// SMS 消息重传次数 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0007 = 0x0007; | |||
/// <summary> | |||
/// 主服务器 APN,无线通信拨号访问点。若网络制式为 CDMA,则该处为PPP 拨号号码 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0010 = 0x0010; | |||
/// <summary> | |||
/// 主服务器无线通信拨号用户名 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0011 = 0x0011; | |||
/// <summary> | |||
/// 主服务器无线通信拨号密码 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0012 = 0x0012; | |||
/// <summary> | |||
/// 主服务器地址,IP 或域名 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0013 = 0x0013; | |||
/// <summary> | |||
/// 主服务器地址,IP 或域名 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0014 = 0x0014; | |||
/// <summary> | |||
/// 备份服务器无线通信拨号用户名 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0015 = 0x0015; | |||
/// <summary> | |||
/// 备份服务器无线通信拨号密码 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0016 = 0x0016; | |||
/// <summary> | |||
/// 备份服务器地址,IP 或域名 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0017 = 0x0017; | |||
/// <summary> | |||
/// 服务器 TCP 端口 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0018 = 0x0018; | |||
/// <summary> | |||
/// 服务器 UDP 端口 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0019 = 0x0019; | |||
/// <summary> | |||
/// 道路运输证 IC 卡认证主服务器 IP 地址或域名 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x001A = 0x001A; | |||
/// <summary> | |||
/// 道路运输证 IC 卡认证主服务器 TCP 端口 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x001B = 0x001B; | |||
/// <summary> | |||
/// 道路运输证 IC 卡认证主服务器 UDP 端口 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x001C = 0x001C; | |||
/// <summary> | |||
/// 道路运输证 IC 卡认证备份服务器 IP 地址或域名,端口同主服务器 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x001D = 0x001D; | |||
/// <summary> | |||
/// 位置汇报策略,0:定时汇报;1:定距汇报;2:定时和定距汇报 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0020 = 0x0020; | |||
/// <summary> | |||
/// 位置汇报方案,0:根据 ACC 状态; 1:根据登录状态和 ACC 状态,先判断登录状态,若登录再根据 ACC 状态 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0021 = 0x0021; | |||
/// <summary> | |||
/// 驾驶员未登录汇报时间间隔,单位为秒(s),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0022 = 0x0022; | |||
/// <summary> | |||
/// 休眠时汇报时间间隔,单位为秒(s),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0027 = 0x0027; | |||
/// <summary> | |||
/// 紧急报警时汇报时间间隔,单位为秒(s),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0028 = 0x0028; | |||
/// <summary> | |||
/// 缺省时间汇报间隔,单位为秒(s),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0029 = 0x0029; | |||
/// <summary> | |||
/// 缺省距离汇报间隔,单位为米(m),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x002C = 0x002C; | |||
/// <summary> | |||
/// 驾驶员未登录汇报距离间隔,单位为米(m),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x002D = 0x002D; | |||
/// <summary> | |||
/// 休眠时汇报距离间隔,单位为米(m),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x002E = 0x002E; | |||
/// <summary> | |||
/// 紧急报警时汇报距离间隔,单位为米(m),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x002F = 0x002F; | |||
/// <summary> | |||
/// 拐点补传角度,<180 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0030 = 0x0030; | |||
/// <summary> | |||
/// 电子围栏半径(非法位移阈值),单位为米 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0031 = 0x0031; | |||
/// <summary> | |||
/// 监控平台电话号码 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0040 = 0x0040; | |||
/// <summary> | |||
/// 复位电话号码,可采用此电话号码拨打终端电话让终端复位 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0041 = 0x0041; | |||
/// <summary> | |||
/// 恢复出厂设置电话号码,可采用此电话号码拨打终端电话让终端恢复出厂设置 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0042 = 0x0042; | |||
/// <summary> | |||
/// 监控平台 SMS 电话号码 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0043 = 0x0043; | |||
/// <summary> | |||
/// 接收终端 SMS 文本报警号码 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0044 = 0x0044; | |||
/// <summary> | |||
/// 终端电话接听策略,0:自动接听;1:ACC ON 时自动接听,OFF 时手动接听 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0045 = 0x0045; | |||
/// <summary> | |||
/// 每次最长通话时间,单位为秒(s),0 为不允许通话,0xFFFFFFFF 为不限制 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0046 = 0x0046; | |||
/// <summary> | |||
/// 当月最长通话时间,单位为秒(s),0 为不允许通话,0xFFFFFFFF 为不限制 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0047 = 0x0047; | |||
/// <summary> | |||
/// 监听电话号码 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0048 = 0x0048; | |||
/// <summary> | |||
/// 监管平台特权短信号码 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0049 = 0x0049; | |||
/// <summary> | |||
/// 报警屏蔽字,与位置信息汇报消息中的报警标志相对应,相应位为 1则相应报警被屏蔽 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0050 = 0x0050; | |||
/// <summary> | |||
/// 报警发送文本 SMS 开关,与位置信息汇报消息中的报警标志相对应,相应位为 1 则相应报警时发送文本 SMS | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0051 = 0x0051; | |||
/// <summary> | |||
/// 报警拍摄开关,与位置信息汇报消息中的报警标志相对应,相应位为1 则相应报警时摄像头拍摄 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0052 = 0x0052; | |||
/// <summary> | |||
/// 报警拍摄存储标志,与位置信息汇报消息中的报警标志相对应,相应位为 1 则对相应报警时拍的照片进行存储,否则实时上传 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0053 = 0x0053; | |||
/// <summary> | |||
/// 关键标志,与位置信息汇报消息中的报警标志相对应,相应位为 1 则对相应报警为关键报警 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0054 = 0x0054; | |||
/// <summary> | |||
/// 最高速度,单位为公里每小时(km/h) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0055 = 0x0055; | |||
/// <summary> | |||
/// 超速持续时间,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0056 = 0x0056; | |||
/// <summary> | |||
/// 连续驾驶时间门限,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0057 = 0x0057; | |||
/// <summary> | |||
/// 当天累计驾驶时间门限,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0058 = 0x0058; | |||
/// <summary> | |||
/// 最小休息时间,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0059 = 0x0059; | |||
/// <summary> | |||
/// 最长停车时间,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x005A = 0x005A; | |||
/// <summary> | |||
/// 超速报警预警差值,单位为 1/10Km/h | |||
/// </summary> | |||
public const uint JT808_0x8103_0x005B = 0x005B; | |||
/// <summary> | |||
/// 疲劳驾驶预警差值,单位为秒(s),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x005C = 0x005C; | |||
/// <summary> | |||
/// 碰撞报警参数设置 | |||
/// b7-b0: 碰撞时间,单位 4ms; | |||
/// b15-b8:碰撞加速度,单位 0.1g,设置范围在:0-79 之间,默认为10。 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x005D = 0x005D; | |||
/// <summary> | |||
/// 侧翻报警参数设置: | |||
/// 侧翻角度,单位 1 度,默认为 30 度 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x005E = 0x005E; | |||
/// <summary> | |||
/// 定时拍照控制,见 表 13 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0064 = 0x0064; | |||
/// <summary> | |||
/// 定距拍照控制,见 表 14 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0065 = 0x0065; | |||
/// <summary> | |||
/// 图像/视频质量,1-10,1 最好 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0070 = 0x0070; | |||
/// <summary> | |||
/// 亮度,0-255 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0071 = 0x0071; | |||
/// <summary> | |||
/// 对比度,0-127 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0072 = 0x0072; | |||
/// <summary> | |||
/// 饱和度,0-127 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0073 = 0x0073; | |||
/// <summary> | |||
/// 色度,0-255 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0074 = 0x0074; | |||
/// <summary> | |||
/// 车辆里程表读数,1/10km | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0080 = 0x0080; | |||
/// <summary> | |||
/// 车辆所在的省域 ID | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0081 = 0x0081; | |||
/// <summary> | |||
/// 车辆所在的市域 ID | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0082 = 0x0082; | |||
/// <summary> | |||
/// 公安交通管理部门颁发的机动车号牌 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0083 = 0x0083; | |||
/// <summary> | |||
/// 车牌颜色,按照 JT/T415-2006 的 5.4.12 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0084 = 0x0084; | |||
/// <summary> | |||
/// GNSS 定位模式,定义如下: | |||
/// bit0,0:禁用 GPS 定位, 1:启用 GPS 定位; | |||
/// bit1,0:禁用北斗定位, 1:启用北斗定位; | |||
/// bit2,0:禁用 GLONASS 定位, 1:启用 GLONASS 定位; | |||
/// bit3,0:禁用 Galileo 定位, 1:启用 Galileo 定位。 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0090 = 0x0090; | |||
/// <summary> | |||
/// GNSS 波特率,定义如下: | |||
/// 0x00:4800;0x01:9600; | |||
/// 0x02:19200;0x03:38400; | |||
/// 0x04:57600;0x05:115200。 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0091 = 0x0091; | |||
/// <summary> | |||
/// GNSS 模块详细定位数据输出频率,定义如下: | |||
/// 0x00:500ms;0x01:1000ms(默认值); | |||
/// 0x02:2000ms;0x03:3000ms; | |||
/// 0x04:4000ms。 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0092 = 0x0092; | |||
/// <summary> | |||
/// GNSS 模块详细定位数据采集频率,单位为秒,默认为 1。 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0093 = 0x0093; | |||
/// <summary> | |||
/// GNSS 模块详细定位数据上传方式 | |||
/// 0x00,本地存储,不上传(默认值); | |||
/// 0x01,按时间间隔上传; | |||
/// 0x02,按距离间隔上传; | |||
/// 0x0B,按累计时间上传,达到传输时间后自动停止上传; | |||
/// 0x0C,按累计距离上传,达到距离后自动停止上传; | |||
/// 0x0D,按累计条数上传,达到上传条数后自动停止上传。 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0094 = 0x0094; | |||
/// <summary> | |||
/// GNSS 模块详细定位数据上传设置: | |||
/// 上传方式为 0x01 时,单位为秒; | |||
/// 上传方式为 0x02 时,单位为米; | |||
/// 上传方式为 0x0B 时,单位为秒; | |||
/// 上传方式为 0x0C 时,单位为米; | |||
/// 上传方式为 0x0D 时,单位为条。 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0095 = 0x0095; | |||
/// <summary> | |||
/// CAN 总线通道 1 采集时间间隔(ms),0 表示不采集 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0100 = 0x0100; | |||
/// <summary> | |||
/// CAN 总线通道 1 上传时间间隔(s),0 表示不上传 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0101 = 0x0101; | |||
/// <summary> | |||
/// CAN 总线通道 2 采集时间间隔(ms),0 表示不采集 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0102 = 0x0102; | |||
/// <summary> | |||
/// CAN 总线通道 2 上传时间间隔(s),0 表示不上传 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0103 = 0x0103; | |||
/// <summary> | |||
/// CAN 总线 ID 单独采集设置: | |||
/// bit63-bit32 表示此 ID 采集时间间隔(ms),0 表示不采集; | |||
/// bit31 表示 CAN 通道号,0:CAN1,1:CAN2; | |||
/// bit30 表示帧类型,0:标准帧,1:扩展帧; | |||
/// bit29 表示数据采集方式,0:原始数据,1:采集区间的计算值; | |||
/// bit28-bit0 表示 CAN 总线 ID。 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0110 = 0x0110; | |||
} | |||
} |
@@ -9,46 +9,6 @@ namespace JT808.Protocol.MessageBody | |||
/// </summary> | |||
public abstract class JT808_0x0200_BodyBase | |||
{ | |||
/// <summary> | |||
/// 位置附加信息方法 | |||
/// </summary> | |||
internal static IDictionary<byte, Type> JT808LocationAttachMethod { get; private set; } | |||
static JT808_0x0200_BodyBase() | |||
{ | |||
InitJT808LocationAttachMethod(); | |||
} | |||
private static void InitJT808LocationAttachMethod() | |||
{ | |||
JT808LocationAttachMethod = new Dictionary<byte, Type> | |||
{ | |||
{AttachId0x01, typeof(JT808_0x0200_0x01)}, | |||
{AttachId0x02, typeof(JT808_0x0200_0x02)}, | |||
{AttachId0x03, typeof(JT808_0x0200_0x03)}, | |||
{AttachId0x04, typeof(JT808_0x0200_0x04)}, | |||
{AttachId0x11, typeof(JT808_0x0200_0x11)}, | |||
{AttachId0x12, typeof(JT808_0x0200_0x12)}, | |||
{AttachId0x13, typeof(JT808_0x0200_0x13)}, | |||
{AttachId0x25, typeof(JT808_0x0200_0x25)}, | |||
{AttachId0x2A, typeof(JT808_0x0200_0x2A)}, | |||
{AttachId0x2B, typeof(JT808_0x0200_0x2B)}, | |||
{AttachId0x30, typeof(JT808_0x0200_0x30)}, | |||
{AttachId0x31, typeof(JT808_0x0200_0x31)}, | |||
}; | |||
} | |||
internal static void AddJT808LocationAttachMethod<TJT808LocationAttach>(byte attachInfoId) | |||
where TJT808LocationAttach : JT808_0x0200_BodyBase | |||
{ | |||
JT808LocationAttachMethod.Add(attachInfoId, typeof(TJT808LocationAttach)); | |||
} | |||
internal static void AddJT808LocationAttachMethod(byte attachInfoId, Type type) | |||
{ | |||
JT808LocationAttachMethod.Add(attachInfoId, type); | |||
} | |||
/// <summary> | |||
/// 附加信息Id | |||
/// </summary> | |||
@@ -58,18 +18,5 @@ namespace JT808.Protocol.MessageBody | |||
/// 附加信息长度 | |||
/// </summary> | |||
public abstract byte AttachInfoLength { get; set; } | |||
public const byte AttachId0x01 = 0x01; | |||
public const byte AttachId0x02 = 0x02; | |||
public const byte AttachId0x03 = 0x03; | |||
public const byte AttachId0x04 = 0x04; | |||
public const byte AttachId0x11 = 0x11; | |||
public const byte AttachId0x12 = 0x12; | |||
public const byte AttachId0x13 = 0x13; | |||
public const byte AttachId0x25 = 0x25; | |||
public const byte AttachId0x2A = 0x2A; | |||
public const byte AttachId0x2B = 0x2B; | |||
public const byte AttachId0x30 = 0x30; | |||
public const byte AttachId0x31 = 0x31; | |||
} | |||
} |
@@ -5,361 +5,6 @@ namespace JT808.Protocol.MessageBody | |||
{ | |||
public abstract class JT808_0x8103_BodyBase | |||
{ | |||
/// <summary> | |||
/// 终端心跳发送间隔,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0001_Type = 0x0001; | |||
/// <summary> | |||
/// TCP 消息应答超时时间,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0002_Type = 0x0002; | |||
/// <summary> | |||
/// TCP 消息重传次数 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0003_Type = 0x0003; | |||
/// <summary> | |||
/// UDP 消息应答超时时间,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0004_Type = 0x0004; | |||
/// <summary> | |||
/// UDP 消息重传次数 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0005_Type = 0x0005; | |||
/// <summary> | |||
/// SMS 消息应答超时时间,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0006_Type = 0x0006; | |||
/// <summary> | |||
/// SMS 消息重传次数 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0007_Type = 0x0007; | |||
/// <summary> | |||
/// 主服务器 APN,无线通信拨号访问点。若网络制式为 CDMA,则该处为PPP 拨号号码 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0010_Type = 0x0010; | |||
/// <summary> | |||
/// 主服务器无线通信拨号用户名 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0011_Type = 0x0011; | |||
/// <summary> | |||
/// 主服务器无线通信拨号密码 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0012_Type = 0x0012; | |||
/// <summary> | |||
/// 主服务器地址,IP 或域名 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0013_Type = 0x0013; | |||
/// <summary> | |||
/// 主服务器地址,IP 或域名 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0014_Type = 0x0014; | |||
/// <summary> | |||
/// 备份服务器无线通信拨号用户名 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0015_Type = 0x0015; | |||
/// <summary> | |||
/// 备份服务器无线通信拨号密码 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0016_Type = 0x0016; | |||
/// <summary> | |||
/// 备份服务器地址,IP 或域名 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0017_Type = 0x0017; | |||
/// <summary> | |||
/// 服务器 TCP 端口 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0018_Type = 0x0018; | |||
/// <summary> | |||
/// 服务器 UDP 端口 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0019_Type = 0x0019; | |||
/// <summary> | |||
/// 道路运输证 IC 卡认证主服务器 IP 地址或域名 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x001A_Type = 0x001A; | |||
/// <summary> | |||
/// 道路运输证 IC 卡认证主服务器 TCP 端口 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x001B_Type = 0x001B; | |||
/// <summary> | |||
/// 道路运输证 IC 卡认证主服务器 UDP 端口 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x001C_Type = 0x001C; | |||
/// <summary> | |||
/// 道路运输证 IC 卡认证备份服务器 IP 地址或域名,端口同主服务器 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x001D_Type = 0x001D; | |||
/// <summary> | |||
/// 位置汇报策略,0:定时汇报;1:定距汇报;2:定时和定距汇报 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0020_Type = 0x0020; | |||
/// <summary> | |||
/// 位置汇报方案,0:根据 ACC 状态; 1:根据登录状态和 ACC 状态,先判断登录状态,若登录再根据 ACC 状态 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0021_Type = 0x0021; | |||
/// <summary> | |||
/// 驾驶员未登录汇报时间间隔,单位为秒(s),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0022_Type = 0x0022; | |||
/// <summary> | |||
/// 休眠时汇报时间间隔,单位为秒(s),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0027_Type = 0x0027; | |||
/// <summary> | |||
/// 紧急报警时汇报时间间隔,单位为秒(s),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0028_Type = 0x0028; | |||
/// <summary> | |||
/// 缺省时间汇报间隔,单位为秒(s),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0029_Type = 0x0029; | |||
/// <summary> | |||
/// 缺省距离汇报间隔,单位为米(m),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x002C_Type = 0x002C; | |||
/// <summary> | |||
/// 驾驶员未登录汇报距离间隔,单位为米(m),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x002D_Type = 0x002D; | |||
/// <summary> | |||
/// 休眠时汇报距离间隔,单位为米(m),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x002E_Type = 0x002E; | |||
/// <summary> | |||
/// 紧急报警时汇报距离间隔,单位为米(m),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x002F_Type = 0x002F; | |||
/// <summary> | |||
/// 拐点补传角度,<180 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0030_Type = 0x0030; | |||
/// <summary> | |||
/// 电子围栏半径(非法位移阈值),单位为米 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0031_Type = 0x0031; | |||
/// <summary> | |||
/// 监控平台电话号码 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0040_Type = 0x0040; | |||
/// <summary> | |||
/// 复位电话号码,可采用此电话号码拨打终端电话让终端复位 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0041_Type = 0x0041; | |||
/// <summary> | |||
/// 恢复出厂设置电话号码,可采用此电话号码拨打终端电话让终端恢复出厂设置 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0042_Type = 0x0042; | |||
/// <summary> | |||
/// 监控平台 SMS 电话号码 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0043_Type = 0x0043; | |||
/// <summary> | |||
/// 接收终端 SMS 文本报警号码 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0044_Type = 0x0044; | |||
/// <summary> | |||
/// 终端电话接听策略,0:自动接听;1:ACC ON 时自动接听,OFF 时手动接听 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0045_Type = 0x0045; | |||
/// <summary> | |||
/// 每次最长通话时间,单位为秒(s),0 为不允许通话,0xFFFFFFFF 为不限制 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0046_Type = 0x0046; | |||
/// <summary> | |||
/// 当月最长通话时间,单位为秒(s),0 为不允许通话,0xFFFFFFFF 为不限制 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0047_Type = 0x0047; | |||
/// <summary> | |||
/// 监听电话号码 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0048_Type = 0x0048; | |||
/// <summary> | |||
/// 监管平台特权短信号码 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0049_Type = 0x0049; | |||
/// <summary> | |||
/// 报警屏蔽字,与位置信息汇报消息中的报警标志相对应,相应位为 1则相应报警被屏蔽 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0050_Type = 0x0050; | |||
/// <summary> | |||
/// 报警发送文本 SMS 开关,与位置信息汇报消息中的报警标志相对应,相应位为 1 则相应报警时发送文本 SMS | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0051_Type = 0x0051; | |||
/// <summary> | |||
/// 报警拍摄开关,与位置信息汇报消息中的报警标志相对应,相应位为1 则相应报警时摄像头拍摄 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0052_Type = 0x0052; | |||
/// <summary> | |||
/// 报警拍摄存储标志,与位置信息汇报消息中的报警标志相对应,相应位为 1 则对相应报警时拍的照片进行存储,否则实时上传 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0053_Type = 0x0053; | |||
/// <summary> | |||
/// 关键标志,与位置信息汇报消息中的报警标志相对应,相应位为 1 则对相应报警为关键报警 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0054_Type = 0x0054; | |||
/// <summary> | |||
/// 最高速度,单位为公里每小时(km/h) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0055_Type = 0x0055; | |||
/// <summary> | |||
/// 超速持续时间,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0056_Type = 0x0056; | |||
/// <summary> | |||
/// 连续驾驶时间门限,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0057_Type = 0x0057; | |||
/// <summary> | |||
/// 当天累计驾驶时间门限,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0058_Type = 0x0058; | |||
/// <summary> | |||
/// 最小休息时间,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0059_Type = 0x0059; | |||
/// <summary> | |||
/// 最长停车时间,单位为秒(s) | |||
/// </summary> | |||
public const uint JT808_0x8103_0x005A_Type = 0x005A; | |||
/// <summary> | |||
/// 超速报警预警差值,单位为 1/10Km/h | |||
/// </summary> | |||
public const uint JT808_0x8103_0x005B_Type = 0x005B; | |||
/// <summary> | |||
/// 疲劳驾驶预警差值,单位为秒(s),>0 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x005C_Type = 0x005C; | |||
/// <summary> | |||
/// 碰撞报警参数设置 | |||
/// b7-b0: 碰撞时间,单位 4ms; | |||
/// b15-b8:碰撞加速度,单位 0.1g,设置范围在:0-79 之间,默认为10。 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x005D_Type = 0x005D; | |||
/// <summary> | |||
/// 侧翻报警参数设置: | |||
/// 侧翻角度,单位 1 度,默认为 30 度 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x005E_Type = 0x005E; | |||
/// <summary> | |||
/// 定时拍照控制,见 表 13 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0064_Type = 0x0064; | |||
/// <summary> | |||
/// 定距拍照控制,见 表 14 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0065_Type = 0x0065; | |||
/// <summary> | |||
/// 图像/视频质量,1-10,1 最好 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0070_Type = 0x0070; | |||
/// <summary> | |||
/// 亮度,0-255 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0071_Type = 0x0071; | |||
/// <summary> | |||
/// 对比度,0-127 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0072_Type = 0x0072; | |||
/// <summary> | |||
/// 饱和度,0-127 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0073_Type = 0x0073; | |||
/// <summary> | |||
/// 色度,0-255 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0074_Type = 0x0074; | |||
/// <summary> | |||
/// 车辆里程表读数,1/10km | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0080_Type = 0x0080; | |||
/// <summary> | |||
/// 车辆所在的省域 ID | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0081_Type = 0x0081; | |||
/// <summary> | |||
/// 车辆所在的市域 ID | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0082_Type = 0x0082; | |||
/// <summary> | |||
/// 公安交通管理部门颁发的机动车号牌 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0083_Type = 0x0083; | |||
/// <summary> | |||
/// 车牌颜色,按照 JT/T415-2006 的 5.4.12 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0084_Type = 0x0084; | |||
/// <summary> | |||
/// GNSS 定位模式,定义如下: | |||
/// bit0,0:禁用 GPS 定位, 1:启用 GPS 定位; | |||
/// bit1,0:禁用北斗定位, 1:启用北斗定位; | |||
/// bit2,0:禁用 GLONASS 定位, 1:启用 GLONASS 定位; | |||
/// bit3,0:禁用 Galileo 定位, 1:启用 Galileo 定位。 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0090_Type = 0x0090; | |||
/// <summary> | |||
/// GNSS 波特率,定义如下: | |||
/// 0x00:4800;0x01:9600; | |||
/// 0x02:19200;0x03:38400; | |||
/// 0x04:57600;0x05:115200。 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0091_Type = 0x0091; | |||
/// <summary> | |||
/// GNSS 模块详细定位数据输出频率,定义如下: | |||
/// 0x00:500ms;0x01:1000ms(默认值); | |||
/// 0x02:2000ms;0x03:3000ms; | |||
/// 0x04:4000ms。 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0092_Type = 0x0092; | |||
/// <summary> | |||
/// GNSS 模块详细定位数据采集频率,单位为秒,默认为 1。 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0093_Type = 0x0093; | |||
/// <summary> | |||
/// GNSS 模块详细定位数据上传方式 | |||
/// 0x00,本地存储,不上传(默认值); | |||
/// 0x01,按时间间隔上传; | |||
/// 0x02,按距离间隔上传; | |||
/// 0x0B,按累计时间上传,达到传输时间后自动停止上传; | |||
/// 0x0C,按累计距离上传,达到距离后自动停止上传; | |||
/// 0x0D,按累计条数上传,达到上传条数后自动停止上传。 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0094_Type = 0x0094; | |||
/// <summary> | |||
/// GNSS 模块详细定位数据上传设置: | |||
/// 上传方式为 0x01 时,单位为秒; | |||
/// 上传方式为 0x02 时,单位为米; | |||
/// 上传方式为 0x0B 时,单位为秒; | |||
/// 上传方式为 0x0C 时,单位为米; | |||
/// 上传方式为 0x0D 时,单位为条。 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0095_Type = 0x0095; | |||
/// <summary> | |||
/// CAN 总线通道 1 采集时间间隔(ms),0 表示不采集 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0100_Type = 0x0100; | |||
/// <summary> | |||
/// CAN 总线通道 1 上传时间间隔(s),0 表示不上传 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0101_Type = 0x0101; | |||
/// <summary> | |||
/// CAN 总线通道 2 采集时间间隔(ms),0 表示不采集 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0102_Type = 0x0102; | |||
/// <summary> | |||
/// CAN 总线通道 2 上传时间间隔(s),0 表示不上传 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0103_Type = 0x0103; | |||
/// <summary> | |||
/// CAN 总线 ID 单独采集设置: | |||
/// bit63-bit32 表示此 ID 采集时间间隔(ms),0 表示不采集; | |||
/// bit31 表示 CAN 通道号,0:CAN1,1:CAN2; | |||
/// bit30 表示帧类型,0:标准帧,1:扩展帧; | |||
/// bit29 表示数据采集方式,0:原始数据,1:采集区间的计算值; | |||
/// bit28-bit0 表示 CAN 总线 ID。 | |||
/// </summary> | |||
public const uint JT808_0x8103_0x0110_Type = 0x0110; | |||
public static IDictionary<uint, Type> JT808_0x8103Method { get; private set; } | |||
/// <summary> | |||
/// 参数 ID | |||
/// </summary> | |||
@@ -369,93 +14,5 @@ namespace JT808.Protocol.MessageBody | |||
/// 参数长度 | |||
/// </summary> | |||
public abstract byte ParamLength { get; set; } | |||
static JT808_0x8103_BodyBase() | |||
{ | |||
JT808_0x8103Method = new Dictionary<uint, Type> | |||
{ | |||
{ JT808_0x8103_0x0001_Type, typeof(JT808_0x8103_0x0001) }, | |||
{ JT808_0x8103_0x0002_Type, typeof(JT808_0x8103_0x0002) }, | |||
{ JT808_0x8103_0x0003_Type, typeof(JT808_0x8103_0x0003) }, | |||
{ JT808_0x8103_0x0004_Type, typeof(JT808_0x8103_0x0004) }, | |||
{ JT808_0x8103_0x0005_Type, typeof(JT808_0x8103_0x0005) }, | |||
{ JT808_0x8103_0x0006_Type, typeof(JT808_0x8103_0x0006) }, | |||
{ JT808_0x8103_0x0007_Type, typeof(JT808_0x8103_0x0007) }, | |||
{ JT808_0x8103_0x0010_Type, typeof(JT808_0x8103_0x0010) }, | |||
{ JT808_0x8103_0x0011_Type, typeof(JT808_0x8103_0x0011) }, | |||
{ JT808_0x8103_0x0012_Type, typeof(JT808_0x8103_0x0012) }, | |||
{ JT808_0x8103_0x0013_Type, typeof(JT808_0x8103_0x0013) }, | |||
{ JT808_0x8103_0x0014_Type, typeof(JT808_0x8103_0x0014) }, | |||
{ JT808_0x8103_0x0015_Type, typeof(JT808_0x8103_0x0015) }, | |||
{ JT808_0x8103_0x0016_Type, typeof(JT808_0x8103_0x0016) }, | |||
{ JT808_0x8103_0x0017_Type, typeof(JT808_0x8103_0x0017) }, | |||
{ JT808_0x8103_0x0018_Type, typeof(JT808_0x8103_0x0018) }, | |||
{ JT808_0x8103_0x0019_Type, typeof(JT808_0x8103_0x0019) }, | |||
{ JT808_0x8103_0x001A_Type, typeof(JT808_0x8103_0x001A) }, | |||
{ JT808_0x8103_0x001B_Type, typeof(JT808_0x8103_0x001B) }, | |||
{ JT808_0x8103_0x001C_Type, typeof(JT808_0x8103_0x001C) }, | |||
{ JT808_0x8103_0x001D_Type, typeof(JT808_0x8103_0x001D) }, | |||
{ JT808_0x8103_0x0020_Type, typeof(JT808_0x8103_0x0020) }, | |||
{ JT808_0x8103_0x0021_Type, typeof(JT808_0x8103_0x0021) }, | |||
{ JT808_0x8103_0x0022_Type, typeof(JT808_0x8103_0x0022) }, | |||
{ JT808_0x8103_0x0027_Type, typeof(JT808_0x8103_0x0027) }, | |||
{ JT808_0x8103_0x0028_Type, typeof(JT808_0x8103_0x0028) }, | |||
{ JT808_0x8103_0x0029_Type, typeof(JT808_0x8103_0x0029) }, | |||
{ JT808_0x8103_0x002C_Type, typeof(JT808_0x8103_0x002C) }, | |||
{ JT808_0x8103_0x002D_Type, typeof(JT808_0x8103_0x002D) }, | |||
{ JT808_0x8103_0x002E_Type, typeof(JT808_0x8103_0x002E) }, | |||
{ JT808_0x8103_0x002F_Type, typeof(JT808_0x8103_0x002F) }, | |||
{ JT808_0x8103_0x0030_Type, typeof(JT808_0x8103_0x0030) }, | |||
{ JT808_0x8103_0x0031_Type, typeof(JT808_0x8103_0x0031) }, | |||
{ JT808_0x8103_0x0040_Type, typeof(JT808_0x8103_0x0040) }, | |||
{ JT808_0x8103_0x0041_Type, typeof(JT808_0x8103_0x0041) }, | |||
{ JT808_0x8103_0x0042_Type, typeof(JT808_0x8103_0x0042) }, | |||
{ JT808_0x8103_0x0043_Type, typeof(JT808_0x8103_0x0043) }, | |||
{ JT808_0x8103_0x0044_Type, typeof(JT808_0x8103_0x0044) }, | |||
{ JT808_0x8103_0x0045_Type, typeof(JT808_0x8103_0x0045) }, | |||
{ JT808_0x8103_0x0046_Type, typeof(JT808_0x8103_0x0046) }, | |||
{ JT808_0x8103_0x0047_Type, typeof(JT808_0x8103_0x0047) }, | |||
{ JT808_0x8103_0x0048_Type, typeof(JT808_0x8103_0x0048) }, | |||
{ JT808_0x8103_0x0049_Type, typeof(JT808_0x8103_0x0049) }, | |||
{ JT808_0x8103_0x0050_Type, typeof(JT808_0x8103_0x0050) }, | |||
{ JT808_0x8103_0x0051_Type, typeof(JT808_0x8103_0x0051) }, | |||
{ JT808_0x8103_0x0052_Type, typeof(JT808_0x8103_0x0052) }, | |||
{ JT808_0x8103_0x0053_Type, typeof(JT808_0x8103_0x0053) }, | |||
{ JT808_0x8103_0x0054_Type, typeof(JT808_0x8103_0x0054) }, | |||
{ JT808_0x8103_0x0055_Type, typeof(JT808_0x8103_0x0055) }, | |||
{ JT808_0x8103_0x0056_Type, typeof(JT808_0x8103_0x0056) }, | |||
{ JT808_0x8103_0x0057_Type, typeof(JT808_0x8103_0x0057) }, | |||
{ JT808_0x8103_0x0058_Type, typeof(JT808_0x8103_0x0058) }, | |||
{ JT808_0x8103_0x0059_Type, typeof(JT808_0x8103_0x0059) }, | |||
{ JT808_0x8103_0x005A_Type, typeof(JT808_0x8103_0x005A) }, | |||
{ JT808_0x8103_0x005B_Type, typeof(JT808_0x8103_0x005B) }, | |||
{ JT808_0x8103_0x005C_Type, typeof(JT808_0x8103_0x005C) }, | |||
{ JT808_0x8103_0x005D_Type, typeof(JT808_0x8103_0x005D) }, | |||
{ JT808_0x8103_0x005E_Type, typeof(JT808_0x8103_0x005E) }, | |||
{ JT808_0x8103_0x0064_Type, typeof(JT808_0x8103_0x0064) }, | |||
{ JT808_0x8103_0x0065_Type, typeof(JT808_0x8103_0x0065) }, | |||
{ JT808_0x8103_0x0070_Type, typeof(JT808_0x8103_0x0070) }, | |||
{ JT808_0x8103_0x0071_Type, typeof(JT808_0x8103_0x0081) }, | |||
{ JT808_0x8103_0x0072_Type, typeof(JT808_0x8103_0x0072) }, | |||
{ JT808_0x8103_0x0073_Type, typeof(JT808_0x8103_0x0073) }, | |||
{ JT808_0x8103_0x0074_Type, typeof(JT808_0x8103_0x0074) }, | |||
{ JT808_0x8103_0x0080_Type, typeof(JT808_0x8103_0x0080) }, | |||
{ JT808_0x8103_0x0081_Type, typeof(JT808_0x8103_0x0081) }, | |||
{ JT808_0x8103_0x0082_Type, typeof(JT808_0x8103_0x0082) }, | |||
{ JT808_0x8103_0x0083_Type, typeof(JT808_0x8103_0x0083) }, | |||
{ JT808_0x8103_0x0084_Type, typeof(JT808_0x8103_0x0084) }, | |||
{ JT808_0x8103_0x0090_Type, typeof(JT808_0x8103_0x0090) }, | |||
{ JT808_0x8103_0x0091_Type, typeof(JT808_0x8103_0x0091) }, | |||
{ JT808_0x8103_0x0092_Type, typeof(JT808_0x8103_0x0092) }, | |||
{ JT808_0x8103_0x0093_Type, typeof(JT808_0x8103_0x0093) }, | |||
{ JT808_0x8103_0x0094_Type, typeof(JT808_0x8103_0x0094) }, | |||
{ JT808_0x8103_0x0095_Type, typeof(JT808_0x8103_0x0095) }, | |||
{ JT808_0x8103_0x0100_Type, typeof(JT808_0x8103_0x0100) }, | |||
{ JT808_0x8103_0x0101_Type, typeof(JT808_0x8103_0x0101) }, | |||
{ JT808_0x8103_0x0102_Type, typeof(JT808_0x8103_0x0102) }, | |||
{ JT808_0x8103_0x0103_Type, typeof(JT808_0x8103_0x0103) }, | |||
{ JT808_0x8103_0x0110_Type, typeof(JT808_0x8103_0x0110) } | |||
}; | |||
} | |||
} | |||
} |