aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/Gl200Protocol.java6
-rw-r--r--src/org/traccar/protocol/Gl200TextProtocolDecoder.java (renamed from src/org/traccar/protocol/Gl200ProtocolDecoder.java)8
2 files changed, 7 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/Gl200Protocol.java b/src/org/traccar/protocol/Gl200Protocol.java
index 3ea371085..dbcbf61c0 100644
--- a/src/org/traccar/protocol/Gl200Protocol.java
+++ b/src/org/traccar/protocol/Gl200Protocol.java
@@ -45,18 +45,16 @@ public class Gl200Protocol extends BaseProtocol {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new Gl200FrameDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
- pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("objectEncoder", new Gl200ProtocolEncoder());
- pipeline.addLast("objectDecoder", new Gl200ProtocolDecoder(Gl200Protocol.this));
+ pipeline.addLast("objectDecoder", new Gl200TextProtocolDecoder(Gl200Protocol.this));
}
});
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("stringEncoder", new StringEncoder());
- pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("objectEncoder", new Gl200ProtocolEncoder());
- pipeline.addLast("objectDecoder", new Gl200ProtocolDecoder(Gl200Protocol.this));
+ pipeline.addLast("objectDecoder", new Gl200TextProtocolDecoder(Gl200Protocol.this));
}
});
}
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
index 140d3300a..57fecc3fe 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -15,6 +15,7 @@
*/
package org.traccar.protocol;
+import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.Context;
@@ -29,16 +30,17 @@ import org.traccar.model.Position;
import org.traccar.model.WifiAccessPoint;
import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
+public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
private boolean ignoreFixTime;
- public Gl200ProtocolDecoder(Gl200Protocol protocol) {
+ public Gl200TextProtocolDecoder(Gl200Protocol protocol) {
super(protocol);
ignoreFixTime = Context.getConfig().getBoolean(getProtocolName() + ".ignoreFixTime");
@@ -811,7 +813,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
- String sentence = (String) msg;
+ String sentence = ((ChannelBuffer) msg).toString(StandardCharsets.US_ASCII);
int typeIndex = sentence.indexOf(":GT");
if (typeIndex < 0) {