aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
diff options
context:
space:
mode:
authorninioe <ninioe@gmail.com>2016-07-19 15:20:15 +0300
committerninioe <ninioe@gmail.com>2016-07-19 15:20:15 +0300
commit20f603076210073e122c720e21a3e8999478b11a (patch)
tree668a50e6c55601c2420bf0f4b986ed0b194c2e32 /src/org/traccar/protocol/BlackKiteProtocolDecoder.java
parente954e95547d05a34bbd36e3aa5003f4ddaf2ccd0 (diff)
parent00e2f8a3575855a8b863e245005b8f83b3314bfb (diff)
downloadtrackermap-server-20f603076210073e122c720e21a3e8999478b11a.tar.gz
trackermap-server-20f603076210073e122c720e21a3e8999478b11a.tar.bz2
trackermap-server-20f603076210073e122c720e21a3e8999478b11a.zip
Merge remote-tracking branch 'refs/remotes/tananaev/master'
Diffstat (limited to 'src/org/traccar/protocol/BlackKiteProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/BlackKiteProtocolDecoder.java14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/BlackKiteProtocolDecoder.java b/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
index 6787140e0..92179072a 100644
--- a/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
+++ b/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
@@ -1,6 +1,6 @@
/*
+ * Copyright 2013 - 2016 Anton Tananaev (anton.tananaev@gmail.com)
* Copyright 2015 Vijay Kumar (vijaykumar@zilogic.com)
- * Copyright 2013 - 2014 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,8 +20,8 @@ import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.DeviceSession;
import org.traccar.helper.BitUtil;
-import org.traccar.helper.Log;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -96,9 +96,7 @@ public class BlackKiteProtocolDecoder extends BaseProtocolDecoder {
switch (tag) {
case TAG_IMEI:
- String imei = buf.toString(buf.readerIndex(), 15, StandardCharsets.US_ASCII);
- buf.skipBytes(imei.length());
- identify(imei, channel, remoteAddress);
+ getDeviceSession(channel, remoteAddress, buf.readBytes(15).toString(StandardCharsets.US_ASCII));
break;
case TAG_DATE:
@@ -174,15 +172,15 @@ public class BlackKiteProtocolDecoder extends BaseProtocolDecoder {
positions.add(position);
}
- if (!hasDeviceId()) {
- Log.warning("Unknown device");
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress);
+ if (deviceSession == null) {
return null;
}
sendReply(channel, buf.readUnsignedShort());
for (Position p : positions) {
- p.setDeviceId(getDeviceId());
+ p.setDeviceId(deviceSession.getDeviceId());
}
if (positions.isEmpty()) {