diff options
author | Abyss777 <abyss@fox5.ru> | 2016-08-19 19:49:11 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-08-19 19:49:11 +0500 |
commit | aaa16c01263847221c7cfec95d722b283dcfd35e (patch) | |
tree | 0b40718962f549b6ab963cf93e9de7cf3c105b13 /src/org/traccar/protocol/WialonProtocol.java | |
parent | 3826a93f1009942e22ec80c1e13be71e8e917b01 (diff) | |
download | trackermap-server-aaa16c01263847221c7cfec95d722b283dcfd35e.tar.gz trackermap-server-aaa16c01263847221c7cfec95d722b283dcfd35e.tar.bz2 trackermap-server-aaa16c01263847221c7cfec95d722b283dcfd35e.zip |
- Added commands to WialonProtocol
- Added more additional fields to CommandDialog
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)); } }); |