diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-08-19 23:34:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-19 23:34:24 +0300 |
commit | 6b6d28695600fee509ee37a7225dd6518879ac9c (patch) | |
tree | 0b40718962f549b6ab963cf93e9de7cf3c105b13 /src/org/traccar/protocol/WialonProtocol.java | |
parent | 3826a93f1009942e22ec80c1e13be71e8e917b01 (diff) | |
parent | aaa16c01263847221c7cfec95d722b283dcfd35e (diff) | |
download | trackermap-server-6b6d28695600fee509ee37a7225dd6518879ac9c.tar.gz trackermap-server-6b6d28695600fee509ee37a7225dd6518879ac9c.tar.bz2 trackermap-server-6b6d28695600fee509ee37a7225dd6518879ac9c.zip |
Merge pull request #2231 from Abyss777/wialon_commands
Commands to Wialon protocol
Diffstat (limited to 'src/org/traccar/protocol/WialonProtocol.java')
-rw-r--r-- | src/org/traccar/protocol/WialonProtocol.java | 16 |
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)); } }); |