aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/CityeasyProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-28 18:24:59 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-28 18:24:59 +1200
commit03ffd6d914feb8e11fd545bd9d1a9b989190a7d1 (patch)
tree85ed30afb67228e487d1cecf6f296b440b272969 /src/org/traccar/protocol/CityeasyProtocolDecoder.java
parent326b666573a3ca0bbe0f219f3dfe60417d630c44 (diff)
downloadtrackermap-server-03ffd6d914feb8e11fd545bd9d1a9b989190a7d1.tar.gz
trackermap-server-03ffd6d914feb8e11fd545bd9d1a9b989190a7d1.tar.bz2
trackermap-server-03ffd6d914feb8e11fd545bd9d1a9b989190a7d1.zip
Fix Cityeasy identification
Diffstat (limited to 'src/org/traccar/protocol/CityeasyProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/CityeasyProtocolDecoder.java20
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();