buffet: Add an abstract command dispatch interface

Added simple framework for implementing command dispatch from
buffet to command-handling daemons which concrete delivery
layers, such as D-Bus, can use to actually implement the command
delivery.

Also changed some CommandQueue unit tests to remove the
implementation detail knowledge of how the command IDs are generated.

BUG=chromium:374864
TEST=USE=buffet P2_TEST_FILTER="buffet::*" FEATURES=test emerge-link platform2

Change-Id: Ic7a719a09e924fefedc72cc0bb675adf1acd3713
Reviewed-on: https://chromium-review.googlesource.com/211485
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/commands/command_dispatch_interface.h b/buffet/commands/command_dispatch_interface.h
new file mode 100644
index 0000000..b09c6ec
--- /dev/null
+++ b/buffet/commands/command_dispatch_interface.h
@@ -0,0 +1,31 @@
+// Copyright 2014 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BUFFET_COMMANDS_COMMAND_DISPATCH_INTERFACE_H_
+#define BUFFET_COMMANDS_COMMAND_DISPATCH_INTERFACE_H_
+
+#include <string>
+
+namespace buffet {
+
+class CommandInstance;
+
+// This is an abstract base interface that a command dispatcher will implement.
+// It allows to abstract out the actual transport layer, such as D-Bus, from
+// the rest of command registration and delivery subsystems.
+class CommandDispachInterface {
+ public:
+  virtual ~CommandDispachInterface() = default;
+  // Callback invoked by CommandQueue when a new command is added to the queue.
+  virtual void OnCommandAdded(const std::string& command_id,
+                              const CommandInstance* command_instance) = 0;
+  // Callback invoked by CommandQueue when a new command is removed from
+  // the queue.
+  virtual void OnCommandRemoved(const std::string& command_id,
+                                const CommandInstance* command_instance) = 0;
+};
+
+}  // namespace buffet
+
+#endif  // BUFFET_COMMANDS_COMMAND_DISPATCH_INTERFACE_H_