diff --git a/simples/JT808.Gateway.SimpleClient/JT808.Gateway.SimpleClient.csproj b/simples/JT808.Gateway.SimpleClient/JT808.Gateway.SimpleClient.csproj
index 7d2ab2b..b2bb251 100644
--- a/simples/JT808.Gateway.SimpleClient/JT808.Gateway.SimpleClient.csproj
+++ b/simples/JT808.Gateway.SimpleClient/JT808.Gateway.SimpleClient.csproj
@@ -6,12 +6,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/simples/JT808.Gateway.SimpleQueueNotification/JT808.Gateway.SimpleQueueNotification.csproj b/simples/JT808.Gateway.SimpleQueueNotification/JT808.Gateway.SimpleQueueNotification.csproj
index d84d58f..401196b 100644
--- a/simples/JT808.Gateway.SimpleQueueNotification/JT808.Gateway.SimpleQueueNotification.csproj
+++ b/simples/JT808.Gateway.SimpleQueueNotification/JT808.Gateway.SimpleQueueNotification.csproj
@@ -1,4 +1,4 @@
-
+
netcoreapp3.1
@@ -27,7 +27,7 @@
-
-
+
+
diff --git a/simples/JT808.Gateway.SimpleQueueServer/JT808.Gateway.SimpleQueueServer.csproj b/simples/JT808.Gateway.SimpleQueueServer/JT808.Gateway.SimpleQueueServer.csproj
index a274481..ec18764 100644
--- a/simples/JT808.Gateway.SimpleQueueServer/JT808.Gateway.SimpleQueueServer.csproj
+++ b/simples/JT808.Gateway.SimpleQueueServer/JT808.Gateway.SimpleQueueServer.csproj
@@ -6,12 +6,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/simples/JT808.Gateway.SimpleQueueService/JT808.Gateway.SimpleQueueService.csproj b/simples/JT808.Gateway.SimpleQueueService/JT808.Gateway.SimpleQueueService.csproj
index 0b018d1..ab347bd 100644
--- a/simples/JT808.Gateway.SimpleQueueService/JT808.Gateway.SimpleQueueService.csproj
+++ b/simples/JT808.Gateway.SimpleQueueService/JT808.Gateway.SimpleQueueService.csproj
@@ -1,4 +1,4 @@
-
+
Exe
@@ -6,18 +6,18 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/simples/JT808.Gateway.SimpleServer/JT808.Gateway.SimpleServer.csproj b/simples/JT808.Gateway.SimpleServer/JT808.Gateway.SimpleServer.csproj
index ac7c4b3..cf43311 100644
--- a/simples/JT808.Gateway.SimpleServer/JT808.Gateway.SimpleServer.csproj
+++ b/simples/JT808.Gateway.SimpleServer/JT808.Gateway.SimpleServer.csproj
@@ -5,17 +5,17 @@
netcoreapp3.1
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/JT808.Gateway.Abstractions/JT808.Gateway.Abstractions.csproj b/src/JT808.Gateway.Abstractions/JT808.Gateway.Abstractions.csproj
index b60e330..cc7a0cb 100644
--- a/src/JT808.Gateway.Abstractions/JT808.Gateway.Abstractions.csproj
+++ b/src/JT808.Gateway.Abstractions/JT808.Gateway.Abstractions.csproj
@@ -19,18 +19,24 @@
JT808.Gateway.Abstractions
$(JT808GatewayPackageVersion)
+
+
+
+
+ JT808.Gateway.Abstractions.xml
+
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/src/JT808.Gateway.Abstractions/JT808.Gateway.Abstractions.xml b/src/JT808.Gateway.Abstractions/JT808.Gateway.Abstractions.xml
new file mode 100644
index 0000000..b4a374d
--- /dev/null
+++ b/src/JT808.Gateway.Abstractions/JT808.Gateway.Abstractions.xml
@@ -0,0 +1,843 @@
+
+
+
+ JT808.Gateway.Abstractions
+
+
+
+
+ 传输协议类型
+
+
+
+
+
+
+ 设备终端号
+ 808 hex data
+
+
+
+
+
+ 设备终端号
+ 808 hex data
+
+
+
+ 终端手机号
+
+
+
+
+ 会话通知(在线/离线)
+
+
+
+
+ 会话通知(在线/离线)
+
+
+
+
+
+
+ 请求数据
+ 当前会话
+ 应答消息数据
+
+
+
+ 终端通用应答
+ 平台无需回复
+ 实现自己的业务
+
+
+
+
+
+
+ 平台通用应答
+
+
+
+
+
+
+ 终端心跳
+
+
+
+
+
+
+ 查询服务器时间
+ 2019版本
+
+
+
+
+
+
+
+ 服务器补传分包请求
+
+
+
+
+
+
+
+ 终端补传分包请求
+
+
+
+
+
+
+
+ 终端注册
+
+
+
+
+
+
+
+ 终端注销
+
+
+
+
+
+
+
+ 终端鉴权
+
+
+
+
+
+
+
+ 查询终端参数应答
+
+
+
+
+
+
+
+ 查询终端属性应答
+
+
+
+
+
+
+
+ 终端升级结果应答
+
+
+
+
+
+
+
+ 位置信息汇报
+
+
+
+
+
+
+
+ 位置信息查询应答
+
+
+
+
+
+
+
+ 链路检测
+ 2019版本
+
+
+
+
+
+
+
+ 车辆控制应答
+
+
+
+
+
+
+
+ 定位数据批量上传
+
+
+
+
+
+
+
+ CAN总线数据上传
+
+
+
+
+
+
+
+ 多媒体事件信息上传
+
+
+
+
+
+
+
+ 多媒体数据上传
+
+
+
+
+
+
+
+ 摄像头立即拍摄命令
+
+
+
+
+
+
+
+ 数据上行透传
+
+
+
+
+
+
+
+ 终端通用应答
+ 平台无需回复
+ 实现自己的业务
+
+
+
+
+
+
+ 平台通用应答
+
+
+
+
+
+
+ 终端心跳
+
+
+
+
+
+
+ 查询服务器时间
+ 2019版本
+
+
+
+
+
+
+ 服务器补传分包请求
+
+
+
+
+
+
+
+ 终端补传分包请求
+
+
+
+
+
+
+ 终端注册
+
+
+
+
+
+
+ 终端注销
+
+
+
+
+
+
+ 终端鉴权
+
+
+
+
+
+
+ 查询终端参数应答
+
+
+
+
+
+
+ 查询终端属性应答
+
+
+
+
+
+
+ 终端升级结果应答
+
+
+
+
+
+
+ 位置信息汇报
+
+
+
+
+
+
+
+ 位置信息查询应答
+
+
+
+
+
+
+ 链路检测
+ 2019版本
+
+
+
+
+
+
+ 车辆控制应答
+
+
+
+
+
+
+ 定位数据批量上传
+
+
+
+
+
+
+ CAN总线数据上传
+
+
+
+
+
+
+ 多媒体事件信息上传
+
+
+
+
+
+
+ 多媒体数据上传
+
+
+
+
+
+
+ 摄像头立即拍摄命令
+
+
+
+
+
+
+ 数据上行透传
+
+
+
+
+
+
+ 使用正常方式
+
+
+
+
+ 使用队列方式
+
+
+
+ Holder for reflection information generated from Protos/JT808Gateway.proto
+
+
+ File descriptor for Protos/JT808Gateway.proto
+
+
+ Field number for the "TcpSessions" field.
+
+
+ Field number for the "TerminalPhoneNo" field.
+
+
+ Field number for the "Count" field.
+
+
+ Field number for the "UdpSessions" field.
+
+
+ Field number for the "StartTime" field.
+
+
+ Field number for the "LastActiveTime" field.
+
+
+ Field number for the "TerminalPhoneNo" field.
+
+
+ Field number for the "RemoteAddressIP" field.
+
+
+ Field number for the "TerminalPhoneNo" field.
+
+
+ Field number for the "Success" field.
+
+
+ Field number for the "TerminalPhoneNo" field.
+
+
+ Field number for the "Data" field.
+
+
+ Field number for the "Success" field.
+
+
+ Field number for the "MsgSuccessCount" field.
+
+
+ Field number for the "MsgFailCount" field.
+
+
+ Field number for the "MsgSuccessCount" field.
+
+
+ Field number for the "MsgFailCount" field.
+
+
+ Service descriptor
+
+
+ Base class for server-side implementations of JT808Gateway
+
+
+
+ 会话服务-获取会话服务集合
+
+ The request received from the client.
+ The context of the server-side call handler being invoked.
+ The response to send back to the client (wrapped by a task).
+
+
+
+ 会话服务-获取会话总数
+
+ The request received from the client.
+ The context of the server-side call handler being invoked.
+ The response to send back to the client (wrapped by a task).
+
+
+
+ 会话服务-通过设备终端号获取当前会话信息
+
+ The request received from the client.
+ The context of the server-side call handler being invoked.
+ The response to send back to the client (wrapped by a task).
+
+
+
+ 会话服务-通过设备终端号移除对应会话
+
+ The request received from the client.
+ The context of the server-side call handler being invoked.
+ The response to send back to the client (wrapped by a task).
+
+
+
+ 统一下发信息
+
+ The request received from the client.
+ The context of the server-side call handler being invoked.
+ The response to send back to the client (wrapped by a task).
+
+
+
+ 获取Tcp包计数器
+
+ The request received from the client.
+ The context of the server-side call handler being invoked.
+ The response to send back to the client (wrapped by a task).
+
+
+
+ 会话服务-获取会话服务集合
+
+ The request received from the client.
+ The context of the server-side call handler being invoked.
+ The response to send back to the client (wrapped by a task).
+
+
+
+ 获取Udp包计数器
+
+ The request received from the client.
+ The context of the server-side call handler being invoked.
+ The response to send back to the client (wrapped by a task).
+
+
+ Client for JT808Gateway
+
+
+ Creates a new client for JT808Gateway
+ The channel to use to make remote calls.
+
+
+ Creates a new client for JT808Gateway that uses a custom CallInvoker.
+ The callInvoker to use to make remote calls.
+
+
+ Protected parameterless constructor to allow creation of test doubles.
+
+
+ Protected constructor to allow creation of configured clients.
+ The client configuration.
+
+
+
+ 会话服务-获取会话服务集合
+
+ The request to send to the server.
+ The initial metadata to send with the call. This parameter is optional.
+ An optional deadline for the call. The call will be cancelled if deadline is hit.
+ An optional token for canceling the call.
+ The response received from the server.
+
+
+
+ 会话服务-获取会话服务集合
+
+ The request to send to the server.
+ The options for the call.
+ The response received from the server.
+
+
+
+ 会话服务-获取会话服务集合
+
+ The request to send to the server.
+ The initial metadata to send with the call. This parameter is optional.
+ An optional deadline for the call. The call will be cancelled if deadline is hit.
+ An optional token for canceling the call.
+ The call object.
+
+
+
+ 会话服务-获取会话服务集合
+
+ The request to send to the server.
+ The options for the call.
+ The call object.
+
+
+
+ 会话服务-获取会话总数
+
+ The request to send to the server.
+ The initial metadata to send with the call. This parameter is optional.
+ An optional deadline for the call. The call will be cancelled if deadline is hit.
+ An optional token for canceling the call.
+ The response received from the server.
+
+
+
+ 会话服务-获取会话总数
+
+ The request to send to the server.
+ The options for the call.
+ The response received from the server.
+
+
+
+ 会话服务-获取会话总数
+
+ The request to send to the server.
+ The initial metadata to send with the call. This parameter is optional.
+ An optional deadline for the call. The call will be cancelled if deadline is hit.
+ An optional token for canceling the call.
+ The call object.
+
+
+
+ 会话服务-获取会话总数
+
+ The request to send to the server.
+ The options for the call.
+ The call object.
+
+
+
+ 会话服务-通过设备终端号获取当前会话信息
+
+ The request to send to the server.
+ The initial metadata to send with the call. This parameter is optional.
+ An optional deadline for the call. The call will be cancelled if deadline is hit.
+ An optional token for canceling the call.
+ The response received from the server.
+
+
+
+ 会话服务-通过设备终端号获取当前会话信息
+
+ The request to send to the server.
+ The options for the call.
+ The response received from the server.
+
+
+
+ 会话服务-通过设备终端号获取当前会话信息
+
+ The request to send to the server.
+ The initial metadata to send with the call. This parameter is optional.
+ An optional deadline for the call. The call will be cancelled if deadline is hit.
+ An optional token for canceling the call.
+ The call object.
+
+
+
+ 会话服务-通过设备终端号获取当前会话信息
+
+ The request to send to the server.
+ The options for the call.
+ The call object.
+
+
+
+ 会话服务-通过设备终端号移除对应会话
+
+ The request to send to the server.
+ The initial metadata to send with the call. This parameter is optional.
+ An optional deadline for the call. The call will be cancelled if deadline is hit.
+ An optional token for canceling the call.
+ The response received from the server.
+
+
+
+ 会话服务-通过设备终端号移除对应会话
+
+ The request to send to the server.
+ The options for the call.
+ The response received from the server.
+
+
+
+ 会话服务-通过设备终端号移除对应会话
+
+ The request to send to the server.
+ The initial metadata to send with the call. This parameter is optional.
+ An optional deadline for the call. The call will be cancelled if deadline is hit.
+ An optional token for canceling the call.
+ The call object.
+
+
+
+ 会话服务-通过设备终端号移除对应会话
+
+ The request to send to the server.
+ The options for the call.
+ The call object.
+
+
+
+ 统一下发信息
+
+ The request to send to the server.
+ The initial metadata to send with the call. This parameter is optional.
+ An optional deadline for the call. The call will be cancelled if deadline is hit.
+ An optional token for canceling the call.
+ The response received from the server.
+
+
+
+ 统一下发信息
+
+ The request to send to the server.
+ The options for the call.
+ The response received from the server.
+
+
+
+ 统一下发信息
+
+ The request to send to the server.
+ The initial metadata to send with the call. This parameter is optional.
+ An optional deadline for the call. The call will be cancelled if deadline is hit.
+ An optional token for canceling the call.
+ The call object.
+
+
+
+ 统一下发信息
+
+ The request to send to the server.
+ The options for the call.
+ The call object.
+
+
+
+ 获取Tcp包计数器
+
+ The request to send to the server.
+ The initial metadata to send with the call. This parameter is optional.
+ An optional deadline for the call. The call will be cancelled if deadline is hit.
+ An optional token for canceling the call.
+ The response received from the server.
+
+
+
+ 获取Tcp包计数器
+
+ The request to send to the server.
+ The options for the call.
+ The response received from the server.
+
+
+
+ 获取Tcp包计数器
+
+ The request to send to the server.
+ The initial metadata to send with the call. This parameter is optional.
+ An optional deadline for the call. The call will be cancelled if deadline is hit.
+ An optional token for canceling the call.
+ The call object.
+
+
+
+ 获取Tcp包计数器
+
+ The request to send to the server.
+ The options for the call.
+ The call object.
+
+
+
+ 会话服务-获取会话服务集合
+
+ The request to send to the server.
+ The initial metadata to send with the call. This parameter is optional.
+ An optional deadline for the call. The call will be cancelled if deadline is hit.
+ An optional token for canceling the call.
+ The response received from the server.
+
+
+
+ 会话服务-获取会话服务集合
+
+ The request to send to the server.
+ The options for the call.
+ The response received from the server.
+
+
+
+ 会话服务-获取会话服务集合
+
+ The request to send to the server.
+ The initial metadata to send with the call. This parameter is optional.
+ An optional deadline for the call. The call will be cancelled if deadline is hit.
+ An optional token for canceling the call.
+ The call object.
+
+
+
+ 会话服务-获取会话服务集合
+
+ The request to send to the server.
+ The options for the call.
+ The call object.
+
+
+
+ 获取Udp包计数器
+
+ The request to send to the server.
+ The initial metadata to send with the call. This parameter is optional.
+ An optional deadline for the call. The call will be cancelled if deadline is hit.
+ An optional token for canceling the call.
+ The response received from the server.
+
+
+
+ 获取Udp包计数器
+
+ The request to send to the server.
+ The options for the call.
+ The response received from the server.
+
+
+
+ 获取Udp包计数器
+
+ The request to send to the server.
+ The initial metadata to send with the call. This parameter is optional.
+ An optional deadline for the call. The call will be cancelled if deadline is hit.
+ An optional token for canceling the call.
+ The call object.
+
+
+
+ 获取Udp包计数器
+
+ The request to send to the server.
+ The options for the call.
+ The call object.
+
+
+ Creates a new instance of client from given ClientBaseConfiguration.
+
+
+ Creates service definition that can be registered with a server
+ An object implementing the server-side handling logic.
+
+
+ Register service method with a service binder with or without implementation. Useful when customizing the service binding logic.
+ Note: this method is part of an experimental API that can change or be removed without any prior notice.
+ Service methods will be bound by calling AddMethod on this object.
+ An object implementing the server-side handling logic.
+
+
+
diff --git a/src/JT808.Gateway.Abstractions/JT808NormalReplyMessageHandler.cs b/src/JT808.Gateway.Abstractions/JT808NormalReplyMessageHandler.cs
index ff39cdb..de6d280 100644
--- a/src/JT808.Gateway.Abstractions/JT808NormalReplyMessageHandler.cs
+++ b/src/JT808.Gateway.Abstractions/JT808NormalReplyMessageHandler.cs
@@ -26,7 +26,18 @@ namespace JT808.Gateway.Abstractions
{JT808MsgId.终端注册.ToUInt16Value(), Msg0x0100},
{JT808MsgId.位置信息汇报.ToUInt16Value(),Msg0x0200 },
{JT808MsgId.定位数据批量上传.ToUInt16Value(),Msg0x0704 },
- {JT808MsgId.数据上行透传.ToUInt16Value(),Msg0x0900 }
+ {JT808MsgId.数据上行透传.ToUInt16Value(),Msg0x0900 },
+ {JT808MsgId.查询服务器时间请求.ToUInt16Value(),Msg0x0004 },
+ {JT808MsgId.查询终端参数应答.ToUInt16Value(),Msg0x0104 },
+ {JT808MsgId.查询终端属性应答.ToUInt16Value(),Msg0x0107 },
+ {JT808MsgId.终端升级结果通知.ToUInt16Value(),Msg0x0108 },
+ {JT808MsgId.位置信息查询应答.ToUInt16Value(),Msg0x0201 },
+ {JT808MsgId.链路检测.ToUInt16Value(),Msg0x8204 },
+ {JT808MsgId.车辆控制应答.ToUInt16Value(),Msg0x0500 },
+ {JT808MsgId.摄像头立即拍摄命令.ToUInt16Value(),Msg0x8801 },
+ {JT808MsgId.多媒体数据上传.ToUInt16Value(),Msg0x0801 },
+ {JT808MsgId.多媒体事件信息上传.ToUInt16Value(),Msg0x0800 },
+ {JT808MsgId.CAN总线数据上传.ToUInt16Value(),Msg0x0705 },
};
}
@@ -49,6 +60,17 @@ namespace JT808.Gateway.Abstractions
}
}
+ ///
+ /// 终端通用应答
+ /// 平台无需回复
+ /// 实现自己的业务
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0001(JT808HeaderPackage request, IJT808Session session)
+ {
+ return default;
+ }
///
/// 平台通用应答
///
@@ -79,40 +101,56 @@ namespace JT808.Gateway.Abstractions
return data;
}
}
-
///
- /// 终端通用应答
- /// 平台无需回复
- /// 实现自己的业务
+ /// 终端心跳
///
///
///
- public virtual byte[] Msg0x0001(JT808HeaderPackage request, IJT808Session session)
+ public virtual byte[] Msg0x0002(JT808HeaderPackage request, IJT808Session session)
{
- return default;
+ return CommonReply(request, session);
}
///
- /// 终端心跳
+ /// 查询服务器时间
+ /// 2019版本
///
///
+ ///
///
- public virtual byte[] Msg0x0002(JT808HeaderPackage request, IJT808Session session)
+ public virtual byte[] Msg0x0004(JT808HeaderPackage request, IJT808Session session)
{
- return CommonReply(request, session);
+ byte[] data = JT808Serializer.Serialize(JT808MsgId.查询服务器时间应答.Create(request.Header.TerminalPhoneNo, new JT808_0x8004()
+ {
+ Time=DateTime.Now
+ }));
+ session.SendAsync(data);
+ return data;
}
///
- /// 终端注销
+ /// 服务器补传分包请求
///
///
+ ///
///
- public virtual byte[] Msg0x0003(JT808HeaderPackage request, IJT808Session session)
+ public virtual byte[] Msg0x8003(JT808HeaderPackage request, IJT808Session session)
{
- return CommonReply(request, session);
+ throw new NotImplementedException("0x8003-服务器补传分包请求");
+ }
+ ///
+ /// 终端补传分包请求
+ ///
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0005(JT808HeaderPackage request, IJT808Session session)
+ {
+ throw new NotImplementedException("0x0005-终端补传分包请求");
}
///
/// 终端注册
///
///
+ ///
///
public virtual byte[] Msg0x0100(JT808HeaderPackage request, IJT808Session session)
{
@@ -140,36 +178,151 @@ namespace JT808.Gateway.Abstractions
}
}
///
+ /// 终端注销
+ ///
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0003(JT808HeaderPackage request, IJT808Session session)
+ {
+ return CommonReply(request, session);
+ }
+ ///
/// 终端鉴权
///
///
+ ///
///
public virtual byte[] Msg0x0102(JT808HeaderPackage request, IJT808Session session)
{
return CommonReply(request, session);
}
///
+ /// 查询终端参数应答
+ ///
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0104(JT808HeaderPackage request, IJT808Session session)
+ {
+ return CommonReply(request, session);
+ }
+ ///
+ /// 查询终端属性应答
+ ///
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0107(JT808HeaderPackage request, IJT808Session session)
+ {
+ return CommonReply(request, session);
+ }
+ ///
+ /// 终端升级结果应答
+ ///
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0108(JT808HeaderPackage request, IJT808Session session)
+ {
+ return CommonReply(request, session);
+ }
+ ///
/// 位置信息汇报
///
///
+ ///
///
public virtual byte[] Msg0x0200(JT808HeaderPackage request, IJT808Session session)
{
return CommonReply(request, session);
}
///
+ /// 位置信息查询应答
+ ///
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0201(JT808HeaderPackage request, IJT808Session session)
+ {
+ return CommonReply(request, session);
+ }
+ ///
+ /// 链路检测
+ /// 2019版本
+ ///
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x8204(JT808HeaderPackage request, IJT808Session session)
+ {
+ return default;
+ }
+ ///
+ /// 车辆控制应答
+ ///
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0500(JT808HeaderPackage request, IJT808Session session)
+ {
+ return CommonReply(request, session);
+ }
+ ///
/// 定位数据批量上传
///
///
+ ///
///
public virtual byte[] Msg0x0704(JT808HeaderPackage request, IJT808Session session)
{
return CommonReply(request, session);
}
///
+ /// CAN总线数据上传
+ ///
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0705(JT808HeaderPackage request, IJT808Session session)
+ {
+ return CommonReply(request, session);
+ }
+ ///
+ /// 多媒体事件信息上传
+ ///
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0800(JT808HeaderPackage request, IJT808Session session)
+ {
+ return CommonReply(request, session);
+ }
+ ///
+ /// 多媒体数据上传
+ ///
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0801(JT808HeaderPackage request, IJT808Session session)
+ {
+ throw new NotImplementedException("0x8800多媒体数据上传应答");
+ }
+ ///
+ /// 摄像头立即拍摄命令
+ ///
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x8801(JT808HeaderPackage request, IJT808Session session)
+ {
+ throw new NotImplementedException("0x0805摄像头立即拍摄命令应答");
+ }
+ ///
/// 数据上行透传
///
///
+ ///
///
public virtual byte[] Msg0x0900(JT808HeaderPackage request, IJT808Session session)
{
diff --git a/src/JT808.Gateway.Abstractions/JT808QueueReplyMessageHandler.cs b/src/JT808.Gateway.Abstractions/JT808QueueReplyMessageHandler.cs
index 5350773..f31dd16 100644
--- a/src/JT808.Gateway.Abstractions/JT808QueueReplyMessageHandler.cs
+++ b/src/JT808.Gateway.Abstractions/JT808QueueReplyMessageHandler.cs
@@ -29,7 +29,18 @@ namespace JT808.Gateway.Abstractions
{JT808MsgId.终端注册.ToUInt16Value(), Msg0x0100},
{JT808MsgId.位置信息汇报.ToUInt16Value(),Msg0x0200 },
{JT808MsgId.定位数据批量上传.ToUInt16Value(),Msg0x0704 },
- {JT808MsgId.数据上行透传.ToUInt16Value(),Msg0x0900 }
+ {JT808MsgId.数据上行透传.ToUInt16Value(),Msg0x0900 },
+ {JT808MsgId.查询服务器时间请求.ToUInt16Value(),Msg0x0004 },
+ {JT808MsgId.查询终端参数应答.ToUInt16Value(),Msg0x0104 },
+ {JT808MsgId.查询终端属性应答.ToUInt16Value(),Msg0x0107 },
+ {JT808MsgId.终端升级结果通知.ToUInt16Value(),Msg0x0108 },
+ {JT808MsgId.位置信息查询应答.ToUInt16Value(),Msg0x0201 },
+ {JT808MsgId.链路检测.ToUInt16Value(),Msg0x8204 },
+ {JT808MsgId.车辆控制应答.ToUInt16Value(),Msg0x0500 },
+ {JT808MsgId.摄像头立即拍摄命令.ToUInt16Value(),Msg0x8801 },
+ {JT808MsgId.多媒体数据上传.ToUInt16Value(),Msg0x0801 },
+ {JT808MsgId.多媒体事件信息上传.ToUInt16Value(),Msg0x0800 },
+ {JT808MsgId.CAN总线数据上传.ToUInt16Value(),Msg0x0705 },
};
}
@@ -46,6 +57,17 @@ namespace JT808.Gateway.Abstractions
}
}
+ ///
+ /// 终端通用应答
+ /// 平台无需回复
+ /// 实现自己的业务
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0001(JT808HeaderPackage request)
+ {
+ return default;
+ }
///
/// 平台通用应答
///
@@ -55,52 +77,66 @@ namespace JT808.Gateway.Abstractions
{
if (request.Version == JT808Version.JTT2019)
{
- return JT808Serializer.Serialize(JT808MsgId.平台通用应答.Create_平台通用应答_2019(request.Header.TerminalPhoneNo, new JT808_0x8001()
+ byte[] data = JT808Serializer.Serialize(JT808MsgId.平台通用应答.Create_平台通用应答_2019(request.Header.TerminalPhoneNo, new JT808_0x8001()
{
AckMsgId = request.Header.MsgId,
JT808PlatformResult = JT808PlatformResult.成功,
MsgNum = request.Header.MsgNum
}));
+ return data;
}
else
{
- return JT808Serializer.Serialize(JT808MsgId.平台通用应答.Create(request.Header.TerminalPhoneNo, new JT808_0x8001()
+ byte[] data = JT808Serializer.Serialize(JT808MsgId.平台通用应答.Create(request.Header.TerminalPhoneNo, new JT808_0x8001()
{
AckMsgId = request.Header.MsgId,
JT808PlatformResult = JT808PlatformResult.成功,
MsgNum = request.Header.MsgNum
}));
+ return data;
}
}
-
///
- /// 终端通用应答
- /// 平台无需回复
- /// 实现自己的业务
+ /// 终端心跳
///
///
///
- public virtual byte[] Msg0x0001(JT808HeaderPackage request)
+ public virtual byte[] Msg0x0002(JT808HeaderPackage request)
{
- return null;
+ return CommonReply(request);
}
///
- /// 终端心跳
+ /// 查询服务器时间
+ /// 2019版本
///
///
///
- public virtual byte[] Msg0x0002(JT808HeaderPackage request)
+ public virtual byte[] Msg0x0004(JT808HeaderPackage request)
{
- return CommonReply(request);
+ byte[] data = JT808Serializer.Serialize(JT808MsgId.查询服务器时间应答.Create(request.Header.TerminalPhoneNo, new JT808_0x8004()
+ {
+ Time = DateTime.Now
+ }));
+ return data;
}
///
- /// 终端注销
+ /// 服务器补传分包请求
///
///
+ ///
///
- public virtual byte[] Msg0x0003(JT808HeaderPackage request)
+ public virtual byte[] Msg0x8003(JT808HeaderPackage request)
{
- return CommonReply(request);
+ throw new NotImplementedException("0x8003-服务器补传分包请求");
+ }
+ ///
+ /// 终端补传分包请求
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0005(JT808HeaderPackage request)
+ {
+ throw new NotImplementedException("0x0005-终端补传分包请求");
}
///
/// 终端注册
@@ -111,24 +147,35 @@ namespace JT808.Gateway.Abstractions
{
if (request.Version == JT808Version.JTT2019)
{
- return JT808Serializer.Serialize(JT808MsgId.终端注册应答.Create_终端注册应答_2019(request.Header.TerminalPhoneNo, new JT808_0x8100()
+ byte[] data = JT808Serializer.Serialize(JT808MsgId.终端注册应答.Create_终端注册应答_2019(request.Header.TerminalPhoneNo, new JT808_0x8100()
{
Code = "J" + request.Header.TerminalPhoneNo,
JT808TerminalRegisterResult = JT808TerminalRegisterResult.成功,
AckMsgNum = request.Header.MsgNum
}));
+ return data;
}
else
{
- return JT808Serializer.Serialize(JT808MsgId.终端注册应答.Create(request.Header.TerminalPhoneNo, new JT808_0x8100()
+ byte[] data = JT808Serializer.Serialize(JT808MsgId.终端注册应答.Create(request.Header.TerminalPhoneNo, new JT808_0x8100()
{
Code = "J" + request.Header.TerminalPhoneNo,
JT808TerminalRegisterResult = JT808TerminalRegisterResult.成功,
AckMsgNum = request.Header.MsgNum
}));
+ return data;
}
}
///
+ /// 终端注销
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0003(JT808HeaderPackage request)
+ {
+ return CommonReply(request);
+ }
+ ///
/// 终端鉴权
///
///
@@ -138,15 +185,71 @@ namespace JT808.Gateway.Abstractions
return CommonReply(request);
}
///
+ /// 查询终端参数应答
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0104(JT808HeaderPackage request)
+ {
+ return CommonReply(request);
+ }
+ ///
+ /// 查询终端属性应答
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0107(JT808HeaderPackage request)
+ {
+ return CommonReply(request);
+ }
+ ///
+ /// 终端升级结果应答
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0108(JT808HeaderPackage request)
+ {
+ return CommonReply(request);
+ }
+ ///
/// 位置信息汇报
///
///
+ ///
///
public virtual byte[] Msg0x0200(JT808HeaderPackage request)
{
return CommonReply(request);
}
///
+ /// 位置信息查询应答
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0201(JT808HeaderPackage request)
+ {
+ return CommonReply(request);
+ }
+ ///
+ /// 链路检测
+ /// 2019版本
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x8204(JT808HeaderPackage request)
+ {
+ return default;
+ }
+ ///
+ /// 车辆控制应答
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0500(JT808HeaderPackage request)
+ {
+ return CommonReply(request);
+ }
+ ///
/// 定位数据批量上传
///
///
@@ -156,6 +259,42 @@ namespace JT808.Gateway.Abstractions
return CommonReply(request);
}
///
+ /// CAN总线数据上传
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0705(JT808HeaderPackage request)
+ {
+ return CommonReply(request);
+ }
+ ///
+ /// 多媒体事件信息上传
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0800(JT808HeaderPackage request)
+ {
+ return CommonReply(request);
+ }
+ ///
+ /// 多媒体数据上传
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x0801(JT808HeaderPackage request)
+ {
+ throw new NotImplementedException("0x8800多媒体数据上传应答");
+ }
+ ///
+ /// 摄像头立即拍摄命令
+ ///
+ ///
+ ///
+ public virtual byte[] Msg0x8801(JT808HeaderPackage request)
+ {
+ throw new NotImplementedException("0x0805摄像头立即拍摄命令应答");
+ }
+ ///
/// 数据上行透传
///
///
diff --git a/src/JT808.Gateway.Abstractions/Protos/JT808Gateway.proto b/src/JT808.Gateway.Abstractions/Protos/JT808Gateway.proto
index 042fc89..81fe9f6 100644
--- a/src/JT808.Gateway.Abstractions/Protos/JT808Gateway.proto
+++ b/src/JT808.Gateway.Abstractions/Protos/JT808Gateway.proto
@@ -6,7 +6,11 @@ package JT808GatewayGrpc;
service JT808Gateway{
// 会话服务-获取会话服务集合
- rpc GetTcpSessionAll(Empty) returns (TcpSessionInfoReply);
+ rpc GetTcpSessionAll(Empty) returns (TcpSessionInfoReply);
+ // 会话服务-获取会话总数
+ rpc GetTcpSessionCount(Empty) returns (SessionCountReply);
+ // 会话服务-通过设备终端号获取当前会话信息
+ rpc GetTcpSessionByTerminalPhoneNo(SessionRequest) returns (SessionInfo);
// 会话服务-通过设备终端号移除对应会话
rpc RemoveSessionByTerminalPhoneNo(SessionRemoveRequest) returns (SessionRemoveReply);
// 统一下发信息
@@ -24,6 +28,12 @@ message Empty{}
message TcpSessionInfoReply{
repeated SessionInfo TcpSessions=1;
}
+message SessionRequest{
+ string TerminalPhoneNo=1;
+}
+message SessionCountReply{
+ int64 Count=1;
+}
message UdpSessionInfoReply{
repeated SessionInfo UdpSessions=1;
}
diff --git a/src/JT808.Gateway.Benchmark/JT808.Gateway.CleintBenchmark/JT808.Gateway.CleintBenchmark.csproj b/src/JT808.Gateway.Benchmark/JT808.Gateway.CleintBenchmark/JT808.Gateway.CleintBenchmark.csproj
index cf24270..062bbfd 100644
--- a/src/JT808.Gateway.Benchmark/JT808.Gateway.CleintBenchmark/JT808.Gateway.CleintBenchmark.csproj
+++ b/src/JT808.Gateway.Benchmark/JT808.Gateway.CleintBenchmark/JT808.Gateway.CleintBenchmark.csproj
@@ -12,10 +12,10 @@
-
-
-
-
+
+
+
+
diff --git a/src/JT808.Gateway.Benchmark/JT808.Gateway.ServerBenchmark/JT808.Gateway.ServerBenchmark.csproj b/src/JT808.Gateway.Benchmark/JT808.Gateway.ServerBenchmark/JT808.Gateway.ServerBenchmark.csproj
index 69c4512..ede005b 100644
--- a/src/JT808.Gateway.Benchmark/JT808.Gateway.ServerBenchmark/JT808.Gateway.ServerBenchmark.csproj
+++ b/src/JT808.Gateway.Benchmark/JT808.Gateway.ServerBenchmark/JT808.Gateway.ServerBenchmark.csproj
@@ -6,8 +6,8 @@
-
-
+
+
diff --git a/src/JT808.Gateway.Client/JT808.Gateway.Client.csproj b/src/JT808.Gateway.Client/JT808.Gateway.Client.csproj
index af742a9..528087e 100644
--- a/src/JT808.Gateway.Client/JT808.Gateway.Client.csproj
+++ b/src/JT808.Gateway.Client/JT808.Gateway.Client.csproj
@@ -22,13 +22,13 @@
-
-
-
+
+
+
-
-
+
+
diff --git a/src/JT808.Gateway.Kafka/JT808.Gateway.Kafka.csproj b/src/JT808.Gateway.Kafka/JT808.Gateway.Kafka.csproj
index 473cae1..1d8762d 100644
--- a/src/JT808.Gateway.Kafka/JT808.Gateway.Kafka.csproj
+++ b/src/JT808.Gateway.Kafka/JT808.Gateway.Kafka.csproj
@@ -21,11 +21,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808.Gateway.MsgLogging.csproj b/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808.Gateway.MsgLogging.csproj
index 0a4b424..8bb463a 100644
--- a/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808.Gateway.MsgLogging.csproj
+++ b/src/JT808.Gateway.Services/JT808.Gateway.MsgLogging/JT808.Gateway.MsgLogging.csproj
@@ -22,7 +22,7 @@
LICENSE
-
+
diff --git a/src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808.Gateway.ReplyMessage.csproj b/src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808.Gateway.ReplyMessage.csproj
index e8c090e..97ebd8d 100644
--- a/src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808.Gateway.ReplyMessage.csproj
+++ b/src/JT808.Gateway.Services/JT808.Gateway.ReplyMessage/JT808.Gateway.ReplyMessage.csproj
@@ -21,7 +21,7 @@
LICENSE
-
+
diff --git a/src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808.Gateway.SessionNotice.csproj b/src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808.Gateway.SessionNotice.csproj
index 4ecab27..c85def7 100644
--- a/src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808.Gateway.SessionNotice.csproj
+++ b/src/JT808.Gateway.Services/JT808.Gateway.SessionNotice/JT808.Gateway.SessionNotice.csproj
@@ -22,7 +22,7 @@
LICENSE
-
+
diff --git a/src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808.Gateway.Transmit.csproj b/src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808.Gateway.Transmit.csproj
index 0f8b418..ba8141a 100644
--- a/src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808.Gateway.Transmit.csproj
+++ b/src/JT808.Gateway.Services/JT808.Gateway.Transmit/JT808.Gateway.Transmit.csproj
@@ -22,7 +22,7 @@
LICENSE
-
+
diff --git a/src/JT808.Gateway.Tests/JT808.Gateway.NormalHosting/JT808.Gateway.NormalHosting.csproj b/src/JT808.Gateway.Tests/JT808.Gateway.NormalHosting/JT808.Gateway.NormalHosting.csproj
index c1ac1e8..5c73175 100644
--- a/src/JT808.Gateway.Tests/JT808.Gateway.NormalHosting/JT808.Gateway.NormalHosting.csproj
+++ b/src/JT808.Gateway.Tests/JT808.Gateway.NormalHosting/JT808.Gateway.NormalHosting.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/src/JT808.Gateway.Tests/JT808.Gateway.QueueHosting/JT808.Gateway.QueueHosting.csproj b/src/JT808.Gateway.Tests/JT808.Gateway.QueueHosting/JT808.Gateway.QueueHosting.csproj
index a700cb0..72f720f 100644
--- a/src/JT808.Gateway.Tests/JT808.Gateway.QueueHosting/JT808.Gateway.QueueHosting.csproj
+++ b/src/JT808.Gateway.Tests/JT808.Gateway.QueueHosting/JT808.Gateway.QueueHosting.csproj
@@ -6,8 +6,8 @@
-
-
+
+
diff --git a/src/JT808.Gateway.Tests/JT808.Gateway.QueueHosting/Program.cs b/src/JT808.Gateway.Tests/JT808.Gateway.QueueHosting/Program.cs
index 2a01222..7c9bf83 100644
--- a/src/JT808.Gateway.Tests/JT808.Gateway.QueueHosting/Program.cs
+++ b/src/JT808.Gateway.Tests/JT808.Gateway.QueueHosting/Program.cs
@@ -7,6 +7,7 @@ using JT808.Protocol;
using Microsoft.Extensions.Configuration;
using NLog.Extensions.Logging;
using JT808.Gateway.MsgLogging;
+using JT808.Gateway.ReplyMessage;
using JT808.Gateway.Transmit;
using JT808.Gateway.Traffic;
using JT808.Gateway.Abstractions;
@@ -40,8 +41,6 @@ namespace JT808.Gateway.QueueHosting
services.AddSingleton();
services.AddSingleton(typeof(ILogger<>), typeof(Logger<>));
services.AddJT808Configure()
- //添加客户端工具
- //.AddClient()
//.AddQueueGateway(options =>
//{
// options.TcpPort = 808;
@@ -54,11 +53,21 @@ namespace JT808.Gateway.QueueHosting
.AddTcp()
.AddUdp()
.AddGrpc()
+ .Builder()
+ //添加客户端工具
+ .AddClient()
+ //添加客户端服务
+ .AddClientKafka()
+ .AddMsgConsumer(hostContext.Configuration)
+ //添加消息应答服务
+ .AddMsgReplyProducer(hostContext.Configuration)
+ //添加消息应答处理
+ .AddReplyMessage()
;
//grpc客户端调用
//services.AddHostedService();
//客户端测试
- //services.AddHostedService();
+ services.AddHostedService();
});
await serverHostBuilder.RunConsoleAsync();
diff --git a/src/JT808.Gateway.Tests/JT808.Gateway.QueueHosting/appsettings.json b/src/JT808.Gateway.Tests/JT808.Gateway.QueueHosting/appsettings.json
index 2cc2a42..e5d7c33 100644
--- a/src/JT808.Gateway.Tests/JT808.Gateway.QueueHosting/appsettings.json
+++ b/src/JT808.Gateway.Tests/JT808.Gateway.QueueHosting/appsettings.json
@@ -15,6 +15,16 @@
"EnableAutoCommit": true,
"BootstrapServers": "127.0.0.1:9092"
},
+ "JT808MsgConsumerConfig": {
+ "TopicName": "JT808Msg",
+ "GroupId": "msg-group",
+ "EnableAutoCommit": true,
+ "BootstrapServers": "127.0.0.1:9092"
+ },
+ "JT808MsgReplyProducerConfig": {
+ "TopicName": "JT808MsgReply",
+ "BootstrapServers": "127.0.0.1:9092"
+ },
"JT808SessionProducerConfig": {
"TopicName": "JT808Session",
"BootstrapServers": "127.0.0.1:9092"
diff --git a/src/JT808.Gateway.Tests/JT808.Gateway.Test/JT808.Gateway.Test.csproj b/src/JT808.Gateway.Tests/JT808.Gateway.Test/JT808.Gateway.Test.csproj
index 63742bf..ec4daa0 100644
--- a/src/JT808.Gateway.Tests/JT808.Gateway.Test/JT808.Gateway.Test.csproj
+++ b/src/JT808.Gateway.Tests/JT808.Gateway.Test/JT808.Gateway.Test.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/src/JT808.Gateway/JT808.Gateway.csproj b/src/JT808.Gateway/JT808.Gateway.csproj
index c6c4da1..67910d5 100644
--- a/src/JT808.Gateway/JT808.Gateway.csproj
+++ b/src/JT808.Gateway/JT808.Gateway.csproj
@@ -21,8 +21,8 @@
-
-
+
+
diff --git a/src/JT808.Gateway/JT808TcpServer.cs b/src/JT808.Gateway/JT808TcpServer.cs
index 72a685e..5079f54 100644
--- a/src/JT808.Gateway/JT808TcpServer.cs
+++ b/src/JT808.Gateway/JT808TcpServer.cs
@@ -249,6 +249,10 @@ namespace JT808.Gateway
}
}
}
+ catch (NotImplementedException ex)
+ {
+ Logger.LogError(ex.Message);
+ }
catch (JT808Exception ex)
{
AtomicCounterService.MsgFailIncrement();
diff --git a/src/JT808.Gateway/JT808UdpServer.cs b/src/JT808.Gateway/JT808UdpServer.cs
index 718f964..1a2ada1 100644
--- a/src/JT808.Gateway/JT808UdpServer.cs
+++ b/src/JT808.Gateway/JT808UdpServer.cs
@@ -137,6 +137,10 @@ namespace JT808.Gateway
MsgProducer.ProduceAsync(package.Header.TerminalPhoneNo, package.OriginalData.ToArray());
}
}
+ catch (NotImplementedException ex)
+ {
+ Logger.LogError(ex.Message);
+ }
catch (JT808Exception ex)
{
AtomicCounterService.MsgFailIncrement();
diff --git a/src/JT808.Gateway/Services/JT808GatewayService.cs b/src/JT808.Gateway/Services/JT808GatewayService.cs
index 32e541c..adcedcf 100644
--- a/src/JT808.Gateway/Services/JT808GatewayService.cs
+++ b/src/JT808.Gateway/Services/JT808GatewayService.cs
@@ -60,6 +60,34 @@ namespace JT808.Gateway.Services
return Task.FromResult(reply);
}
+ public override Task GetTcpSessionByTerminalPhoneNo(SessionRequest request, ServerCallContext context)
+ {
+ Auth(context);
+ var result = jT808SessionManager.GetTcpAll().FirstOrDefault(f=>f.TerminalPhoneNo==request.TerminalPhoneNo);
+ SessionInfo sessionInfo = new SessionInfo();
+ if (result != null)
+ {
+ sessionInfo.LastActiveTime = result.ActiveTime.ToString("yyyy-MM-dd HH:mm:ss");
+ sessionInfo.StartTime = result.StartTime.ToString("yyyy-MM-dd HH:mm:ss");
+ sessionInfo.RemoteAddressIP = result.RemoteEndPoint.ToString();
+ sessionInfo.TerminalPhoneNo = result.TerminalPhoneNo;
+ return Task.FromResult(sessionInfo);
+ }
+ else
+ {
+ throw new Grpc.Core.RpcException(new Status(StatusCode.FailedPrecondition, $"{request.TerminalPhoneNo} not exists"));
+ }
+ }
+
+ public override Task GetTcpSessionCount(Empty request, ServerCallContext context)
+ {
+ Auth(context);
+ return Task.FromResult(new SessionCountReply
+ {
+ Count = jT808SessionManager.TcpSessionCount
+ });
+ }
+
public override Task RemoveSessionByTerminalPhoneNo(SessionRemoveRequest request, ServerCallContext context)
{
Auth(context);
diff --git a/src/Version.props b/src/Version.props
index e5e88c6..6681c32 100644
--- a/src/Version.props
+++ b/src/Version.props
@@ -1,6 +1,6 @@
2.3.1
- 1.0.0-preview8
+ 1.0.0-preview9
\ No newline at end of file