diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-20 13:59:44 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-20 13:59:44 +1300 |
commit | 06b5113f3d98a44530c2ade6810bc75092fccc31 (patch) | |
tree | cb8c03c8f3394db0691b73547e86d2a181462607 /src/org/traccar/protocol/Gt06ProtocolDecoder.java | |
parent | 7b103b43754de283e423df03042c6f75307c8466 (diff) | |
download | trackermap-server-06b5113f3d98a44530c2ade6810bc75092fccc31.tar.gz trackermap-server-06b5113f3d98a44530c2ade6810bc75092fccc31.tar.bz2 trackermap-server-06b5113f3d98a44530c2ade6810bc75092fccc31.zip |
Refactor bit utililies class
Diffstat (limited to 'src/org/traccar/protocol/Gt06ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Gt06ProtocolDecoder.java | 7 |
1 files changed, 5 insertions, 2 deletions
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 |