aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/TytanProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-20 13:59:44 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-20 13:59:44 +1300
commit06b5113f3d98a44530c2ade6810bc75092fccc31 (patch)
treecb8c03c8f3394db0691b73547e86d2a181462607 /src/org/traccar/protocol/TytanProtocolDecoder.java
parent7b103b43754de283e423df03042c6f75307c8466 (diff)
downloadtrackermap-server-06b5113f3d98a44530c2ade6810bc75092fccc31.tar.gz
trackermap-server-06b5113f3d98a44530c2ade6810bc75092fccc31.tar.bz2
trackermap-server-06b5113f3d98a44530c2ade6810bc75092fccc31.zip
Refactor bit utililies class
Diffstat (limited to 'src/org/traccar/protocol/TytanProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/TytanProtocolDecoder.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java
index 20cfc8ace..ec5fb167d 100644
--- a/src/org/traccar/protocol/TytanProtocolDecoder.java
+++ b/src/org/traccar/protocol/TytanProtocolDecoder.java
@@ -76,7 +76,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
int alarm = buf.readUnsignedByte();
buf.readUnsignedByte();
if (BitUtil.check(alarm, 5)) {
- position.set(Event.KEY_ALARM, BitUtil.range(alarm, 0, 4));
+ position.set(Event.KEY_ALARM, BitUtil.to(alarm, 4));
}
break;
case 8:
@@ -172,8 +172,8 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
position.setTime(new Date(buf.readUnsignedInt() * 1000));
int flags = buf.readUnsignedByte();
- position.set(Event.KEY_SATELLITES, BitUtil.range(flags, 2));
- position.setValid(BitUtil.range(flags, 0, 2) > 0);
+ position.set(Event.KEY_SATELLITES, BitUtil.from(flags, 2));
+ position.setValid(BitUtil.to(flags, 2) > 0);
// Latitude
double lat = buf.readUnsignedMedium();
@@ -188,8 +188,8 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
// Status
flags = buf.readUnsignedByte();
position.set(Event.KEY_IGNITION, BitUtil.check(flags, 0));
- position.set(Event.KEY_GSM, BitUtil.range(flags, 2, 3));
- position.setCourse((BitUtil.range(flags, 5) * 45 + 180) % 360);
+ position.set(Event.KEY_GSM, BitUtil.between(flags, 2, 5));
+ position.setCourse((BitUtil.from(flags, 5) * 45 + 180) % 360);
// Speed
int speed = buf.readUnsignedByte();