From 6dc180657196e4b6c2029c8b3fe9d3931152d094 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 19 Aug 2012 22:34:23 +0400 Subject: Add ST-210 server --- src/org/traccar/Server.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/org') diff --git a/src/org/traccar/Server.java b/src/org/traccar/Server.java index 36d7720b6..7df1a463a 100644 --- a/src/org/traccar/Server.java +++ b/src/org/traccar/Server.java @@ -97,6 +97,7 @@ public class Server { initEnforaServer(properties); initMeiligaoServer(properties); initMaxonServer(properties); + initST210Server(properties); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -478,4 +479,25 @@ public class Server { } } + private void initST210Server(Properties properties) throws SQLException { + String protocol = "st210"; + if (isProtocolEnabled(properties, protocol)) { + + TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol)); + final Integer resetDelay = getProtocolResetDelay(properties, protocol); + + server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) { + protected void addSpecificHandlers(ChannelPipeline pipeline) { + byte delimiter[] = { (byte) '\r' }; + pipeline.addLast("frameDecoder", + new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); + pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("objectDecoder", new ST210ProtocolDecoder(getDataManager(), resetDelay)); + } + }); + + serverList.add(server); + } + } + } -- cgit v1.2.3