aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-19 15:11:35 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-07-19 15:11:35 +1200
commit815c3de43ee8943fddb916f27317c37a7a806d65 (patch)
treea38e4f6bf80c35ccc83ae9d4c4d3d88e0d837b00 /src/org/traccar/protocol/BlackKiteProtocolDecoder.java
parent4054777eac379ce07560c44901ada659aad062ba (diff)
downloadtrackermap-server-815c3de43ee8943fddb916f27317c37a7a806d65.tar.gz
trackermap-server-815c3de43ee8943fddb916f27317c37a7a806d65.tar.bz2
trackermap-server-815c3de43ee8943fddb916f27317c37a7a806d65.zip
Move device id to a session
Diffstat (limited to 'src/org/traccar/protocol/BlackKiteProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/BlackKiteProtocolDecoder.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/BlackKiteProtocolDecoder.java b/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
index 6787140e0..1c9c0a003 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,6 +20,7 @@ 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;
@@ -96,9 +97,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 +173,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()) {