From 03ffd6d914feb8e11fd545bd9d1a9b989190a7d1 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 28 Jul 2015 18:24:59 +1200 Subject: Fix Cityeasy identification --- .../traccar/protocol/CityeasyProtocolDecoder.java | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/org') 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(); -- cgit v1.2.3