blob: 1d98dead6ca558104921d7e79b2f75dfabe40466 [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
5#ifndef SHILL_MODEM_INFO_
6#define SHILL_MODEM_INFO_
7
8#include <string>
9
10#include <base/memory/scoped_vector.h>
11#include <gtest/gtest_prod.h> // for FRIEND_TEST
12
Darin Petkov137884a2011-10-26 18:52:47 +020013struct mobile_provider_db;
14
Darin Petkov887f2982011-07-14 16:10:17 -070015namespace shill {
16
17class ControlInterface;
18class EventDispatcher;
19class GLib;
20class Manager;
Thieu Le3426c8f2012-01-11 17:35:11 -080021class Metrics;
Darin Petkov887f2982011-07-14 16:10:17 -070022class ModemManager;
23
24// Manages modem managers.
25class ModemInfo {
26 public:
27 ModemInfo(ControlInterface *control_interface,
28 EventDispatcher *dispatcher,
Thieu Le3426c8f2012-01-11 17:35:11 -080029 Metrics *metrics,
Darin Petkov887f2982011-07-14 16:10:17 -070030 Manager *manager,
31 GLib *glib);
32 ~ModemInfo();
33
34 void Start();
35 void Stop();
36
Darin Petkov41c0e0a2012-01-09 16:38:53 +010037 void OnDeviceInfoAvailable(const std::string &link_name);
38
Darin Petkov887f2982011-07-14 16:10:17 -070039 private:
40 friend class ModemInfoTest;
41 FRIEND_TEST(ModemInfoTest, RegisterModemManager);
42 FRIEND_TEST(ModemInfoTest, StartStop);
43
Darin Petkov41c0e0a2012-01-09 16:38:53 +010044 typedef ScopedVector<ModemManager> ModemManagers;
45
Darin Petkov887f2982011-07-14 16:10:17 -070046 static const char kCromoService[];
47 static const char kCromoPath[];
Darin Petkov137884a2011-10-26 18:52:47 +020048 static const char kMobileProviderDBPath[];
Darin Petkov887f2982011-07-14 16:10:17 -070049
David Rochberg7cb06f62012-03-05 11:23:44 -050050 // Register and start new ModemManagers
51 template <class mm> void RegisterModemManager(const std::string &service,
52 const std::string &path);
Darin Petkov41c0e0a2012-01-09 16:38:53 +010053 ModemManagers modem_managers_;
Darin Petkov887f2982011-07-14 16:10:17 -070054
55 ControlInterface *control_interface_;
56 EventDispatcher *dispatcher_;
Thieu Le3426c8f2012-01-11 17:35:11 -080057 Metrics *metrics_;
Darin Petkov887f2982011-07-14 16:10:17 -070058 Manager *manager_;
59 GLib *glib_;
60
Darin Petkov137884a2011-10-26 18:52:47 +020061 std::string provider_db_path_; // For testing.
62 mobile_provider_db *provider_db_; // Database instance owned by |this|.
63
Darin Petkov887f2982011-07-14 16:10:17 -070064 DISALLOW_COPY_AND_ASSIGN(ModemInfo);
65};
66
67} // namespace shill
68
69#endif // SHILL_MODEM_INFO_