aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-01-06 08:34:32 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-01-06 07:34:32 +1300
commit681057b88e91c5c64c1f6b8780676d5172ea7c6f (patch)
tree6c123dd6e0646935f624748c27c4db5d27a4d71a /src
parente87eddaf0b50fd95260b1b31e05f961c1aee0f4d (diff)
downloadtrackermap-server-681057b88e91c5c64c1f6b8780676d5172ea7c6f.tar.gz
trackermap-server-681057b88e91c5c64c1f6b8780676d5172ea7c6f.tar.bz2
trackermap-server-681057b88e91c5c64c1f6b8780676d5172ea7c6f.zip
Extend eelink protocol decoder
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java
index b1634042d..4b77b1ff6 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2014 - 2017 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -116,11 +116,27 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
position.setValid((buf.readUnsignedByte() & 0x01) != 0);
if (type == MSG_ALARM) {
- position.set(Position.KEY_ALARM, buf.readUnsignedByte());
+ position.set(Position.KEY_ALARM, decodeAlarm(buf.readUnsignedByte()));
}
- if (type == MSG_STATE) {
- position.set(Position.KEY_STATUS, decodeAlarm(buf.readUnsignedByte()));
+ if (buf.readableBytes() >= 2 * 5) {
+
+ int status = buf.readUnsignedShort();
+ if (BitUtil.check(status, 1)) {
+ position.set(Position.KEY_IGNITION, BitUtil.check(status, 2));
+ }
+ if (BitUtil.check(status, 7)) {
+ position.set(Position.KEY_CHARGE, BitUtil.check(status, 8));
+ }
+ position.set(Position.KEY_STATUS, status);
+
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort() + "mV");
+
+ buf.readUnsignedShort(); // signal strength
+
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort());
+
}
return position;