aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-05-08 23:24:22 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2013-05-08 23:24:22 +1200
commit14b7897b6df25a144da1a329f4a088b52a01571b (patch)
tree3a9e67594db6fab8748b1d5fe295dc5e437609b3
parent986912687a15f3d1376beae751a9160c3db5dc7a (diff)
downloadtrackermap-server-14b7897b6df25a144da1a329f4a088b52a01571b.tar.gz
trackermap-server-14b7897b6df25a144da1a329f4a088b52a01571b.tar.bz2
trackermap-server-14b7897b6df25a144da1a329f4a088b52a01571b.zip
Fix Teltonika negative coordinates (fix #234)
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
index a7bdf6132..d0b07ccb4 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -73,8 +73,8 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("priority", buf.readUnsignedByte());
- position.setLongitude(buf.readUnsignedInt() / 10000000.0);
- position.setLatitude(buf.readUnsignedInt() / 10000000.0);
+ position.setLongitude(buf.readInt() / 10000000.0);
+ position.setLatitude(buf.readInt() / 10000000.0);
position.setAltitude((double) buf.readUnsignedShort());
position.setCourse((double) buf.readUnsignedShort());
diff --git a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
index f896c1593..b24cbd471 100644
--- a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
@@ -18,6 +18,9 @@ public class TeltonikaProtocolDecoderTest {
byte[] buf2 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xA7,0x08,0x04,0x00,0x00,0x01,0x13,(byte)0xfc,0x20,(byte)0x8d,(byte)0xff,0x00,0x0f,0x14,(byte)0xf6,0x50,0x20,(byte)0x9c,(byte)0xca,(byte)0x80,0x00,0x6f,0x00,(byte)0xd6,0x04,0x00,0x04,0x00,0x04,0x03,0x01,0x01,0x15,0x03,0x16,0x03,0x00,0x01,0x46,0x00,0x00,0x01,0x5d,0x00,0x00,0x00,0x01,0x13,(byte)0xfc,0x17,0x61,0x0b,0x00,0x0f,0x14,(byte)0xff,(byte)0xe0,0x20,(byte)0x9c,(byte)0xc5,(byte)0x80,0x00,0x6e,0x00,(byte)0xc0,0x05,0x00,0x01,0x00,0x04,0x03,0x01,0x01,0x15,0x03,0x16,0x01,0x00,0x01,0x46,0x00,0x00,0x01,0x5e,0x00,0x00,0x00,0x01,0x13,(byte)0xfc,0x28,0x49,0x45,0x00,0x0f,0x15,0x0f,0x00,0x20,(byte)0x9c,(byte)0xd2,0x00,0x00,(byte)0x95,0x01,0x08,0x04,0x00,0x00,0x00,0x04,0x03,0x01,0x01,0x15,0x00,0x16,0x03,0x00,0x01,0x46,0x00,0x00,0x01,0x5d,0x00,0x00,0x00,0x01,0x13,(byte)0xfc,0x26,0x7c,0x5b,0x00,0x0f,0x15,0x0a,0x50,0x20,(byte)0x9c,(byte)0xcc,(byte)0xc0,0x00,(byte)0x93,0x00,0x68,0x04,0x00,0x00,0x00,0x04,0x03,0x01,0x01,0x15,0x00,0x16,0x03,0x00,0x01,0x46,0x00,0x00,0x01,0x5b,0x00,0x04,0x00,0x00};
assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf2)));
+
+ byte[] buf3 = {0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x47,0x08,0x06,0x00,0x00,0x01,0x3e,0x5a,0x60,(byte)0xa4,(byte)0xcb,0x00,0x3f,(byte)0xa7,(byte)0xb7,(byte)0x80,(byte)0xfc,0x42,0x45,0x18,0x00,0x42,0x00,0x00,0x0a,0x00,0x00,0x00,0x09,0x05,0x01,0x01,0x02,0x00,(byte)0xb3,0x00,(byte)0xb4,0x00,(byte)0xf0,0x00,0x03,0x42,0x68,(byte)0xa7,0x46,0x01,0x18,0x18,0x00,0x00,0x01,(byte)0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3e,0x5d,(byte)0xc8,(byte)0xba,0x28,0x00,0x3f,(byte)0xa7,(byte)0xc0,(byte)0x80,(byte)0xfc,0x42,0x46,0x04,0x00,0x01,0x00,0x00,0x05,0x00,0x00,0x00,0x09,0x05,0x01,0x01,0x02,0x00,(byte)0xb3,0x00,(byte)0xb4,0x00,(byte)0xf0,0x01,0x03,0x42,0x68,(byte)0xb4,0x46,0x00,(byte)0xef,0x18,0x00,0x00,0x01,(byte)0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3e,0x5d,(byte)0xc9,0x04,0x55,0x00,0x3f,(byte)0xa7,(byte)0xb6,0x40,(byte)0xfc,0x42,0x43,(byte)0x88,0x00,0x3a,0x00,0x00,0x07,0x00,0x00,(byte)0xf0,0x09,0x05,0x01,0x01,0x02,0x00,(byte)0xb3,0x00,(byte)0xb4,0x00,(byte)0xf0,0x00,0x03,0x42,0x68,(byte)0xdc,0x46,0x00,(byte)0xf7,0x18,0x00,0x00,0x01,(byte)0xc7,0x00,0x00,0x00,0x1d,0x00,0x00,0x00,0x01,0x3e,0x5d,(byte)0xc9,(byte)0xd3,0x68,0x00,0x3f,(byte)0xa7,(byte)0xb8,0x00,(byte)0xfc,0x42,0x44,0x30,0x00,0x49,0x00,0x00,0x04,0x00,0x00,0x00,0x09,0x05,0x01,0x01,0x02,0x00,(byte)0xb3,0x00,(byte)0xb4,0x00,(byte)0xf0,0x01,0x03,0x42,0x67,(byte)0xde,0x46,0x01,0x07,0x18,0x00,0x00,0x01,(byte)0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3e,0x5d,(byte)0xca,0x31,0x1d,0x00,0x3f,(byte)0xa7,(byte)0xb6,(byte)0x80,(byte)0xfc,0x42,0x43,(byte)0xcc,0x00,0x42,0x00,0x00,0x07,0x00,0x00,(byte)0xf0,0x09,0x05,0x01,0x01,0x02,0x00,(byte)0xb3,0x00,(byte)0xb4,0x00,(byte)0xf0,0x00,0x03,0x42,0x68,0x53,0x46,0x01,0x0b,0x18,0x00,0x00,0x01,(byte)0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3e,0x5d,(byte)0xcf,(byte)0xaf,(byte)0xe9,0x00,0x3f,(byte)0xa7,(byte)0xb6,0x00,(byte)0xfc,0x42,0x42,(byte)0xf0,0x00,0x3d,0x00,0x00,0x08,0x00,0x00,0x00,0x09,0x05,0x01,0x01,0x02,0x00,(byte)0xb3,0x00,(byte)0xb4,0x00,(byte)0xf0,0x00,0x03,0x42,0x68,0x52,0x46,0x01,0x19,0x18,0x00,0x00,0x01,(byte)0xc7,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x02,0x75};
+ assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf3)));
}