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/TytanProtocolDecoder.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/org/traccar/protocol/TytanProtocolDecoder.java') 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(); -- cgit v1.2.3