aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/Server.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2012-12-05 22:56:14 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2012-12-05 22:56:14 +1300
commitb444e789127951b902d557517a520d44c59f15d2 (patch)
tree34d9b78d6606e52906f7633059f40d71dad77b00 /src/org/traccar/Server.java
parent206600cd599e03eaa095619fc8a52b742d3413a1 (diff)
downloadtrackermap-server-b444e789127951b902d557517a520d44c59f15d2.tar.gz
trackermap-server-b444e789127951b902d557517a520d44c59f15d2.tar.bz2
trackermap-server-b444e789127951b902d557517a520d44c59f15d2.zip
Added meitrack protocol (fix #103)
Diffstat (limited to 'src/org/traccar/Server.java')
-rw-r--r--src/org/traccar/Server.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/org/traccar/Server.java b/src/org/traccar/Server.java
index f5a67cc68..288719834 100644
--- a/src/org/traccar/Server.java
+++ b/src/org/traccar/Server.java
@@ -108,6 +108,7 @@ public class Server {
initPt502Server(properties);
initTr20Server(properties);
initNavisServer(properties);
+ initMeitrackServer(properties);
// Initialize web server
if (Boolean.valueOf(properties.getProperty("http.enable"))) {
@@ -712,4 +713,30 @@ public class Server {
serverList.add(server);
}
}
+
+ /**
+ * Init Meitrack server
+ */
+ private void initMeitrackServer(Properties properties) throws SQLException {
+
+ String protocol = "meitrack";
+ if (isProtocolEnabled(properties, protocol)) {
+
+ TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ final Integer resetDelay = getProtocolResetDelay(properties, protocol);
+
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
+ protected void addSpecificHandlers(ChannelPipeline pipeline) {
+ byte delimiter[] = { (byte) '\r', (byte) '\n' };
+ pipeline.addLast("frameDecoder",
+ new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter)));
+ pipeline.addLast("stringDecoder", new StringDecoder());
+ pipeline.addLast("stringEncoder", new StringEncoder());
+ pipeline.addLast("objectDecoder", new MeitrackProtocolDecoder(getDataManager()));
+ }
+ });
+
+ serverList.add(server);
+ }
+ }
}