aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/EelinkProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-11-27 22:56:22 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-11-27 22:56:22 +1300
commitb149a7b71283f1a8481c9e3954d636afcff6169e (patch)
treec0682f9493518cb096bfe2e7f609513566c523ff /src/org/traccar/protocol/EelinkProtocolDecoder.java
parent4f772b76b08d7515cf27c7bfda819612aeea26f9 (diff)
downloadtraccar-server-b149a7b71283f1a8481c9e3954d636afcff6169e.tar.gz
traccar-server-b149a7b71283f1a8481c9e3954d636afcff6169e.tar.bz2
traccar-server-b149a7b71283f1a8481c9e3954d636afcff6169e.zip
Support eeLink UDP format
Diffstat (limited to 'src/org/traccar/protocol/EelinkProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java
index 8d0f8016a..91ae16289 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -265,6 +265,16 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
ChannelBuffer buf = (ChannelBuffer) msg;
+ DeviceSession deviceSession = null;
+
+ if (buf.getByte(0) == 'E' && buf.getByte(1) == 'L') {
+ buf.skipBytes(2 + 2 + 2); // udp header
+ deviceSession = getDeviceSession(
+ channel, remoteAddress, ChannelBuffers.hexDump(buf.readBytes(8)).substring(1));
+ } else {
+ deviceSession = getDeviceSession(channel, remoteAddress);
+ }
+
buf.skipBytes(2); // header
int type = buf.readUnsignedByte();
buf.readShort(); // length
@@ -276,11 +286,12 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
if (type == MSG_LOGIN) {
- getDeviceSession(channel, remoteAddress, ChannelBuffers.hexDump(buf.readBytes(8)).substring(1));
+ if (deviceSession == null) {
+ getDeviceSession(channel, remoteAddress, ChannelBuffers.hexDump(buf.readBytes(8)).substring(1));
+ }
} else {
- DeviceSession deviceSession = getDeviceSession(channel, remoteAddress);
if (deviceSession == null) {
return null;
}