diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-29 10:50:55 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-29 10:50:55 +1300 |
commit | e4cca2ad0dfbf3ecd60785b6974f5f16ac2f66ea (patch) | |
tree | 68d0c5e55f45067983789e11850b2ac074c4f07d | |
parent | 4610c2245dea9178ff46e7eea63b9fffd99f852d (diff) | |
parent | e134adb5f7518c6e38782166666d3de71e0a5f69 (diff) | |
download | trackermap-server-e4cca2ad0dfbf3ecd60785b6974f5f16ac2f66ea.tar.gz trackermap-server-e4cca2ad0dfbf3ecd60785b6974f5f16ac2f66ea.tar.bz2 trackermap-server-e4cca2ad0dfbf3ecd60785b6974f5f16ac2f66ea.zip |
Merge pull request #1484 from vitalidze/master
Another version of GlobalSat protocol
-rw-r--r-- | src/org/traccar/protocol/GlobalSatProtocolDecoder.java | 8 | ||||
-rw-r--r-- | test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java | 7 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java index 049bb2f7f..b4c64f750 100644 --- a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java +++ b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java @@ -180,7 +180,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder { .text("$") .number("(d+),") // imei .number("d+,") // mode - .number("(d),") // fix + .number("(d+),") // fix .number("(dd)(dd)(dd),") // date (ddmmyy) .number("(dd)(dd)(dd),") // time (hhmmss) .expression("([EW])") @@ -189,8 +189,8 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder { .number("(dd)(dd.d+),") // latitude (ddmm.mmmm) .number("(d+.?d*),") // altitude .number("(d+.?d*),") // speed - .number("(d+.?d*),") // course - .number("(d+),") // satellites + .number("(d+.?d*)?,") // course + .number("(d+)[,*]") // satellites .number("(d+.?d*)") // hdop .compile(); @@ -209,7 +209,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(getDeviceId()); - position.setValid(parser.next().equals("1")); + position.setValid(!parser.next().equals("1")); DateBuilder dateBuilder = new DateBuilder() .setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt()) diff --git a/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java b/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java index 97b9f4aaa..3a6e04a3d 100644 --- a/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java @@ -46,6 +46,13 @@ public class GlobalSatProtocolDecoderTest extends ProtocolDecoderTest { verifyPosition(decoder, text( "GSr,GTR-128,013227006963064,0080,1,a080,3,190615,163816,W07407.7134,N0440.8601,2579,0.01,130,12,0.7,11540mV,0,77,14,\"732,123,0744,2fc1,41,23\",\"732,123,0744,2dfe,05,28\",\"732,123,0744,272a,15,21\",\"732,123,0744,2f02,27,23\"*3b!")); + verifyPosition(decoder, text( + "$80050377796567,0,13,281015,173437,E08513.28616,N5232.85432,222.3,0.526,,07*37" + ), position("2015-10-28 17:34:37.000", true, 52.54757, 85.22144)); + + verifyPosition(decoder, text( + "$80050377796567,0,18,281015,191919,E08513.93290,N5232.42141,193.4,37.647,305.40,07*37" + ), position("2015-10-28 19:19:19.000", true, 52.54036, 85.23222)); } } |