diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-10-28 10:34:32 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-10-28 10:34:32 +1300 |
commit | af73f3436fc25f52e0157bce7b725ecd85f49869 (patch) | |
tree | f304ff9b8147677bccf8d660dc869b1b130ed617 /src/org/traccar/Server.java | |
parent | 19733d81e8f50e89abdd4848c3f1dd5a437e87ff (diff) | |
download | trackermap-server-af73f3436fc25f52e0157bce7b725ecd85f49869.tar.gz trackermap-server-af73f3436fc25f52e0157bce7b725ecd85f49869.tar.bz2 trackermap-server-af73f3436fc25f52e0157bce7b725ecd85f49869.zip |
Add V680 support (fix #59)
Diffstat (limited to 'src/org/traccar/Server.java')
-rw-r--r-- | src/org/traccar/Server.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/org/traccar/Server.java b/src/org/traccar/Server.java index f61edcede..0cca284d0 100644 --- a/src/org/traccar/Server.java +++ b/src/org/traccar/Server.java @@ -102,6 +102,7 @@ public class Server { initH02Server(properties); initJt600Server(properties); initEv603Server(properties); + initV680Server(properties); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -594,4 +595,29 @@ public class Server { serverList.add(server); } } + + /** + * Init V680 server + */ + private void initV680Server(Properties properties) throws SQLException { + + String protocol = "v680"; + 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) '#', (byte) '#' }; + pipeline.addLast("frameDecoder", + new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); + pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("objectDecoder", new V680ProtocolDecoder(getDataManager(), resetDelay)); + } + }); + + serverList.add(server); + } + } } |