aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-04-11 00:56:07 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-04-11 00:56:11 +1200
commit7efecf8089ca11940f9ff749717e86c05c94c24c (patch)
treec80201d590aced4320817349362c22268d4b5991 /src/org/traccar/protocol
parent50009502e2a47bafafede983656f40f99745665a (diff)
downloadtraccar-server-7efecf8089ca11940f9ff749717e86c05c94c24c.tar.gz
traccar-server-7efecf8089ca11940f9ff749717e86c05c94c24c.tar.bz2
traccar-server-7efecf8089ca11940f9ff749717e86c05c94c24c.zip
Fix totem IO decoding
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/TotemProtocolDecoder.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java
index d6dd933b5..5a2c203d2 100644
--- a/src/org/traccar/protocol/TotemProtocolDecoder.java
+++ b/src/org/traccar/protocol/TotemProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 - 2018 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -243,22 +243,22 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_HDOP, parser.nextDouble());
}
- String io = parser.next();
+ int io = parser.nextBinInt();
if (pattern == PATTERN1) {
for (int i = 1; i <= 4; i++) {
- position.set(Position.PREFIX_IN + i, io.charAt(3 + i) == '1');
+ position.set(Position.PREFIX_IN + i, BitUtil.check(io, 3 + i));
}
position.set(Position.KEY_BATTERY, parser.nextDouble(0) * 0.01);
} else {
- position.set(Position.KEY_ANTENNA, io.charAt(0) == '1');
- position.set(Position.KEY_CHARGE, io.charAt(1) == '1');
+ position.set(Position.KEY_ANTENNA, BitUtil.check(io, 0));
+ position.set(Position.KEY_CHARGE, BitUtil.check(io, 1));
for (int i = 1; i <= 6; i++) {
- position.set(Position.PREFIX_IN + i, io.charAt(1 + i) == '1');
+ position.set(Position.PREFIX_IN + i, BitUtil.check(io, 1 + i));
}
position.set(Position.KEY_BATTERY, parser.nextDouble(0) * 0.1);
}
for (int i = 1; i <= 4; i++) {
- position.set(Position.PREFIX_OUT + i, io.charAt(7 + i) == '1');
+ 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());