aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Gps103Protocol.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-17 20:10:48 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-17 20:10:48 +1200
commit51d4e557703a0322b983a8b294f2a8c6920718c5 (patch)
tree188a34f8bcba3dae3cebc3c8e5b47986782f3cd6 /src/org/traccar/protocol/Gps103Protocol.java
parentd2b861df3f3faa46c8dcf72e5897ed31cfe40b40 (diff)
downloadtrackermap-server-51d4e557703a0322b983a8b294f2a8c6920718c5.tar.gz
trackermap-server-51d4e557703a0322b983a8b294f2a8c6920718c5.tar.bz2
trackermap-server-51d4e557703a0322b983a8b294f2a8c6920718c5.zip
Start GPS103 encoder implementation
Diffstat (limited to 'src/org/traccar/protocol/Gps103Protocol.java')
-rw-r--r--src/org/traccar/protocol/Gps103Protocol.java25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/org/traccar/protocol/Gps103Protocol.java b/src/org/traccar/protocol/Gps103Protocol.java
index 3f04ede4e..59d8e62a7 100644
--- a/src/org/traccar/protocol/Gps103Protocol.java
+++ b/src/org/traccar/protocol/Gps103Protocol.java
@@ -15,6 +15,7 @@
*/
package org.traccar.protocol;
+import java.util.List;
import org.jboss.netty.bootstrap.ConnectionlessBootstrap;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
@@ -23,29 +24,19 @@ import org.jboss.netty.handler.codec.string.StringEncoder;
import org.traccar.BaseProtocol;
import org.traccar.CharacterDelimiterFrameDecoder;
import org.traccar.TrackerServer;
-
-import java.util.List;
+import org.traccar.model.Command;
public class Gps103Protocol extends BaseProtocol {
public Gps103Protocol() {
super("gps103");
+ setSupportedCommands(
+ Command.TYPE_POSITION_STOP,
+ Command.TYPE_POSITION_FIX,
+ Command.TYPE_ENGINE_STOP,
+ Command.TYPE_ENGINE_RESUME);
}
- /*@Override
- protected void initCommandsTemplates(Map<CommandType, CommandTemplate> templates) {
- 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", Command.UNIQUE_ID));
- templates.put(CommandType.STOP_ENGINE, new StringCommandTemplate("**,imei:[%s],K", Command.UNIQUE_ID));
- }*/
-
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
serverList.add(new TrackerServer(new ServerBootstrap(), this.getName()) {
@@ -55,6 +46,7 @@ public class Gps103Protocol extends BaseProtocol {
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectDecoder", new Gps103ProtocolDecoder(Gps103Protocol.this));
+ pipeline.addLast("objectEncoder", new Gps103ProtocolEncoder());
}
});
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), this.getName()) {
@@ -63,6 +55,7 @@ public class Gps103Protocol extends BaseProtocol {
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectDecoder", new Gps103ProtocolDecoder(Gps103Protocol.this));
+ pipeline.addLast("objectEncoder", new Gps103ProtocolEncoder());
}
});
}