Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 | // 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_ |
| 6 | #define SHILL_MODEM_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include <base/basictypes.h> |
| 11 | #include <base/memory/scoped_ptr.h> |
Darin Petkov | e0a312e | 2011-07-20 13:45:28 -0700 | [diff] [blame^] | 12 | #include <gtest/gtest_prod.h> // for FRIEND_TEST |
| 13 | |
| 14 | #include "shill/dbus_properties_proxy_interface.h" |
| 15 | #include "shill/refptr_types.h" |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 16 | |
| 17 | namespace shill { |
| 18 | |
| 19 | class ControlInterface; |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 20 | class EventDispatcher; |
| 21 | class Manager; |
| 22 | |
Darin Petkov | e0a312e | 2011-07-20 13:45:28 -0700 | [diff] [blame^] | 23 | // Handles an instance of ModemManager.Modem and an instance of a Cellular |
| 24 | // device. |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 25 | class Modem { |
| 26 | public: |
Darin Petkov | e0a312e | 2011-07-20 13:45:28 -0700 | [diff] [blame^] | 27 | // |owner| is the ModemManager DBus service owner (e.g., ":1.17"). |path| is |
| 28 | // the ModemManager.Modem DBus object path (e.g., |
| 29 | // "/org/chromium/ModemManager/Gobi/0"). |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 30 | Modem(const std::string &owner, |
| 31 | const std::string &path, |
| 32 | ControlInterface *control_interface, |
| 33 | EventDispatcher *dispatcher, |
| 34 | Manager *manager); |
| 35 | ~Modem(); |
| 36 | |
Darin Petkov | e0a312e | 2011-07-20 13:45:28 -0700 | [diff] [blame^] | 37 | // Initializes support for the modem, possibly constructing a Cellular device. |
| 38 | void Init(); |
| 39 | |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 40 | private: |
Darin Petkov | e0a312e | 2011-07-20 13:45:28 -0700 | [diff] [blame^] | 41 | friend class ModemManagerTest; |
| 42 | friend class ModemTest; |
| 43 | FRIEND_TEST(ModemTest, CreateCellularDevice); |
| 44 | FRIEND_TEST(ModemTest, Init); |
| 45 | |
| 46 | static const char kPropertyLinkName[]; |
| 47 | static const char kPropertyIPMethod[]; |
| 48 | static const char kPropertyType[]; |
| 49 | static const char kPropertyUnlockRequired[]; |
| 50 | static const char kPropertyUnlockRetries[]; |
| 51 | |
| 52 | void CreateCellularDevice(const DBusPropertiesMap &properties); |
| 53 | |
| 54 | // A proxy to the org.freedesktop.DBus.Properties interface used to obtain |
| 55 | // ModemManager.Modem properties and watch for property changes. |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 56 | scoped_ptr<DBusPropertiesProxyInterface> dbus_properties_proxy_; |
| 57 | |
Darin Petkov | e0a312e | 2011-07-20 13:45:28 -0700 | [diff] [blame^] | 58 | const std::string owner_; |
| 59 | const std::string path_; |
| 60 | |
| 61 | CellularRefPtr device_; |
| 62 | |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 63 | ControlInterface *control_interface_; |
| 64 | EventDispatcher *dispatcher_; |
| 65 | Manager *manager_; |
| 66 | |
| 67 | DISALLOW_COPY_AND_ASSIGN(Modem); |
| 68 | }; |
| 69 | |
| 70 | } // namespace shill |
| 71 | |
| 72 | #endif // SHILL_MODEM_ |