aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/BaseProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/WristbandProtocolDecoder.java4
3 files changed, 5 insertions, 5 deletions
diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java
index 7d840960b..cbef4568d 100644
--- a/src/org/traccar/BaseProtocolDecoder.java
+++ b/src/org/traccar/BaseProtocolDecoder.java
@@ -55,13 +55,13 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder {
return protocol != null ? protocol.getName() : PROTOCOL_UNKNOWN;
}
- public String getServer(Channel channel) {
+ public String getServer(Channel channel, char delimiter) {
String server = config.getString(getProtocolName() + ".server");
if (server == null && channel != null) {
InetSocketAddress address = (InetSocketAddress) channel.localAddress();
server = address.getAddress().getHostAddress() + ":" + address.getPort();
}
- return server;
+ return server != null ? server.replace(':', delimiter) : null;
}
protected double convertSpeed(double value, String defaultUnits) {
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index 06ecba357..cbfc3660a 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -402,7 +402,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
sendResponse(channel, remoteAddress, id, MSG_HEARTBEAT, response);
return null;
} else if (command == MSG_SERVER) {
- ByteBuf response = Unpooled.copiedBuffer(getServer(channel), StandardCharsets.US_ASCII);
+ ByteBuf response = Unpooled.copiedBuffer(getServer(channel, ':'), StandardCharsets.US_ASCII);
sendResponse(channel, remoteAddress, id, MSG_SERVER, response);
return null;
} else if (command == MSG_UPLOAD_PHOTO) {
diff --git a/src/org/traccar/protocol/WristbandProtocolDecoder.java b/src/org/traccar/protocol/WristbandProtocolDecoder.java
index b750f1bad..84aeb6804 100644
--- a/src/org/traccar/protocol/WristbandProtocolDecoder.java
+++ b/src/org/traccar/protocol/WristbandProtocolDecoder.java
@@ -108,11 +108,11 @@ public class WristbandProtocolDecoder extends BaseProtocolDecoder {
switch (type) {
case 90:
- sendResponse(channel, imei, version, type, getServer(channel));
+ sendResponse(channel, imei, version, type, getServer(channel, ','));
break;
case 91:
String time = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date());
- sendResponse(channel, imei, version, type, time + "|" + getServer(channel));
+ sendResponse(channel, imei, version, type, time + "|" + getServer(channel, ','));
break;
case 1:
sendResponse(channel, imei, version, type, "0");