aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-16 22:38:03 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-16 22:38:03 +1300
commit4d9157995627d6a6ba226e01e8580edcfb1e682b (patch)
tree763f9cb14edb6eebdb5358faa7d54b5e236f8c14
parent4b36a0f1b95c1a4f4f12442d7cf075626b8fdbef (diff)
downloadtraccar-server-4d9157995627d6a6ba226e01e8580edcfb1e682b.tar.gz
traccar-server-4d9157995627d6a6ba226e01e8580edcfb1e682b.tar.bz2
traccar-server-4d9157995627d6a6ba226e01e8580edcfb1e682b.zip
Fix GoSafe protocol decoder
-rw-r--r--src/org/traccar/protocol/GoSafeProtocolDecoder.java5
-rw-r--r--test/org/traccar/protocol/GoSafeProtocolDecoderTest.java3
2 files changed, 7 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
index d32322d48..cba045122 100644
--- a/src/org/traccar/protocol/GoSafeProtocolDecoder.java
+++ b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
@@ -64,11 +64,14 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder {
.xpr(",?")
.groupEnd(false)
.groupBegin()
+ .txt("GSM:").not(",").xpr(",?")
+ .groupEnd(true)
+ .groupBegin()
.txt("COT:")
.num("(d+)") // odometer
.opn(";d+:d+:d+") // engine hours
.xpr(",?")
- .groupEnd(false)
+ .groupEnd(true)
.groupBegin()
.txt("ADC:")
.num("(d+.d+);") // power
diff --git a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java
index 7148a0ab3..2adf92ee4 100644
--- a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java
@@ -13,6 +13,9 @@ public class GoSafeProtocolDecoderTest extends ProtocolDecoderTest {
assertNull(decoder.decode(null, null,
"*GS16,351535058709775"));
+
+ verify(decoder.decode(null, null,
+ "*GS16,351535059439208,103441131015,,GPS:A;8;N31.960122;E35.921652;27;99;847;1.33;2.41,GSM:1;4;416;3;AF0;9C73;-61;416;3;AF0;9C89;-68,OBD:04410C0DA403410D0B03411C010341057A037F011203411100$103453131015,,GPS:A;8;N31.959976;E35.922144;6;0;835;1.33;2.41,GSM:1;4;416;3;AF0;9C73;-67;416;3;AF0;9C89;-64;416;3;AF0;B389;-83,OBD:04410C0D8E03410D0B03411C010341057D037F011203411100$103503131015,,GPS:A;9;N31.959870;E35.922284;11;127;830;1.33;2.41,GSM:1;4;416;3;AF0;9C73;-67;416;3;AF0;9C89;-64;416;3;AF0;B389;-83,OBD:04410C0D8E03410D0B03411C010341057D037F011203411100$103513131015,,GPS:A;9;N31.959742;E35.922516;10;106;830;1.37;2.91,GSM:1;4;416;3;AF0;9C73;-67;416;3;AF0;9C89;-64;416;3;AF0;B389;-83,OBD:04410C0D1003410D0603411C010341057E037F011203411100$103553131015,,GPS:A;8;N31.959564;E35.923308;6;0;836;1.41;2.43,GSM:1;4;416;3;AF0;9C73;-65;416;3;AF0;B389;-71;416;3;AF0;9C89;-74,OBD:04410C0DAE03410D0403411C010341057C037F011203411100#"));
verify(decoder.decode(null, null,
"*GS16,351535058709775,100356130215,,SYS:G79W;V1.06;V1.0.2,GPS:A;6;N24.802700;E46.616828;0;0;684;1.35,COT:60,ADC:4.31;0.10,DTT:20000;;0;0;0;1"));