aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/BaseProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/BaseProtocolDecoder.java')
-rw-r--r--src/org/traccar/BaseProtocolDecoder.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java
index d7ccb6460..d9ab60e3a 100644
--- a/src/org/traccar/BaseProtocolDecoder.java
+++ b/src/org/traccar/BaseProtocolDecoder.java
@@ -67,6 +67,15 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder {
return protocol.getName();
}
+ public String getServer(Channel channel) {
+ String server = Context.getConfig().getString(getProtocolName() + ".server");
+ if (server == null && channel != null) {
+ InetSocketAddress address = (InetSocketAddress) channel.localAddress();
+ server = address.getAddress().getHostAddress() + ":" + address.getPort();
+ }
+ return server;
+ }
+
protected double convertSpeed(double value, String defaultUnits) {
switch (Context.getConfig().getString(getProtocolName() + ".speed", defaultUnits)) {
case "kmh":