aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorEdward Valley <ed.valley@yandex.com>2019-08-23 22:46:25 -0400
committerEdward Valley <ed.valley@yandex.com>2019-08-23 22:46:25 -0400
commit841eea22d98c943272bd0b7c99d395a3d38308aa (patch)
treead850364822fca09f353236256cb2ddf7f3d7966 /src/main
parent2e30e3cf3b583003045980e66e7ee9b6ea237182 (diff)
downloadtrackermap-server-841eea22d98c943272bd0b7c99d395a3d38308aa.tar.gz
trackermap-server-841eea22d98c943272bd0b7c99d395a3d38308aa.tar.bz2
trackermap-server-841eea22d98c943272bd0b7c99d395a3d38308aa.zip
Enable UDP support for Wialon devices
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/WialonProtocol.java16
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));
+ }
+ });
}
}