aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-10-02 19:14:54 -0700
committerAnton Tananaev <anton@traccar.org>2022-10-02 19:14:54 -0700
commit1a8766d8d7a6635d90d11a80935cde256d8a6dbb (patch)
tree3b37a94fa454f8fb71b0b77f1f9359d76f95cc62
parentb05471157c2471d0bc053fdaa7f465602d446f4e (diff)
downloadtrackermap-server-1a8766d8d7a6635d90d11a80935cde256d8a6dbb.tar.gz
trackermap-server-1a8766d8d7a6635d90d11a80935cde256d8a6dbb.tar.bz2
trackermap-server-1a8766d8d7a6635d90d11a80935cde256d8a6dbb.zip
Use IP as id for NMEA
-rw-r--r--src/main/java/org/traccar/protocol/T55ProtocolDecoder.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/T55ProtocolDecoder.java b/src/main/java/org/traccar/protocol/T55ProtocolDecoder.java
index 1529aae29..90382439e 100644
--- a/src/main/java/org/traccar/protocol/T55ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/T55ProtocolDecoder.java
@@ -28,6 +28,7 @@ import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Position;
+import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.channels.DatagramChannel;
import java.util.Date;
@@ -378,6 +379,9 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
}
deviceSession = getDeviceSession(channel, remoteAddress, id);
sentence = sentence.substring(index);
+ } else if (remoteAddress instanceof InetSocketAddress) {
+ String host = ((InetSocketAddress) remoteAddress).getHostString();
+ deviceSession = getDeviceSession(channel, remoteAddress, host);
} else {
deviceSession = getDeviceSession(channel, remoteAddress);
}