shill: cellular: Update DBus bindings changed in ModemManager 0.8

ModemManager 0.8 has some incompatible DBus API changes. Previous commit
b0febb29c81933bada9abf3fb04675ccfe76a38b temporarily removes those
changed DBus bindings from shill. This CL reintroduces the updated DBus
bindings in shill. It also cleans up some style issues in the code.

The API changes in the upcoming ModemManager 0.8 release:
https://mail.gnome.org/archives/networkmanager-list/2013-May/msg00223.html

BUG=chromium:246348
TEST=Tested the following:
1. Build shill and run unit tests.
2. Run network_3GSmokeTest on Y3400 and E362 modem.

Change-Id: I1472e0b00ded884046327f432c733c6bcfd384fb
Reviewed-on: https://gerrit.chromium.org/gerrit/58781
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
diff --git a/cellular_capability_universal.cc b/cellular_capability_universal.cc
index a67ce85..aa1dc77 100644
--- a/cellular_capability_universal.cc
+++ b/cellular_capability_universal.cc
@@ -1491,6 +1491,14 @@
   if (DBusProperties::GetObjectPath(properties,
                                     MM_MODEM_PROPERTY_SIM, &string_value))
     OnSimPathChanged(string_value);
+
+  DBusPropertiesMap::const_iterator it =
+      properties.find(MM_MODEM_PROPERTY_SUPPORTEDCAPABILITIES);
+  if (it != properties.end()) {
+    const vector<uint32> &supported_capabilities = it->second;
+    OnSupportedCapabilitesChanged(supported_capabilities);
+  }
+
   uint32 uint_value;
   if (DBusProperties::GetUint32(properties,
                                 MM_MODEM_PROPERTY_CURRENTCAPABILITIES,
@@ -1517,15 +1525,14 @@
   // not needed: MM_MODEM_PROPERTY_EQUIPMENTIDENTIFIER
 
   // Unlock required and SimLock
-  uint32_t unlock_required;  // This is really of type MMModemLock
+  uint32 unlock_required;  // This is really of type MMModemLock
   if (DBusProperties::GetUint32(properties,
                                 MM_MODEM_PROPERTY_UNLOCKREQUIRED,
                                 &unlock_required))
     OnLockTypeChanged(static_cast<MMModemLock>(unlock_required));
 
   // Unlock retries
-  DBusPropertiesMap::const_iterator it =
-      properties.find(MM_MODEM_PROPERTY_UNLOCKRETRIES);
+  it = properties.find(MM_MODEM_PROPERTY_UNLOCKRETRIES);
   if (it != properties.end()) {
     LockRetryData lock_retries = it->second.operator LockRetryData();
     OnLockRetriesChanged(lock_retries);
@@ -1549,6 +1556,25 @@
       mdn = numbers[0];
     OnMdnChanged(mdn);
   }
+
+  it = properties.find(MM_MODEM_PROPERTY_SUPPORTEDMODES);
+  if (it != properties.end()) {
+    const vector<DBus::Struct<uint32, uint32>> &mm_supported_modes = it->second;
+    vector<ModemModes> supported_modes;
+    for (const auto &modes : mm_supported_modes) {
+      supported_modes.push_back(
+          ModemModes(modes._1, static_cast<MMModemMode>(modes._2)));
+    }
+    OnSupportedModesChanged(supported_modes);
+  }
+
+  it = properties.find(MM_MODEM_PROPERTY_CURRENTMODES);
+  if (it != properties.end()) {
+    const DBus::Struct<uint32, uint32> &current_modes = it->second;
+    OnCurrentModesChanged(ModemModes(
+        current_modes._1, static_cast<MMModemMode>(current_modes._2)));
+  }
+
   // au: MM_MODEM_PROPERTY_SUPPORTEDBANDS,
   // au: MM_MODEM_PROPERTY_BANDS
 }
@@ -1632,6 +1658,11 @@
   }
 }
 
+void CellularCapabilityUniversal::OnSupportedCapabilitesChanged(
+    const vector<uint32> &supported_capabilities) {
+  supported_capabilities_ = supported_capabilities;
+}
+
 void CellularCapabilityUniversal::OnModemCurrentCapabilitiesChanged(
     uint32 current_capabilities) {
   current_capabilities_ = current_capabilities;
@@ -1708,6 +1739,16 @@
   }
 }
 
+void CellularCapabilityUniversal::OnSupportedModesChanged(
+    const vector<ModemModes> &supported_modes) {
+  supported_modes_ = supported_modes;
+}
+
+void CellularCapabilityUniversal::OnCurrentModesChanged(
+    const ModemModes &current_modes) {
+  current_modes_ = current_modes;
+}
+
 void CellularCapabilityUniversal::OnLockRetriesChanged(
     const LockRetryData &lock_retries) {
   SLOG(Cellular, 2) << __func__;
diff --git a/cellular_capability_universal.h b/cellular_capability_universal.h
index 2ce9c68..7724f4f 100644
--- a/cellular_capability_universal.h
+++ b/cellular_capability_universal.h
@@ -37,7 +37,7 @@
  public:
   typedef std::vector<DBusPropertiesMap> ScanResults;
   typedef DBusPropertiesMap ScanResult;
-  typedef std::map< uint32_t, uint32_t > LockRetryData;
+  typedef std::map<uint32_t, uint32_t> LockRetryData;
 
   // Constants used in connect method call.  Make available to test matchers.
   // TODO(jglasgow): Generate from modem manager into
@@ -137,6 +137,19 @@
   void set_esn(const std::string &esn) { esn_ = esn; }
 
  private:
+  struct ModemModes {
+    ModemModes()
+        : allowed_modes(MM_MODEM_MODE_NONE),
+          preferred_mode(MM_MODEM_MODE_NONE) {}
+
+    ModemModes(uint32 allowed, MMModemMode preferred)
+        : allowed_modes(allowed),
+          preferred_mode(preferred) {}
+
+    uint32 allowed_modes;        // Bits based on MMModemMode.
+    MMModemMode preferred_mode;  // A single MMModemMode bit.
+  };
+
   // Constants used in scan results.  Make available to unit tests.
   // TODO(jglasgow): Generate from modem manager into ModemManager-names.h.
   // See http://crosbug.com/30551.
@@ -317,6 +330,9 @@
       const std::vector<std::string> &invalidated_properties);
 
   void OnSignalQualityChanged(uint32 quality);
+
+  void OnSupportedCapabilitesChanged(
+      const std::vector<uint32> &supported_capabilities);
   void OnModemCurrentCapabilitiesChanged(uint32 current_capabilities);
   void OnMdnChanged(const std::string &mdn);
   void OnModemManufacturerChanged(const std::string &manufacturer);
@@ -324,6 +340,8 @@
   void OnModemRevisionChanged(const std::string &revision);
   void OnModemStateChanged(Cellular::ModemState state);
   void OnAccessTechnologiesChanged(uint32 access_technologies);
+  void OnSupportedModesChanged(const std::vector<ModemModes> &supported_modes);
+  void OnCurrentModesChanged(const ModemModes &current_modes);
   void OnLockRetriesChanged(const LockRetryData &lock_retries);
   void OnLockTypeChanged(MMModemLock unlock_required);
   void OnSimLockStatusChanged();
@@ -405,8 +423,11 @@
   MMModem3gppRegistrationState registration_state_;
 
   // Bits based on MMModemCapabilities
-  uint32 current_capabilities_;  // technologies supportsed without a reload
+  std::vector<uint32> supported_capabilities_;  // Technologies supported
+  uint32 current_capabilities_;  // Technologies supported without a reload
   uint32 access_technologies_;   // Bits based on MMModemAccessTechnology
+  std::vector<ModemModes> supported_modes_;
+  ModemModes current_modes_;
 
   Cellular::Operator serving_operator_;
   std::string spn_;
diff --git a/mm1_modem_proxy.cc b/mm1_modem_proxy.cc
index 447a49f..2e29a45 100644
--- a/mm1_modem_proxy.cc
+++ b/mm1_modem_proxy.cc
@@ -20,7 +20,7 @@
 ModemProxy::~ModemProxy() {}
 
 void ModemProxy::set_state_changed_callback(
-      const ModemStateChangedSignalCallback &callback) {
+    const ModemStateChangedSignalCallback &callback) {
   proxy_.set_state_changed_callback(callback);
 }
 
@@ -114,6 +114,52 @@
   }
 }
 
+void ModemProxy::SetCurrentCapabilities(const uint32_t &capabilities,
+                                        Error *error,
+                                        const ResultCallback &callback,
+                                        int timeout) {
+  scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
+  try {
+    SLOG(DBus, 2) << __func__;
+    proxy_.SetCurrentCapabilities(capabilities, cb.get(), timeout);
+    cb.release();
+  } catch (const DBus::Error &e) {
+    if (error)
+      CellularError::FromDBusError(e, error);
+  }
+}
+
+void ModemProxy::SetCurrentModes(
+    const ::DBus::Struct<uint32_t, uint32_t> &modes,
+    Error *error,
+    const ResultCallback &callback,
+    int timeout) {
+  scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
+  try {
+    SLOG(DBus, 2) << __func__;
+    proxy_.SetCurrentModes(modes, cb.get(), timeout);
+    cb.release();
+  } catch (const DBus::Error &e) {
+    if (error)
+      CellularError::FromDBusError(e, error);
+  }
+}
+
+void ModemProxy::SetCurrentBands(const std::vector<uint32_t> &bands,
+                                 Error *error,
+                                 const ResultCallback &callback,
+                                 int timeout) {
+  scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
+  try {
+    SLOG(DBus, 2) << __func__;
+    proxy_.SetCurrentBands(bands, cb.get(), timeout);
+    cb.release();
+  } catch (const DBus::Error &e) {
+    if (error)
+      CellularError::FromDBusError(e, error);
+  }
+}
+
 void ModemProxy::Command(const std::string &cmd,
                          const uint32_t &user_timeout,
                          Error *error,
@@ -155,6 +201,17 @@
     return ::DBus::Path();  // Make the compiler happy.
   }
 }
+
+const std::vector<uint32_t> ModemProxy::SupportedCapabilities() {
+  SLOG(DBus, 2) << __func__;
+  try {
+    return proxy_.SupportedCapabilities();
+  } catch (const DBus::Error &e) {
+    LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
+    return std::vector<uint32_t>();  // Make the compiler happy.
+  }
+}
+
 uint32_t ModemProxy::CurrentCapabilities() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -164,6 +221,7 @@
     return 0;  // Make the compiler happy.
   }
 }
+
 uint32_t ModemProxy::MaxBearers() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -173,6 +231,7 @@
     return 0;  // Make the compiler happy.
   }
 }
+
 uint32_t ModemProxy::MaxActiveBearers() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -182,6 +241,7 @@
     return 0;  // Make the compiler happy.
   }
 }
+
 const std::string ModemProxy::Manufacturer() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -191,6 +251,7 @@
     return std::string();  // Make the compiler happy.
   }
 }
+
 const std::string ModemProxy::Model() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -200,6 +261,7 @@
     return std::string();  // Make the compiler happy.
   }
 }
+
 const std::string ModemProxy::Revision() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -209,6 +271,7 @@
     return std::string();  // Make the compiler happy.
   }
 }
+
 const std::string ModemProxy::DeviceIdentifier() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -218,6 +281,7 @@
     return std::string();  // Make the compiler happy.
   }
 }
+
 const std::string ModemProxy::Device() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -227,6 +291,7 @@
     return std::string();  // Make the compiler happy.
   }
 }
+
 const std::vector<std::string> ModemProxy::Drivers() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -236,6 +301,7 @@
     return std::vector<std::string>();  // Make the compiler happy.
   }
 }
+
 const std::string ModemProxy::Plugin() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -245,6 +311,7 @@
     return std::string();  // Make the compiler happy.
   }
 }
+
 const std::string ModemProxy::EquipmentIdentifier() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -254,6 +321,7 @@
     return std::string();  // Make the compiler happy.
   }
 }
+
 uint32_t ModemProxy::UnlockRequired() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -263,6 +331,7 @@
     return 0;  // Make the compiler happy.
   }
 }
+
 const std::map<uint32_t, uint32_t> ModemProxy::UnlockRetries() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -272,6 +341,7 @@
     return std::map<uint32_t, uint32_t>();  // Make the compiler happy.
   }
 }
+
 uint32_t ModemProxy::State() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -281,6 +351,7 @@
     return 0;  // Make the compiler happy.
   }
 }
+
 uint32_t ModemProxy::AccessTechnologies() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -290,6 +361,7 @@
     return 0;  // Make the compiler happy.
   }
 }
+
 const ::DBus::Struct<uint32_t, bool> ModemProxy::SignalQuality() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -299,6 +371,7 @@
     return ::DBus::Struct<uint32_t, bool>();  // Make the compiler happy.
   }
 }
+
 const std::vector<string> ModemProxy::OwnNumbers() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -308,6 +381,29 @@
     return std::vector<string>();  // Make the compiler happy.
   }
 }
+
+const std::vector<::DBus::Struct<uint32_t, uint32_t>>
+ModemProxy::SupportedModes() {
+  SLOG(DBus, 2) << __func__;
+  try {
+    return proxy_.SupportedModes();
+  } catch (const DBus::Error &e) {
+    LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
+    // Make the compiler happy.
+    return std::vector<::DBus::Struct<uint32_t, uint32_t>>();
+  }
+}
+
+const ::DBus::Struct<uint32_t, uint32_t> ModemProxy::CurrentModes() {
+  SLOG(DBus, 2) << __func__;
+  try {
+    return proxy_.CurrentModes();
+  } catch (const DBus::Error &e) {
+    LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
+    return ::DBus::Struct<uint32_t, uint32_t>();  // Make the compiler happy.
+  }
+}
+
 const std::vector<uint32_t> ModemProxy::SupportedBands() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -317,6 +413,27 @@
     return std::vector<uint32_t>();  // Make the compiler happy.
   }
 }
+
+const std::vector<uint32_t> ModemProxy::CurrentBands() {
+  SLOG(DBus, 2) << __func__;
+  try {
+    return proxy_.CurrentBands();
+  } catch (const DBus::Error &e) {
+    LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
+    return std::vector<uint32_t>();  // Make the compiler happy.
+  }
+}
+
+uint32_t ModemProxy::SupportedIpFamilies() {
+  SLOG(DBus, 2) << __func__;
+  try {
+    return proxy_.SupportedIpFamilies();
+  } catch (const DBus::Error &e) {
+    LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
+    return 0;  // Make the compiler happy.
+  }
+}
+
 uint32_t ModemProxy::PowerState() {
   SLOG(DBus, 2) << __func__;
   try {
@@ -350,7 +467,7 @@
 
 // Method callbacks inherited from
 // org::freedesktop::ModemManager1::ModemProxy
-void ModemProxy::Proxy::EnableCallback(const ::DBus::Error& dberror,
+void ModemProxy::Proxy::EnableCallback(const ::DBus::Error &dberror,
                                        void *data) {
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
@@ -361,7 +478,7 @@
 
 void ModemProxy::Proxy::ListBearersCallback(
     const std::vector< ::DBus::Path> &bearers,
-    const ::DBus::Error& dberror,
+    const ::DBus::Error &dberror,
     void *data) {
   SLOG(DBus, 2) << __func__;
   scoped_ptr<DBusPathsCallback> callback(
@@ -372,7 +489,7 @@
 }
 
 void ModemProxy::Proxy::CreateBearerCallback(const ::DBus::Path &path,
-                                             const ::DBus::Error& dberror,
+                                             const ::DBus::Error &dberror,
                                              void *data) {
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
@@ -381,7 +498,7 @@
   callback->Run(error);
 }
 
-void ModemProxy::Proxy::DeleteBearerCallback(const ::DBus::Error& dberror,
+void ModemProxy::Proxy::DeleteBearerCallback(const ::DBus::Error &dberror,
                                              void *data) {
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
@@ -390,7 +507,7 @@
   callback->Run(error);
 }
 
-void ModemProxy::Proxy::ResetCallback(const ::DBus::Error& dberror,
+void ModemProxy::Proxy::ResetCallback(const ::DBus::Error &dberror,
                                       void *data) {
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
@@ -399,7 +516,7 @@
   callback->Run(error);
 }
 
-void ModemProxy::Proxy::FactoryResetCallback(const ::DBus::Error& dberror,
+void ModemProxy::Proxy::FactoryResetCallback(const ::DBus::Error &dberror,
                                              void *data) {
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
@@ -408,8 +525,36 @@
   callback->Run(error);
 }
 
+void ModemProxy::Proxy::SetCurrentCapabilitesCallback(
+    const ::DBus::Error &dberror,
+    void *data) {
+  SLOG(DBus, 2) << __func__;
+  scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+  Error error;
+  CellularError::FromDBusError(dberror, &error);
+  callback->Run(error);
+}
+
+void ModemProxy::Proxy::SetCurrentModesCallback(const ::DBus::Error &dberror,
+                                                void *data) {
+  SLOG(DBus, 2) << __func__;
+  scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+  Error error;
+  CellularError::FromDBusError(dberror, &error);
+  callback->Run(error);
+}
+
+void ModemProxy::Proxy::SetCurrentBandsCallback(const ::DBus::Error &dberror,
+                                                void *data) {
+  SLOG(DBus, 2) << __func__;
+  scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
+  Error error;
+  CellularError::FromDBusError(dberror, &error);
+  callback->Run(error);
+}
+
 void ModemProxy::Proxy::CommandCallback(const std::string &response,
-                                        const ::DBus::Error& dberror,
+                                        const ::DBus::Error &dberror,
                                         void *data) {
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
diff --git a/mm1_modem_proxy.h b/mm1_modem_proxy.h
index c7ad25f..c646326 100644
--- a/mm1_modem_proxy.h
+++ b/mm1_modem_proxy.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SHILL_MM1_MODEM_PROXY_
-#define SHILL_MM1_MODEM_PROXY_
+#ifndef SHILL_MM1_MODEM_PROXY_H_
+#define SHILL_MM1_MODEM_PROXY_H_
 
 #include <string>
 
@@ -46,6 +46,18 @@
                             Error *error,
                             const ResultCallback &callback,
                             int timeout);
+  virtual void SetCurrentCapabilities(const uint32_t &capabilities,
+                                      Error *error,
+                                      const ResultCallback &callback,
+                                      int timeout);
+  virtual void SetCurrentModes(const ::DBus::Struct<uint32_t, uint32_t> &modes,
+                               Error *error,
+                               const ResultCallback &callback,
+                               int timeout);
+  virtual void SetCurrentBands(const std::vector<uint32_t> &bands,
+                               Error *error,
+                               const ResultCallback &callback,
+                               int timeout);
   virtual void Command(const std::string &cmd,
                        const uint32_t &user_timeout,
                        Error *error,
@@ -61,6 +73,7 @@
 
   // Inherited properties from ModemProxyInterface.
   virtual const ::DBus::Path Sim();
+  virtual const std::vector<uint32_t> SupportedCapabilities();
   virtual uint32_t CurrentCapabilities();
   virtual uint32_t MaxBearers();
   virtual uint32_t MaxActiveBearers();
@@ -73,12 +86,17 @@
   virtual const std::string Plugin();
   virtual const std::string EquipmentIdentifier();
   virtual uint32_t UnlockRequired();
-  virtual const std::map< uint32_t, uint32_t > UnlockRetries();
+  virtual const std::map<uint32_t, uint32_t> UnlockRetries();
   virtual uint32_t State();
   virtual uint32_t AccessTechnologies();
-  virtual const ::DBus::Struct< uint32_t, bool > SignalQuality();
-  virtual const std::vector< std::string > OwnNumbers();
-  virtual const std::vector< uint32_t > SupportedBands();
+  virtual const ::DBus::Struct<uint32_t, bool> SignalQuality();
+  virtual const std::vector<std::string> OwnNumbers();
+  virtual const std::vector<::DBus::Struct<uint32_t, uint32_t>>
+      SupportedModes();
+  virtual const ::DBus::Struct<uint32_t, uint32_t> CurrentModes();
+  virtual const std::vector<uint32_t> SupportedBands();
+  virtual const std::vector<uint32_t> CurrentBands();
+  virtual uint32_t SupportedIpFamilies();
   virtual uint32_t PowerState();
 
  private:
@@ -104,13 +122,19 @@
     // org::freedesktop::ModemManager1::ModemProxy
     virtual void EnableCallback(const ::DBus::Error &dberror, void *data);
     virtual void ListBearersCallback(
-        const std::vector< ::DBus::Path > &bearers,
+        const std::vector<::DBus::Path> &bearers,
         const ::DBus::Error &dberror, void *data);
     virtual void CreateBearerCallback(const ::DBus::Path &bearer,
                                       const ::DBus::Error &dberror, void *data);
     virtual void DeleteBearerCallback(const ::DBus::Error &dberror, void *data);
     virtual void ResetCallback(const ::DBus::Error &dberror, void *data);
     virtual void FactoryResetCallback(const ::DBus::Error &dberror, void *data);
+    virtual void SetCurrentCapabilitesCallback(const ::DBus::Error &dberror,
+                                               void *data);
+    virtual void SetCurrentModesCallback(const ::DBus::Error &dberror,
+                                         void *data);
+    virtual void SetCurrentBandsCallback(const ::DBus::Error &dberror,
+                                         void *data);
     virtual void CommandCallback(const std::string &response,
                                  const ::DBus::Error &dberror,
                                  void *data);
@@ -130,4 +154,4 @@
 }  // namespace mm1
 }  // namespace shill
 
-#endif  // SHILL_MM1_MODEM_PROXY_
+#endif  // SHILL_MM1_MODEM_PROXY_H_
diff --git a/mm1_modem_proxy_interface.h b/mm1_modem_proxy_interface.h
index d370b22..0b40d04 100644
--- a/mm1_modem_proxy_interface.h
+++ b/mm1_modem_proxy_interface.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SHILL_MM1_MODEM_PROXY_INTERFACE_
-#define SHILL_MM1_MODEM_PROXY_INTERFACE_
+#ifndef SHILL_MM1_MODEM_PROXY_INTERFACE_H_
+#define SHILL_MM1_MODEM_PROXY_INTERFACE_H_
 
 #include <string>
 
@@ -49,6 +49,18 @@
                             Error *error,
                             const ResultCallback &callback,
                             int timeout) = 0;
+  virtual void SetCurrentCapabilities(const uint32_t &capabilities,
+                                      Error *error,
+                                      const ResultCallback &callback,
+                                      int timeout) = 0;
+  virtual void SetCurrentModes(const ::DBus::Struct<uint32_t, uint32_t> &modes,
+                               Error *error,
+                               const ResultCallback &callback,
+                               int timeout) = 0;
+  virtual void SetCurrentBands(const std::vector<uint32_t> &bands,
+                               Error *error,
+                               const ResultCallback &callback,
+                               int timeout) = 0;
   virtual void Command(const std::string &cmd,
                        const uint32_t &user_timeout,
                        Error *error,
@@ -65,6 +77,7 @@
 
   // Properties.
   virtual const ::DBus::Path Sim() = 0;
+  virtual const std::vector<uint32_t> SupportedCapabilities() = 0;
   virtual uint32_t CurrentCapabilities() = 0;
   virtual uint32_t MaxBearers() = 0;
   virtual uint32_t MaxActiveBearers() = 0;
@@ -77,16 +90,21 @@
   virtual const std::string Plugin() = 0;
   virtual const std::string EquipmentIdentifier() = 0;
   virtual uint32_t UnlockRequired() = 0;
-  virtual const std::map< uint32_t, uint32_t > UnlockRetries() = 0;
+  virtual const std::map<uint32_t, uint32_t> UnlockRetries() = 0;
   virtual uint32_t State() = 0;
   virtual uint32_t AccessTechnologies() = 0;
-  virtual const ::DBus::Struct< uint32_t, bool > SignalQuality() = 0;
-  virtual const std::vector< std::string > OwnNumbers() = 0;
-  virtual const std::vector< uint32_t > SupportedBands() = 0;
+  virtual const ::DBus::Struct<uint32_t, bool> SignalQuality() = 0;
+  virtual const std::vector<std::string> OwnNumbers() = 0;
+  virtual const std::vector<::DBus::Struct<uint32_t, uint32_t>>
+      SupportedModes() = 0;
+  virtual const ::DBus::Struct<uint32_t, uint32_t> CurrentModes() = 0;
+  virtual const std::vector<uint32_t> SupportedBands() = 0;
+  virtual const std::vector<uint32_t> CurrentBands() = 0;
+  virtual uint32_t SupportedIpFamilies() = 0;
   virtual uint32_t PowerState() = 0;
 };
 
 }  // namespace mm1
 }  // namespace shill
 
-#endif  // SHILL_MM1_MODEM_PROXY_INTERFACE_
+#endif  // SHILL_MM1_MODEM_PROXY_INTERFACE_H_
diff --git a/mock_mm1_modem_proxy.h b/mock_mm1_modem_proxy.h
index d6556a9..f7a231d 100644
--- a/mock_mm1_modem_proxy.h
+++ b/mock_mm1_modem_proxy.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SHILL_MM1_MOCK_MODEM_PROXY_
-#define SHILL_MM1_MOCK_MODEM_PROXY_
+#ifndef SHILL_MM1_MOCK_MODEM_PROXY_H_
+#define SHILL_MM1_MOCK_MODEM_PROXY_H_
 
 #include <string>
 
@@ -43,6 +43,19 @@
                                   Error *error,
                                   const ResultCallback &callback,
                                   int timeout));
+  MOCK_METHOD4(SetCurrentCapabilities, void(const uint32_t &capabilities,
+                                            Error *error,
+                                            const ResultCallback &callback,
+                                            int timeout));
+  MOCK_METHOD4(SetCurrentModes,
+               void(const ::DBus::Struct<uint32_t, uint32_t> &modes,
+                    Error *error,
+                    const ResultCallback &callback,
+                    int timeout));
+  MOCK_METHOD4(SetCurrentBands, void(const std::vector<uint32_t> &bands,
+                                     Error *error,
+                                     const ResultCallback &callback,
+                                     int timeout));
   MOCK_METHOD5(Command, void(const std::string &cmd,
                              const uint32_t &user_timeout,
                              Error *error,
@@ -57,6 +70,7 @@
 
   // Inherited properties from ModemProxyInterface.
   MOCK_METHOD0(Sim, const ::DBus::Path());
+  MOCK_METHOD0(SupportedCapabilities, const std::vector<uint32_t>());
   MOCK_METHOD0(CurrentCapabilities, uint32_t());
   MOCK_METHOD0(MaxBearers, uint32_t());
   MOCK_METHOD0(MaxActiveBearers, uint32_t());
@@ -69,14 +83,20 @@
   MOCK_METHOD0(Plugin, const std::string());
   MOCK_METHOD0(EquipmentIdentifier, const std::string());
   MOCK_METHOD0(UnlockRequired, uint32_t());
-  typedef std::map< uint32_t, uint32_t > RetryData;
+  typedef std::map<uint32_t, uint32_t> RetryData;
   MOCK_METHOD0(UnlockRetries, const RetryData());
   MOCK_METHOD0(State, uint32_t());
   MOCK_METHOD0(AccessTechnologies, uint32_t());
-  typedef ::DBus::Struct< uint32_t, bool > SignalQualityData;
+  typedef ::DBus::Struct<uint32_t, bool> SignalQualityData;
   MOCK_METHOD0(SignalQuality, const SignalQualityData());
-  MOCK_METHOD0(OwnNumbers, const std::vector< std::string >());
-  MOCK_METHOD0(SupportedBands, const std::vector< uint32_t >());
+  MOCK_METHOD0(OwnNumbers, const std::vector<std::string>());
+  typedef std::vector<::DBus::Struct<uint32_t, uint32_t>> SupportedModesData;
+  MOCK_METHOD0(SupportedModes, const SupportedModesData());
+  typedef ::DBus::Struct<uint32_t, uint32_t> CurrentModesData;
+  MOCK_METHOD0(CurrentModes, const CurrentModesData());
+  MOCK_METHOD0(SupportedBands, const std::vector<uint32_t>());
+  MOCK_METHOD0(CurrentBands, const std::vector<uint32_t>());
+  MOCK_METHOD0(SupportedIpFamilies, uint32_t());
   MOCK_METHOD0(PowerState, uint32_t());
 
  private:
@@ -86,4 +106,4 @@
 }  // namespace mm1
 }  // namespace shill
 
-#endif  // SHILL_MM1_MOCK_MODEM_PROXY_
+#endif  // SHILL_MM1_MOCK_MODEM_PROXY_H_