diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-10-14 09:56:37 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-10-14 09:56:37 +1300 |
commit | f278d3ff3e7b17b458a512d7bb16131eb9d97b2b (patch) | |
tree | a68cdb9c99e2e31786522d9418a1404d3bb2890c /src/org/traccar/Server.java | |
parent | 7ca3514fe59d876e2b91c52c100014b84962ee5b (diff) | |
download | trackermap-server-f278d3ff3e7b17b458a512d7bb16131eb9d97b2b.tar.gz trackermap-server-f278d3ff3e7b17b458a512d7bb16131eb9d97b2b.tar.bz2 trackermap-server-f278d3ff3e7b17b458a512d7bb16131eb9d97b2b.zip |
Add H02 support (fix #56)
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 7dcabe084..79e69fd87 100644 --- a/src/org/traccar/Server.java +++ b/src/org/traccar/Server.java @@ -517,6 +517,31 @@ public class Server { serverList.add(server); } - } + } + + /** + * Init H02 server + */ + private void initH02Server(Properties properties) throws SQLException { + + String protocol = "h02"; + 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 H02ProtocolDecoder(getDataManager(), resetDelay)); + } + }); + + serverList.add(server); + } + } } |