shill: Handle modem state changes reported by modem-manager.

Also, adjust correctly to initial state reported by
modem-manager. This involved some adjustments to the
StartModem path, e.g., to make the MM Enable operation
conditional on whether the current modem state is not
already Enabled. Other streamlining done for the StartModem
path includes:

- eliminating the GetModemStatus call in the GSM
  case. All the needed information (such as IMSI)
  is obtained in later calls.
- making the Register call conditional on the modem
  not already being registered.

I added a couple of unit tests to check responses to
state changes, but many more tests could be created.

BUG=chromium-os:19962
TEST=Testing includes running mm-enable and
mm-disable while the modem is in the disabled, enabled,
registered, and connected states, and making sure that
shill updates its own state appropriately, and that the
UI properly reflects the new state.  Also ran mm-connect
and mm-disconnect to see that the UI (and shill) respond
correctly to connect and disconnect events. Similarly,
started up shill while modem started out in these various
states.

Tested only using MM classic API. Code is in place to make
this work for the MM1 API, but I haven't tried testing while
the new modem manager is running.

Change-Id: I4f276bee62b64e8f1260a39f18c3c2a5de8d2798
Reviewed-on: https://gerrit.chromium.org/gerrit/20517
Commit-Ready: Eric Shienbrood <ers@chromium.org>
Reviewed-by: Eric Shienbrood <ers@chromium.org>
Tested-by: Eric Shienbrood <ers@chromium.org>
diff --git a/dbus_properties.h b/dbus_properties.h
index a88ea76..f69c22b 100644
--- a/dbus_properties.h
+++ b/dbus_properties.h
@@ -17,22 +17,30 @@
 
 class DBusProperties {
  public:
-  static bool GetString(const DBusPropertiesMap &properties,
-                        const std::string &key,
-                        std::string *value);
+  static bool GetBool(const DBusPropertiesMap &properties,
+                      const std::string &key,
+                      bool *value);
+
+  static bool GetInt32(const DBusPropertiesMap &properties,
+                       const std::string &key,
+                       int32 *value);
 
   static bool GetObjectPath(const DBusPropertiesMap &properties,
                             const std::string &key,
                             std::string *value);
 
-  static bool GetUint32(const DBusPropertiesMap &properties,
+  static bool GetString(const DBusPropertiesMap &properties,
                         const std::string &key,
-                        uint32 *value);
+                        std::string *value);
 
   static bool GetUint16(const DBusPropertiesMap &properties,
                         const std::string &key,
                         uint16 *value);
 
+  static bool GetUint32(const DBusPropertiesMap &properties,
+                        const std::string &key,
+                        uint32 *value);
+
  private:
   DISALLOW_COPY_AND_ASSIGN(DBusProperties);
 };