shill: implement Manager.GetService (error-case only)

BUG=chromium-os:20254
TEST=unittests, WiFiManager/000_SSID_Length_Limit

this gives us enough to pass the autotest for
network_WiFiManager/000_SSID_Length_Limit.

Change-Id: Ib0305e707d2203327d846be3e0b206033d6a884a
Reviewed-on: http://gerrit.chromium.org/gerrit/7567
Commit-Ready: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
diff --git a/dbus_adaptor.cc b/dbus_adaptor.cc
index a8cbc45..808b325 100644
--- a/dbus_adaptor.cc
+++ b/dbus_adaptor.cc
@@ -12,6 +12,7 @@
 #include "shill/accessor_interface.h"
 #include "shill/dbus_adaptor.h"
 #include "shill/error.h"
+#include "shill/key_value_store.h"
 #include "shill/property_store.h"
 
 using std::map;
@@ -133,6 +134,28 @@
 }
 
 // static
+void DBusAdaptor::ArgsToKeyValueStore(
+    const map<string, ::DBus::Variant> &args,
+    KeyValueStore *out,
+    Error *error) {  // XXX should be ::DBus::Error?
+  for (map<string, ::DBus::Variant>::const_iterator it = args.begin();
+       it != args.end();
+       ++it) {
+    DBus::type<string> string_type;
+    DBus::type<bool> bool_type;
+
+    if (it->second.signature() == string_type.sig()) {
+      out->SetString(it->first, it->second.reader().get_string());
+    } else if (it->second.signature() == bool_type.sig()) {
+      out->SetBool(it->first, it->second.reader().get_bool());
+    } else {
+      error->Populate(Error::kInternalError);
+      return;  // skip remaining args after error
+    }
+  }
+}
+
+// static
 ::DBus::Variant DBusAdaptor::BoolToVariant(bool value) {
   ::DBus::Variant v;
   v.writer().append_bool(value);