Skip to content

Commit

Permalink
Fix an issue in GpsMaker protocol decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Aug 26, 2016
1 parent a394398 commit 06eb72a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/org/traccar/protocol/GpsMarkerProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
* Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com)
* Copyright 2015 - 2016 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -45,7 +45,7 @@ public GpsMarkerProtocolDecoder(GpsMarkerProtocol protocol) {
.number("(ddd)(dd)(dddd)") // longitude
.number("(ddd)") // speed
.number("(ddd)") // course
.number("(d)") // satellites
.number("(x)") // satellites
.number("(dd)") // battery
.number("(d)") // input
.number("(d)") // output
Expand Down Expand Up @@ -82,7 +82,7 @@ protected Object decode(
position.setSpeed(parser.nextDouble());
position.setCourse(parser.nextDouble());

position.set(Position.KEY_SATELLITES, parser.next());
position.set(Position.KEY_SATELLITES, parser.nextInt(16));
position.set(Position.KEY_BATTERY, parser.next());
position.set(Position.KEY_INPUT, parser.next());
position.set(Position.KEY_OUTPUT, parser.next());
Expand Down
2 changes: 2 additions & 0 deletions test/org/traccar/protocol/GpsMarkerProtocolDecoderTest.java
Expand Up @@ -11,6 +11,8 @@ public void testDecode() throws Exception {

GpsMarkerProtocolDecoder decoder = new GpsMarkerProtocolDecoder(new GpsMarkerProtocol());

verifyPosition(decoder, text(
"$GM23D863071014445404T260816142611N55441051E037325071033063C0530304#"));

verifyNothing(decoder, text(
"$GM300350123456789012T100511123300G25000001772F185200000000000000005230298#"));
Expand Down

0 comments on commit 06eb72a

Please sign in to comment.