Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
signal
traffic-signal-platform
Commits
0b2c4ba0
Commit
0b2c4ba0
authored
Jun 09, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 信号机心跳测试
parent
9927b379
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
CommandResultSign.java
...in/java/net/wanji/com/common/enums/CommandResultSign.java
+1
-1
HeartBeatService.java
...a/net/wanji/com/netty/response/impl/HeartBeatService.java
+11
-7
No files found.
signal-utc-dt-service/src/main/java/net/wanji/com/common/enums/CommandResultSign.java
View file @
0b2c4ba0
...
...
@@ -10,7 +10,7 @@ import org.apache.commons.lang3.StringUtils;
@Getter
public
enum
CommandResultSign
{
HEARTBEAT
(
"
55ab
"
,
"heartBeatService"
),
HEARTBEAT
(
"
7e00
"
,
"heartBeatService"
),
GET_DEVICE_INFO
(
"2001"
,
"getDeviceInfoService"
),
GET_SIGNAL_BASE_INFO
(
"2002"
,
"getBaseInfoService"
),
GET_LIGHTS_GROUP_INFO
(
"2003"
,
"getLightsGroupInfoService"
),
...
...
signal-utc-dt-service/src/main/java/net/wanji/com/netty/response/impl/HeartBeatService.java
View file @
0b2c4ba0
package
net
.
wanji
.
com
.
netty
.
response
.
impl
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.com.common.constants.Constants
;
import
net.wanji.com.netty.NettyClient
;
import
net.wanji.com.netty.pojo.CommandPojo
;
import
net.wanji.com.netty.response.CommandResponseFactory
;
import
net.wanji.com.pojo.netty.MessageResultPojo
;
import
net.wanji.com.util.CRC16Utils
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
...
...
@@ -22,13 +24,15 @@ public class HeartBeatService implements CommandResponseFactory {
@Scheduled
(
fixedRate
=
1000
,
initialDelay
=
10
*
1000
)
public
void
heartbeat
()
{
// String body = String.format("%02x", Constants.COMMAND_HEARTBEAT.length() / 2).concat(Constants.COMMAND_HEARTBEAT);
// String crc16HexStr = CRC16Utils.getCRC16HexStr(body);
// String heartBeatRequest = Constants.buildMessageBody(body, crc16HexStr);
// MessageResultPojo resultPojo2 = NettyClient.sendMessage("10.102.1.204", 5050, heartBeatRequest, "55ab", 300);
String
body
=
String
.
format
(
"%02x"
,
Constants
.
COMMAND_HEARTBEAT
.
length
()
/
2
).
concat
(
Constants
.
COMMAND_HEARTBEAT
);
String
crc16HexStr
=
CRC16Utils
.
getCRC16HexStr
(
body
);
String
heartBeatRequest
=
Constants
.
buildMessageBody
(
body
,
crc16HexStr
);
MessageResultPojo
resultPojo2
=
NettyClient
.
sendMessage
(
"10.102.1.204"
,
4050
,
heartBeatRequest
,
"7e00"
,
300
);
log
.
info
(
"信号返回字符串:{}"
,
resultPojo2
.
getHexMessageResult
());
String
str
=
"55ac00000000000017050f11060b0000000000000000000000000000000000"
;
MessageResultPojo
resultPojo
=
NettyClient
.
sendMessage
(
"10.102.1.204"
,
5050
,
str
,
"55ab"
,
300
);
log
.
info
(
"信号返回字符串:{}"
,
resultPojo
.
getHexMessageResult
());
// String str = "55ac00000000000017050f11060b0000000000000000000000000000000000";
// MessageResultPojo resultPojo = NettyClient.sendMessage("10.102.1.204", 4050, str, "55ab", 300);
// log.info("信号返回字符串:{}", resultPojo.getHexMessageResult());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment