diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-10-27 17:25:52 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-10-27 17:25:52 +1300 |
commit | d3f29ab8a57299dc5bcc8031118f811d1182fdb1 (patch) | |
tree | 7aba54d513fe35965188fd52f3d56507fabbf59b /src/org/traccar/Server.java | |
parent | 72171038c2140acfc11ccae2c90c8b28c592e554 (diff) | |
download | trackermap-server-d3f29ab8a57299dc5bcc8031118f811d1182fdb1.tar.gz trackermap-server-d3f29ab8a57299dc5bcc8031118f811d1182fdb1.tar.bz2 trackermap-server-d3f29ab8a57299dc5bcc8031118f811d1182fdb1.zip |
Complete EV603 protocol (fix #64)
Diffstat (limited to 'src/org/traccar/Server.java')
-rw-r--r-- | src/org/traccar/Server.java | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/org/traccar/Server.java b/src/org/traccar/Server.java index 140862d8b..f61edcede 100644 --- a/src/org/traccar/Server.java +++ b/src/org/traccar/Server.java @@ -101,7 +101,7 @@ public class Server { initProgressServer(properties); initH02Server(properties); initJt600Server(properties); - + initEv603Server(properties); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -569,4 +569,29 @@ public class Server { serverList.add(server); } } + + /** + * Init EV603 server + */ + private void initEv603Server(Properties properties) throws SQLException { + + String protocol = "ev603"; + 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) ';' }; + pipeline.addLast("frameDecoder", + new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); + pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("objectDecoder", new Ev603ProtocolDecoder(getDataManager(), resetDelay)); + } + }); + + serverList.add(server); + } + } } |