diff options
-rw-r--r-- | src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java | 13 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/MobilogixProtocolDecoderTest.java | 7 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java b/src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java index edce2d52f..8677ba9ec 100644 --- a/src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java @@ -45,10 +45,13 @@ public class MobilogixProtocolDecoder extends BaseProtocolDecoder { .expression("([^,]+),") // serial number .number("(xx),") // status .number("(d+.d+),") // battery + .number("(d)") // valid + .number("(d)") // rssi + .number("(d),") // satellites .number("(-?d+.d+),") // latitude .number("(-?d+.d+),") // longitude - .number("(d+.d+),") // speed - .number("(d+.d+)") // course + .number("(d+.?d*),") // speed + .number("(d+.?d*)") // course .any() .compile(); @@ -92,7 +95,11 @@ public class MobilogixProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY, parser.nextDouble()); - position.setValid(true); + position.setValid(parser.nextInt() > 0); + + position.set(Position.KEY_RSSI, parser.nextInt()); + position.set(Position.KEY_SATELLITES, parser.nextInt()); + position.setLatitude(parser.nextDouble()); position.setLongitude(parser.nextDouble()); position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); diff --git a/src/test/java/org/traccar/protocol/MobilogixProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MobilogixProtocolDecoderTest.java index feee99021..875a79b42 100644 --- a/src/test/java/org/traccar/protocol/MobilogixProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/MobilogixProtocolDecoderTest.java @@ -11,13 +11,10 @@ public class MobilogixProtocolDecoderTest extends ProtocolTest { MobilogixProtocolDecoder decoder = new MobilogixProtocolDecoder(null); verifyNull(decoder, text( - "[2020-09-25 21:21:43,T1,1,V1.1.1,201951132415,,,12345678,724108034109376,359366080215256")); + "[2020-12-01 14:00:22,T1,1,V1.1.1,201951132031,,,12345678,724108005415815,359366080211420")); verifyPosition(decoder, text( - "[2011-12-15 10:00:00,T2,1,V1.0.0,A123045612AA123488,1B,4.5,22.564152,113.252432,50.6,270.5,1,460:00:10101:03633")); - - verifyPosition(decoder, text( - "[2011-12-15 10:00:00,T3,1,V1.0.0,A123045612AA123488,1B,4.5,22.564152,113.252432,50.6,270.5,1")); + "[2020-12-01 12:01:09,T3,1,V1.1.1,201951132031,3B,12.99,022,-23.563410,-46.588055,0,0")); } |