diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-06-11 20:38:46 +0400 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-06-11 20:38:46 +0400 |
commit | 3687acb3a93b3f8332de5a9fa7d99be4a665bbdd (patch) | |
tree | 7728775d836b763253dc83a0d557122236a8f0a2 /src/org/traccar/Server.java | |
parent | bb86570acc87ca082663986c2f9207d55c434623 (diff) | |
download | traccar-server-3687acb3a93b3f8332de5a9fa7d99be4a665bbdd.tar.gz traccar-server-3687acb3a93b3f8332de5a9fa7d99be4a665bbdd.tar.bz2 traccar-server-3687acb3a93b3f8332de5a9fa7d99be4a665bbdd.zip |
Added meiligao protocol (fix #4)
Diffstat (limited to 'src/org/traccar/Server.java')
-rw-r--r-- | src/org/traccar/Server.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/org/traccar/Server.java b/src/org/traccar/Server.java index a6b0a67da..81a1988d1 100644 --- a/src/org/traccar/Server.java +++ b/src/org/traccar/Server.java @@ -90,6 +90,7 @@ public class Server { initXexun2Server(properties); initAvl08Server(properties); initEnforaServer(properties); + initMeiligaoServer(properties); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -416,4 +417,26 @@ public class Server { } } + /** + * Init Meiligao server + */ + public void initMeiligaoServer(Properties properties) throws SQLException { + + String protocol = "meiligao"; + if (isProtocolEnabled(properties, protocol)) { + + TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol)); + final Integer resetDelay = getProtocolResetDelay(properties, protocol); + + server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled()) { + protected void addSpecificHandlers(ChannelPipeline pipeline) { + pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, -4, 4)); + pipeline.addLast("objectDecoder", new MeiligaoProtocolDecoder(getDataManager(), resetDelay)); + } + }); + + serverList.add(server); + } + } + } |