diff options
-rw-r--r-- | src/org/traccar/protocol/GenxProtocolDecoder.java | 19 | ||||
-rw-r--r-- | test/org/traccar/protocol/GenxProtocolDecoderTest.java | 5 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/GenxProtocolDecoder.java b/src/org/traccar/protocol/GenxProtocolDecoder.java index 3b716796c..ebf6f2b53 100644 --- a/src/org/traccar/protocol/GenxProtocolDecoder.java +++ b/src/org/traccar/protocol/GenxProtocolDecoder.java @@ -19,6 +19,7 @@ import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.Context; import org.traccar.DeviceSession; +import org.traccar.helper.UnitsConverter; import org.traccar.model.Position; import java.net.SocketAddress; @@ -68,6 +69,24 @@ public class GenxProtocolDecoder extends BaseProtocolDecoder { case 4: position.setLongitude(Double.parseDouble(values[i])); break; + case 11: + position.set(Position.KEY_IGNITION, values[i].equals("ON")); + break; + case 13: + position.setSpeed(UnitsConverter.knotsFromKph(Integer.parseInt(values[i]))); + break; + case 17: + position.setCourse(Integer.parseInt(values[i])); + break; + case 23: + position.set(Position.KEY_ODOMETER, Double.parseDouble(values[i]) * 1000); + break; + case 27: + position.setAltitude(UnitsConverter.metersFromFeet(Integer.parseInt(values[i]))); + break; + case 46: + position.set(Position.KEY_SATELLITES, Integer.parseInt(values[i])); + break; default: break; } diff --git a/test/org/traccar/protocol/GenxProtocolDecoderTest.java b/test/org/traccar/protocol/GenxProtocolDecoderTest.java index 43d9e7d6e..9c49839c4 100644 --- a/test/org/traccar/protocol/GenxProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GenxProtocolDecoderTest.java @@ -16,11 +16,14 @@ public class GenxProtocolDecoderTest extends ProtocolTest { verifyPosition(decoder, text( "000036004130,08/31/2017 17:24:37,45.47257,-73.65506,3,0,117,1.14,124,ON,1489,0,5,N,0,0.000,-95.0,-1.0,0,0.0000,0.0000,0.000,0,0.00,0.00,0.00,NA,U,UUU,0,-95.0,U")); - decoder.setReportColumns("1,2,3,4"); + decoder.setReportColumns("1,2,3,4,13,17,10,23,27,11,7,8,46,56,59,70,74,75,77,89,90,93,99,107,112,113,114,176,175,178,181,182"); verifyPosition(decoder, text( "000036035855,04/16/2017 21:19:07,45.46485,-73.65424,24,32,61:213,342.51,157,ON,20984,0,12,O,18,0.000,95.0,24.0,1990,64.0894,0.0219,316.009,71,0.00,16.78,5.10,NA,U,UUU,0,-95.0,U")); + verifyPosition(decoder, text( + "000036004129,10/20/2017 00:54:27,43.44638,-79.68616,36,310,6,4954.40,321,ON,35377,0,12,O,13,0.000,85.6,36.0,1573,451.2514,0.0012,5260.953,0,0.00,122.48,33.17,NA,U,UUU,0,-95.0,U")); + } } |