aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-03-23 12:05:35 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2019-03-23 12:05:35 -0700
commit89a8132cdcd4a409adaf8eae6a18c97a640ab738 (patch)
tree100ec2cc5055ecce33f8b38d6e1d695c882bb9ac /src/org/traccar
parentad087c64207c28b5aa0026e9ad198ec677f79fd4 (diff)
downloadtraccar-server-89a8132cdcd4a409adaf8eae6a18c97a640ab738.tar.gz
traccar-server-89a8132cdcd4a409adaf8eae6a18c97a640ab738.tar.bz2
traccar-server-89a8132cdcd4a409adaf8eae6a18c97a640ab738.zip
Support eeLink OBD data
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java
index fce176ec5..2a1db2e32 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -327,6 +327,34 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
return position;
}
+ private Position decodeObd(DeviceSession deviceSession, ByteBuf buf, int index) {
+
+ Position position = new Position(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
+
+ getLastLocation(position, new Date(buf.readUnsignedInt() * 1000));
+
+ while (buf.readableBytes() > 0) {
+ int pid = buf.readUnsignedByte();
+ int value = buf.readInt();
+ switch (pid) {
+ case 0x89:
+ position.set(Position.KEY_FUEL_CONSUMPTION, value);
+ break;
+ case 0x8a:
+ position.set(Position.KEY_ODOMETER, value * 1000L);
+ break;
+ case 0x8b:
+ position.set(Position.KEY_FUEL_LEVEL, value / 10);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return position;
+ }
+
@Override
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
@@ -395,6 +423,10 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
return position;
+ } else if (type == MSG_OBD) {
+
+ return decodeObd(deviceSession, buf, index);
+
} else if (type == MSG_DOWNLINK) {
return decodeResult(deviceSession, buf, index);