diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-08-01 00:57:43 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-08-01 00:57:43 +1200 |
commit | e99ce88d9ea0ab3d2ae0a039e27ebe0029508092 (patch) | |
tree | 5842006d1e83d582a3b066b6c9c5f0afbddfa125 | |
parent | c07721bbf4b360a0173803d429d910e7932ecf6f (diff) | |
download | traccar-server-e99ce88d9ea0ab3d2ae0a039e27ebe0029508092.tar.gz traccar-server-e99ce88d9ea0ab3d2ae0a039e27ebe0029508092.tar.bz2 traccar-server-e99ce88d9ea0ab3d2ae0a039e27ebe0029508092.zip |
Fix some commands issues
-rw-r--r-- | src/org/traccar/BaseProtocol.java | 2 | ||||
-rw-r--r-- | src/org/traccar/protocol/Gt06ProtocolEncoder.java | 2 | ||||
-rw-r--r-- | src/org/traccar/web/CommandServlet.java | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/org/traccar/BaseProtocol.java b/src/org/traccar/BaseProtocol.java index aa98d776c..3af39a07c 100644 --- a/src/org/traccar/BaseProtocol.java +++ b/src/org/traccar/BaseProtocol.java @@ -42,7 +42,7 @@ public abstract class BaseProtocol implements Protocol { @Override public void sendCommand(ActiveDevice activeDevice, Command command) { if (!supportedCommands.contains(command.getType())) { - throw new RuntimeException("Command " + command + " is not supported in protocol " + getName()); + throw new RuntimeException("Command " + command.getType() + " is not supported in protocol " + getName()); } activeDevice.write(command); } diff --git a/src/org/traccar/protocol/Gt06ProtocolEncoder.java b/src/org/traccar/protocol/Gt06ProtocolEncoder.java index b8177d60b..13836945f 100644 --- a/src/org/traccar/protocol/Gt06ProtocolEncoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolEncoder.java @@ -40,7 +40,7 @@ public class Gt06ProtocolEncoder extends BaseProtocolEncoder { int commandLength = serverFlagBit + content.length(); int packetLength = 0x80 + content.length() + 2 + 2; - ChannelBuffer response = ChannelBuffers.directBuffer(10); + ChannelBuffer response = ChannelBuffers.dynamicBuffer(); response.writeBytes(new byte[]{0x78, 0x78}); // Start Bit response.writeByte(packetLength); // Packet Length response.writeByte(0x80); // Protocol Number diff --git a/src/org/traccar/web/CommandServlet.java b/src/org/traccar/web/CommandServlet.java index 049a0534d..f638520ec 100644 --- a/src/org/traccar/web/CommandServlet.java +++ b/src/org/traccar/web/CommandServlet.java @@ -5,8 +5,8 @@ import javax.json.JsonObject; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.traccar.Context; -import org.traccar.model.Command; import org.traccar.database.ActiveDevice; +import org.traccar.model.Command; public class CommandServlet extends BaseServlet { @@ -36,7 +36,7 @@ public class CommandServlet extends BaseServlet { private void send(HttpServletRequest req, HttpServletResponse resp) throws Exception { Command command = JsonConverter.objectFromJson(req.getReader(), new Command()); - getActiveDevice(command.getDeviceId()).write(command); + getActiveDevice(command.getDeviceId()).sendCommand(command); sendResponse(resp.getWriter(), true); } |