diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-03-21 04:57:55 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-03-21 04:57:55 +1300 |
commit | 04c087935a2bd4b703134d86bbe9456e6930c287 (patch) | |
tree | d1520ab58757c1ccf2cb0f28dcd35d5f7ce8f144 | |
parent | 9ba0e8f826c9edb78beb234192c694b881a4418a (diff) | |
download | trackermap-server-04c087935a2bd4b703134d86bbe9456e6930c287.tar.gz trackermap-server-04c087935a2bd4b703134d86bbe9456e6930c287.tar.bz2 trackermap-server-04c087935a2bd4b703134d86bbe9456e6930c287.zip |
Handle DMT messages without location
-rw-r--r-- | src/org/traccar/protocol/DmtProtocolDecoder.java | 4 | ||||
-rw-r--r-- | test/org/traccar/protocol/DmtProtocolDecoderTest.java | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/DmtProtocolDecoder.java b/src/org/traccar/protocol/DmtProtocolDecoder.java index 4c641f397..6481255e9 100644 --- a/src/org/traccar/protocol/DmtProtocolDecoder.java +++ b/src/org/traccar/protocol/DmtProtocolDecoder.java @@ -133,6 +133,10 @@ public class DmtProtocolDecoder extends BaseProtocolDecoder { } + if (position.getFixTime() == null) { + getLastLocation(position, position.getDeviceTime()); + } + positions.add(position); } diff --git a/test/org/traccar/protocol/DmtProtocolDecoderTest.java b/test/org/traccar/protocol/DmtProtocolDecoderTest.java index fa43c661d..cb48bf799 100644 --- a/test/org/traccar/protocol/DmtProtocolDecoderTest.java +++ b/test/org/traccar/protocol/DmtProtocolDecoderTest.java @@ -13,6 +13,15 @@ public class DmtProtocolDecoderTest extends ProtocolTest { DmtProtocolDecoder decoder = new DmtProtocolDecoder(new DmtProtocol()); verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "025500310038f90100333533333233303831363639373330003839363130313835303031383234383434363330002202010900000000")); + + verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "0255220000")); + + verifyPositions(decoder, false, binary(ByteOrder.LITTLE_ENDIAN, + "025504e9032f000d000000000000001501222700524553455420446172742033342e322e312e3920666c6167733d312057443d303f000e0000000000000015013214004e6f2041646d696e20706172616d7320666f756e64202d207573696e672064656661756c7473202b204175746f41504e37000f00000000000000090015000000000000000000000000000000000000000000020805000000000007000609012b1002400003700e37001000000000000000090015000000000000000000000000000000000000000000020801000000000007000609012b1002400003700e37001100000000000000090015000000000000000000000000000000000000000000020800000000000007000609012b1002400003700e37001200000000000000020015000000000000000000000000000000000000000000020800000000000006000609012b1002400003700e370013000000000000000f001500000000000000000000000000000000000000000002080000000000000200060901271002370003670e2e0014000000000000001501211300526f6c6c20646574656374656420636f735e32203c203338333535333838343700150000000000000017001500000000000000000000000000000000000000000002080000000000000200060901071002300003d60e2a00160000000000000015011d130054756d626c65722074726967676572656420636f735e32203c20302e0017000000000000001501211300526f6c6c20646574656374656420636f735e32203c203338333535333838343700180000000000000017001500000000000000000000000000000000000000000002080000000000000200060901071002300003f70e2a00190000000000000015011d130054756d626c65722074726967676572656420636f735e32203c203026001a000000000000001501190b0047534d3a20544350206261642053594e432063686172732e001b000000000000001501211300526f6c6c20646574656374656420636f735e32203c203338333535333838343a001c0000000000000017001500000000000000000000000000000000000000000002080000000000000200060c01c90f02300003e20f041f002a001d0000000000000015011d130054756d626c65722074726967676572656420636f735e32203c20302e001e000000000000001501211300526f6c6c20646574656374656420636f735e32203c203338333535333838343a001f0000000000000017001500000000000000000000000000000000000000000002080000000000000200060c01d80f02300003ff0f0418002a00200000000000000015011d130054756d626c65722074726967676572656420636f735e32203c2030")); + + verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN, "025500310038f90100333533333233303831363639373330003839363130313435363839393333303030303835002202010900000000")); verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, |