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/MxtProtocolDecoder.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/org/traccar/protocol/MxtProtocolDecoder.java') diff --git a/src/org/traccar/protocol/MxtProtocolDecoder.java b/src/org/traccar/protocol/MxtProtocolDecoder.java index 9151d9672..ba97694d3 100644 --- a/src/org/traccar/protocol/MxtProtocolDecoder.java +++ b/src/org/traccar/protocol/MxtProtocolDecoder.java @@ -73,10 +73,10 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder { long date = buf.readUnsignedInt(); - long days = BitUtil.range(date, 6 + 6 + 5); - long hours = BitUtil.range(date, 6 + 6, 5); - long minutes = BitUtil.range(date, 6, 6); - long seconds = BitUtil.range(date, 0, 6); + long days = BitUtil.from(date, 6 + 6 + 5); + long hours = BitUtil.between(date, 6 + 6, 6 + 6 + 5); + long minutes = BitUtil.between(date, 6, 6 + 6); + long seconds = BitUtil.to(date, 6); long millis = time.getTimeInMillis(); millis += (((days * 24 + hours) * 60 + minutes) * 60 + seconds) * 1000; @@ -91,9 +91,9 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder { long flags = buf.readUnsignedInt(); position.set(Event.KEY_IGNITION, BitUtil.check(flags, 0)); position.set(Event.KEY_ALARM, BitUtil.check(flags, 1)); - position.set(Event.KEY_INPUT, BitUtil.range(flags, 2, 5)); - position.set(Event.KEY_OUTPUT, BitUtil.range(flags, 7, 3)); - position.setCourse(BitUtil.range(flags, 10, 3) * 45); + position.set(Event.KEY_INPUT, BitUtil.between(flags, 2, 7)); + position.set(Event.KEY_OUTPUT, BitUtil.between(flags, 7, 10)); + position.setCourse(BitUtil.between(flags, 10, 13) * 45); //position.setValid(BitUtil.check(flags, 15)); position.set(Event.KEY_CHARGE, BitUtil.check(flags, 20)); -- cgit v1.2.3