aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-08-29 05:16:55 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-08-29 05:16:55 +1200
commitff949b7ee233cd343f1fb5bb5ef7db7f24991df0 (patch)
tree2926fb2dc5b51e570198e6e62a74e91e8d5f4633 /src
parent0a8d0110d5d3876a292d6ea8213e62e4bb98c252 (diff)
downloadtrackermap-server-ff949b7ee233cd343f1fb5bb5ef7db7f24991df0.tar.gz
trackermap-server-ff949b7ee233cd343f1fb5bb5ef7db7f24991df0.tar.bz2
trackermap-server-ff949b7ee233cd343f1fb5bb5ef7db7f24991df0.zip
Fix eeLink status decoding
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java
index e16866977..11d111e54 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -131,22 +131,37 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
position.setValid((buf.readUnsignedByte() & 0x01) != 0);
- if (type == MSG_ALARM) {
- position.set(Position.KEY_ALARM, decodeAlarm(buf.readUnsignedByte()));
- }
+ if (type == MSG_GPS) {
- if (buf.readableBytes() >= 2) {
- decodeStatus(position, buf.readUnsignedShort());
- }
+ if (buf.readableBytes() >= 2) {
+ decodeStatus(position, buf.readUnsignedShort());
+ }
+
+ if (buf.readableBytes() >= 2 * 4) {
+
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
+
+ position.set(Position.KEY_RSSI, buf.readUnsignedShort());
- if (buf.readableBytes() >= 2 * 4) {
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort());
- position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
+ }
+
+ } else if (type == MSG_ALARM) {
+
+ position.set(Position.KEY_ALARM, decodeAlarm(buf.readUnsignedByte()));
- position.set(Position.KEY_RSSI, buf.readUnsignedShort());
+ } else if (type == MSG_STATE) {
- position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort());
- position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort());
+ int statusType = buf.readUnsignedByte();
+
+ position.set(Position.KEY_EVENT, statusType);
+
+ if (statusType == 0x01 || statusType == 0x02 || statusType == 0x03) {
+ buf.readUnsignedInt(); // device time
+ decodeStatus(position, buf.readUnsignedShort());
+ }
}