shill: SIM property is an object path, not a string

Add DBusProperties::GetObjectPath() helper to accomodate this.

BUG=None
TEST=Run on a system with modemmanager-next and a GSM modem; see if it crashes.

Change-Id: I55df239b5b69e260fb1ad1d7983154ee717727b2
Reviewed-on: https://gerrit.chromium.org/gerrit/20516
Reviewed-by: Jason Glasgow <jglasgow@chromium.org>
Commit-Ready: Nathan J. Williams <njw@chromium.org>
Tested-by: Nathan J. Williams <njw@chromium.org>
diff --git a/cellular_capability_universal.cc b/cellular_capability_universal.cc
index c9b8547..cd38d34 100644
--- a/cellular_capability_universal.cc
+++ b/cellular_capability_universal.cc
@@ -853,8 +853,8 @@
     const DBusPropertiesMap &properties,
     const vector<string> &/* invalidated_properties */) {
   string value;
-  if (DBusProperties::GetString(properties,
-                                MM_MODEM_PROPERTY_SIM, &value))
+  if (DBusProperties::GetObjectPath(properties,
+                                    MM_MODEM_PROPERTY_SIM, &value))
     OnSimPathChanged(value);
 
   uint32 access_technologies = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN;
diff --git a/dbus_properties.cc b/dbus_properties.cc
index 1948591..6310502 100644
--- a/dbus_properties.cc
+++ b/dbus_properties.cc
@@ -22,6 +22,19 @@
 }
 
 // static
+bool DBusProperties::GetObjectPath(const DBusPropertiesMap &properties,
+                                   const std::string &key,
+                                   std::string *value) {
+  DBusPropertiesMap::const_iterator it = properties.find(key);
+  if (it == properties.end()) {
+    return false;
+  }
+  *value = it->second.reader().get_path();
+  VLOG(2) << key << " = " << *value;
+  return true;
+}
+
+// static
 bool DBusProperties::GetUint32(const DBusPropertiesMap &properties,
                                const std::string &key,
                                uint32 *value) {
diff --git a/dbus_properties.h b/dbus_properties.h
index 0a290ef..a88ea76 100644
--- a/dbus_properties.h
+++ b/dbus_properties.h
@@ -21,6 +21,10 @@
                         const std::string &key,
                         std::string *value);
 
+  static bool GetObjectPath(const DBusPropertiesMap &properties,
+                            const std::string &key,
+                            std::string *value);
+
   static bool GetUint32(const DBusPropertiesMap &properties,
                         const std::string &key,
                         uint32 *value);