aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-03-06 16:23:24 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2021-03-06 16:23:24 -0800
commit7f28cbe9a997fb5271ece16f30383d7cc4241575 (patch)
tree0ca3a8a8b386dd745af86423e81dd068a89ede46
parentb6eed4bde62316d66c28d3cb029df6e537be17a5 (diff)
downloadtrackermap-server-7f28cbe9a997fb5271ece16f30383d7cc4241575.tar.gz
trackermap-server-7f28cbe9a997fb5271ece16f30383d7cc4241575.tar.bz2
trackermap-server-7f28cbe9a997fb5271ece16f30383d7cc4241575.zip
Send heartbeat response
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java5
-rw-r--r--src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java3
2 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
index a3d16cb62..e715547ed 100644
--- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,6 +45,7 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_GENERAL_RESPONSE = 0x8001;
public static final int MSG_GENERAL_RESPONSE_2 = 0x4401;
+ public static final int MSG_HEARTBEAT = 0x0002;
public static final int MSG_TERMINAL_REGISTER = 0x0100;
public static final int MSG_TERMINAL_REGISTER_RESPONSE = 0x8100;
public static final int MSG_TERMINAL_CONTROL = 0x8105;
@@ -171,7 +172,7 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
formatMessage(MSG_TERMINAL_REGISTER_RESPONSE, id, false, response), remoteAddress));
}
- } else if (type == MSG_TERMINAL_AUTH) {
+ } else if (type == MSG_TERMINAL_AUTH || type == MSG_HEARTBEAT) {
sendGeneralResponse(channel, remoteAddress, id, type, index);
diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
index 552b5bb2d..6accd6305 100644
--- a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
@@ -109,6 +109,9 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, binary(
"7e020000220014012499170007000000000000400e012af16f02cbd2ba000000000000150101194257010400000077a97e"));
+ verifyNull(decoder, binary(
+ "7e0002000004304832546500b7ca7e"));
+
}
}