aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/BaseProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/AdmProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/ApelProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/AplicomProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/AquilaProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Ardi01ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/AutoFon45ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/AutoFonProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Avl301ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/BceProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/BlackKiteProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/BoxProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/CarTrackProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/CarscopProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/CellocatorProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/CityeasyProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/EasyTrackProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/EnforaProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/FlextrackProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/FreedomProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/GalileoProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/GatorProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Gl100ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/GlobalSatProtocolDecoder.java12
-rw-r--r--src/org/traccar/protocol/GotopProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/GpsGateProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Gt02ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java12
-rw-r--r--src/org/traccar/protocol/HaicomProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/IntellitracProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java12
-rw-r--r--src/org/traccar/protocol/KhdProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/LaipacProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/M2mProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/ManPowerProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/MegastekProtocolDecoder.java16
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java8
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java12
-rw-r--r--src/org/traccar/protocol/MiniFinderProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Mta6ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/MtxProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/MxtProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/NavigilProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/NavisProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/OrionProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/OsmAndProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/PiligrimProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/ProgressProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Pt3000ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Pt502ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/RitiProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/RuptelaProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/SanavProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/SkypatrolProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Stl060ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/SuntechProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/T55ProtocolDecoder.java12
-rw-r--r--src/org/traccar/protocol/TaipProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/TelikProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Tk102ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Tlt2hProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/TopflytechProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/TotemProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Tr20ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/TrackboxProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/TramigoProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/TrvProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/TzoneProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/UlbotechProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/V680ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/VisiontekProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/WatchProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/WialonProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/WondexProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/XexunProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Xt013ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/YwtProtocolDecoder.java2
-rw-r--r--test/org/traccar/protocol/Gps103ProtocolDecoderTest.java3
-rw-r--r--web/app/store/DistanceUnits.js4
-rw-r--r--web/app/store/SpeedUnits.js2
85 files changed, 137 insertions, 132 deletions
diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java
index bd91f5e09..3bd39d594 100644
--- a/src/org/traccar/BaseProtocolDecoder.java
+++ b/src/org/traccar/BaseProtocolDecoder.java
@@ -15,6 +15,7 @@
*/
package org.traccar;
+import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.Date;
@@ -51,7 +52,11 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder {
} else {
deviceId = 0;
if (logWarning) {
- Log.warning("Unknown device - " + uniqueId);
+ String message = "Unknown device - " + uniqueId;
+ if (remoteAddress != null) {
+ message += " (" + ((InetSocketAddress) remoteAddress).getHostString() + ")";
+ }
+ Log.warning(message);
}
return false;
}
@@ -66,10 +71,6 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder {
return identify(uniqueId, channel, remoteAddress, true);
}
- public boolean identify(String uniqueId, Channel channel) {
- return identify(uniqueId, channel, null, true);
- }
-
public BaseProtocolDecoder(Protocol protocol) {
this.protocol = protocol;
}
diff --git a/src/org/traccar/protocol/AdmProtocolDecoder.java b/src/org/traccar/protocol/AdmProtocolDecoder.java
index a40b00e90..374dd8995 100644
--- a/src/org/traccar/protocol/AdmProtocolDecoder.java
+++ b/src/org/traccar/protocol/AdmProtocolDecoder.java
@@ -49,7 +49,7 @@ public class AdmProtocolDecoder extends BaseProtocolDecoder {
int type = buf.readUnsignedByte();
if (type == MSG_IMEI) {
- identify(buf.toString(buf.readerIndex(), 15, Charset.defaultCharset()), channel);
+ identify(buf.toString(buf.readerIndex(), 15, Charset.defaultCharset()), channel, remoteAddress);
}
if (hasDeviceId() && BitUtil.to(type, 2) == 0) {
diff --git a/src/org/traccar/protocol/ApelProtocolDecoder.java b/src/org/traccar/protocol/ApelProtocolDecoder.java
index e346e7d88..a72447883 100644
--- a/src/org/traccar/protocol/ApelProtocolDecoder.java
+++ b/src/org/traccar/protocol/ApelProtocolDecoder.java
@@ -110,7 +110,7 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder {
int length = buf.readUnsignedShort();
buf.skipBytes(length);
length = buf.readUnsignedShort();
- identify(buf.readBytes(length).toString(Charset.defaultCharset()), channel);
+ identify(buf.readBytes(length).toString(Charset.defaultCharset()), channel, remoteAddress);
} else if (type == MSG_LAST_LOG_INDEX) {
diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java
index 59d68629e..6ae6aa09f 100644
--- a/src/org/traccar/protocol/AplicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java
@@ -214,7 +214,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(imei, channel)) {
+ if (!identify(imei, channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/AquilaProtocolDecoder.java b/src/org/traccar/protocol/AquilaProtocolDecoder.java
index 577a7bbef..74b127bfe 100644
--- a/src/org/traccar/protocol/AquilaProtocolDecoder.java
+++ b/src/org/traccar/protocol/AquilaProtocolDecoder.java
@@ -80,7 +80,7 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/Ardi01ProtocolDecoder.java b/src/org/traccar/protocol/Ardi01ProtocolDecoder.java
index 80186894a..8f449222b 100644
--- a/src/org/traccar/protocol/Ardi01ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Ardi01ProtocolDecoder.java
@@ -59,7 +59,7 @@ public class Ardi01ProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java b/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java
index 8ff306c41..ad3097a68 100644
--- a/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java
+++ b/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java
@@ -69,7 +69,7 @@ public class AutoFon45ProtocolDecoder extends BaseProtocolDecoder {
buf.readBytes(bytes);
String imei = ChannelBuffers.hexDump(ChannelBuffers.wrappedBuffer(bytes, 1, 8)).substring(1);
- if (!identify(imei, channel)) {
+ if (!identify(imei, channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
index 9356e2cd7..84df09a29 100644
--- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java
+++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
@@ -110,7 +110,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // software version
String imei = ChannelBuffers.hexDump(buf.readBytes(8)).substring(1);
- if (!identify(imei, channel)) {
+ if (!identify(imei, channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/Avl301ProtocolDecoder.java b/src/org/traccar/protocol/Avl301ProtocolDecoder.java
index 1b0ee89a7..c0aefbeae 100644
--- a/src/org/traccar/protocol/Avl301ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Avl301ProtocolDecoder.java
@@ -69,7 +69,7 @@ public class Avl301ProtocolDecoder extends BaseProtocolDecoder {
if (type == MSG_LOGIN) {
- if (identify(readImei(buf), channel)) {
+ if (identify(readImei(buf), channel, remoteAddress)) {
sendResponse(channel, type);
}
diff --git a/src/org/traccar/protocol/BceProtocolDecoder.java b/src/org/traccar/protocol/BceProtocolDecoder.java
index c5aa2693f..5a5092ae0 100644
--- a/src/org/traccar/protocol/BceProtocolDecoder.java
+++ b/src/org/traccar/protocol/BceProtocolDecoder.java
@@ -49,7 +49,7 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
ChannelBuffer buf = (ChannelBuffer) msg;
String imei = String.format("%015d", buf.readLong());
- if (!identify(imei, channel)) {
+ if (!identify(imei, channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/BlackKiteProtocolDecoder.java b/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
index 3a32a1dc2..9f4724351 100644
--- a/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
+++ b/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
@@ -98,7 +98,7 @@ public class BlackKiteProtocolDecoder extends BaseProtocolDecoder {
case TAG_IMEI:
String imei = buf.toString(buf.readerIndex(), 15, Charset.defaultCharset());
buf.skipBytes(imei.length());
- identify(imei, channel);
+ identify(imei, channel, remoteAddress);
break;
case TAG_DATE:
diff --git a/src/org/traccar/protocol/BoxProtocolDecoder.java b/src/org/traccar/protocol/BoxProtocolDecoder.java
index 24f8b1d9d..7cd9ad0f9 100644
--- a/src/org/traccar/protocol/BoxProtocolDecoder.java
+++ b/src/org/traccar/protocol/BoxProtocolDecoder.java
@@ -57,7 +57,7 @@ public class BoxProtocolDecoder extends BaseProtocolDecoder {
int index = sentence.indexOf(',', 2) + 1;
String id = sentence.substring(index, sentence.indexOf(',', index));
- identify(id, channel);
+ identify(id, channel, remoteAddress);
} else if (sentence.startsWith("E,")) {
diff --git a/src/org/traccar/protocol/CarTrackProtocolDecoder.java b/src/org/traccar/protocol/CarTrackProtocolDecoder.java
index 762017d33..9a0a98992 100644
--- a/src/org/traccar/protocol/CarTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/CarTrackProtocolDecoder.java
@@ -67,7 +67,7 @@ public class CarTrackProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/CarscopProtocolDecoder.java b/src/org/traccar/protocol/CarscopProtocolDecoder.java
index db38cb4f0..9dce57b4e 100644
--- a/src/org/traccar/protocol/CarscopProtocolDecoder.java
+++ b/src/org/traccar/protocol/CarscopProtocolDecoder.java
@@ -56,7 +56,7 @@ public class CarscopProtocolDecoder extends BaseProtocolDecoder {
int index = sentence.indexOf("UB05");
if (index != -1) {
String imei = sentence.substring(index + 4, index + 4 + 15);
- identify(imei, channel);
+ identify(imei, channel, remoteAddress);
}
if (!hasDeviceId()) {
return null;
diff --git a/src/org/traccar/protocol/CellocatorProtocolDecoder.java b/src/org/traccar/protocol/CellocatorProtocolDecoder.java
index 27c94c6ba..79db82bd1 100644
--- a/src/org/traccar/protocol/CellocatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/CellocatorProtocolDecoder.java
@@ -89,7 +89,7 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(String.valueOf(deviceUniqueId), channel)) {
+ if (!identify(String.valueOf(deviceUniqueId), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/CityeasyProtocolDecoder.java b/src/org/traccar/protocol/CityeasyProtocolDecoder.java
index 4d9d93544..4ccd96a17 100644
--- a/src/org/traccar/protocol/CityeasyProtocolDecoder.java
+++ b/src/org/traccar/protocol/CityeasyProtocolDecoder.java
@@ -73,7 +73,8 @@ public class CityeasyProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(); // length
String imei = ChannelBuffers.hexDump(buf.readBytes(7));
- if (!identify(imei, channel, null, false) && !identify(imei + Checksum.luhn(Long.parseLong(imei)), channel)) {
+ if (!identify(imei, channel, remoteAddress, false)
+ && !identify(imei + Checksum.luhn(Long.parseLong(imei)), channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
index 352fc97dc..cff90c7f1 100644
--- a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
@@ -70,7 +70,7 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java
index b75587743..f81e22bee 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -69,7 +69,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
if (type == MSG_LOGIN) {
- identify(ChannelBuffers.hexDump(buf.readBytes(8)).substring(1), channel);
+ identify(ChannelBuffers.hexDump(buf.readBytes(8)).substring(1), channel, remoteAddress);
} else if (hasDeviceId()
&& (type == MSG_GPS || type == MSG_ALARM || type == MSG_STATE || type == MSG_SMS)) {
diff --git a/src/org/traccar/protocol/EnforaProtocolDecoder.java b/src/org/traccar/protocol/EnforaProtocolDecoder.java
index 424182da9..0153d254c 100644
--- a/src/org/traccar/protocol/EnforaProtocolDecoder.java
+++ b/src/org/traccar/protocol/EnforaProtocolDecoder.java
@@ -76,7 +76,7 @@ public class EnforaProtocolDecoder extends BaseProtocolDecoder {
}
String imei = buf.toString(index, IMEI_LENGTH, Charset.defaultCharset());
- if (!identify(imei, channel)) {
+ if (!identify(imei, channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/FlextrackProtocolDecoder.java b/src/org/traccar/protocol/FlextrackProtocolDecoder.java
index bc9825b49..0f82e7c59 100644
--- a/src/org/traccar/protocol/FlextrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/FlextrackProtocolDecoder.java
@@ -87,7 +87,7 @@ public class FlextrackProtocolDecoder extends BaseProtocolDecoder {
String id = parser.next();
String iccid = parser.next();
- if (!identify(iccid, channel, null, false) && !identify(id, channel)) {
+ if (!identify(iccid, channel, remoteAddress, false) && !identify(id, channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/FreedomProtocolDecoder.java b/src/org/traccar/protocol/FreedomProtocolDecoder.java
index e5f0dceee..d7d704869 100644
--- a/src/org/traccar/protocol/FreedomProtocolDecoder.java
+++ b/src/org/traccar/protocol/FreedomProtocolDecoder.java
@@ -55,7 +55,7 @@ public class FreedomProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java
index ce8716291..ef7cd2ab1 100644
--- a/src/org/traccar/protocol/GalileoProtocolDecoder.java
+++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java
@@ -144,7 +144,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
case TAG_IMEI:
String imei = buf.toString(buf.readerIndex(), 15, Charset.defaultCharset());
buf.skipBytes(imei.length());
- identify(imei, channel);
+ identify(imei, channel, remoteAddress);
break;
case TAG_DATE:
diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java
index aad771099..22b3ebc3a 100644
--- a/src/org/traccar/protocol/GatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/GatorProtocolDecoder.java
@@ -74,7 +74,7 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify("1" + id, channel, null, false) && !identify(id, channel)) {
+ if (!identify("1" + id, channel, remoteAddress, false) && !identify(id, channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/Gl100ProtocolDecoder.java b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
index 2995230ee..1a144ae27 100644
--- a/src/org/traccar/protocol/Gl100ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
@@ -74,7 +74,7 @@ public class Gl100ProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
index 2643b6375..589bb991a 100644
--- a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
+++ b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
@@ -47,7 +47,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
format1 = format;
}
- private Position decodeOriginal(Channel channel, String sentence) {
+ private Position decodeOriginal(Channel channel, SocketAddress remoteAddress, String sentence) {
if (channel != null) {
channel.write("ACK\r");
@@ -84,7 +84,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
switch (format.charAt(formatIndex)) {
case 'S':
- if (!identify(value, channel)) {
+ if (!identify(value, channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
@@ -193,7 +193,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
.number("(d+.?d*)") // hdop
.compile();
- private Position decodeAlternative(Channel channel, String sentence) {
+ private Position decodeAlternative(Channel channel, SocketAddress remoteAddress, String sentence) {
Parser parser = new Parser(PATTERN, sentence);
if (!parser.matches()) {
@@ -203,7 +203,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
@@ -234,9 +234,9 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
if (sentence.startsWith("GS")) {
- return decodeOriginal(channel, sentence);
+ return decodeOriginal(channel, remoteAddress, sentence);
} else if (sentence.startsWith("$")) {
- return decodeAlternative(channel, sentence);
+ return decodeAlternative(channel, remoteAddress, sentence);
}
return null;
diff --git a/src/org/traccar/protocol/GotopProtocolDecoder.java b/src/org/traccar/protocol/GotopProtocolDecoder.java
index cfae1b0f6..594b4c958 100644
--- a/src/org/traccar/protocol/GotopProtocolDecoder.java
+++ b/src/org/traccar/protocol/GotopProtocolDecoder.java
@@ -58,7 +58,7 @@ public class GotopProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index a91848f5b..f6cd57d9e 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -67,7 +67,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
.text("imei:")
.number("(d+),") // imei
.expression("[^,]+,") // alarm
- .number("d+,,")
+ .number("d*,,")
.text("L,,,")
.number("(x+),,") // lac
.number("(x+),,,") // cid
@@ -90,7 +90,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
channel.write("LOAD", remoteAddress);
Parser handshakeParser = new Parser(PATTERN_HANDSHAKE, sentence);
if (handshakeParser.matches()) {
- identify(handshakeParser.next(), channel);
+ identify(handshakeParser.next(), channel, remoteAddress);
}
}
return null;
diff --git a/src/org/traccar/protocol/GpsGateProtocolDecoder.java b/src/org/traccar/protocol/GpsGateProtocolDecoder.java
index 6c0d663d4..421dc5304 100644
--- a/src/org/traccar/protocol/GpsGateProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsGateProtocolDecoder.java
@@ -66,7 +66,7 @@ public class GpsGateProtocolDecoder extends BaseProtocolDecoder {
int endIndex = sentence.indexOf(',', beginIndex);
if (endIndex != -1) {
String imei = sentence.substring(beginIndex, endIndex);
- if (identify(imei, channel)) {
+ if (identify(imei, channel, remoteAddress)) {
if (channel != null) {
send(channel, "$FRSES," + channel.getId());
}
diff --git a/src/org/traccar/protocol/Gt02ProtocolDecoder.java b/src/org/traccar/protocol/Gt02ProtocolDecoder.java
index 53739ee1c..0b015366e 100644
--- a/src/org/traccar/protocol/Gt02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt02ProtocolDecoder.java
@@ -52,7 +52,7 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder {
int gsm = buf.readUnsignedByte();
String imei = ChannelBuffers.hexDump(buf.readBytes(8)).substring(1);
- if (!identify(imei, channel)) {
+ if (!identify(imei, channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index 486539bc1..2b049c57e 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -197,7 +197,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
}
}
- if (identify(imei, channel)) {
+ if (identify(imei, channel, remoteAddress)) {
buf.skipBytes(buf.readableBytes() - 6);
sendResponse(channel, type, buf.readUnsignedShort());
}
diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java
index 31bdd9aa9..2b8adda4a 100644
--- a/src/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/H02ProtocolDecoder.java
@@ -70,14 +70,14 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_STATUS, status);
}
- private Position decodeBinary(ChannelBuffer buf, Channel channel) {
+ private Position decodeBinary(ChannelBuffer buf, Channel channel, SocketAddress remoteAddress) {
Position position = new Position();
position.setProtocol(getProtocolName());
buf.readByte(); // marker
- if (!identify(ChannelBuffers.hexDump(buf.readBytes(5)), channel)) {
+ if (!identify(ChannelBuffers.hexDump(buf.readBytes(5)), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
@@ -141,7 +141,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
.any()
.compile();
- private Position decodeText(String sentence, Channel channel) {
+ private Position decodeText(String sentence, Channel channel, SocketAddress remoteAddress) {
Parser parser = new Parser(PATTERN, sentence);
if (!parser.matches()) {
@@ -151,7 +151,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
@@ -198,9 +198,9 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
// handle X mode?
if (marker.equals("*")) {
- return decodeText(buf.toString(Charset.defaultCharset()), channel);
+ return decodeText(buf.toString(Charset.defaultCharset()), channel, remoteAddress);
} else if (marker.equals("$")) {
- return decodeBinary(buf, channel);
+ return decodeBinary(buf, channel, remoteAddress);
}
return null;
diff --git a/src/org/traccar/protocol/HaicomProtocolDecoder.java b/src/org/traccar/protocol/HaicomProtocolDecoder.java
index db6090650..009c6046c 100644
--- a/src/org/traccar/protocol/HaicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/HaicomProtocolDecoder.java
@@ -65,7 +65,7 @@ public class HaicomProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
index 20a0f9160..fbab27c17 100644
--- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java
+++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
@@ -75,7 +75,7 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index b576b063d..7c6ab8a4d 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -42,7 +42,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
return degrees + minutes / 60;
}
- private Position decodeNormalMessage(ChannelBuffer buf, Channel channel) {
+ private Position decodeNormalMessage(ChannelBuffer buf, Channel channel, SocketAddress remoteAddress) {
Position position = new Position();
position.setProtocol(getProtocolName());
@@ -50,7 +50,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
buf.readByte(); // header
String id = String.valueOf(Long.parseLong(ChannelBuffers.hexDump(buf.readBytes(5))));
- if (!identify(id, channel)) {
+ if (!identify(id, channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
@@ -139,7 +139,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
.text(")")
.compile();
- private Position decodeAlertMessage(ChannelBuffer buf, Channel channel) {
+ private Position decodeAlertMessage(ChannelBuffer buf, Channel channel, SocketAddress remoteAddress) {
Parser parser = new Parser(PATTERN, buf.toString(Charset.defaultCharset()));
if (!parser.matches()) {
@@ -151,7 +151,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_ALARM, true);
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
@@ -181,9 +181,9 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
char first = (char) buf.getByte(0);
if (first == '$') {
- return decodeNormalMessage(buf, channel);
+ return decodeNormalMessage(buf, channel, remoteAddress);
} else if (first == '(') {
- return decodeAlertMessage(buf, channel);
+ return decodeAlertMessage(buf, channel, remoteAddress);
}
return null;
diff --git a/src/org/traccar/protocol/KhdProtocolDecoder.java b/src/org/traccar/protocol/KhdProtocolDecoder.java
index f6083be70..c1ebb1bf4 100644
--- a/src/org/traccar/protocol/KhdProtocolDecoder.java
+++ b/src/org/traccar/protocol/KhdProtocolDecoder.java
@@ -73,7 +73,7 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(readSerialNumber(buf), channel)) {
+ if (!identify(readSerialNumber(buf), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/LaipacProtocolDecoder.java b/src/org/traccar/protocol/LaipacProtocolDecoder.java
index 97fcfe3b5..292e8adbb 100644
--- a/src/org/traccar/protocol/LaipacProtocolDecoder.java
+++ b/src/org/traccar/protocol/LaipacProtocolDecoder.java
@@ -67,7 +67,7 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/M2mProtocolDecoder.java b/src/org/traccar/protocol/M2mProtocolDecoder.java
index d60303601..dbb73c469 100644
--- a/src/org/traccar/protocol/M2mProtocolDecoder.java
+++ b/src/org/traccar/protocol/M2mProtocolDecoder.java
@@ -60,7 +60,7 @@ public class M2mProtocolDecoder extends BaseProtocolDecoder {
imei.append(b % 10);
}
- identify(imei.toString(), channel);
+ identify(imei.toString(), channel, remoteAddress);
} else if (hasDeviceId()) {
diff --git a/src/org/traccar/protocol/ManPowerProtocolDecoder.java b/src/org/traccar/protocol/ManPowerProtocolDecoder.java
index 48c36bb6a..8c189eef9 100644
--- a/src/org/traccar/protocol/ManPowerProtocolDecoder.java
+++ b/src/org/traccar/protocol/ManPowerProtocolDecoder.java
@@ -60,7 +60,7 @@ public class ManPowerProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java
index dc9e6056e..e28bf6c1d 100644
--- a/src/org/traccar/protocol/MegastekProtocolDecoder.java
+++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java
@@ -99,7 +99,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
return true;
}
- private Position decodeOld(Channel channel, String sentence) {
+ private Position decodeOld(Channel channel, SocketAddress remoteAddress, String sentence) {
// Detect type
boolean simple = sentence.charAt(3) == ',' || sentence.charAt(6) == ',';
@@ -157,7 +157,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_ALARM, parser.next());
- if (!identify(parser.next(), channel, null, false) && !identify(id, channel)) {
+ if (!identify(parser.next(), channel, remoteAddress, false) && !identify(id, channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
@@ -182,7 +182,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
} else {
- if (!identify(id, channel)) {
+ if (!identify(id, channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
@@ -194,7 +194,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
Parser parser = new Parser(PATTERN_ALTERNATIVE, status);
if (parser.matches()) {
- if (!identify(id, channel)) {
+ if (!identify(id, channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
@@ -264,7 +264,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
.any()
.compile();
- private Position decodeNew(Channel channel, String sentence) {
+ private Position decodeNew(Channel channel, SocketAddress remoteAddress, String sentence) {
Parser parser = new Parser(PATTERN_NEW, sentence);
if (!parser.matches()) {
@@ -274,7 +274,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
@@ -343,9 +343,9 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
if (sentence.startsWith("$MG")) {
- return decodeNew(channel, sentence);
+ return decodeNew(channel, remoteAddress, sentence);
} else {
- return decodeOld(channel, sentence);
+ return decodeOld(channel, remoteAddress, sentence);
}
}
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index 046162331..cb2139a00 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -94,7 +94,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_RFID = 0x9966;
- private boolean identify(ChannelBuffer buf, Channel channel) {
+ private boolean identify(ChannelBuffer buf, Channel channel, SocketAddress remoteAddress) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < 7; i++) {
@@ -119,11 +119,11 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
// Try to recreate full IMEI number
// Sometimes first digit is cut, so this won't work
- if (id.length() == 14 && identify(id + Checksum.luhn(Long.parseLong(id)), channel, null, false)) {
+ if (id.length() == 14 && identify(id + Checksum.luhn(Long.parseLong(id)), channel, remoteAddress, false)) {
return true;
}
- return identify(id, channel);
+ return identify(id, channel, remoteAddress);
}
private static void sendResponse(
@@ -206,7 +206,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
buf.skipBytes(6);
}
- if (!identify(id, channel)) {
+ if (!identify(id, channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
index 4bde5cf75..e0ca01412 100644
--- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -79,7 +79,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
.text("\r\n").optional()
.compile();
- private Position decodeRegularMessage(Channel channel, ChannelBuffer buf) {
+ private Position decodeRegularMessage(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) {
Parser parser = new Parser(PATTERN, buf.toString(Charset.defaultCharset()));
if (!parser.matches()) {
@@ -89,7 +89,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
@@ -155,14 +155,14 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
return position;
}
- private List<Position> decodeBinaryMessage(Channel channel, ChannelBuffer buf) {
+ private List<Position> decodeBinaryMessage(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) {
List<Position> positions = new LinkedList<>();
String flag = buf.toString(2, 1, Charset.defaultCharset());
int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) ',');
String imei = buf.toString(index + 1, 15, Charset.defaultCharset());
- if (!identify(imei, channel)) {
+ if (!identify(imei, channel, remoteAddress)) {
return null;
}
@@ -238,9 +238,9 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
String type = buf.toString(index + 1, 3, Charset.defaultCharset());
if (type.equals("CCC")) {
- return decodeBinaryMessage(channel, buf);
+ return decodeBinaryMessage(channel, remoteAddress, buf);
} else {
- return decodeRegularMessage(channel, buf);
+ return decodeRegularMessage(channel, remoteAddress, buf);
}
}
diff --git a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
index 5a5ef3964..eda085bc3 100644
--- a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
+++ b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
@@ -60,7 +60,7 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder {
if (sentence.startsWith("!1")) {
- identify(sentence.substring(3, sentence.length()), channel);
+ identify(sentence.substring(3, sentence.length()), channel, remoteAddress);
} else if ((sentence.startsWith("!D") || sentence.startsWith("!A")) && hasDeviceId()) {
diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
index f0349a2ef..bc8d95551 100644
--- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
@@ -283,7 +283,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
buf.skipBytes("id=".length());
int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '&');
String uniqueId = buf.toString(buf.readerIndex(), index - buf.readerIndex(), Charset.defaultCharset());
- if (!identify(uniqueId, channel)) {
+ if (!identify(uniqueId, channel, remoteAddress)) {
return null;
}
buf.skipBytes(uniqueId.length());
diff --git a/src/org/traccar/protocol/MtxProtocolDecoder.java b/src/org/traccar/protocol/MtxProtocolDecoder.java
index 802875345..37a384be9 100644
--- a/src/org/traccar/protocol/MtxProtocolDecoder.java
+++ b/src/org/traccar/protocol/MtxProtocolDecoder.java
@@ -71,7 +71,7 @@ public class MtxProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/MxtProtocolDecoder.java b/src/org/traccar/protocol/MxtProtocolDecoder.java
index 3ff127d5d..fedb7c715 100644
--- a/src/org/traccar/protocol/MxtProtocolDecoder.java
+++ b/src/org/traccar/protocol/MxtProtocolDecoder.java
@@ -46,7 +46,7 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder {
int type = buf.readUnsignedByte();
String id = String.valueOf(buf.readUnsignedInt());
- if (!identify(id, channel)) {
+ if (!identify(id, channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/NavigilProtocolDecoder.java b/src/org/traccar/protocol/NavigilProtocolDecoder.java
index 60aaab345..5b1d67a45 100644
--- a/src/org/traccar/protocol/NavigilProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavigilProtocolDecoder.java
@@ -274,7 +274,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(); // checksum
// Get device identifier
- if (!identify(String.valueOf(buf.readUnsignedInt()), channel)) {
+ if (!identify(String.valueOf(buf.readUnsignedInt()), channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java
index c5dc9fbdc..0d740298d 100644
--- a/src/org/traccar/protocol/NavisProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavisProtocolDecoder.java
@@ -217,9 +217,9 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
return positions;
}
- private Object processHandshake(Channel channel, ChannelBuffer buf) {
+ private Object processHandshake(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) {
buf.readByte(); // semicolon symbol
- if (identify(buf.toString(Charset.defaultCharset()), channel)) {
+ if (identify(buf.toString(Charset.defaultCharset()), channel, remoteAddress)) {
sendReply(channel, ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "*<S", CHARSET));
}
return null;
@@ -273,7 +273,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
case "*>A":
return processArray(channel, buf);
case "*>S":
- return processHandshake(channel, buf);
+ return processHandshake(channel, remoteAddress, buf);
default:
Log.warning(new UnsupportedOperationException(type));
break;
diff --git a/src/org/traccar/protocol/OrionProtocolDecoder.java b/src/org/traccar/protocol/OrionProtocolDecoder.java
index a208d83e4..d2b0ed5ea 100644
--- a/src/org/traccar/protocol/OrionProtocolDecoder.java
+++ b/src/org/traccar/protocol/OrionProtocolDecoder.java
@@ -68,7 +68,7 @@ public class OrionProtocolDecoder extends BaseProtocolDecoder {
sendResponse(channel, buf);
}
- if (!identify(String.valueOf(buf.readUnsignedInt()), channel)) {
+ if (!identify(String.valueOf(buf.readUnsignedInt()), channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
index 529a2940e..2476a983f 100644
--- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java
+++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
@@ -62,7 +62,7 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
} else {
id = params.get("deviceid").get(0);
}
- if (!identify(id, channel)) {
+ if (!identify(id, channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/PiligrimProtocolDecoder.java b/src/org/traccar/protocol/PiligrimProtocolDecoder.java
index 4f194605d..9cd2c1dc1 100644
--- a/src/org/traccar/protocol/PiligrimProtocolDecoder.java
+++ b/src/org/traccar/protocol/PiligrimProtocolDecoder.java
@@ -81,7 +81,7 @@ public class PiligrimProtocolDecoder extends BaseProtocolDecoder {
sendResponse(channel, "BINGPS: OK");
QueryStringDecoder decoder = new QueryStringDecoder(request.getUri());
- if (!identify(decoder.getParameters().get("imei").get(0), channel)) {
+ if (!identify(decoder.getParameters().get("imei").get(0), channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/ProgressProtocolDecoder.java b/src/org/traccar/protocol/ProgressProtocolDecoder.java
index 93091e0a1..eead2b4bb 100644
--- a/src/org/traccar/protocol/ProgressProtocolDecoder.java
+++ b/src/org/traccar/protocol/ProgressProtocolDecoder.java
@@ -78,7 +78,7 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
buf.skipBytes(length);
length = buf.readUnsignedShort();
String imei = buf.readBytes(length).toString(Charset.defaultCharset());
- identify(imei, channel);
+ identify(imei, channel, remoteAddress);
} else if (hasDeviceId() && (type == MSG_POINT || type == MSG_ALARM || type == MSG_LOGMSG)) {
diff --git a/src/org/traccar/protocol/Pt3000ProtocolDecoder.java b/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
index 1eaba20e4..d0476d66b 100644
--- a/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
@@ -57,7 +57,7 @@ public class Pt3000ProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
index 4eec65758..faca2a620 100644
--- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
@@ -68,7 +68,7 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/RitiProtocolDecoder.java b/src/org/traccar/protocol/RitiProtocolDecoder.java
index 23d0243cc..1b95bb8f6 100644
--- a/src/org/traccar/protocol/RitiProtocolDecoder.java
+++ b/src/org/traccar/protocol/RitiProtocolDecoder.java
@@ -58,7 +58,7 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(String.valueOf(buf.readUnsignedShort()), channel)) {
+ if (!identify(String.valueOf(buf.readUnsignedShort()), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/org/traccar/protocol/RuptelaProtocolDecoder.java
index ede92d837..3bb8ad1f4 100644
--- a/src/org/traccar/protocol/RuptelaProtocolDecoder.java
+++ b/src/org/traccar/protocol/RuptelaProtocolDecoder.java
@@ -44,7 +44,7 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(); // data length
String imei = String.format("%015d", buf.readLong());
- if (!identify(imei, channel)) {
+ if (!identify(imei, channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/SanavProtocolDecoder.java b/src/org/traccar/protocol/SanavProtocolDecoder.java
index 1411651d5..2adefcf3a 100644
--- a/src/org/traccar/protocol/SanavProtocolDecoder.java
+++ b/src/org/traccar/protocol/SanavProtocolDecoder.java
@@ -60,7 +60,7 @@ public class SanavProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
index 231024731..262bafa6e 100644
--- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
+++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
@@ -84,7 +84,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
Log.warning("No device id field");
return null;
}
- if (!identify(id, channel)) {
+ if (!identify(id, channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/Stl060ProtocolDecoder.java b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
index b583aee66..e85831b5d 100644
--- a/src/org/traccar/protocol/Stl060ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
@@ -78,7 +78,7 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java
index 38f771eec..89c8b2ebd 100644
--- a/src/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -71,7 +71,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
}
}
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java
index d8b3eefe8..9c47d1ab0 100644
--- a/src/org/traccar/protocol/T55ProtocolDecoder.java
+++ b/src/org/traccar/protocol/T55ProtocolDecoder.java
@@ -206,25 +206,25 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
if (id.endsWith(",")) {
id = id.substring(0, id.length() - 1);
}
- identify(id, channel);
+ identify(id, channel, remoteAddress);
sentence = sentence.substring(index);
}
if (sentence.startsWith("$PGID")) {
- identify(sentence.substring(6, sentence.length() - 3), channel);
+ identify(sentence.substring(6, sentence.length() - 3), channel, remoteAddress);
} else if (sentence.startsWith("$PCPTI")) {
- identify(sentence.substring(7, sentence.indexOf(",", 7)), channel);
+ identify(sentence.substring(7, sentence.indexOf(",", 7)), channel, remoteAddress);
} else if (sentence.startsWith("IMEI")) {
- identify(sentence.substring(5, sentence.length()), channel);
+ identify(sentence.substring(5, sentence.length()), channel, remoteAddress);
} else if (sentence.startsWith("$GPFID")) {
- if (identify(sentence.substring(6, sentence.length()), channel) && position != null) {
+ if (identify(sentence.substring(6, sentence.length()), channel, remoteAddress) && position != null) {
Position position = this.position;
position.setDeviceId(getDeviceId());
this.position = null;
return position;
}
} else if (Character.isDigit(sentence.charAt(0)) && sentence.length() == 15) {
- identify(sentence, channel);
+ identify(sentence, channel, remoteAddress);
} else if (sentence.startsWith("$GPRMC")) {
return decodeGprmc(sentence, channel);
} else if (sentence.startsWith("$GPGGA") && hasDeviceId()) {
diff --git a/src/org/traccar/protocol/TaipProtocolDecoder.java b/src/org/traccar/protocol/TaipProtocolDecoder.java
index 7f8c1a3c6..565d4a0c7 100644
--- a/src/org/traccar/protocol/TaipProtocolDecoder.java
+++ b/src/org/traccar/protocol/TaipProtocolDecoder.java
@@ -103,7 +103,7 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
}
String id = sentence.substring(beginIndex, endIndex);
- if (!identify(id, channel)) {
+ if (!identify(id, channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/TelikProtocolDecoder.java b/src/org/traccar/protocol/TelikProtocolDecoder.java
index 8ad88c868..4171750d6 100644
--- a/src/org/traccar/protocol/TelikProtocolDecoder.java
+++ b/src/org/traccar/protocol/TelikProtocolDecoder.java
@@ -60,7 +60,7 @@ public class TelikProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
index e82425a54..f8266d076 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -35,11 +35,11 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private void parseIdentification(Channel channel, ChannelBuffer buf) {
+ private void parseIdentification(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) {
int length = buf.readUnsignedShort();
String imei = buf.toString(buf.readerIndex(), length, Charset.defaultCharset());
- boolean result = identify(imei, channel);
+ boolean result = identify(imei, channel, remoteAddress);
if (channel != null) {
ChannelBuffer response = ChannelBuffers.directBuffer(1);
@@ -210,7 +210,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
ChannelBuffer buf = (ChannelBuffer) msg;
if (buf.getUnsignedShort(0) > 0) {
- parseIdentification(channel, buf);
+ parseIdentification(channel, remoteAddress, buf);
} else {
return parseLocation(channel, buf);
}
diff --git a/src/org/traccar/protocol/Tk102ProtocolDecoder.java b/src/org/traccar/protocol/Tk102ProtocolDecoder.java
index 386f465a5..70ee9bd84 100644
--- a/src/org/traccar/protocol/Tk102ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk102ProtocolDecoder.java
@@ -57,7 +57,7 @@ public class Tk102ProtocolDecoder extends BaseProtocolDecoder {
if (sentence.startsWith("[!")) {
- if (!identify(sentence.substring(14, 14 + 15), channel)) {
+ if (!identify(sentence.substring(14, 14 + 15), channel, remoteAddress)) {
return null;
}
if (channel != null) {
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index e8d0d210d..322ec9747 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -103,7 +103,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
Parser parser = new Parser(PATTERN_BATTERY, sentence);
if (parser.matches()) {
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
@@ -129,7 +129,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
parser = new Parser(PATTERN_NETWORK, sentence);
if (parser.matches()) {
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
@@ -149,7 +149,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
index 24e9893bb..5f44bd989 100644
--- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -69,7 +69,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/TopflytechProtocolDecoder.java b/src/org/traccar/protocol/TopflytechProtocolDecoder.java
index 768de3463..231d71f24 100644
--- a/src/org/traccar/protocol/TopflytechProtocolDecoder.java
+++ b/src/org/traccar/protocol/TopflytechProtocolDecoder.java
@@ -57,7 +57,7 @@ public class TopflytechProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java
index 88eecab70..ccb6fcb01 100644
--- a/src/org/traccar/protocol/TotemProtocolDecoder.java
+++ b/src/org/traccar/protocol/TotemProtocolDecoder.java
@@ -149,7 +149,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/Tr20ProtocolDecoder.java b/src/org/traccar/protocol/Tr20ProtocolDecoder.java
index fac0f8ee9..338c0533d 100644
--- a/src/org/traccar/protocol/Tr20ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tr20ProtocolDecoder.java
@@ -72,7 +72,7 @@ public class Tr20ProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/TrackboxProtocolDecoder.java b/src/org/traccar/protocol/TrackboxProtocolDecoder.java
index bf4c4f34d..f220972ad 100644
--- a/src/org/traccar/protocol/TrackboxProtocolDecoder.java
+++ b/src/org/traccar/protocol/TrackboxProtocolDecoder.java
@@ -59,7 +59,7 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder {
if (sentence.startsWith("a=connect")) {
String id = sentence.substring(sentence.indexOf("i=") + 2);
- if (identify(id, channel)) {
+ if (identify(id, channel, remoteAddress)) {
sendResponse(channel);
}
return null;
diff --git a/src/org/traccar/protocol/TramigoProtocolDecoder.java b/src/org/traccar/protocol/TramigoProtocolDecoder.java
index 456086fe2..da34bcdfa 100644
--- a/src/org/traccar/protocol/TramigoProtocolDecoder.java
+++ b/src/org/traccar/protocol/TramigoProtocolDecoder.java
@@ -62,7 +62,7 @@ public class TramigoProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_INDEX, index);
position.setValid(true);
- if (!identify(String.valueOf(id), channel)) {
+ if (!identify(String.valueOf(id), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/TrvProtocolDecoder.java b/src/org/traccar/protocol/TrvProtocolDecoder.java
index 67713cafc..26f432464 100644
--- a/src/org/traccar/protocol/TrvProtocolDecoder.java
+++ b/src/org/traccar/protocol/TrvProtocolDecoder.java
@@ -70,7 +70,7 @@ public class TrvProtocolDecoder extends BaseProtocolDecoder {
}
if (type.equals("AP00")) {
- identify(sentence.substring(7), channel);
+ identify(sentence.substring(7), channel, remoteAddress);
return null;
}
diff --git a/src/org/traccar/protocol/TzoneProtocolDecoder.java b/src/org/traccar/protocol/TzoneProtocolDecoder.java
index 4e37863fa..eb08664e5 100644
--- a/src/org/traccar/protocol/TzoneProtocolDecoder.java
+++ b/src/org/traccar/protocol/TzoneProtocolDecoder.java
@@ -46,7 +46,7 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedInt(); // firmware
String imei = ChannelBuffers.hexDump(buf.readBytes(8)).substring(1);
- if (!identify(imei, channel)) {
+ if (!identify(imei, channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
index dd6fb1593..712444d95 100644
--- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java
+++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
@@ -109,7 +109,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
position.setProtocol(getProtocolName());
String imei = ChannelBuffers.hexDump(buf.readBytes(8)).substring(1);
- if (!identify(imei, channel)) {
+ if (!identify(imei, channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java
index 229861c4f..3ba6c8f0e 100644
--- a/src/org/traccar/protocol/V680ProtocolDecoder.java
+++ b/src/org/traccar/protocol/V680ProtocolDecoder.java
@@ -62,7 +62,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
if (sentence.length() == 16) {
- identify(sentence.substring(1, sentence.length()), channel);
+ identify(sentence.substring(1, sentence.length()), channel, remoteAddress);
} else {
@@ -75,7 +75,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
position.setProtocol(getProtocolName());
if (parser.hasNext()) {
- identify(parser.next(), channel);
+ identify(parser.next(), channel, remoteAddress);
}
if (!hasDeviceId()) {
return null;
diff --git a/src/org/traccar/protocol/VisiontekProtocolDecoder.java b/src/org/traccar/protocol/VisiontekProtocolDecoder.java
index 2fecda341..e4c9656f7 100644
--- a/src/org/traccar/protocol/VisiontekProtocolDecoder.java
+++ b/src/org/traccar/protocol/VisiontekProtocolDecoder.java
@@ -82,7 +82,7 @@ public class VisiontekProtocolDecoder extends BaseProtocolDecoder {
String id = parser.next();
String imei = parser.next();
- if (!identify(id, channel, null, false) && (imei == null || !identify(imei, channel))) {
+ if (!identify(id, channel, remoteAddress, false) && (imei == null || !identify(imei, channel, remoteAddress))) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/WatchProtocolDecoder.java b/src/org/traccar/protocol/WatchProtocolDecoder.java
index 92b7638fb..bfa8c081d 100644
--- a/src/org/traccar/protocol/WatchProtocolDecoder.java
+++ b/src/org/traccar/protocol/WatchProtocolDecoder.java
@@ -80,7 +80,7 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder {
String manufacturer = parser.next();
String id = parser.next();
- if (!identify(id, channel)) {
+ if (!identify(id, channel, remoteAddress)) {
return null;
}
diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java
index e55702441..bfaa19954 100644
--- a/src/org/traccar/protocol/WialonProtocolDecoder.java
+++ b/src/org/traccar/protocol/WialonProtocolDecoder.java
@@ -129,7 +129,7 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder {
if (sentence.startsWith("#L#")) {
String imei = sentence.substring(3, sentence.indexOf(';'));
- if (identify(imei, channel)) {
+ if (identify(imei, channel, remoteAddress)) {
sendResponse(channel, "#AL#", 1);
}
diff --git a/src/org/traccar/protocol/WondexProtocolDecoder.java b/src/org/traccar/protocol/WondexProtocolDecoder.java
index 1a639b05c..f2c617898 100644
--- a/src/org/traccar/protocol/WondexProtocolDecoder.java
+++ b/src/org/traccar/protocol/WondexProtocolDecoder.java
@@ -65,7 +65,7 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java
index c2e4cfe14..f9369b463 100644
--- a/src/org/traccar/protocol/XexunProtocolDecoder.java
+++ b/src/org/traccar/protocol/XexunProtocolDecoder.java
@@ -99,7 +99,7 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
position.set("signal", parser.next());
position.set(Event.KEY_ALARM, parser.next());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/Xt013ProtocolDecoder.java b/src/org/traccar/protocol/Xt013ProtocolDecoder.java
index 5ae9f8622..b5e20d92e 100644
--- a/src/org/traccar/protocol/Xt013ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Xt013ProtocolDecoder.java
@@ -68,7 +68,7 @@ public class Xt013ProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/src/org/traccar/protocol/YwtProtocolDecoder.java b/src/org/traccar/protocol/YwtProtocolDecoder.java
index 574c5b877..2977e3cf8 100644
--- a/src/org/traccar/protocol/YwtProtocolDecoder.java
+++ b/src/org/traccar/protocol/YwtProtocolDecoder.java
@@ -81,7 +81,7 @@ public class YwtProtocolDecoder extends BaseProtocolDecoder {
String type = parser.next();
- if (!identify(parser.next(), channel)) {
+ if (!identify(parser.next(), channel, remoteAddress)) {
return null;
}
position.setDeviceId(getDeviceId());
diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
index 371b137fd..8ee080560 100644
--- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class Gps103ProtocolDecoderTest extends ProtocolDecoderTest {
Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(new Gps103Protocol());
verifyAttributes(decoder, text(
+ "imei:359710049075097,help me,,,L,,,113b,,558f,,,,,0,0,,,"));
+
+ verifyAttributes(decoder, text(
"imei:359710041100000,tracker,000000000,,L,,,fa8,,c9af,,,,,0,0,0.00%,,"));
verifyAttributes(decoder, text(
diff --git a/web/app/store/DistanceUnits.js b/web/app/store/DistanceUnits.js
index 7f808c684..29c4f28e0 100644
--- a/web/app/store/DistanceUnits.js
+++ b/web/app/store/DistanceUnits.js
@@ -25,14 +25,14 @@ Ext.define('Traccar.store.DistanceUnits', {
}, {
key: 'mi',
name: Strings.sharedMi,
- factor: 0.00621371
+ factor: 0.000621371
}],
formatValue: function (value, unit) {
var model;
if (unit) {
model = this.findRecord('key', unit);
- return (value * Number(model.get('factor')).toFixed(2)) + ' ' + model.get('name');
+ return (value * model.get('factor')).toFixed(2) + ' ' + model.get('name');
} else {
return value;
}
diff --git a/web/app/store/SpeedUnits.js b/web/app/store/SpeedUnits.js
index cbcf94e3b..d02892a01 100644
--- a/web/app/store/SpeedUnits.js
+++ b/web/app/store/SpeedUnits.js
@@ -32,7 +32,7 @@ Ext.define('Traccar.store.SpeedUnits', {
var model;
if (unit) {
model = this.findRecord('key', unit);
- return (value * Number(model.get('factor')).toFixed(1)) + ' ' + model.get('name');
+ return (value * model.get('factor')).toFixed(1) + ' ' + model.get('name');
} else {
return value;
}