From 278712a8720e1e93e63063d7854a1767dd06c3f2 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 19 Jun 2015 10:45:05 +1200 Subject: Add UDP support for TR900 (fix #1246) --- src/org/traccar/ServerManager.java | 8 ++++++++ src/org/traccar/protocol/Tr900ProtocolDecoder.java | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java index 44adfadbc..c175a332b 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -1288,6 +1288,14 @@ public class ServerManager { pipeline.addLast("objectDecoder", new Tr900ProtocolDecoder(protocol)); } }); + serverList.add(new TrackerServer(new ConnectionlessBootstrap(), protocol) { + @Override + protected void addSpecificHandlers(ChannelPipeline pipeline) { + pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); + pipeline.addLast("objectDecoder", new Tr900ProtocolDecoder(protocol)); + } + }); } } diff --git a/src/org/traccar/protocol/Tr900ProtocolDecoder.java b/src/org/traccar/protocol/Tr900ProtocolDecoder.java index 8839f230b..e5674b262 100644 --- a/src/org/traccar/protocol/Tr900ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tr900ProtocolDecoder.java @@ -21,6 +21,7 @@ import org.traccar.BaseProtocolDecoder; import org.traccar.model.Event; import org.traccar.model.Position; +import java.net.SocketAddress; import java.util.Calendar; import java.util.TimeZone; import java.util.regex.Matcher; @@ -56,7 +57,7 @@ public class Tr900ProtocolDecoder extends BaseProtocolDecoder { @Override protected Object decode( - ChannelHandlerContext ctx, Channel channel, Object msg) + ChannelHandlerContext ctx, Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { String sentence = (String) msg; -- cgit v1.2.3