diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-07-11 05:09:25 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-07-11 05:09:25 +1200 |
commit | 85f7eae47ec4bf6b269305a05a696f9acce31fd5 (patch) | |
tree | 2140777c5561512413d2482909dc607ee554e203 | |
parent | 96b48f5cb2bf214059de2875194634b0801fcc94 (diff) | |
download | trackermap-server-85f7eae47ec4bf6b269305a05a696f9acce31fd5.tar.gz trackermap-server-85f7eae47ec4bf6b269305a05a696f9acce31fd5.tar.bz2 trackermap-server-85f7eae47ec4bf6b269305a05a696f9acce31fd5.zip |
Support Gelileo command response
-rw-r--r-- | src/org/traccar/protocol/GalileoProtocolDecoder.java | 10 | ||||
-rw-r--r-- | test/org/traccar/protocol/GalileoProtocolDecoderTest.java | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java index 0e8163f8c..3944b37de 100644 --- a/src/org/traccar/protocol/GalileoProtocolDecoder.java +++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java @@ -208,6 +208,13 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { case 0xd4: position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); break; + case 0xe0: + position.set(Position.KEY_INDEX, buf.readUnsignedInt()); + break; + case 0xe1: + position.set(Position.KEY_RESULT, + buf.readBytes(buf.readUnsignedByte()).toString(StandardCharsets.US_ASCII)); + break; case 0xe2: case 0xe3: case 0xe4: @@ -273,6 +280,9 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { if (hasLocation && position.getFixTime() != null) { positions.add(position); + } else if (position.getAttributes().containsKey(Position.KEY_RESULT)) { + getLastLocation(position, null); + positions.add(position); } if (deviceSession == null) { diff --git a/test/org/traccar/protocol/GalileoProtocolDecoderTest.java b/test/org/traccar/protocol/GalileoProtocolDecoderTest.java index 2ad6cc582..e2e9f0ca3 100644 --- a/test/org/traccar/protocol/GalileoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GalileoProtocolDecoderTest.java @@ -12,6 +12,9 @@ public class GalileoProtocolDecoderTest extends ProtocolTest { GalileoProtocolDecoder decoder = new GalileoProtocolDecoder(new GalileoProtocol()); + verifyPositions(decoder, false, binary(ByteOrder.LITTLE_ENDIAN, + "012a0003383633353931303233353137333732046600e000000000e1104f555428332e2e3029203d2031313130bb29")); + verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, "0144030338363832303430303132363939333404320010ee0f20f5a86c57300570172f03bc7dfd023363002604343e00351c40092a414a6842af0e432445000046030050246b51666a524c055300000338363832303430303132363939333404320010ed0f20f4a86c57300570172f03b47dfd023363000d05343e00351140090a41c56742a60e432445000046030050b56a514f6a521b045300000338363832303430303132363939333404320010ec0f20e6a86c57300b34172f03287efd023300000000344900350d40290a41562742030b43234500004603205023455190445295005300000338363832303430303132363939333404320010eb0f20e4a86c57300b34172f03287efd023300000000344900350d40290b41000042bd0b432345000046032050dc31518c315200005300000338363832303430303132363939333404320010ea0f20c7a86c57300b34172f03287efd023300000000344900350d40a90b41000042050d43234500004600205000005100005200005300000338363832303430303132363939333404320010e90f204fa86c57300b34172f03287efd023300000000344900350d40a90b41000042ff0c43244500004600205000005100005200005300000338363832303430303132363939333404320010e80f20d7a76c57300b34172f03287efd023300000000344900350d40a90b41000042fd0c43244500004600205000005100005200005300000338363832303430303132363939333404320010e70f205fa76c57300b34172f03287efd023300000000344900350d40a90b41000042fd0c43254500004600205000005100005200005300000338363832303430303132363939333404320010e60f20e7a66c57300b34172f03287efd023300000000344900350d40a90b41000042fd0c43264500004600205000005100005200005300000338363832303430303132363939333404320010e50f206fa66c57300468172f03907cfd023300007a0a343600352b40a90b41000042030d43274500004600205000005100005200005300000338363832303430303132363939333404320010e40f2051a66c5730048c172f03ac7cfd02335300980a341600352b40a12b41000042040d43274500004600e0500000510000520000530000abde")); |