aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/WialonProtocol.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/WialonProtocol.java')
-rw-r--r--src/org/traccar/protocol/WialonProtocol.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/WialonProtocol.java b/src/org/traccar/protocol/WialonProtocol.java
index d0d3aa446..e0255c888 100644
--- a/src/org/traccar/protocol/WialonProtocol.java
+++ b/src/org/traccar/protocol/WialonProtocol.java
@@ -21,14 +21,22 @@ import org.jboss.netty.handler.codec.frame.LineBasedFrameDecoder;
import org.jboss.netty.handler.codec.string.StringDecoder;
import org.jboss.netty.handler.codec.string.StringEncoder;
import org.traccar.BaseProtocol;
+import org.traccar.Context;
import org.traccar.TrackerServer;
+import org.traccar.model.Command;
+import java.nio.charset.StandardCharsets;
import java.util.List;
public class WialonProtocol extends BaseProtocol {
public WialonProtocol() {
super("wialon");
+ setSupportedCommands(
+ Command.TYPE_REBOOT_DEVICE,
+ Command.TYPE_SEND_USSD,
+ Command.TYPE_IDENTIFICATION,
+ Command.TYPE_OUTPUT_CONTROL);
}
@Override
@@ -38,7 +46,13 @@ public class WialonProtocol extends BaseProtocol {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(4 * 1024));
pipeline.addLast("stringEncoder", new StringEncoder());
- pipeline.addLast("stringDecoder", new StringDecoder());
+ boolean utf8 = Context.getConfig().getBoolean(getName() + ".utf8");
+ if (utf8) {
+ pipeline.addLast("stringDecoder", new StringDecoder(StandardCharsets.UTF_8));
+ } else {
+ pipeline.addLast("stringDecoder", new StringDecoder());
+ }
+ pipeline.addLast("objectEncoder", new WialonProtocolEncoder());
pipeline.addLast("objectDecoder", new WialonProtocolDecoder(WialonProtocol.this));
}
});