diff options
author | Edward Valley <ed.valley@yandex.com> | 2019-08-23 22:46:25 -0400 |
---|---|---|
committer | Edward Valley <ed.valley@yandex.com> | 2019-08-23 22:46:25 -0400 |
commit | 841eea22d98c943272bd0b7c99d395a3d38308aa (patch) | |
tree | ad850364822fca09f353236256cb2ddf7f3d7966 /src/main/java/org/traccar | |
parent | 2e30e3cf3b583003045980e66e7ee9b6ea237182 (diff) | |
download | traccar-server-841eea22d98c943272bd0b7c99d395a3d38308aa.tar.gz traccar-server-841eea22d98c943272bd0b7c99d395a3d38308aa.tar.bz2 traccar-server-841eea22d98c943272bd0b7c99d395a3d38308aa.zip |
Enable UDP support for Wialon devices
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/protocol/WialonProtocol.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/WialonProtocol.java b/src/main/java/org/traccar/protocol/WialonProtocol.java index 2eac58a3e..fd183dd2c 100644 --- a/src/main/java/org/traccar/protocol/WialonProtocol.java +++ b/src/main/java/org/traccar/protocol/WialonProtocol.java @@ -50,6 +50,22 @@ public class WialonProtocol extends BaseProtocol { pipeline.addLast(new WialonProtocolDecoder(WialonProtocol.this)); } }); + addServer(new TrackerServer(true, getName()) { + @Override + protected void addProtocolHandlers(PipelineBuilder pipeline) { + pipeline.addLast(new LineBasedFrameDecoder(4 * 1024)); + boolean utf8 = Context.getConfig().getBoolean(getName() + ".utf8"); + if (utf8) { + pipeline.addLast(new StringEncoder(StandardCharsets.UTF_8)); + pipeline.addLast(new StringDecoder(StandardCharsets.UTF_8)); + } else { + pipeline.addLast(new StringEncoder()); + pipeline.addLast(new StringDecoder()); + } + pipeline.addLast(new WialonProtocolEncoder(WialonProtocol.this)); + pipeline.addLast(new WialonProtocolDecoder(WialonProtocol.this)); + } + }); } } |