aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-10-22 18:55:34 +0500
committerAbyss777 <abyss@fox5.ru>2017-10-22 19:22:49 +0500
commited72ff6e7f964bc56a4948c15c97f37c072bf326 (patch)
tree70568d6af20bc90a071c907583ccb951059bcd2a /src/org/traccar/database
parent9ace2318b9ea5a2d949800eedff8398808d3a6ce (diff)
downloadtraccar-server-ed72ff6e7f964bc56a4948c15c97f37c072bf326.tar.gz
traccar-server-ed72ff6e7f964bc56a4948c15c97f37c072bf326.tar.bz2
traccar-server-ed72ff6e7f964bc56a4948c15c97f37c072bf326.zip
Set deviceId in Saved Command before send
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r--src/org/traccar/database/CommandsManager.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/org/traccar/database/CommandsManager.java b/src/org/traccar/database/CommandsManager.java
index cae4ac6f7..07695cbf7 100644
--- a/src/org/traccar/database/CommandsManager.java
+++ b/src/org/traccar/database/CommandsManager.java
@@ -45,11 +45,15 @@ public class CommandsManager extends ExtendedObjectManager<Command> {
return !getAllDeviceItems(deviceId).contains(commandId);
}
- public boolean sendCommand(long commandId, long deviceId) throws Exception {
- return sendCommand(getById(commandId), deviceId);
- }
-
- public boolean sendCommand(Command command, long deviceId) throws Exception {
+ public boolean sendCommand(Command command) throws Exception {
+ long deviceId = command.getDeviceId();
+ if (command.getId() != 0) {
+ Command savedCommand = getById(command.getId());
+ command.setTextChannel(savedCommand.getTextChannel());
+ command.setType(savedCommand.getType());
+ command.setAttributes(savedCommand.getAttributes());
+ command.setDescription(savedCommand.getDescription());
+ }
boolean sent = true;
if (command.getTextChannel()) {
Position lastPosition = Context.getIdentityManager().getLastPosition(deviceId);