diff options
Diffstat (limited to 'src/org/traccar/BaseProtocol.java')
-rw-r--r-- | src/org/traccar/BaseProtocol.java | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/org/traccar/BaseProtocol.java b/src/org/traccar/BaseProtocol.java index 86bebacc7..932c0d9cc 100644 --- a/src/org/traccar/BaseProtocol.java +++ b/src/org/traccar/BaseProtocol.java @@ -15,31 +15,31 @@ */ package org.traccar; +import org.traccar.model.Command; import org.traccar.database.ActiveDevice; -import org.traccar.command.CommandType; -import org.traccar.command.CommandTemplate; -import org.traccar.command.GpsCommand; -import java.util.HashMap; -import java.util.Map; +import java.util.*; public abstract class BaseProtocol implements Protocol { private final String name; - private Map<CommandType, CommandTemplate> commandTemplates = new HashMap<>(); + private final Set<String> supportedCommands = new HashSet<>(); public BaseProtocol(String name) { this.name = name; - this.initCommandsTemplates(commandTemplates); } public String getName() { return name; } + public void setSupportedCommands(String[] commands) { + supportedCommands.addAll(Arrays.asList(commands)); + } + @Override - public void sendCommand(ActiveDevice activeDevice, GpsCommand command) { - CommandTemplate commandMessage = commandTemplates.get(command.getType()); + public void sendCommand(ActiveDevice activeDevice, Command command) { + /*CommandTemplate commandMessage = commandTemplates.get(command.getType()); if (commandMessage == null) { throw new RuntimeException("The command " + command + " is not yet supported in protocol " + this.getName()); @@ -47,10 +47,7 @@ public abstract class BaseProtocol implements Protocol { Object response = commandMessage.applyTo(activeDevice, command); - activeDevice.write(response); - } - - protected void initCommandsTemplates(Map<CommandType, CommandTemplate> templates) { + activeDevice.write(response);*/ } } |