aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-07-14 22:22:52 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-07-14 22:22:52 -0700
commitedeb03b40d04be2c75eb736e35afc3b324da0cf2 (patch)
treea20333cfeeaf913d553834b70d51a86cc6a8aff0 /src
parent9d057f8c87af2df410f65e5f70f26c59b3192fcb (diff)
downloadtrackermap-server-edeb03b40d04be2c75eb736e35afc3b324da0cf2.tar.gz
trackermap-server-edeb03b40d04be2c75eb736e35afc3b324da0cf2.tar.bz2
trackermap-server-edeb03b40d04be2c75eb736e35afc3b324da0cf2.zip
Support acknowledgement
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/EasyTrackProtocolDecoder.java10
-rw-r--r--src/test/java/org/traccar/protocol/EasyTrackProtocolDecoderTest.java3
2 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/EasyTrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/EasyTrackProtocolDecoder.java
index 81a31e1d1..889e2bf09 100644
--- a/src/main/java/org/traccar/protocol/EasyTrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/EasyTrackProtocolDecoder.java
@@ -18,6 +18,7 @@ package org.traccar.protocol;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
+import org.traccar.NetworkMessage;
import org.traccar.Protocol;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
@@ -93,7 +94,14 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder {
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
- Parser parser = new Parser(PATTERN, (String) msg);
+ String sentence = (String) msg;
+ String type = sentence.substring(20, 22);
+
+ if (type.equals("TX") && channel != null) {
+ channel.writeAndFlush(new NetworkMessage(sentence + "#", remoteAddress));
+ }
+
+ Parser parser = new Parser(PATTERN, sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/test/java/org/traccar/protocol/EasyTrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/EasyTrackProtocolDecoderTest.java
index 1ea608b04..c86e14db2 100644
--- a/src/test/java/org/traccar/protocol/EasyTrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/EasyTrackProtocolDecoderTest.java
@@ -10,6 +10,9 @@ public class EasyTrackProtocolDecoderTest extends ProtocolTest {
EasyTrackProtocolDecoder decoder = new EasyTrackProtocolDecoder(null);
+ verifyNull(decoder, text(
+ "*ET,354522180045564,TX,V,14070E,122336"));
+
verifyPosition(decoder, text(
"*ET,135790246811221,HB,A,050915,0C2A27,00CE5954,04132263,0000,F000,01000000,20,4,0000,00F123,100,4845423835,0091564212,0B45,10.00,9"));