diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-28 18:24:59 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-28 18:24:59 +1200 |
commit | 03ffd6d914feb8e11fd545bd9d1a9b989190a7d1 (patch) | |
tree | 85ed30afb67228e487d1cecf6f296b440b272969 /src | |
parent | 326b666573a3ca0bbe0f219f3dfe60417d630c44 (diff) | |
download | traccar-server-03ffd6d914feb8e11fd545bd9d1a9b989190a7d1.tar.gz traccar-server-03ffd6d914feb8e11fd545bd9d1a9b989190a7d1.tar.bz2 traccar-server-03ffd6d914feb8e11fd545bd9d1a9b989190a7d1.zip |
Fix Cityeasy identification
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/CityeasyProtocolDecoder.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/CityeasyProtocolDecoder.java b/src/org/traccar/protocol/CityeasyProtocolDecoder.java index ba6a3e62d..c0288a8d5 100644 --- a/src/org/traccar/protocol/CityeasyProtocolDecoder.java +++ b/src/org/traccar/protocol/CityeasyProtocolDecoder.java @@ -15,6 +15,12 @@ */ package org.traccar.protocol; +import java.net.SocketAddress; +import java.nio.charset.Charset; +import java.util.Calendar; +import java.util.TimeZone; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; @@ -23,13 +29,6 @@ import org.traccar.helper.Crc; import org.traccar.model.Event; import org.traccar.model.Position; -import java.net.SocketAddress; -import java.nio.charset.Charset; -import java.util.Calendar; -import java.util.TimeZone; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - public class CityeasyProtocolDecoder extends BaseProtocolDecoder { public CityeasyProtocolDecoder(CityeasyProtocol protocol) { @@ -66,9 +65,10 @@ public class CityeasyProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedShort(); // length String imei = ChannelBufferTools.readHexString(buf, 14); - imei += Crc.luhnChecksum(Long.valueOf(imei)); - if (!identify(imei, channel)) { - return null; + if (!identify(imei, channel, null, false)) { + if (!identify(imei + Crc.luhnChecksum(Long.valueOf(imei)), channel)) { + return null; + } } int type = buf.readUnsignedShort(); |