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 38f0a1388..b80d22c8f 100644
--- a/src/org/traccar/Server.java
+++ b/src/org/traccar/Server.java
@@ -17,6 +17,7 @@ package org.traccar;
import java.io.FileInputStream;
import java.io.IOException;
+import java.nio.ByteOrder;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@@ -105,6 +106,7 @@ public class Server {
initV680Server(properties);
initPt502Server(properties);
initTr20Server(properties);
+ initNavisServer(properties);
// Initialize web server
if (Boolean.valueOf(properties.getProperty("http.enable"))) {
@@ -517,7 +519,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
- server.setEndianness(java.nio.ByteOrder.LITTLE_ENDIAN);
+ server.setEndianness(ByteOrder.LITTLE_ENDIAN);
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -679,4 +681,27 @@ public class Server {
serverList.add(server);
}
}
+
+ /**
+ * Init Navis server
+ */
+ private void initNavisServer(Properties properties) throws SQLException {
+
+ String protocol = "navis";
+ if (isProtocolEnabled(properties, protocol)) {
+
+ TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setEndianness(ByteOrder.LITTLE_ENDIAN);
+ final Integer resetDelay = getProtocolResetDelay(properties, protocol);
+
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
+ protected void addSpecificHandlers(ChannelPipeline pipeline) {
+ pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(4 * 1024, 12, 2, 2, 0));
+ pipeline.addLast("objectDecoder", new NavisProtocolDecoder(getDataManager()));
+ }
+ });
+
+ serverList.add(server);
+ }
+ }
}