buffet: Move command state into CommandInstance The command state is now stored in CommandInstance and not in DBusCommandProxy. CommandInstance can now notify the proxy of command state changes via CommandProxyInterface. Moved command status strings from dbus_constants.h into the CommandInstance class, as members. Added a property on DBusCommandProxy to expose the command parameters to command handlers, so they can get the parameter values over D-Bus. BUG=chromium:374864 TEST=FEATURES=test emerge-link buffet Change-Id: Ief3397ef09644772ffc3b1b01ed972a8b6779df4 Reviewed-on: https://chromium-review.googlesource.com/216296 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_proxy_interface.h b/buffet/commands/command_proxy_interface.h new file mode 100644 index 0000000..f9e78d6 --- /dev/null +++ b/buffet/commands/command_proxy_interface.h
@@ -0,0 +1,25 @@ +// 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_PROXY_INTERFACE_H_ +#define BUFFET_COMMANDS_COMMAND_PROXY_INTERFACE_H_ + +#include <string> + +namespace buffet { + +// This interface lets the command instance to update its proxy of command +// state changes, so that the proxy can then notify clients of the changes over +// their supported protocol (e.g. D-Bus). +class CommandProxyInterface { + public: + virtual ~CommandProxyInterface() = default; + + virtual void OnStatusChanged(const std::string& status) = 0; + virtual void OnProgressChanged(int progress) = 0; +}; + +} // namespace buffet + +#endif // BUFFET_COMMANDS_COMMAND_PROXY_INTERFACE_H_