shill: Refactor Manager's Get*Service to support both VPN and WiFi types.
BUG=chromium-os:22063
TEST=unit tests
Change-Id: I1f9ae822af8a22a59dda0c159a5f3471dcda2a89
Reviewed-on: https://gerrit.chromium.org/gerrit/16479
Commit-Ready: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
diff --git a/manager_dbus_adaptor.cc b/manager_dbus_adaptor.cc
index b1996e1..b7c283b 100644
--- a/manager_dbus_adaptor.cc
+++ b/manager_dbus_adaptor.cc
@@ -150,32 +150,35 @@
::DBus::Error &/*error*/) {
}
-// deprecated synonym for GetWifiService
+// Called, e.g., to get WiFiService handle for a hidden SSID.
::DBus::Path ManagerDBusAdaptor::GetService(
const map<string, ::DBus::Variant> &args,
::DBus::Error &error) {
- return GetWifiService(args, error);
+ ServiceRefPtr service;
+ KeyValueStore args_store;
+ Error e;
+ DBusAdaptor::ArgsToKeyValueStore(args, &args_store, &e);
+ if (e.IsSuccess()) {
+ service = manager_->GetService(args_store, &e);
+ }
+ if (e.ToDBusError(&error)) {
+ return "/"; // ensure return is syntactically valid
+ }
+ return service->GetRpcIdentifier();
}
-// called, e.g., to get Service handle for a hidden SSID
+// Obsolete, use GetService instead.
+::DBus::Path ManagerDBusAdaptor::GetVPNService(
+ const map<string, ::DBus::Variant> &args,
+ ::DBus::Error &error) {
+ return GetService(args, error);
+}
+
+// Obsolete, use GetService instead.
::DBus::Path ManagerDBusAdaptor::GetWifiService(
const map<string, ::DBus::Variant> &args,
::DBus::Error &error) {
- KeyValueStore args_store;
- Error e;
- WiFiServiceRefPtr service;
- string ret;
-
- DBusAdaptor::ArgsToKeyValueStore(args, &args_store, &e);
- if (e.IsSuccess()) {
- service = manager_->GetWifiService(args_store, &e);
- }
-
- if (e.ToDBusError(&error)) {
- return "/"; // ensure return is syntactically valid
- } else {
- return service->GetRpcIdentifier();
- }
+ return GetService(args, error);
}
void ManagerDBusAdaptor::ConfigureWifiService(
@@ -183,12 +186,6 @@
::DBus::Error &/*error*/) {
}
-::DBus::Path ManagerDBusAdaptor::GetVPNService(
- const map<string, ::DBus::Variant> &,
- ::DBus::Error &/*error*/) {
- return ::DBus::Path();
-}
-
void ManagerDBusAdaptor::RegisterAgent(const ::DBus::Path &,
::DBus::Error &/*error*/) {
}