From 3593d6075cbc40460e91cfccb4f2fb7c9913e315 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 26 Oct 2021 22:58:23 -0700 Subject: Fix responses --- src/main/java/org/traccar/protocol/MobilogixProtocolDecoder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/java') 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; } -- cgit v1.2.3