Split ModemManager into ModemManagerBase and ModemManagerClassic
This is in preparation for building ModemManager1 to support the MM0.6
interface.
BUG=chromium-os:27014
TEST=unit tests, ran shill across multiple cromo restarts
Change-Id: I718c9508d81e12481be44cdaf5453679e08b905e
Reviewed-on: https://gerrit.chromium.org/gerrit/17249
Commit-Ready: David Rochberg <rochberg@chromium.org>
Reviewed-by: David Rochberg <rochberg@chromium.org>
Tested-by: David Rochberg <rochberg@chromium.org>
diff --git a/modem_manager.h b/modem_manager.h
index 8947798..793a6ef 100644
--- a/modem_manager.h
+++ b/modem_manager.h
@@ -55,6 +55,20 @@
void OnDeviceInfoAvailable(const std::string &link_name);
+ protected:
+ typedef std::map<std::string, std::tr1::shared_ptr<Modem> > Modems;
+
+ const std::string &owner() const { return owner_; }
+ const Modems &modems() const { return modems_; }
+ const std::string &path() const { return path_; }
+ ProxyFactory *proxy_factory() const { return proxy_factory_; }
+
+ // Connect/Disconnect to a modem manager service.
+ // Inheriting classes must call this superclass method.
+ virtual void Connect(const std::string &owner);
+ // Inheriting classes must call this superclass method.
+ virtual void Disconnect();
+
private:
friend class ModemManagerTest;
FRIEND_TEST(ModemInfoTest, RegisterModemManager);
@@ -66,14 +80,6 @@
FRIEND_TEST(ModemManagerTest, Start);
FRIEND_TEST(ModemManagerTest, Stop);
- typedef std::map<std::string, std::tr1::shared_ptr<Modem> > Modems;
-
- // Connects a newly appeared modem manager service.
- void Connect(const std::string &owner);
-
- // Disconnects a vanished modem manager service.
- void Disconnect();
-
// DBus service watcher callbacks.
static void OnAppear(GDBusConnection *connection,
const gchar *name,
@@ -83,6 +89,11 @@
const gchar *name,
gpointer user_data);
+ // Starts the process of bringing up the modem so that shill can
+ // talk to it. Called after modem has been added to the
+ // ModemManager's internal data structures.
+ virtual void InitModem(std::tr1::shared_ptr<Modem> modem) = 0;
+
// Store cached copies of singletons for speed/ease of testing.
ProxyFactory *proxy_factory_;
@@ -91,7 +102,6 @@
guint watcher_id_;
std::string owner_; // DBus service owner.
- scoped_ptr<ModemManagerProxyInterface> proxy_; // DBus service proxy.
Modems modems_; // Maps a modem |path| to a modem instance.
@@ -105,6 +115,34 @@
DISALLOW_COPY_AND_ASSIGN(ModemManager);
};
+class ModemManagerClassic : public ModemManager {
+ public:
+ ModemManagerClassic(const std::string &service,
+ const std::string &path,
+ ControlInterface *control_interface,
+ EventDispatcher *dispatcher,
+ Metrics *metrics,
+ Manager *manager,
+ GLib *glib,
+ mobile_provider_db *provider_db);
+
+ virtual ~ModemManagerClassic();
+
+ protected:
+ virtual void Connect(const std::string &owner);
+ virtual void Disconnect();
+ virtual void InitModem(std::tr1::shared_ptr<Modem> modem);
+
+ private:
+ scoped_ptr<ModemManagerProxyInterface> proxy_; // DBus service proxy
+
+ FRIEND_TEST(ModemManagerTest, Connect);
+ FRIEND_TEST(ModemManagerTest, Disconnect);
+ FRIEND_TEST(ModemManagerTest, OnAppear);
+ FRIEND_TEST(ModemManagerTest, OnVanish);
+
+ DISALLOW_COPY_AND_ASSIGN(ModemManagerClassic);
+};
} // namespace shill
#endif // SHILL_MODEM_MANAGER_