aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-11-25 08:48:53 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2020-11-25 08:48:53 -0800
commit146a4c1c0d9c4e80454d9ed382db226af41670a0 (patch)
tree022c7b6d7521b5a682e7451a2d7e5b2a794ff5b5 /src
parentcdf892cd39c528929284728562beef3220e91cf3 (diff)
downloadtraccar-server-146a4c1c0d9c4e80454d9ed382db226af41670a0.tar.gz
traccar-server-146a4c1c0d9c4e80454d9ed382db226af41670a0.tar.bz2
traccar-server-146a4c1c0d9c4e80454d9ed382db226af41670a0.zip
Fix OKO decoding (fix #4609)
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/OkoProtocolDecoder.java4
-rw-r--r--src/test/java/org/traccar/protocol/OkoProtocolDecoderTest.java3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/OkoProtocolDecoder.java b/src/main/java/org/traccar/protocol/OkoProtocolDecoder.java
index 4d9c9afc4..fa35ab455 100644
--- a/src/main/java/org/traccar/protocol/OkoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/OkoProtocolDecoder.java
@@ -49,8 +49,8 @@ public class OkoProtocolDecoder extends BaseProtocolDecoder {
.number("(d+.d+|xx),") // adc
.number("(xx),") // event
.number("(d+.d+|xx),") // power
- .number("d,") // memory status
- .number("(xx)?") // io
+ .number("d") // memory status
+ .number(",(xx)").optional() // io
.any()
.compile();
diff --git a/src/test/java/org/traccar/protocol/OkoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/OkoProtocolDecoderTest.java
index d6b8e9a4a..19fb25135 100644
--- a/src/test/java/org/traccar/protocol/OkoProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/OkoProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class OkoProtocolDecoderTest extends ProtocolTest {
OkoProtocolDecoder decoder = new OkoProtocolDecoder(null);
verifyPosition(decoder, text(
+ "{861001001012919,090745,A,4944.302,N,02353.366,E,0.0,225,251120,7,0.27,F9,11.3,1}"));
+
+ verifyPosition(decoder, text(
"{868204000482330,125138,A,5026.821,N,03032.472,E,0.0,171,240200,7,00,F9,7D,1,,,,,,,91,,,187.7,M,2,,}"));
verifyPosition(decoder, text(