aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-04-06 04:46:51 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-04-06 04:46:51 +1200
commit2a768a85e6de2a0b7049764b1f936d8cbcbe23bc (patch)
treea2a695738e33a3294a403cc050bc9e8544ff48be /src/org/traccar
parenta0f83250c58b7d10b345370438d7b1923499294c (diff)
downloadtrackermap-server-2a768a85e6de2a0b7049764b1f936d8cbcbe23bc.tar.gz
trackermap-server-2a768a85e6de2a0b7049764b1f936d8cbcbe23bc.tar.bz2
trackermap-server-2a768a85e6de2a0b7049764b1f936d8cbcbe23bc.zip
Decode Totem IO values
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/model/Position.java1
-rw-r--r--src/org/traccar/protocol/TotemProtocolDecoder.java13
2 files changed, 13 insertions, 1 deletions
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java
index 49e3231c3..fca0f16e3 100644
--- a/src/org/traccar/model/Position.java
+++ b/src/org/traccar/model/Position.java
@@ -58,6 +58,7 @@ public class Position extends Message {
public static final String KEY_TYPE = "type";
public static final String KEY_IGNITION = "ignition";
public static final String KEY_FLAGS = "flags";
+ public static final String KEY_ANTENNA = "antenna";
public static final String KEY_CHARGE = "charge";
public static final String KEY_IP = "ip";
public static final String KEY_ARCHIVE = "archive";
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java
index 8da188f60..d6dd933b5 100644
--- a/src/org/traccar/protocol/TotemProtocolDecoder.java
+++ b/src/org/traccar/protocol/TotemProtocolDecoder.java
@@ -243,12 +243,23 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_HDOP, parser.nextDouble());
}
- position.set(Position.PREFIX_IO + 1, parser.next());
+ String io = parser.next();
if (pattern == PATTERN1) {
+ for (int i = 1; i <= 4; i++) {
+ position.set(Position.PREFIX_IN + i, io.charAt(3 + i) == '1');
+ }
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');
+ for (int i = 1; i <= 6; i++) {
+ position.set(Position.PREFIX_IN + i, io.charAt(1 + i) == '1');
+ }
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.KEY_POWER, parser.nextDouble(0));
position.set(Position.PREFIX_ADC + 1, parser.next());