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/MxtProtocolDecoder.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/MxtProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/MxtProtocolDecoder.java | 14 |
1 files changed, 7 insertions, 7 deletions
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)); |