diff options
author | Anton Tananaev <anton@traccar.org> | 2022-10-02 19:14:54 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-10-02 19:14:54 -0700 |
commit | 1a8766d8d7a6635d90d11a80935cde256d8a6dbb (patch) | |
tree | 3b37a94fa454f8fb71b0b77f1f9359d76f95cc62 /src/main | |
parent | b05471157c2471d0bc053fdaa7f465602d446f4e (diff) | |
download | trackermap-server-1a8766d8d7a6635d90d11a80935cde256d8a6dbb.tar.gz trackermap-server-1a8766d8d7a6635d90d11a80935cde256d8a6dbb.tar.bz2 trackermap-server-1a8766d8d7a6635d90d11a80935cde256d8a6dbb.zip |
Use IP as id for NMEA
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/protocol/T55ProtocolDecoder.java | 4 |
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); } |