aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/WialonProtocol.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-08-23 23:23:43 -0700
committerGitHub <noreply@github.com>2019-08-23 23:23:43 -0700
commit4860e6ede4a174443bce1d5a809b5dfe1ae68543 (patch)
treead850364822fca09f353236256cb2ddf7f3d7966 /src/main/java/org/traccar/protocol/WialonProtocol.java
parent4ebb2d0c5c03846999b083c7ee52720730279b90 (diff)
parent841eea22d98c943272bd0b7c99d395a3d38308aa (diff)
downloadtrackermap-server-4860e6ede4a174443bce1d5a809b5dfe1ae68543.tar.gz
trackermap-server-4860e6ede4a174443bce1d5a809b5dfe1ae68543.tar.bz2
trackermap-server-4860e6ede4a174443bce1d5a809b5dfe1ae68543.zip
Merge pull request #4388 from edvalley/proposed
Enhance Wialon protocol decoder
Diffstat (limited to 'src/main/java/org/traccar/protocol/WialonProtocol.java')
-rw-r--r--src/main/java/org/traccar/protocol/WialonProtocol.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/WialonProtocol.java b/src/main/java/org/traccar/protocol/WialonProtocol.java
index 3838791a7..fd183dd2c 100644
--- a/src/main/java/org/traccar/protocol/WialonProtocol.java
+++ b/src/main/java/org/traccar/protocol/WialonProtocol.java
@@ -38,11 +38,28 @@ public class WialonProtocol extends BaseProtocol {
@Override
protected void addProtocolHandlers(PipelineBuilder pipeline) {
pipeline.addLast(new LineBasedFrameDecoder(4 * 1024));
- pipeline.addLast(new StringEncoder());
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));
+ }
+ });
+ 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));