From 78a6d42d3ddc1755d3754c148996f7804d076ccf Mon Sep 17 00:00:00 2001 From: Matjaž Črnko Date: Wed, 20 Oct 2021 20:13:52 +0200 Subject: fix: Totem - More accurate/generic Vehicle Status decoding so it does not show wrong values for AT07 --- .../org/traccar/protocol/TotemProtocolDecoder.java | 30 ++++++++++++++++------ 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'src/main/java/org/traccar/protocol') 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 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()); -- cgit v1.2.3