Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-charging-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ff393b86
authored
Nov 09, 2023
by
zhouhaibao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]服务端发送消息
1 parent
b6c62fce
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
3 deletions
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/handler/TimeSettingRspHandler.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/server/ProxyHelper.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/server/TcpServer.java
platform-charging/src/test/java/cn/com/glsx/charging/gbt/ocpp16/TimeSettingTest.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/handler/TimeSettingRspHandler.java
View file @
ff393b8
...
...
@@ -29,7 +29,7 @@ public class TimeSettingRspHandler implements TcpHandler<TimeSettingRsp, TimeSet
.
parseCp56Time2aStr
(
data
.
getTime
())
/* DateUtils.datetimeToStr(ByteUtils.parseCp56Time2a(timeSettingRsp.getData().getTime())) */
);
// TODO
String
key
=
channel
.
attr
(
ProxyHelper
.
PILE_ID_KEY
).
get
()
+
"+"
+
rsp
.
getSeq
(
);
String
key
=
ProxyHelper
.
getCallbackKey
(
rsp
,
channel
);
TcpCallback
<
TcpRsp
>
callback
=
ProxyHelper
.
getCallback
(
key
);
callback
.
callback
(
rsp
);
...
...
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/server/ProxyHelper.java
View file @
ff393b8
package
cn
.
com
.
glsx
.
charging
.
modules
.
gbt
.
ocpp16
.
tcp
.
server
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpBase
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpCallback
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.base.TcpRsp
;
import
java.net.InetSocketAddress
;
...
...
@@ -174,4 +175,11 @@ public class ProxyHelper {
public
static
TcpCallback
<
TcpRsp
>
getCallback
(
String
key
)
{
return
callbackMap
.
get
(
key
);
}
public
static
<
T
extends
TcpBase
>
String
getCallbackKey
(
T
data
,
Channel
channel
)
{
if
(
channel
==
null
)
{
throw
new
RuntimeException
(
"channel为null!!!"
);
}
return
channel
.
attr
(
ProxyHelper
.
PILE_ID_KEY
).
get
()
+
"+"
+
data
.
getSeq
();
}
}
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/server/TcpServer.java
View file @
ff393b8
This diff is collapsed.
Click to expand it.
platform-charging/src/test/java/cn/com/glsx/charging/gbt/ocpp16/TimeSettingTest.java
View file @
ff393b8
...
...
@@ -54,11 +54,11 @@ public class TimeSettingTest {
req
.
setData
(
data
);
Thread
.
sleep
(
3
0000
);
Thread
.
sleep
(
2
0000
);
TcpCallback
<
TcpRsp
>
callback
=
tcpServer
.
sendSync
(
req
);
Thread
.
sleep
(
3
0000
);
Thread
.
sleep
(
1
0000
);
TcpRsp
rsp
=
callback
.
get
();
log
.
info
(
"callback{}"
,
req
);
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment