aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Gl200ProtocolEncoder.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-10-05 14:20:59 +0500
committerAbyss777 <abyss@fox5.ru>2016-10-05 14:20:59 +0500
commit664cc129f1a5ad13fab966d3c293e7aa6ce12ab6 (patch)
tree13c7e8eb020ad36f67c0c74161b7c9550558d08b /src/org/traccar/protocol/Gl200ProtocolEncoder.java
parent44d36f3adea94b98c88b6e491d22f4466678ad6d (diff)
downloadtrackermap-server-664cc129f1a5ad13fab966d3c293e7aa6ce12ab6.tar.gz
trackermap-server-664cc129f1a5ad13fab966d3c293e7aa6ce12ab6.tar.bz2
trackermap-server-664cc129f1a5ad13fab966d3c293e7aa6ce12ab6.zip
- Remove hardcoded password from commands
- Authenticate device on heardbeat stage
Diffstat (limited to 'src/org/traccar/protocol/Gl200ProtocolEncoder.java')
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolEncoder.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolEncoder.java b/src/org/traccar/protocol/Gl200ProtocolEncoder.java
index 0537420a0..25ca1bf75 100644
--- a/src/org/traccar/protocol/Gl200ProtocolEncoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolEncoder.java
@@ -24,15 +24,21 @@ public class Gl200ProtocolEncoder extends StringProtocolEncoder {
@Override
protected Object encodeCommand(Command command) {
+ initDevicePassword(command, "");
+
switch (command.getType()) {
case Command.TYPE_POSITION_SINGLE:
- return "AT+GTRTO=gv300,1,,,,,,FFFF$";
+ return formatCommand(command, "AT+GTRTO={%s},1,,,,,,FFFF$", Command.KEY_DEVICE_PASSWORD);
case Command.TYPE_ENGINE_STOP:
- return "AT+GTOUT=gv300,1,,,0,0,0,0,0,0,0,,,,,,,FFFF$";
+ return formatCommand(command, "AT+GTOUT={%s},1,,,0,0,0,0,0,0,0,,,,,,,FFFF$",
+ Command.KEY_DEVICE_PASSWORD);
case Command.TYPE_ENGINE_RESUME:
- return "AT+GTOUT=gv300,0,,,0,0,0,0,0,0,0,,,,,,,FFFF$";
+ return formatCommand(command, "AT+GTOUT={%s},0,,,0,0,0,0,0,0,0,,,,,,,FFFF$",
+ Command.KEY_DEVICE_PASSWORD);
+ case Command.TYPE_IDENTIFICATION:
+ return formatCommand(command, "AT+GTRTO={%s},8,,,,,,FFFF$", Command.KEY_DEVICE_PASSWORD);
case Command.TYPE_REBOOT_DEVICE:
- return "AT+GTRTO=gv300,3,,,,,,FFFF$";
+ return formatCommand(command, "AT+GTRTO={%s},3,,,,,,FFFF$", Command.KEY_DEVICE_PASSWORD);
default:
Log.warning(new UnsupportedOperationException(command.getType()));
break;