aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-11-25 20:59:52 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2020-11-25 20:59:52 -0800
commit91a83142c78e0c5927a4eb4a3604d8524e77baa3 (patch)
treeadd64e5dd95859b68dd0ce638b718aa24d0875a5
parent492dbe8014c4ffd83e92c641ddf416bb5bca5b8b (diff)
downloadtrackermap-server-91a83142c78e0c5927a4eb4a3604d8524e77baa3.tar.gz
trackermap-server-91a83142c78e0c5927a4eb4a3604d8524e77baa3.tar.bz2
trackermap-server-91a83142c78e0c5927a4eb4a3604d8524e77baa3.zip
Change Mobilogix frame decoder
-rw-r--r--src/main/java/org/traccar/protocol/MobilogixProtocol.java4
-rw-r--r--src/test/java/org/traccar/protocol/MobilogixProtocolDecoderTest.java6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/MobilogixProtocol.java b/src/main/java/org/traccar/protocol/MobilogixProtocol.java
index 82f72db86..b93275079 100644
--- a/src/main/java/org/traccar/protocol/MobilogixProtocol.java
+++ b/src/main/java/org/traccar/protocol/MobilogixProtocol.java
@@ -15,10 +15,10 @@
*/
package org.traccar.protocol;
-import io.netty.handler.codec.LineBasedFrameDecoder;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;
import org.traccar.BaseProtocol;
+import org.traccar.CharacterDelimiterFrameDecoder;
import org.traccar.PipelineBuilder;
import org.traccar.TrackerServer;
@@ -28,7 +28,7 @@ public class MobilogixProtocol extends BaseProtocol {
addServer(new TrackerServer(false, getName()) {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
- pipeline.addLast(new LineBasedFrameDecoder(1024));
+ pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, ']'));
pipeline.addLast(new StringEncoder());
pipeline.addLast(new StringDecoder());
pipeline.addLast(new MobilogixProtocolDecoder(MobilogixProtocol.this));
diff --git a/src/test/java/org/traccar/protocol/MobilogixProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MobilogixProtocolDecoderTest.java
index c7772557e..feee99021 100644
--- a/src/test/java/org/traccar/protocol/MobilogixProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MobilogixProtocolDecoderTest.java
@@ -11,13 +11,13 @@ public class MobilogixProtocolDecoderTest extends ProtocolTest {
MobilogixProtocolDecoder decoder = new MobilogixProtocolDecoder(null);
verifyNull(decoder, text(
- "[2020-09-25 21:21:43,T1,1,V1.1.1,201951132415,,,12345678,724108034109376,359366080215256]"));
+ "[2020-09-25 21:21:43,T1,1,V1.1.1,201951132415,,,12345678,724108034109376,359366080215256"));
verifyPosition(decoder, text(
- "[2011-12-15 10:00:00,T2,1,V1.0.0,A123045612AA123488,1B,4.5,22.564152,113.252432,50.6,270.5,1,460:00:10101:03633]"));
+ "[2011-12-15 10:00:00,T2,1,V1.0.0,A123045612AA123488,1B,4.5,22.564152,113.252432,50.6,270.5,1,460:00:10101:03633"));
verifyPosition(decoder, text(
- "[2011-12-15 10:00:00,T3,1,V1.0.0,A123045612AA123488,1B,4.5,22.564152,113.252432,50.6,270.5,1]"));
+ "[2011-12-15 10:00:00,T3,1,V1.0.0,A123045612AA123488,1B,4.5,22.564152,113.252432,50.6,270.5,1"));
}