diff options
Diffstat (limited to 'src/org/traccar/protocol/M2mProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/M2mProtocolDecoder.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/M2mProtocolDecoder.java b/src/org/traccar/protocol/M2mProtocolDecoder.java index 4f50c0411..6e57b5766 100644 --- a/src/org/traccar/protocol/M2mProtocolDecoder.java +++ b/src/org/traccar/protocol/M2mProtocolDecoder.java @@ -16,7 +16,7 @@ package org.traccar.protocol; import java.net.SocketAddress; -import java.util.Calendar; +import java.util.Calendar; import java.util.TimeZone; import org.jboss.netty.buffer.ChannelBuffer; @@ -31,7 +31,7 @@ public class M2mProtocolDecoder extends BaseProtocolDecoder { public M2mProtocolDecoder(M2mProtocol protocol) { super(protocol); } - + private boolean firstPacket = true; @Override @@ -50,7 +50,7 @@ public class M2mProtocolDecoder extends BaseProtocolDecoder { } if (firstPacket) { - + firstPacket = false; // Read IMEI @@ -67,7 +67,7 @@ public class M2mProtocolDecoder extends BaseProtocolDecoder { identify(imei.toString(), channel); } else if (hasDeviceId()) { - + // Create new position Position position = new Position(); position.setProtocol(getProtocolName()); @@ -83,7 +83,7 @@ public class M2mProtocolDecoder extends BaseProtocolDecoder { time.set(Calendar.MINUTE, buf.readUnsignedByte() & 0x7f); time.set(Calendar.SECOND, buf.readUnsignedByte() & 0x7f); position.setTime(time.getTime()); - + // Location int degrees = buf.readUnsignedByte(); double latitude = buf.readUnsignedByte(); @@ -100,14 +100,14 @@ public class M2mProtocolDecoder extends BaseProtocolDecoder { longitude += buf.readUnsignedByte() / 10000.0; longitude /= 60; longitude += degrees; - + if ((b & 0x80) != 0) { longitude = -longitude; } if ((b & 0x40) != 0) { latitude = -latitude; } - + position.setLatitude(latitude); position.setLongitude(longitude); position.setSpeed(buf.readUnsignedByte()); |