diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-05-05 20:32:44 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-05-05 20:32:44 +1200 |
commit | 7d8f1c6546698c2e959f27920e239ae9d95bf455 (patch) | |
tree | 976eb3b80b47e5c4582eaedeca7e474c2f38dd3a /src/org/traccar | |
parent | 8f57a25d92d7cc3b738950b8d35058cd64786b1d (diff) | |
download | traccar-server-7d8f1c6546698c2e959f27920e239ae9d95bf455.tar.gz traccar-server-7d8f1c6546698c2e959f27920e239ae9d95bf455.tar.bz2 traccar-server-7d8f1c6546698c2e959f27920e239ae9d95bf455.zip |
Update Totem IO decoding
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/TotemProtocolDecoder.java | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java index 06a1fbc41..d8943abd5 100644 --- a/src/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/org/traccar/protocol/TotemProtocolDecoder.java @@ -245,12 +245,13 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { int io = parser.nextBinInt(); if (pattern == PATTERN1) { - if (BitUtil.check(io, 0)) { - position.set(Position.KEY_ALARM, Position.ALARM_SOS); - } - for (int i = 1; i <= 4; i++) { - position.set(Position.PREFIX_IN + i, BitUtil.check(io, 3 + i)); - } + position.set(Position.KEY_ALARM, BitUtil.check(io, 0) ? Position.ALARM_SOS : null); + position.set(Position.PREFIX_IN + 3, BitUtil.check(io, 4)); + position.set(Position.PREFIX_IN + 4, BitUtil.check(io, 5)); + position.set(Position.PREFIX_IN + 1, BitUtil.check(io, 6)); + position.set(Position.PREFIX_IN + 2, BitUtil.check(io, 7)); + position.set(Position.PREFIX_OUT + 1, BitUtil.check(io, 8)); + position.set(Position.PREFIX_OUT + 2, BitUtil.check(io, 9)); position.set(Position.KEY_BATTERY, parser.nextDouble(0) * 0.01); } else { position.set(Position.KEY_ANTENNA, BitUtil.check(io, 0)); @@ -258,11 +259,12 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { for (int i = 1; i <= 6; i++) { position.set(Position.PREFIX_IN + i, BitUtil.check(io, 1 + i)); } + for (int i = 1; i <= 4; i++) { + position.set(Position.PREFIX_OUT + i, BitUtil.check(io, 7 + i)); + } position.set(Position.KEY_BATTERY, parser.nextDouble(0) * 0.1); } - for (int i = 1; i <= 4; i++) { - position.set(Position.PREFIX_OUT + i, BitUtil.check(io, 7 + i)); - } + position.set(Position.KEY_POWER, parser.nextDouble(0)); position.set(Position.PREFIX_ADC + 1, parser.next()); |