aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/ServerManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-02-08 19:49:56 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-02-08 19:49:56 +1300
commitab72e6b1295f4f86ee2873c039f35f7c2da70395 (patch)
tree73e8a33391c24410e02660c12fd5ac78d5dc37dc /src/org/traccar/ServerManager.java
parent60c92c0c3efa2fdd7133bb9c0488b614a0409f5f (diff)
downloadtrackermap-server-ab72e6b1295f4f86ee2873c039f35f7c2da70395.tar.gz
trackermap-server-ab72e6b1295f4f86ee2873c039f35f7c2da70395.tar.bz2
trackermap-server-ab72e6b1295f4f86ee2873c039f35f7c2da70395.zip
Added GpsGate protocol (fix #138)
Diffstat (limited to 'src/org/traccar/ServerManager.java')
-rw-r--r--src/org/traccar/ServerManager.java39
1 files changed, 35 insertions, 4 deletions
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java
index 85aa8b2cc..7f73dd019 100644
--- a/src/org/traccar/ServerManager.java
+++ b/src/org/traccar/ServerManager.java
@@ -131,8 +131,10 @@ public class ServerManager {
initGt06Server("gt06");
initMegastekServer("megastek");
initNavigilServer("navigil");
- initMta6Server("mta6");
+ initGpsGateServer("gpsgate");
initTeltonikaServer("teltonika");
+ initMta6Server("mta6");
+ initMta6CanServer("mta6can");
// Initialize web server
if (Boolean.valueOf(properties.getProperty("http.enable"))) {
@@ -610,6 +612,34 @@ public class ServerManager {
}
}
+ private void initGpsGateServer(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) '\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 GpsGateProtocolDecoder(ServerManager.this));
+ }
+ });
+ }
+ }
+
+ private void initTeltonikaServer(String protocol) throws SQLException {
+ if (isProtocolEnabled(properties, protocol)) {
+ serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) {
+ @Override
+ protected void addSpecificHandlers(ChannelPipeline pipeline) {
+ pipeline.addLast("frameDecoder", new TeltonikaFrameDecoder());
+ pipeline.addLast("objectDecoder", new TeltonikaProtocolDecoder(ServerManager.this));
+ }
+ });
+ }
+ }
+
private void initMta6Server(String protocol) throws SQLException {
if (isProtocolEnabled(properties, protocol)) {
serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) {
@@ -623,13 +653,14 @@ public class ServerManager {
}
}
- private void initTeltonikaServer(String protocol) throws SQLException {
+ private void initMta6CanServer(String protocol) throws SQLException {
if (isProtocolEnabled(properties, protocol)) {
serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
- pipeline.addLast("frameDecoder", new TeltonikaFrameDecoder());
- pipeline.addLast("objectDecoder", new TeltonikaProtocolDecoder(ServerManager.this));
+ pipeline.addLast("httpDecoder", new HttpRequestDecoder());
+ pipeline.addLast("httpEncoder", new HttpResponseEncoder());
+ pipeline.addLast("objectDecoder", new Mta6ProtocolDecoder(ServerManager.this));
}
});
}