Darin Petkov | 41c0e0a | 2012-01-09 16:38:53 +0100 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Darin Petkov | 887f298 | 2011-07-14 16:10:17 -0700 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Ben Chan | 62028b2 | 2012-11-05 11:20:02 -0800 | [diff] [blame] | 5 | #ifndef SHILL_MODEM_INFO_H_ |
| 6 | #define SHILL_MODEM_INFO_H_ |
Darin Petkov | 887f298 | 2011-07-14 16:10:17 -0700 | [diff] [blame] | 7 | |
| 8 | #include <string> |
| 9 | |
Ben Chan | 62028b2 | 2012-11-05 11:20:02 -0800 | [diff] [blame] | 10 | #include <base/memory/scoped_ptr.h> |
Darin Petkov | 887f298 | 2011-07-14 16:10:17 -0700 | [diff] [blame] | 11 | #include <base/memory/scoped_vector.h> |
| 12 | #include <gtest/gtest_prod.h> // for FRIEND_TEST |
| 13 | |
Darin Petkov | 137884a | 2011-10-26 18:52:47 +0200 | [diff] [blame] | 14 | struct mobile_provider_db; |
| 15 | |
Darin Petkov | 887f298 | 2011-07-14 16:10:17 -0700 | [diff] [blame] | 16 | namespace shill { |
| 17 | |
Ben Chan | 62028b2 | 2012-11-05 11:20:02 -0800 | [diff] [blame] | 18 | class CellularOperatorInfo; |
Darin Petkov | 887f298 | 2011-07-14 16:10:17 -0700 | [diff] [blame] | 19 | class ControlInterface; |
| 20 | class EventDispatcher; |
| 21 | class GLib; |
| 22 | class Manager; |
Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 23 | class Metrics; |
Darin Petkov | 887f298 | 2011-07-14 16:10:17 -0700 | [diff] [blame] | 24 | class ModemManager; |
| 25 | |
| 26 | // Manages modem managers. |
| 27 | class ModemInfo { |
| 28 | public: |
| 29 | ModemInfo(ControlInterface *control_interface, |
| 30 | EventDispatcher *dispatcher, |
Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 31 | Metrics *metrics, |
Darin Petkov | 887f298 | 2011-07-14 16:10:17 -0700 | [diff] [blame] | 32 | Manager *manager, |
| 33 | GLib *glib); |
Paul Stewart | 8c116a9 | 2012-05-02 18:30:03 -0700 | [diff] [blame] | 34 | virtual ~ModemInfo(); |
Darin Petkov | 887f298 | 2011-07-14 16:10:17 -0700 | [diff] [blame] | 35 | |
Paul Stewart | 8c116a9 | 2012-05-02 18:30:03 -0700 | [diff] [blame] | 36 | virtual void Start(); |
| 37 | virtual void Stop(); |
Darin Petkov | 887f298 | 2011-07-14 16:10:17 -0700 | [diff] [blame] | 38 | |
Paul Stewart | 8c116a9 | 2012-05-02 18:30:03 -0700 | [diff] [blame] | 39 | virtual void OnDeviceInfoAvailable(const std::string &link_name); |
Darin Petkov | 41c0e0a | 2012-01-09 16:38:53 +0100 | [diff] [blame] | 40 | |
Darin Petkov | 887f298 | 2011-07-14 16:10:17 -0700 | [diff] [blame] | 41 | private: |
| 42 | friend class ModemInfoTest; |
| 43 | FRIEND_TEST(ModemInfoTest, RegisterModemManager); |
| 44 | FRIEND_TEST(ModemInfoTest, StartStop); |
| 45 | |
Darin Petkov | 41c0e0a | 2012-01-09 16:38:53 +0100 | [diff] [blame] | 46 | typedef ScopedVector<ModemManager> ModemManagers; |
| 47 | |
David Rochberg | 7cb06f6 | 2012-03-05 11:23:44 -0500 | [diff] [blame] | 48 | // Register and start new ModemManagers |
| 49 | template <class mm> void RegisterModemManager(const std::string &service, |
| 50 | const std::string &path); |
Darin Petkov | 41c0e0a | 2012-01-09 16:38:53 +0100 | [diff] [blame] | 51 | ModemManagers modem_managers_; |
Darin Petkov | 887f298 | 2011-07-14 16:10:17 -0700 | [diff] [blame] | 52 | |
| 53 | ControlInterface *control_interface_; |
| 54 | EventDispatcher *dispatcher_; |
Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 55 | Metrics *metrics_; |
Darin Petkov | 887f298 | 2011-07-14 16:10:17 -0700 | [diff] [blame] | 56 | Manager *manager_; |
| 57 | GLib *glib_; |
| 58 | |
Ben Chan | 62028b2 | 2012-11-05 11:20:02 -0800 | [diff] [blame] | 59 | scoped_ptr<CellularOperatorInfo> cellular_operator_info_; |
Darin Petkov | 137884a | 2011-10-26 18:52:47 +0200 | [diff] [blame] | 60 | std::string provider_db_path_; // For testing. |
| 61 | mobile_provider_db *provider_db_; // Database instance owned by |this|. |
| 62 | |
Darin Petkov | 887f298 | 2011-07-14 16:10:17 -0700 | [diff] [blame] | 63 | DISALLOW_COPY_AND_ASSIGN(ModemInfo); |
| 64 | }; |
| 65 | |
| 66 | } // namespace shill |
| 67 | |
Ben Chan | 62028b2 | 2012-11-05 11:20:02 -0800 | [diff] [blame] | 68 | #endif // SHILL_MODEM_INFO_H_ |