aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2012-12-11 21:16:29 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2012-12-11 21:16:29 +1300
commit77f410b00568e09d503fffdbf42d6eb08aeae570 (patch)
tree32285726faa88cb7c2ad8d5c3969821db6dbc4dc
parent7cc49096e7ea6965a3164ff3ffd66876bc94646c (diff)
downloadtrackermap-server-77f410b00568e09d503fffdbf42d6eb08aeae570.tar.gz
trackermap-server-77f410b00568e09d503fffdbf42d6eb08aeae570.tar.bz2
trackermap-server-77f410b00568e09d503fffdbf42d6eb08aeae570.zip
More Skypatrol stuff
-rw-r--r--default.cfg4
-rw-r--r--src/org/traccar/Server.java24
-rw-r--r--src/org/traccar/protocol/SkypatrolProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java8
4 files changed, 34 insertions, 6 deletions
diff --git a/default.cfg b/default.cfg
index 43e73d722..74f2f390b 100644
--- a/default.cfg
+++ b/default.cfg
@@ -176,5 +176,9 @@
<!-- Meitrack server configuration -->
<entry key="meitrack.enable">true</entry>
<entry key="meitrack.port">5020</entry>
+
+ <!-- Skypatrol server configuration -->
+ <entry key="skypatrol.enable">true</entry>
+ <entry key="skypatrol.port">5021</entry>
</properties>
diff --git a/src/org/traccar/Server.java b/src/org/traccar/Server.java
index 9a4bcd1d4..9deb271da 100644
--- a/src/org/traccar/Server.java
+++ b/src/org/traccar/Server.java
@@ -110,6 +110,7 @@ public class Server {
initTr20Server(properties);
initNavisServer(properties);
initMeitrackServer(properties);
+ initSkypatrolServer(properties);
// Initialize web server
if (Boolean.valueOf(properties.getProperty("http.enable"))) {
@@ -786,4 +787,27 @@ public class Server {
serverList.add(server);
}
}
+
+ /**
+ * Init SkyPatrol server
+ */
+ private void initSkypatrolServer(Properties properties) throws SQLException {
+
+ String protocol = "skypatrol";
+ if (isProtocolEnabled(properties, protocol)) {
+
+ TrackerServer server = new TrackerServer(new ServerBootstrap());
+ server.setPort(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
+ final Integer resetDelay = getProtocolResetDelay(properties, protocol);
+
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
+ protected void addSpecificHandlers(ChannelPipeline pipeline) {
+ pipeline.addLast("objectDecoder", new SkypatrolProtocolDecoder(getDataManager()));
+ }
+ });
+
+ serverList.add(server);
+ }
+ }
}
diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
index 184f5e40b..d5adf2aaf 100644
--- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
+++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
@@ -29,7 +29,7 @@ import org.traccar.model.Position;
/**
* T55 tracker protocol decoder
*/
-public class T55ProtocolDecoder extends GenericProtocolDecoder {
+public class SkypatrolProtocolDecoder extends GenericProtocolDecoder {
/**
* Device ID
@@ -39,7 +39,7 @@ public class T55ProtocolDecoder extends GenericProtocolDecoder {
/**
* Initialize
*/
- public T55ProtocolDecoder(DataManager dataManager) {
+ public SkypatrolProtocolDecoder(DataManager dataManager) {
super(dataManager);
}
diff --git a/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java b/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java
index 5d9ae4e3a..467893fdb 100644
--- a/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java
@@ -4,20 +4,20 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.junit.Test;
-public class T55ProtocolDecoderTest {
+public class SkypatrolProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
- T55ProtocolDecoder decoder = new T55ProtocolDecoder(new TestDataManager());
+ SkypatrolProtocolDecoder decoder = new SkypatrolProtocolDecoder(new TestDataManager());
- assertNull(decoder.decode(null, null, "$PGID,359853000144328*0F"));
+ /*assertNull(decoder.decode(null, null, "$PGID,359853000144328*0F"));
assertNotNull(decoder.decode(null, null,
"$GPRMC,094907.000,A,6000.5332,N,03020.5192,E,1.17,60.26,091111,,*33"));
assertNotNull(decoder.decode(null, null,
- "$GPRMC,115528.000,A,6000.5432,N,03020.4948,E,,,091111,,*06"));
+ "$GPRMC,115528.000,A,6000.5432,N,03020.4948,E,,,091111,,*06"));*/
}