buffet: Separate command IDs from DBus paths.
As we're starting to support cloud and local cases, we need proper
support for cloud command IDs. Therefore now we require each
command instance to have some command id, but generate dbus path
independently.
BUG=None
TEST=cros_workon_make buffet --test&&manual
Change-Id: I83ae92872d920c8e0d6e15324ad11feebfd1f540
Reviewed-on: https://chromium-review.googlesource.com/226532
Tested-by: Anton Muhin <antonm@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Anton Muhin <antonm@chromium.org>
diff --git a/buffet/commands/command_manager.h b/buffet/commands/command_manager.h
index 05326b3..88b551a 100644
--- a/buffet/commands/command_manager.h
+++ b/buffet/commands/command_manager.h
@@ -75,8 +75,13 @@
// the current device.
void Startup();
- // Adds a new command to the command queue. Returns command ID.
- std::string AddCommand(std::unique_ptr<CommandInstance> command_instance);
+ // Adds a new command to the command queue.
+ void AddCommand(std::unique_ptr<CommandInstance> command_instance);
+
+ // Finds a command by the command |id|. Returns nullptr if the command with
+ // the given |id| is not found. The returned pointer should not be persisted
+ // for a long period of time.
+ CommandInstance* FindCommand(const std::string& id) const;
private:
CommandDictionary base_dictionary_; // Base/std command definitions/schemas.