aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/KenjiProtocolDecoder.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-08-17 09:52:27 +0500
committerAbyss777 <abyss@fox5.ru>2016-08-17 09:52:27 +0500
commit7dd85faa3018aa6d3c8a192eed99360cb406eb71 (patch)
tree396ae68b381075ea1663c47d6911a28069ddd4fd /src/org/traccar/protocol/KenjiProtocolDecoder.java
parent376bd7a7342ed46f20b7c0c94d7c9b0074ae99f3 (diff)
downloadtrackermap-server-7dd85faa3018aa6d3c8a192eed99360cb406eb71.tar.gz
trackermap-server-7dd85faa3018aa6d3c8a192eed99360cb406eb71.tar.bz2
trackermap-server-7dd85faa3018aa6d3c8a192eed99360cb406eb71.zip
- Added Kenji, T800x, Xexun alarm decoders
- Fixed GT06 mistake
Diffstat (limited to 'src/org/traccar/protocol/KenjiProtocolDecoder.java')
-rwxr-xr-xsrc/org/traccar/protocol/KenjiProtocolDecoder.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/KenjiProtocolDecoder.java b/src/org/traccar/protocol/KenjiProtocolDecoder.java
index 2a95717ee..e13c91e3a 100755
--- a/src/org/traccar/protocol/KenjiProtocolDecoder.java
+++ b/src/org/traccar/protocol/KenjiProtocolDecoder.java
@@ -18,6 +18,7 @@ package org.traccar.protocol;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
+import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
@@ -49,6 +50,23 @@ public class KenjiProtocolDecoder extends BaseProtocolDecoder {
.any()
.compile();
+ private String decodeAlarm(int value) {
+ if (BitUtil.check(value, 2)) {
+ return Position.ALARM_SOS;
+ }
+ if (BitUtil.check(value, 4)) {
+ return Position.ALARM_LOW_BATTERY;
+ }
+ if (BitUtil.check(value, 6)) {
+ return Position.ALARM_MOVEMENT;
+ }
+ if (BitUtil.check(value, 1) || BitUtil.check(value, 10) || BitUtil.check(value, 11)) {
+ return Position.ALARM_VIBRATION;
+ }
+
+ return null;
+ }
+
@Override
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
@@ -67,7 +85,7 @@ public class KenjiProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(deviceSession.getDeviceId());
- position.set(Position.KEY_ALARM, parser.nextInt(16));
+ position.set(Position.KEY_ALARM, decodeAlarm(parser.nextInt(16)));
position.set(Position.KEY_OUTPUT, parser.nextInt(16));
position.set(Position.KEY_INPUT, parser.nextInt(16));