aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/GatorProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/GatorProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/GatorProtocolDecoder.java22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java
index 041e44588..b2baf455a 100644
--- a/src/org/traccar/protocol/GatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/GatorProtocolDecoder.java
@@ -45,24 +45,6 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder {
private static final int PACKET_CAMERA_RESPONSE = 0x56;
private static final int PACKET_PICTURE_DATA = 0x57;
- private double readCoordinate(ChannelBuffer buf) {
- int b1 = buf.readUnsignedByte();
- int b2 = buf.readUnsignedByte();
- int b3 = buf.readUnsignedByte();
- int b4 = buf.readUnsignedByte();
-
- double value = (b2 & 0xf) * 10 + (b3 >> 4);
- value += (((b3 & 0xf) * 10 + (b4 >> 4)) * 10 + (b4 & 0xf)) / 1000.0;
- value /= 60;
- value += ((b1 >> 4 & 0x7) * 10 + (b1 & 0xf)) * 10 + (b2 >> 4);
-
- if ((b1 & 0x80) != 0) {
- value = -value;
- }
-
- return value;
- }
-
@Override
protected Object decode(
ChannelHandlerContext ctx, Channel channel, Object msg)
@@ -105,8 +87,8 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder {
position.setTime(time.getTime());
// Location
- position.setLatitude(readCoordinate(buf));
- position.setLongitude(readCoordinate(buf));
+ position.setLatitude(ChannelBufferTools.readCoordinate(buf));
+ position.setLongitude(ChannelBufferTools.readCoordinate(buf));
position.setSpeed(ChannelBufferTools.readHexInteger(buf, 4) * 0.539957);
position.setCourse((double) ChannelBufferTools.readHexInteger(buf, 4));
position.setAltitude(0.0);