aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
authorMatjaž Črnko <m.crnko@txt.si>2021-10-20 20:13:52 +0200
committerMatjaž Črnko <m.crnko@txt.si>2021-10-20 20:13:52 +0200
commit78a6d42d3ddc1755d3754c148996f7804d076ccf (patch)
tree303a3d85429c9c642b25d79060946cfc0752ac4e /src/main/java/org/traccar/protocol
parent7c04066ff6444790acd8b28d1abffd46bd8243da (diff)
downloadtraccar-server-78a6d42d3ddc1755d3754c148996f7804d076ccf.tar.gz
traccar-server-78a6d42d3ddc1755d3754c148996f7804d076ccf.tar.bz2
traccar-server-78a6d42d3ddc1755d3754c148996f7804d076ccf.zip
fix: Totem - More accurate/generic Vehicle Status decoding so it does not show wrong values for AT07
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/TotemProtocolDecoder.java30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/main/java/org/traccar/protocol/TotemProtocolDecoder.java b/src/main/java/org/traccar/protocol/TotemProtocolDecoder.java
index f7d0ffde7..758f7f9ba 100644
--- a/src/main/java/org/traccar/protocol/TotemProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TotemProtocolDecoder.java
@@ -372,17 +372,31 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_ALARM, BitUtil.check(status, 32 - 5) ? Position.ALARM_GEOFENCE_EXIT : null);
position.set(Position.KEY_ALARM, BitUtil.check(status, 32 - 6) ? Position.ALARM_GEOFENCE_ENTER : null);
position.set(Position.KEY_ALARM, BitUtil.check(status, 32 - 7) ? Position.ALARM_GPS_ANTENNA_CUT : null);
+ position.set(Position.PREFIX_IO + 8, BitUtil.check(status, 32 - 8)); // GPS Module Error
position.set(Position.PREFIX_OUT + 1, BitUtil.check(status, 32 - 9));
position.set(Position.PREFIX_OUT + 2, BitUtil.check(status, 32 - 10));
position.set(Position.PREFIX_OUT + 3, BitUtil.check(status, 32 - 11));
- position.set(Position.PREFIX_OUT + 4, BitUtil.check(status, 32 - 12));
- position.set(Position.PREFIX_IN + 2, BitUtil.check(status, 32 - 13));
- position.set(Position.PREFIX_IN + 3, BitUtil.check(status, 32 - 14));
- position.set(Position.PREFIX_IN + 4, BitUtil.check(status, 32 - 15));
- position.set(Position.KEY_ALARM, BitUtil.check(status, 32 - 16) ? Position.ALARM_SHOCK : null);
- position.set(Position.KEY_ALARM, BitUtil.check(status, 32 - 17) ? Position.ALARM_IDLE : null);
- position.set(Position.KEY_ALARM, BitUtil.check(status, 32 - 18) ? Position.ALARM_LOW_BATTERY : null);
- position.set(Position.KEY_ALARM, BitUtil.check(status, 32 - 22) ? Position.ALARM_JAMMING : null);
+
+ /**
+ * Different Devices have different meaning for bits 12-22
+ * But unfortunately we cannot reliably detect this, so we use generic IO<bit> notation
+ *
+ * | AT05 | AT07 | AT09
+ * 12 | Reserved | IN2 | OUT4
+ * 13 | IN2 | IN4 | IN2
+ * 14 | IN3 | Shock | IN3
+ * 15 | IN4 | Idle | IN4
+ * 16 | Shock | Low Batt. | Shock
+ * 17 | Idle | Drv. Auth. | Idle
+ * 18 | Low Batt. | GPS Status | Low Batt.
+ * 19 | Drv. Auth. | Batt. chrg.| Drv. Auth.
+ * 20 | GPS Status | GSM Jamming| GPS Status
+ * 21 | Batt. chrg.| Reserved | Batt. chrg.
+ * 22 | Reserved | Reserved | GSM Jamming
+ */
+ for (int i = 12; i < 23; i++) {
+ position.set(Position.PREFIX_IO + i, BitUtil.check(status, 32 - i));
+ }
position.setTime(parser.nextDateTime());