diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-05-16 09:57:27 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-05-16 09:57:27 -0700 |
commit | bac4f925cc7d00f4ba0225d8b3391b6b382a588e (patch) | |
tree | 9a04ef6ca10f6659fe278045b89fccdfff4910c6 /src/main | |
parent | 1ebea9d3765ac5658b0513f3f8a3934d5b0d50d3 (diff) | |
download | trackermap-server-bac4f925cc7d00f4ba0225d8b3391b6b382a588e.tar.gz trackermap-server-bac4f925cc7d00f4ba0225d8b3391b6b382a588e.tar.bz2 trackermap-server-bac4f925cc7d00f4ba0225d8b3391b6b382a588e.zip |
Decode Cellocator ADC and inputs
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/protocol/CellocatorProtocolDecoder.java | 13 |
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()); |