blob: f8596e980ea4e2b7f7ce17bc756cce407329c65b [file] [log] [blame]
Darin Petkov41c0e0a2012-01-09 16:38:53 +01001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Darin Petkov887f2982011-07-14 16:10:17 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Ben Chan62028b22012-11-05 11:20:02 -08005#ifndef SHILL_MODEM_INFO_H_
6#define SHILL_MODEM_INFO_H_
Darin Petkov887f2982011-07-14 16:10:17 -07007
8#include <string>
9
Ben Chan62028b22012-11-05 11:20:02 -080010#include <base/memory/scoped_ptr.h>
Darin Petkov887f2982011-07-14 16:10:17 -070011#include <base/memory/scoped_vector.h>
12#include <gtest/gtest_prod.h> // for FRIEND_TEST
13
Darin Petkov137884a2011-10-26 18:52:47 +020014struct mobile_provider_db;
15
Darin Petkov887f2982011-07-14 16:10:17 -070016namespace shill {
17
Ben Chan62028b22012-11-05 11:20:02 -080018class CellularOperatorInfo;
Darin Petkov887f2982011-07-14 16:10:17 -070019class ControlInterface;
20class EventDispatcher;
21class GLib;
22class Manager;
Thieu Le3426c8f2012-01-11 17:35:11 -080023class Metrics;
Darin Petkov887f2982011-07-14 16:10:17 -070024class ModemManager;
25
26// Manages modem managers.
27class ModemInfo {
28 public:
29 ModemInfo(ControlInterface *control_interface,
30 EventDispatcher *dispatcher,
Thieu Le3426c8f2012-01-11 17:35:11 -080031 Metrics *metrics,
Darin Petkov887f2982011-07-14 16:10:17 -070032 Manager *manager,
33 GLib *glib);
Paul Stewart8c116a92012-05-02 18:30:03 -070034 virtual ~ModemInfo();
Darin Petkov887f2982011-07-14 16:10:17 -070035
Paul Stewart8c116a92012-05-02 18:30:03 -070036 virtual void Start();
37 virtual void Stop();
Darin Petkov887f2982011-07-14 16:10:17 -070038
Paul Stewart8c116a92012-05-02 18:30:03 -070039 virtual void OnDeviceInfoAvailable(const std::string &link_name);
Darin Petkov41c0e0a2012-01-09 16:38:53 +010040
Darin Petkov887f2982011-07-14 16:10:17 -070041 private:
42 friend class ModemInfoTest;
43 FRIEND_TEST(ModemInfoTest, RegisterModemManager);
44 FRIEND_TEST(ModemInfoTest, StartStop);
45
Darin Petkov41c0e0a2012-01-09 16:38:53 +010046 typedef ScopedVector<ModemManager> ModemManagers;
47
David Rochberg7cb06f62012-03-05 11:23:44 -050048 // Register and start new ModemManagers
49 template <class mm> void RegisterModemManager(const std::string &service,
50 const std::string &path);
Darin Petkov41c0e0a2012-01-09 16:38:53 +010051 ModemManagers modem_managers_;
Darin Petkov887f2982011-07-14 16:10:17 -070052
53 ControlInterface *control_interface_;
54 EventDispatcher *dispatcher_;
Thieu Le3426c8f2012-01-11 17:35:11 -080055 Metrics *metrics_;
Darin Petkov887f2982011-07-14 16:10:17 -070056 Manager *manager_;
57 GLib *glib_;
58
Ben Chan62028b22012-11-05 11:20:02 -080059 scoped_ptr<CellularOperatorInfo> cellular_operator_info_;
Darin Petkov137884a2011-10-26 18:52:47 +020060 std::string provider_db_path_; // For testing.
61 mobile_provider_db *provider_db_; // Database instance owned by |this|.
62
Darin Petkov887f2982011-07-14 16:10:17 -070063 DISALLOW_COPY_AND_ASSIGN(ModemInfo);
64};
65
66} // namespace shill
67
Ben Chan62028b22012-11-05 11:20:02 -080068#endif // SHILL_MODEM_INFO_H_