From 06b5113f3d98a44530c2ade6810bc75092fccc31 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 20 Oct 2015 13:59:44 +1300 Subject: Refactor bit utililies class --- src/org/traccar/protocol/Gt06ProtocolDecoder.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/org/traccar/protocol/Gt06ProtocolDecoder.java') diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index e319d9e81..396fe686a 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -26,6 +26,7 @@ import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.Context; +import org.traccar.helper.BitUtil; import org.traccar.helper.Checksum; import org.traccar.helper.DateBuilder; import org.traccar.helper.UnitsConverter; @@ -155,7 +156,9 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { } else if (hasDeviceId()) { - if (MESSAGES_SUPPORTED.contains(type)) { + if (type == MSG_GPS || type == MSG_GPS_LBS_1 || type == MSG_GPS_LBS_2 + || type == MSG_GPS_LBS_STATUS_1 || type == MSG_GPS_LBS_STATUS_2 || type == MSG_GPS_LBS_STATUS_3 + || type == MSG_GPS_PHONE || type == MSG_GPS_LBS_EXTEND) { Position position = new Position(); position.setDeviceId(getDeviceId()); @@ -168,7 +171,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { // GPS length and Satellites count int gpsLength = buf.readUnsignedByte(); - position.set(Event.KEY_SATELLITES, gpsLength & 0b0000_1111); + position.set(Event.KEY_SATELLITES, BitUtil.to(gpsLength, 4)); gpsLength >>= 4; // Latitude -- cgit v1.2.3