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 37dbebca
authored
Nov 09, 2023
by
chenxi
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
实现功能:错误报文协议-单元测试
1 parent
3f21f789
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
4 deletions
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/base/TcpMapper.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/data/ErrorMessageReqData.java
platform-charging/src/test/java/cn/com/glsx/charging/gbt/ocpp16/ErrorMessageTest.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/base/TcpMapper.java
View file @
37dbebc
...
...
@@ -4,6 +4,7 @@ import java.util.Map;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.handler.ChargingCompletionReqHandler
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.handler.ChargingHandshakeReqHandler
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.handler.ErrorMessageReqHandler
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.google.common.collect.Maps
;
...
...
@@ -67,7 +68,7 @@ public final class TcpMapper {
public
static
TcpMapper
CMD_REQ_CHARGING_COMPLETION
=
regist
(
0x19
,
"充电结束"
,
ChargingCompletionReqHandler
.
class
);
public
static
TcpMapper
CMD_REQ_ERROR_MESSAGE
=
regist
(
0x1B
,
"错误报文"
,
ChargingCompletion
ReqHandler
.
class
);
public
static
TcpMapper
CMD_REQ_ERROR_MESSAGE
=
regist
(
0x1B
,
"错误报文"
,
ErrorMessage
ReqHandler
.
class
);
// public static TcpMapper CMD_NOTIFY_TIME = regist(0x56, "对时设置", TimeNotifyHandler.class);
...
...
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/data/ErrorMessageReqData.java
View file @
37dbebc
...
...
@@ -27,7 +27,7 @@ public class ErrorMessageReqData extends TcpData {
* 长度(Byte):7
* 备注:不足7位补0
*/
private
byte
[]
pile
Number
=
new
byte
[
7
];
private
byte
[]
pile
Id
=
new
byte
[
7
];
/**
* 枪号
...
...
@@ -129,7 +129,7 @@ public class ErrorMessageReqData extends TcpData {
/**
* 接收电池充电
要求
报文超时 BIN
* 接收电池充电
总状态
报文超时 BIN
* <00>:=正常;<01>:=超时;<10>:=不可信状态
*/
private
byte
[]
bmsChargingStatusMessageTimeout
=
new
byte
[
2
];
...
...
@@ -155,7 +155,7 @@ public class ErrorMessageReqData extends TcpData {
* 接收 BMS 充电统计报文超时 BIN
* <00>:=正常;<01>:=超时;<10>:=不可信状态
*/
private
byte
[]
bmsChargingStatisticsMessageTimeout
=
new
byte
[
4
];
private
byte
[]
bmsChargingStatisticsMessageTimeout
=
new
byte
[
2
];
/**
* 充电机其他 BIN
...
...
platform-charging/src/test/java/cn/com/glsx/charging/gbt/ocpp16/ErrorMessageTest.java
0 → 100644
View file @
37dbebc
package
cn
.
com
.
glsx
.
charging
.
gbt
.
ocpp16
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.ClientMain
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.Ocpp16Helper
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.client.TcpClient
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.data.ErrorMessageReqData
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.protocol.ErrorMessageReq
;
/**
* 错误报文测试类
* @author chenxi
* @date 2023年11月18日 14:57:39
**/
public
class
ErrorMessageTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Ocpp16Helper
.
scan
();
String
host
=
"localhost"
;
int
port
=
8888
;
TcpClient
client
=
ClientMain
.
getInstance
(
host
,
port
);
Thread
.
sleep
(
3000
);
ErrorMessageReq
req
=
new
ErrorMessageReq
();
ErrorMessageReqData
data
=
new
ErrorMessageReqData
();
data
.
setTransactionSerialNumber
(
Ocpp16Helper
.
strToBcd
(
"3201020000000011151116155535026"
,
data
.
getTransactionSerialNumber
()));
data
.
setPileId
(
Ocpp16Helper
.
strToBcd
(
"32010200000001"
,
data
.
getPileId
()));
data
.
setGunNumber
((
byte
)
1
);
byte
[]
messageTimeOut1
=
new
byte
[]{(
byte
)
0x00
,
0x00
};
data
.
setMessageTimeOut1
(
messageTimeOut1
);
data
.
setMessageTimeOut2
(
messageTimeOut1
);
byte
[]
reserved1
=
new
byte
[]{(
byte
)
0x00
,
0x00
,
0x00
,
0x00
};
data
.
setReserved1
(
reserved1
);
data
.
setTimeSyncMachineMaxOutputMessageTimeout
(
messageTimeOut1
);
data
.
setMachineChargingCompletionMessageTimeout
(
messageTimeOut1
);
data
.
setReserved2
(
reserved1
);
data
.
setMachineChargingStatusMessageTimeout
(
messageTimeOut1
);
data
.
setMachineAbortingMessageTimeout
(
messageTimeOut1
);
data
.
setReserved3
(
reserved1
);
data
.
setMachineChargingStatisticsMessageTimeout
(
messageTimeOut1
);
byte
[]
bmsOther
=
new
byte
[]{(
byte
)
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
};
data
.
setBmsOther
(
bmsOther
);
data
.
setBmsCarRecognitionMessageTimeout
(
messageTimeOut1
);
data
.
setReserved4
(
reserved1
);
data
.
setBatteryChargingParamMessageTimeout
(
messageTimeOut1
);
data
.
setBatteryChargingCompletionMessageTimeout
(
messageTimeOut1
);
data
.
setReserved5
(
reserved1
);
data
.
setBmsChargingStatusMessageTimeout
(
messageTimeOut1
);
data
.
setBmsChargingDemandMessageTimeout
(
messageTimeOut1
);
data
.
setBmsChargingAbortingMessageTimeout
(
messageTimeOut1
);
data
.
setReserved6
(
reserved1
);
data
.
setBmsChargingStatisticsMessageTimeout
(
messageTimeOut1
);
data
.
setMachineOther
(
bmsOther
);
req
.
setData
(
data
);
client
.
sendSync
(
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