aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-07-15 13:29:32 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-07-15 13:29:32 +1200
commit8bb68423f9a1e3c30f900e89f2016bfcc26a324b (patch)
treea5b7dbcb0500938a6eaa18427c606a1729852895 /src/org
parent7c3351939eca27d349417f053ef98a7e4e2668fd (diff)
downloadtraccar-server-8bb68423f9a1e3c30f900e89f2016bfcc26a324b.tar.gz
traccar-server-8bb68423f9a1e3c30f900e89f2016bfcc26a324b.tar.bz2
traccar-server-8bb68423f9a1e3c30f900e89f2016bfcc26a324b.zip
Rename GL200 text protocol decoder
Diffstat (limited to 'src/org')
-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) {