diff options
Diffstat (limited to 'src/org/traccar/protocol/BlackKiteProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/BlackKiteProtocolDecoder.java | 14 |
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()) { |