aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-17 16:28:36 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-17 16:28:36 +1200
commit3f6f92cedd969e741e65bb6e14737b98722b214e (patch)
tree97b19d441bb9f79c73db493d6ad52b2e422ec1ba /src/org/traccar/protocol
parentb6ba5a8ac60e8013e22ed44b15ffdc5ad8097060 (diff)
downloadtrackermap-server-3f6f92cedd969e741e65bb6e14737b98722b214e.tar.gz
trackermap-server-3f6f92cedd969e741e65bb6e14737b98722b214e.tar.bz2
trackermap-server-3f6f92cedd969e741e65bb6e14737b98722b214e.zip
Start re-factoring commands
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/Gps103Protocol.java20
-rw-r--r--src/org/traccar/protocol/GpsMarkerProtocol.java1
-rw-r--r--src/org/traccar/protocol/Gt06Protocol.java13
3 files changed, 11 insertions, 23 deletions
diff --git a/src/org/traccar/protocol/Gps103Protocol.java b/src/org/traccar/protocol/Gps103Protocol.java
index 84275a556..3f04ede4e 100644
--- a/src/org/traccar/protocol/Gps103Protocol.java
+++ b/src/org/traccar/protocol/Gps103Protocol.java
@@ -23,16 +23,8 @@ import org.jboss.netty.handler.codec.string.StringEncoder;
import org.traccar.BaseProtocol;
import org.traccar.CharacterDelimiterFrameDecoder;
import org.traccar.TrackerServer;
-import org.traccar.command.CommandType;
-import org.traccar.command.Duration;
-import org.traccar.command.FixPositioningCommand;
-import org.traccar.command.GpsCommand;
-import org.traccar.command.CommandTemplate;
-import org.traccar.command.CommandValueConversion;
-import org.traccar.command.StringCommandTemplate;
import java.util.List;
-import java.util.Map;
public class Gps103Protocol extends BaseProtocol {
@@ -40,19 +32,19 @@ public class Gps103Protocol extends BaseProtocol {
super("gps103");
}
- @Override
+ /*@Override
protected void initCommandsTemplates(Map<CommandType, CommandTemplate> templates) {
- templates.put(CommandType.STOP_POSITIONING, new StringCommandTemplate("**,imei:[%s],A", GpsCommand.UNIQUE_ID));
- templates.put(CommandType.FIX_POSITIONING, new StringCommandTemplate("**,imei:[%s],C,[%s]", GpsCommand.UNIQUE_ID, FixPositioningCommand.FREQUENCY)
+ templates.put(CommandType.STOP_POSITIONING, new StringCommandTemplate("**,imei:[%s],A", Command.UNIQUE_ID));
+ templates.put(CommandType.FIX_POSITIONING, new StringCommandTemplate("**,imei:[%s],C,[%s]", Command.UNIQUE_ID, FixPositioningCommand.FREQUENCY)
.addConverter(Duration.class, new CommandValueConversion<Duration>() {
@Override
public String convert(Duration value) {
return String.format("%02d%s", value.getValue(), value.getUnit().getCommandFormat());
}
}));
- templates.put(CommandType.RESUME_ENGINE, new StringCommandTemplate("**,imei:[%s],J", GpsCommand.UNIQUE_ID));
- templates.put(CommandType.STOP_ENGINE, new StringCommandTemplate("**,imei:[%s],K", GpsCommand.UNIQUE_ID));
- }
+ templates.put(CommandType.RESUME_ENGINE, new StringCommandTemplate("**,imei:[%s],J", Command.UNIQUE_ID));
+ templates.put(CommandType.STOP_ENGINE, new StringCommandTemplate("**,imei:[%s],K", Command.UNIQUE_ID));
+ }*/
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
diff --git a/src/org/traccar/protocol/GpsMarkerProtocol.java b/src/org/traccar/protocol/GpsMarkerProtocol.java
index 0ef8cad70..7961e2340 100644
--- a/src/org/traccar/protocol/GpsMarkerProtocol.java
+++ b/src/org/traccar/protocol/GpsMarkerProtocol.java
@@ -23,7 +23,6 @@ import org.jboss.netty.handler.codec.string.StringEncoder;
import org.traccar.BaseProtocol;
import org.traccar.CharacterDelimiterFrameDecoder;
import org.traccar.TrackerServer;
-import org.traccar.command.*;
import java.util.List;
import java.util.Map;
diff --git a/src/org/traccar/protocol/Gt06Protocol.java b/src/org/traccar/protocol/Gt06Protocol.java
index d4bd48288..82d706e20 100644
--- a/src/org/traccar/protocol/Gt06Protocol.java
+++ b/src/org/traccar/protocol/Gt06Protocol.java
@@ -23,9 +23,6 @@ import org.traccar.BaseProtocol;
import org.traccar.TrackerServer;
import org.traccar.database.ActiveDevice;
import org.traccar.helper.Crc;
-import org.traccar.command.CommandType;
-import org.traccar.command.NoParameterCommand;
-import org.traccar.command.CommandTemplate;
import java.util.List;
import java.util.Map;
@@ -36,11 +33,11 @@ public class Gt06Protocol extends BaseProtocol {
super("gt06");
}
- @Override
+ /*@Override
protected void initCommandsTemplates(Map<CommandType, CommandTemplate> templates) {
templates.put(CommandType.STOP_ENGINE, new Gt06CommandTemplate("DYD#"));
templates.put(CommandType.RESUME_ENGINE, new Gt06CommandTemplate("HFYD#"));
- }
+ }*/
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
@@ -53,7 +50,7 @@ public class Gt06Protocol extends BaseProtocol {
});
}
- class Gt06CommandTemplate implements CommandTemplate<NoParameterCommand> {
+ /*class Gt06CommandTemplate implements CommandTemplate<NoParameterCommand> {
private String commandContent;
@@ -65,7 +62,7 @@ public class Gt06Protocol extends BaseProtocol {
public Object applyTo(ActiveDevice activeDevice, NoParameterCommand command) {
int serverFlagBit = 0x0;
int commandLength = serverFlagBit + commandContent.length();
- int packetLength = 0x80 /*Protocol Number */ + commandContent.length() /* Information Content */ + 2 /*Information Serial Number */+ 2 /*Error Check */;
+ int packetLength = 0x80 /*Protocol Number + commandContent.length() /* Information Content + 2 /*Information Serial Number + 2 /*Error Check ;
int informationSerialNumber = 1;
@@ -90,6 +87,6 @@ public class Gt06Protocol extends BaseProtocol {
return response;
}
- }
+ }*/
}