aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/Server.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/Server.java')
-rw-r--r--src/org/traccar/Server.java27
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);
+ }
+ }
}