aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-10-20 23:16:33 +1300
committerGitHub <noreply@github.com>2017-10-20 23:16:33 +1300
commit0bf2902297a5f48019675790df60353a27ad80d3 (patch)
tree7232a13a32dece7f341ad007158d73781209e8fd /src/org/traccar/api
parentf5d309d193d1549d29314310b9c2a7bf0caf42af (diff)
parent91da9fa8e53836e71c36609132c38797317ae9e1 (diff)
downloadtrackermap-server-0bf2902297a5f48019675790df60353a27ad80d3.tar.gz
trackermap-server-0bf2902297a5f48019675790df60353a27ad80d3.tar.bz2
trackermap-server-0bf2902297a5f48019675790df60353a27ad80d3.zip
Merge pull request #3589 from Abyss777/buffered_commands
Implement buffered/delayed commands
Diffstat (limited to 'src/org/traccar/api')
-rw-r--r--src/org/traccar/api/resource/CommandResource.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/org/traccar/api/resource/CommandResource.java b/src/org/traccar/api/resource/CommandResource.java
index 8da9f8447..996c15daf 100644
--- a/src/org/traccar/api/resource/CommandResource.java
+++ b/src/org/traccar/api/resource/CommandResource.java
@@ -62,15 +62,19 @@ public class CommandResource extends ExtendedObjectResource<Command> {
Context.getPermissionsManager().checkReadonly(getUserId());
long deviceId = entity.getDeviceId();
long id = entity.getId();
+ boolean sent;
if (deviceId != 0 && id != 0) {
Context.getPermissionsManager().checkPermission(Command.class, getUserId(), id);
Context.getPermissionsManager().checkDevice(getUserId(), deviceId);
Context.getPermissionsManager().checkUserDeviceCommand(getUserId(), deviceId, id);
- Context.getCommandsManager().sendCommand(id, deviceId);
+ sent = Context.getCommandsManager().sendCommand(id, deviceId);
} else {
Context.getPermissionsManager().checkLimitCommands(getUserId());
Context.getPermissionsManager().checkDevice(getUserId(), deviceId);
- Context.getCommandsManager().sendCommand(entity);
+ sent = Context.getCommandsManager().sendCommand(entity, deviceId);
+ }
+ if (!sent) {
+ return Response.accepted(entity).build();
}
return Response.ok(entity).build();
}