aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java
diff options
context:
space:
mode:
authorEdward Valley <ed.valley@yandex.com>2019-07-18 15:12:44 -0400
committerEdward Valley <ed.valley@yandex.com>2019-07-18 15:12:44 -0400
commitad32779b17fd4e480479b3f5702ef62443b8a387 (patch)
tree6e57f6853ed9c14a570c4e49e6faa33760074a1d /src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java
parent94fdc382f4cf46e804472f094401d20421d1e1b3 (diff)
downloadtrackermap-server-ad32779b17fd4e480479b3f5702ef62443b8a387.tar.gz
trackermap-server-ad32779b17fd4e480479b3f5702ef62443b8a387.tar.bz2
trackermap-server-ad32779b17fd4e480479b3f5702ef62443b8a387.zip
Update some encoders with hardcoded protocol names and passwords
Diffstat (limited to 'src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java
index bbc5e02d8..a3ceb4f30 100644
--- a/src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java
+++ b/src/main/java/org/traccar/protocol/Gt06ProtocolEncoder.java
@@ -34,7 +34,7 @@ public class Gt06ProtocolEncoder extends BaseProtocolEncoder {
private ByteBuf encodeContent(long deviceId, String content) {
boolean language = Context.getIdentityManager()
- .lookupAttributeBoolean(deviceId, "gt06.language", false, false, true);
+ .lookupAttributeBoolean(deviceId, getProtocolName() + ".language", false, false, true);
ByteBuf buf = Unpooled.buffer();
@@ -67,13 +67,17 @@ public class Gt06ProtocolEncoder extends BaseProtocolEncoder {
protected Object encodeCommand(Command command) {
boolean alternative = Context.getIdentityManager().lookupAttributeBoolean(
- command.getDeviceId(), "gt06.alternative", false, false, true);
+ command.getDeviceId(), getProtocolName() + ".alternative", false, false, true);
+
+ initDevicePassword(command, "123456");
switch (command.getType()) {
case Command.TYPE_ENGINE_STOP:
- return encodeContent(command.getDeviceId(), alternative ? "DYD,123456#" : "Relay,1#");
+ return encodeContent(command.getDeviceId(),
+ alternative ? "DYD," + Command.KEY_DEVICE_PASSWORD + "#" : "Relay,1#");
case Command.TYPE_ENGINE_RESUME:
- return encodeContent(command.getDeviceId(), alternative ? "HFYD,123456#" : "Relay,0#");
+ return encodeContent(command.getDeviceId(),
+ alternative ? "HFYD," + Command.KEY_DEVICE_PASSWORD + "#" : "Relay,0#");
case Command.TYPE_CUSTOM:
return encodeContent(command.getDeviceId(), command.getString(Command.KEY_DATA));
default: