diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-25 15:40:42 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-25 15:40:42 +1300 |
commit | 78f7e386fe4fb46fc0c9295853a2467408330dfd (patch) | |
tree | 6bf04f57dc205483127d468f396c7f89fc788fed /src/org/traccar/protocol | |
parent | 6fd31893cdcad94044c3db97f6bb183fd5da13a6 (diff) | |
download | trackermap-server-78f7e386fe4fb46fc0c9295853a2467408330dfd.tar.gz trackermap-server-78f7e386fe4fb46fc0c9295853a2467408330dfd.tar.bz2 trackermap-server-78f7e386fe4fb46fc0c9295853a2467408330dfd.zip |
Implement Ulbotech driver behavior
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/UlbotechProtocolDecoder.java | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java index a81c02ce1..dc4741340 100644 --- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java +++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java @@ -66,6 +66,36 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder { } } + private void decodeDriverBehavior(Position position, ChannelBuffer buf) { + + int value = buf.readUnsignedByte(); + + if (BitUtil.check(value, 0)) { + position.set("rapid-acceleration", true); + } + if (BitUtil.check(value, 1)) { + position.set("rough-braking", true); + } + if (BitUtil.check(value, 2)) { + position.set("harsh-course", true); + } + if (BitUtil.check(value, 3)) { + position.set("no-warm-up", true); + } + if (BitUtil.check(value, 4)) { + position.set("long-idle", true); + } + if (BitUtil.check(value, 5)) { + position.set("fatigue-driving", true); + } + if (BitUtil.check(value, 6)) { + position.set("rough-terrain", true); + } + if (BitUtil.check(value, 7)) { + position.set("high-rpm", true); + } + } + @Override protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { @@ -156,7 +186,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder { break; case DATA_HARSH_DRIVER: - position.set("driver-behavior", buf.readUnsignedByte()); + decodeDriverBehavior(position, buf); break; case DATA_CANBUS: |