aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2022-01-22 18:27:02 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2022-01-22 18:27:02 -0800
commita8af4b7d0b7eec1e3076bd51bc2e81c6df0626ac (patch)
tree3d0f2db26a0274f54279501e32ccf74cd19ff0f1
parentb918660950f459959c3a975c558448c907d6a3b4 (diff)
downloadtrackermap-server-a8af4b7d0b7eec1e3076bd51bc2e81c6df0626ac.tar.gz
trackermap-server-a8af4b7d0b7eec1e3076bd51bc2e81c6df0626ac.tar.bz2
trackermap-server-a8af4b7d0b7eec1e3076bd51bc2e81c6df0626ac.zip
Update Armoli frame decoder
-rw-r--r--src/main/java/org/traccar/protocol/ArmoliProtocol.java2
-rw-r--r--src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java2
-rw-r--r--src/test/java/org/traccar/protocol/ArmoliProtocolDecoderTest.java10
3 files changed, 7 insertions, 7 deletions
diff --git a/src/main/java/org/traccar/protocol/ArmoliProtocol.java b/src/main/java/org/traccar/protocol/ArmoliProtocol.java
index 7ee4289b0..dec8c6fe0 100644
--- a/src/main/java/org/traccar/protocol/ArmoliProtocol.java
+++ b/src/main/java/org/traccar/protocol/ArmoliProtocol.java
@@ -28,7 +28,7 @@ public class ArmoliProtocol extends BaseProtocol {
addServer(new TrackerServer(false, getName()) {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
- pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '\r'));
+ pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, ";\r", ";"));
pipeline.addLast(new StringEncoder());
pipeline.addLast(new StringDecoder());
pipeline.addLast(new ArmoliProtocolDecoder(ArmoliProtocol.this));
diff --git a/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java b/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
index b1140d79c..400e4ad89 100644
--- a/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
@@ -78,7 +78,7 @@ public class ArmoliProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
position.set(
Position.KEY_RESULT,
- sentence.substring(sentence.indexOf(',') + 1, sentence.length() - 2));
+ sentence.substring(sentence.indexOf(',') + 1, sentence.length() - 1));
return position;
}
} else if (channel != null && (type == 'Q' || type == 'L')) {
diff --git a/src/test/java/org/traccar/protocol/ArmoliProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ArmoliProtocolDecoderTest.java
index d3269e7d3..c64fbd411 100644
--- a/src/test/java/org/traccar/protocol/ArmoliProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ArmoliProtocolDecoderTest.java
@@ -12,20 +12,20 @@ public class ArmoliProtocolDecoderTest extends ProtocolTest {
var decoder = new ArmoliProtocolDecoder(null);
verifyPosition(decoder, text(
- "[M869867038698074210122125205N38.735641E035.4727751E003340000000C00000E9E07FF:106AG505283H60E];"));
+ "[M869867038698074210122125205N38.735641E035.4727751E003340000000C00000E9E07FF:106AG505283H60E]"));
verifyAttribute(decoder, text(
- "[W869867038698074,O,1234,2657,1];"),
+ "[W869867038698074,O,1234,2657,1]"),
Position.KEY_RESULT, "O,1234,2657,1");
verifyNull(decoder, text(
- "[Q010001088610010024363698990011101070608200,05XXXXXXXXX,10.49.182.53,C,1,20,19,0];"));
+ "[Q010001088610010024363698990011101070608200,05XXXXXXXXX,10.49.182.53,C,1,20,19,0]"));
verifyPosition(decoder, text(
- "[M860906041293587100122061310N40.792751E029.4313092801143000000010003513209FFGC18080H8DA#E209C4];"));
+ "[M860906041293587100122061310N40.792751E029.4313092801143000000010003513209FFGC18080H8DA#E209C4]"));
verifyNull(decoder, text(
- "[L866104027971681];"));
+ "[L866104027971681]"));
}