aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/CommandsManager.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-09-13 13:46:38 +0500
committerAbyss777 <abyss@fox5.ru>2017-09-13 13:46:38 +0500
commit7530522cbca477cb822cb494ffe12480e5237934 (patch)
treef584c95c9d6f2a4a7668ac1498a8f8772052cb6c /src/org/traccar/database/CommandsManager.java
parent0745524cc0a42165e7e1645bdc8d043bf6b8864f (diff)
downloadtrackermap-server-7530522cbca477cb822cb494ffe12480e5237934.tar.gz
trackermap-server-7530522cbca477cb822cb494ffe12480e5237934.tar.bz2
trackermap-server-7530522cbca477cb822cb494ffe12480e5237934.zip
Re implement "getSupportedCommands" function
Diffstat (limited to 'src/org/traccar/database/CommandsManager.java')
-rw-r--r--src/org/traccar/database/CommandsManager.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/org/traccar/database/CommandsManager.java b/src/org/traccar/database/CommandsManager.java
index 6eb6d9035..deb802b29 100644
--- a/src/org/traccar/database/CommandsManager.java
+++ b/src/org/traccar/database/CommandsManager.java
@@ -81,17 +81,17 @@ public class CommandsManager extends ExtendedObjectManager<Command> {
}
}
- public Collection<Long> getSupportedCommands(long deviceId, boolean textChannel) {
+ public Collection<Long> getSupportedCommands(long deviceId) {
List<Long> result = new ArrayList<>();
Position lastPosition = Context.getIdentityManager().getLastPosition(deviceId);
+ boolean online = Context.getConnectionManager().getActiveDevice(deviceId) != null;
for (long commandId : getAllDeviceItems(deviceId)) {
Command command = getById(commandId);
- if (command.getTextChannel() == textChannel) {
+ if (command.getTextChannel() || online) {
if (lastPosition != null) {
BaseProtocol protocol = Context.getServerManager().getProtocol(lastPosition.getProtocol());
- Collection<String> protocolCommands =
- textChannel ? protocol.getSupportedTextCommands() : protocol.getSupportedDataCommands();
- if (protocolCommands.contains(command.getType())) {
+ if (protocol.getSupportedTextCommands().contains(command.getType())
+ || online && protocol.getSupportedDataCommands().contains(command.getType())) {
result.add(commandId);
}
} else if (command.getType().equals(Command.TYPE_CUSTOM)) {