From 829a9456482797109d359bd5d65bc7bf747a35fc Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 9 May 2016 15:00:50 +1200 Subject: Fix GL200 FRI message decoding --- src/org/traccar/protocol/Gl200ProtocolDecoder.java | 5 +++-- test/org/traccar/protocol/Gl200ProtocolDecoderTest.java | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java index 617f0f541..f1211f279 100644 --- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java @@ -396,8 +396,6 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { position.set(Event.PREFIX_ADC + 1, parser.next()); position.set(Event.PREFIX_ADC + 2, parser.next()); position.set(Event.KEY_BATTERY, parser.next()); - position.set(Event.KEY_RPM, parser.next()); - position.set(Event.KEY_FUEL, parser.next()); if (parser.hasNext(3)) { int ignition = parser.nextInt(16); @@ -410,6 +408,9 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_OUTPUT, parser.nextInt(16)); } + position.set(Event.KEY_RPM, parser.next()); + position.set(Event.KEY_FUEL, parser.next()); + // workaround for wrong location time if (parser.hasNext(6)) { DateBuilder dateBuilder = new DateBuilder() diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java index 81439d578..126b3a904 100644 --- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class Gl200ProtocolDecoderTest extends ProtocolTest { Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(new Gl200Protocol()); + verifyPositions(decoder, text( + "+RESP:GTFRI,360201,864251020186064,1G1JC5444R7252367,,12802,10,1,0,0.0,0,219.5,-76.661456,39.832588,20160507132235,,,,,,20460.9,00080:03:37,,,100,210000,791,,56,20160507132239,0233$")); + verifyPositions(decoder, text( "+RESP:GTFRI,1F0101,135790246811220,1G1JC5444R7252367,,,00,2,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,0,4.3,92,70.0,121.354335,31.222073,20090101000000,0460,0000,18d8,6141,00,2000.0,12345:12:34,,,80,210100,,,50,20090214093254,11F0$")); -- cgit v1.2.3