aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/protocol/CellocatorProtocolDecoder.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/CellocatorProtocolDecoder.java b/src/main/java/org/traccar/protocol/CellocatorProtocolDecoder.java
index aa13a0aa2..bc74b6576 100644
--- a/src/main/java/org/traccar/protocol/CellocatorProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/CellocatorProtocolDecoder.java
@@ -22,6 +22,7 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
+import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Position;
@@ -122,7 +123,12 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_ALARM, decodeAlarm(buf.readUnsignedByte()));
position.set("mode", buf.readUnsignedByte());
- position.set(Position.KEY_INPUT, buf.readUnsignedIntLE());
+
+ long input = buf.readUnsignedIntLE();
+ position.set(Position.KEY_DOOR, BitUtil.check(input, 3 * 8));
+ position.set(Position.KEY_IGNITION, BitUtil.check(input, 2 * 8 + 7));
+ position.set(Position.KEY_CHARGE, BitUtil.check(input, 7));
+ position.set(Position.KEY_INPUT, input);
if (alternative) {
buf.readUnsignedByte(); // input
@@ -130,7 +136,10 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShortLE());
} else {
buf.readUnsignedByte(); // operator
- position.set(Position.PREFIX_ADC + 1, buf.readUnsignedIntLE());
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedByte());
+ position.set(Position.PREFIX_ADC + 2, buf.readUnsignedByte());
+ position.set(Position.PREFIX_ADC + 3, buf.readUnsignedByte());
+ position.set(Position.PREFIX_ADC + 4, buf.readUnsignedByte());
}
position.set(Position.KEY_ODOMETER, buf.readUnsignedMediumLE());