diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-07-19 22:25:12 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-19 22:25:12 +1200 |
commit | 4ebf7c5a6df152af9c23eb9caab2885ff79e448c (patch) | |
tree | 3dfcd0b379e71f1fc85b626179a72e14489aeb47 /src/org/traccar/protocol/VisiontekProtocolDecoder.java | |
parent | 934371a0af815e18b3d29f350e96be60606de77b (diff) | |
parent | 1a0eae22fc58d7241e2c60bb593535a17d6c629b (diff) | |
download | traccar-server-4ebf7c5a6df152af9c23eb9caab2885ff79e448c.tar.gz traccar-server-4ebf7c5a6df152af9c23eb9caab2885ff79e448c.tar.bz2 traccar-server-4ebf7c5a6df152af9c23eb9caab2885ff79e448c.zip |
Merge pull request #2127 from tananaev/refactor
Move device id to a session
Diffstat (limited to 'src/org/traccar/protocol/VisiontekProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/VisiontekProtocolDecoder.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/VisiontekProtocolDecoder.java b/src/org/traccar/protocol/VisiontekProtocolDecoder.java index 5d9b905f1..bfd4a78fa 100644 --- a/src/org/traccar/protocol/VisiontekProtocolDecoder.java +++ b/src/org/traccar/protocol/VisiontekProtocolDecoder.java @@ -17,6 +17,7 @@ package org.traccar.protocol; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; +import org.traccar.DeviceSession; import org.traccar.helper.DateBuilder; import org.traccar.helper.Parser; import org.traccar.helper.PatternBuilder; @@ -80,12 +81,11 @@ public class VisiontekProtocolDecoder extends BaseProtocolDecoder { Position position = new Position(); position.setProtocol(getProtocolName()); - String id = parser.next(); - String imei = parser.next(); - if (!identify(id, channel, remoteAddress, false) && (imei == null || !identify(imei, channel, remoteAddress))) { + DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next(), parser.next()); + if (deviceSession == null) { return null; } - position.setDeviceId(getDeviceId()); + position.setDeviceId(deviceSession.getDeviceId()); DateBuilder dateBuilder = new DateBuilder() .setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt()) |