Buffet: Move buffet over to platform2 from src/platform/buffet.

This change also open-sources buffet. The only change in this CL
is the removal of the Makefile and addition of the buffet.gyp file.

BUG=chromium:355180
TEST=USE=buffet emerge-gizmo platform2

Change-Id: Ibf8d3ac3f38313f82a9c07d79932b6f30130f9c5
diff --git a/buffet/buffet_client.cc b/buffet/buffet_client.cc
new file mode 100755
index 0000000..83d5f9c
--- /dev/null
+++ b/buffet/buffet_client.cc
@@ -0,0 +1,56 @@
+// 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.
+
+#include <string>
+
+#include <base/logging.h>
+#include <base/memory/scoped_ptr.h>
+#include <dbus/bus.h>
+#include <dbus/object_proxy.h>
+#include <gflags/gflags.h>
+
+#include "buffet/dbus_manager.h"
+
+DEFINE_bool(testmethod, false, "Call the Buffet Test Method.");
+
+namespace {
+
+dbus::ObjectProxy* GetBuffetDBusProxy(dbus::Bus *bus) {
+  return bus->GetObjectProxy(
+      buffet::kBuffetServiceName,
+      dbus::ObjectPath(buffet::kBuffetServicePath));
+}
+
+void CallTestMethod(dbus::ObjectProxy* proxy) {
+  int timeout_ms = 1000;
+  dbus::MethodCall method_call(buffet::kBuffetInterface,
+                               buffet::kTestMethod);
+  scoped_ptr<dbus::Response> response(proxy->CallMethodAndBlock(&method_call,
+                                                                timeout_ms));
+  if (!response) {
+    LOG(ERROR) << "Failed to receive a response.";
+    return;
+  } else {
+    LOG(INFO) << "Received a response.";
+  }
+}
+
+} // end namespace
+
+int main(int argc, char** argv) {
+  google::ParseCommandLineFlags(&argc, &argv, true);
+
+  dbus::Bus::Options options;
+  options.bus_type = dbus::Bus::SYSTEM;
+  scoped_refptr<dbus::Bus> bus = new dbus::Bus(options);
+
+  auto proxy = GetBuffetDBusProxy(bus);
+  if (FLAGS_testmethod) {
+    CallTestMethod(proxy);
+  }
+
+  LOG(INFO) << "Done.";
+  return 0;
+}
+