aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-10-26 22:58:23 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-10-26 22:58:23 -0700
commit3593d6075cbc40460e91cfccb4f2fb7c9913e315 (patch)
treefc0b2f70cd544c9b78cf0d9d4289bac0e2be8193 /src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java
parent0dab261a9ec77811c073b328018675d5f9d71fe6 (diff)
downloadtrackermap-server-3593d6075cbc40460e91cfccb4f2fb7c9913e315.tar.gz
trackermap-server-3593d6075cbc40460e91cfccb4f2fb7c9913e315.tar.bz2
trackermap-server-3593d6075cbc40460e91cfccb4f2fb7c9913e315.zip
Fix responses
Diffstat (limited to 'src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java b/src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java
index 00e297faa..ba70a8884 100644
--- a/src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java
@@ -60,7 +60,7 @@ public class MobilogixProtocolDecoder extends BaseProtocolDecoder {
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
String sentence = (String) msg;
- String type = sentence.substring(21, 21 + 2);
+ String type = sentence.substring(21, sentence.indexOf(',', 21));
if (channel != null) {
String time = sentence.substring(1, 20);
@@ -68,12 +68,12 @@ public class MobilogixProtocolDecoder extends BaseProtocolDecoder {
if (type.equals("T1")) {
response = String.format("[%s,S1,1]", time);
} else {
- response = String.format("[%s,S%c]", time, type.charAt(1));
+ response = String.format("[%s,S%s]", time, type.substring(1));
}
channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
}
- Parser parser = new Parser(PATTERN, (String) msg);
+ Parser parser = new Parser(PATTERN, sentence);
if (!parser.matches()) {
return null;
}