aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-08-18 00:54:12 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2014-08-18 00:54:12 +1200
commit4d62f1b57100c95dcc62a72362978cd544c987c7 (patch)
tree84709a6846480a7edcbb59b31e07ca2fd63be2e0
parent600aca2812a3fef2480ac55c0587676cef79246f (diff)
downloadtraccar-server-4d62f1b57100c95dcc62a72362978cd544c987c7.tar.gz
traccar-server-4d62f1b57100c95dcc62a72362978cd544c987c7.tar.bz2
traccar-server-4d62f1b57100c95dcc62a72362978cd544c987c7.zip
Implement Visiontek protocol (fix #802)
-rw-r--r--default.cfg4
-rw-r--r--src/org/traccar/ServerManager.java16
2 files changed, 20 insertions, 0 deletions
diff --git a/default.cfg b/default.cfg
index d703c9936..9e0d9631c 100644
--- a/default.cfg
+++ b/default.cfg
@@ -338,4 +338,8 @@
<entry key='trackbox.enable'>true</entry>
<entry key='trackbox.port'>5068</entry>
+ <!-- Visiontek server configuration -->
+ <entry key='visiontek.enable'>true</entry>
+ <entry key='visiontek.port'>5069</entry>
+
</properties>
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java
index 01f78c515..c262de360 100644
--- a/src/org/traccar/ServerManager.java
+++ b/src/org/traccar/ServerManager.java
@@ -172,6 +172,7 @@ public class ServerManager {
initFreedomServer("freedom");
initTelikServer("telik");
initTrackboxServer("trackbox");
+ initVisiontekServer("visiontek");
// Initialize web server
if (Boolean.valueOf(properties.getProperty("http.enable"))) {
@@ -1204,4 +1205,19 @@ public class ServerManager {
}
}
+ private void initVisiontekServer(String protocol) throws SQLException {
+ if (isProtocolEnabled(properties, protocol)) {
+ serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) {
+ @Override
+ 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 VisiontekProtocolDecoder(ServerManager.this));
+ }
+ });
+ }
+ }
+
}