From de43b1203b70a27c2833129983b86253371834d9 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 21 Feb 2017 22:53:25 +1300 Subject: Add UDP support for Pricol protocol --- src/org/traccar/protocol/PricolProtocol.java | 7 +++++++ src/org/traccar/protocol/PricolProtocolDecoder.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/PricolProtocol.java b/src/org/traccar/protocol/PricolProtocol.java index 924c7c1d6..0005dc3c1 100644 --- a/src/org/traccar/protocol/PricolProtocol.java +++ b/src/org/traccar/protocol/PricolProtocol.java @@ -15,6 +15,7 @@ */ package org.traccar.protocol; +import org.jboss.netty.bootstrap.ConnectionlessBootstrap; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.frame.FixedLengthFrameDecoder; @@ -38,6 +39,12 @@ public class PricolProtocol extends BaseProtocol { pipeline.addLast("objectDecoder", new PricolProtocolDecoder(PricolProtocol.this)); } }); + serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) { + @Override + protected void addSpecificHandlers(ChannelPipeline pipeline) { + pipeline.addLast("objectDecoder", new PricolProtocolDecoder(PricolProtocol.this)); + } + }); } } diff --git a/src/org/traccar/protocol/PricolProtocolDecoder.java b/src/org/traccar/protocol/PricolProtocolDecoder.java index 52b68cca6..3313afa22 100644 --- a/src/org/traccar/protocol/PricolProtocolDecoder.java +++ b/src/org/traccar/protocol/PricolProtocolDecoder.java @@ -87,7 +87,7 @@ public class PricolProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_RPM, buf.readUnsignedShort()); if (channel != null) { - channel.write(ChannelBuffers.copiedBuffer("ACK", StandardCharsets.US_ASCII)); + channel.write(ChannelBuffers.copiedBuffer("ACK", StandardCharsets.US_ASCII), remoteAddress); } return position; -- cgit v1.2.3