aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/GoSafeProtocolDecoder.java14
-rw-r--r--test/org/traccar/protocol/GoSafeProtocolDecoderTest.java3
2 files changed, 10 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
index 40a0d4d73..deeea2333 100644
--- a/src/org/traccar/protocol/GoSafeProtocolDecoder.java
+++ b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -69,13 +69,13 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder {
.groupEnd()
.groupBegin()
.text("GSM:")
- .number("d+;") // registration
- .number("d+;") // gsm signal
+ .number("d*;") // registration
+ .number("d*;") // gsm signal
.number("(d+);") // mcc
.number("(d+);") // mnc
.number("(x+);") // lac
.number("(x+);") // cid
- .number("-d+") // rssi
+ .number("(-d+)") // rssi
.expression("[^,]*,?")
.groupEnd("?")
.groupBegin()
@@ -86,8 +86,8 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder {
.groupEnd("?")
.groupBegin()
.text("ADC:")
- .number("(d+.d+);") // power
- .number("(d+.d+),?") // battery
+ .number("(d+.d+)") // power
+ .number("(?:;(d+.d+))?,?") // battery
.groupEnd("?")
.groupBegin()
.text("DTT:")
@@ -158,7 +158,7 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder {
if (parser.hasNext(4)) {
position.setNetwork(new Network(CellTower.from(
- parser.nextInt(), parser.nextInt(), parser.nextInt(16), parser.nextInt(16))));
+ parser.nextInt(), parser.nextInt(), parser.nextInt(16), parser.nextInt(16), parser.nextInt())));
}
if (parser.hasNext()) {
position.set(Position.KEY_ODOMETER, parser.nextInt());
diff --git a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java
index b8f98d8b9..08bfa3f80 100644
--- a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class GoSafeProtocolDecoderTest extends ProtocolTest {
GoSafeProtocolDecoder decoder = new GoSafeProtocolDecoder(new GoSafeProtocol());
verifyPositions(decoder, text(
+ "*GS26,356449061046586,082522030117,,SYS:G737IC;V1.13;V1.0.5,GPS:V;5;N42.594136;W70.723832;0;0;8;2.06,GSM:;;310;260;C76D;9F1D;-85,ADC:3.86,DTT:3918C;;0;0;0;1,#"));
+
+ verifyPositions(decoder, text(
"*GS56,357330051092344,123918301116,10,GPS:L;9;N47.582920;W122.238720;0;0;102;0.99,GSM:0;0;310;410;A7DB;385C;-86,COT:76506,ADC:0.82;3.77,DTT:2184;;0;0;10000;0$000000000000,86,GPS:A;6;N47.582912;W122.238840;0;0;88;2.20,COT:76506,ADC:0.00;3.75,DTT:0;;0;0;40;0$000000000000,86,GPS:A;6;N47.582912;W122.238840;0;0;88;2.20,COT:76506,ADC:0.00;3.74,DTT:0;;0;0;40;0$000000000000,93,GPS:A;6;N47.582912;W122.238840;0;0;88;2.20,COT:76506,ADC:0.00;3.73,DTT:8000;;0;0;80000;0$000000000000,13,GPS:L;6;N47.582912;W122.238840;0;0;88;2.20,COT:76506,ADC:11.09;3.79,DTT:2004;;0;0;80000;0$000000000000,90,GPS:L;6;N47.582912;W122.238840;0;0;88;2.20,COT:76506,ADC:11.13;3.79,DTT:23004;;0;0;10000;0$000000000000,,GPS:L;6;N47.582912;W122.238840;0;0;88;2.20,GSM:5;2;310;410;A7DB;385C;-89,COT:76506,ADC:14.12;3.81,DTT:23184;;0;0;0;6#"));
verifyPositions(decoder, text(