aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/database/ActiveDevice.java6
-rw-r--r--src/main/java/org/traccar/database/CommandsManager.java7
2 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/database/ActiveDevice.java b/src/main/java/org/traccar/database/ActiveDevice.java
index 34b3de227..e3ece6ad9 100644
--- a/src/main/java/org/traccar/database/ActiveDevice.java
+++ b/src/main/java/org/traccar/database/ActiveDevice.java
@@ -16,6 +16,8 @@
package org.traccar.database;
import io.netty.channel.Channel;
+import io.netty.handler.codec.http.HttpRequestDecoder;
+import org.traccar.BasePipelineFactory;
import org.traccar.Protocol;
import org.traccar.model.Command;
@@ -43,6 +45,10 @@ public class ActiveDevice {
return deviceId;
}
+ public boolean supportsLiveCommands() {
+ return BasePipelineFactory.getHandler(channel.pipeline(), HttpRequestDecoder.class) == null;
+ }
+
public void sendCommand(Command command) {
protocol.sendDataCommand(channel, remoteAddress, command);
}
diff --git a/src/main/java/org/traccar/database/CommandsManager.java b/src/main/java/org/traccar/database/CommandsManager.java
index 99114db5e..485402807 100644
--- a/src/main/java/org/traccar/database/CommandsManager.java
+++ b/src/main/java/org/traccar/database/CommandsManager.java
@@ -76,7 +76,12 @@ public class CommandsManager extends ExtendedObjectManager<Command> {
} else {
ActiveDevice activeDevice = Context.getConnectionManager().getActiveDevice(deviceId);
if (activeDevice != null) {
- activeDevice.sendCommand(command);
+ if (activeDevice.supportsLiveCommands()) {
+ activeDevice.sendCommand(command);
+ } else {
+ getDeviceQueue(deviceId).add(command);
+ return false;
+ }
} else if (!queueing) {
throw new RuntimeException("Device is not online");
} else {