diff options
author | drecchia <danilo@deltatecnologia.com> | 2016-07-15 08:22:06 -0300 |
---|---|---|
committer | drecchia <danilo@deltatecnologia.com> | 2016-07-15 08:22:06 -0300 |
commit | 22afcdff52d47e9705c446dc8590deeb6786a701 (patch) | |
tree | 0816cfb09e84d584e511663696182b578b8611de /src/org/traccar/protocol/SuntechProtocolEncoder.java | |
parent | 901c483ac358e5dc38f2014287e5018e79aa7b08 (diff) | |
download | trackermap-server-22afcdff52d47e9705c446dc8590deeb6786a701.tar.gz trackermap-server-22afcdff52d47e9705c446dc8590deeb6786a701.tar.bz2 trackermap-server-22afcdff52d47e9705c446dc8590deeb6786a701.zip |
- Fixed output control command construction.
Diffstat (limited to 'src/org/traccar/protocol/SuntechProtocolEncoder.java')
-rw-r--r-- | src/org/traccar/protocol/SuntechProtocolEncoder.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/SuntechProtocolEncoder.java b/src/org/traccar/protocol/SuntechProtocolEncoder.java index 708b24e79..5f6835e92 100644 --- a/src/org/traccar/protocol/SuntechProtocolEncoder.java +++ b/src/org/traccar/protocol/SuntechProtocolEncoder.java @@ -30,8 +30,14 @@ public class SuntechProtocolEncoder extends StringProtocolEncoder { case Command.TYPE_POSITION_SINGLE: return formatCommand(command, "SA200GTR;{%s};02;\r", Command.KEY_UNIQUE_ID); case Command.TYPE_OUTPUT_CONTROL: - return formatCommand(command, "SA200CMD;{%s};0{%s};Enable{%s}\r", - Command.KEY_UNIQUE_ID, Command.KEY_DATA, Command.KEY_DATA); + if (command.getAttributes().containsKey(Command.KEY_DATA)) { + if (command.getAttributes().get(Command.KEY_DATA).equals("1")) { + return formatCommand(command, "SA200CMD;{%s};02;Enable{%s}\r", + Command.KEY_UNIQUE_ID, Command.KEY_INDEX); + } else + return formatCommand(command, "SA200CMD;{%s};02;Disable{%s}\r", + Command.KEY_UNIQUE_ID, Command.KEY_INDEX); + } case Command.TYPE_ENGINE_STOP: return formatCommand(command, "SA200CMD;{%s};02;Enable1\r", Command.KEY_UNIQUE_ID); case Command.TYPE_ENGINE_RESUME: |