Darin Petkov | c64fe5e | 2012-01-11 12:46:13 +0100 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -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 | |
| 5 | #ifndef SHILL_CELLULAR_ |
| 6 | #define SHILL_CELLULAR_ |
| 7 | |
| 8 | #include <string> |
Jason Glasgow | 82f9ab3 | 2012-04-04 14:27:19 -0400 | [diff] [blame] | 9 | #include <vector> |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 10 | |
| 11 | #include <base/basictypes.h> |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 12 | #include <gtest/gtest_prod.h> // for FRIEND_TEST |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 13 | |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 14 | #include "shill/dbus_properties.h" |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 15 | #include "shill/device.h" |
Paul Stewart | 26b327e | 2011-10-19 11:38:09 -0700 | [diff] [blame] | 16 | #include "shill/event_dispatcher.h" |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 17 | #include "shill/modem_proxy_interface.h" |
Chris Masone | 2b10554 | 2011-06-22 10:58:09 -0700 | [diff] [blame] | 18 | #include "shill/refptr_types.h" |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 19 | |
Darin Petkov | 137884a | 2011-10-26 18:52:47 +0200 | [diff] [blame] | 20 | struct mobile_provider_db; |
| 21 | |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 22 | namespace shill { |
| 23 | |
Darin Petkov | daf4386 | 2011-10-27 11:37:28 +0200 | [diff] [blame] | 24 | class CellularCapability; |
Darin Petkov | 4d6d941 | 2011-08-24 13:19:54 -0700 | [diff] [blame] | 25 | class Error; |
Darin Petkov | ab565bb | 2011-10-06 02:55:51 -0700 | [diff] [blame] | 26 | class ProxyFactory; |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 27 | |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 28 | class Cellular : public Device { |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 29 | public: |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 30 | enum Type { |
| 31 | kTypeGSM, |
David Rochberg | fa1d31d | 2012-03-20 10:38:07 -0400 | [diff] [blame] | 32 | kTypeCDMA, |
| 33 | kTypeUniversal, // ModemManager1 |
| 34 | kTypeInvalid, |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 35 | }; |
| 36 | |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 37 | // The device states progress linearly from Disabled to Linked. |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 38 | enum State { |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 39 | // This is the initial state of the modem and indicates that the modem radio |
| 40 | // is not turned on. |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 41 | kStateDisabled, |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 42 | // This state indicates that the modem radio is turned on, and it should be |
| 43 | // possible to measure signal strength. |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 44 | kStateEnabled, |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 45 | // The modem has registered with a network and has signal quality |
Darin Petkov | 5148900 | 2011-08-18 13:13:20 -0700 | [diff] [blame] | 46 | // measurements. A cellular service object is created. |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 47 | kStateRegistered, |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 48 | // The modem has connected to a network. |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 49 | kStateConnected, |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 50 | // The network interface is UP. |
| 51 | kStateLinked, |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 52 | }; |
| 53 | |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 54 | enum ModemState { |
| 55 | kModemStateUnknown = 0, |
Eric Shienbrood | 7fce52c | 2012-04-13 19:11:02 -0400 | [diff] [blame] | 56 | kModemStateInitializing = 1, |
| 57 | kModemStateLocked = 2, |
| 58 | kModemStateDisabled = 3, |
David Rochberg | fa1d31d | 2012-03-20 10:38:07 -0400 | [diff] [blame] | 59 | kModemStateDisabling = 4, |
| 60 | kModemStateEnabling = 5, |
| 61 | kModemStateEnabled = 6, |
| 62 | kModemStateSearching = 7, |
| 63 | kModemStateRegistered = 8, |
| 64 | kModemStateDisconnecting = 9, |
| 65 | kModemStateConnecting = 10, |
| 66 | kModemStateConnected = 11, |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 67 | }; |
| 68 | |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 69 | class Operator { |
| 70 | public: |
| 71 | Operator(); |
| 72 | ~Operator(); |
| 73 | |
| 74 | void CopyFrom(const Operator &oper); |
Darin Petkov | 9cb0268 | 2012-01-28 00:17:38 +0100 | [diff] [blame] | 75 | bool Equals(const Operator &oper) const { return dict_ == oper.dict_; } |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 76 | |
| 77 | const std::string &GetName() const; |
| 78 | void SetName(const std::string &name); |
| 79 | |
| 80 | const std::string &GetCode() const; |
| 81 | void SetCode(const std::string &code); |
| 82 | |
| 83 | const std::string &GetCountry() const; |
| 84 | void SetCountry(const std::string &country); |
| 85 | |
| 86 | const Stringmap &ToDict() const; |
| 87 | |
| 88 | private: |
| 89 | Stringmap dict_; |
| 90 | |
| 91 | DISALLOW_COPY_AND_ASSIGN(Operator); |
| 92 | }; |
| 93 | |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 94 | // |owner| is the ModemManager DBus service owner (e.g., ":1.17"). |path| is |
| 95 | // the ModemManager.Modem DBus object path (e.g., |
| 96 | // "/org/chromium/ModemManager/Gobi/0"). |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 97 | Cellular(ControlInterface *control_interface, |
| 98 | EventDispatcher *dispatcher, |
Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 99 | Metrics *metrics, |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 100 | Manager *manager, |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 101 | const std::string &link_name, |
Chris Masone | 626719f | 2011-08-18 16:58:48 -0700 | [diff] [blame] | 102 | const std::string &address, |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 103 | int interface_index, |
| 104 | Type type, |
| 105 | const std::string &owner, |
Darin Petkov | 137884a | 2011-10-26 18:52:47 +0200 | [diff] [blame] | 106 | const std::string &path, |
| 107 | mobile_provider_db *provider_db); |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 108 | virtual ~Cellular(); |
| 109 | |
Jason Glasgow | 7b461df | 2012-05-01 16:38:45 -0400 | [diff] [blame] | 110 | // Load configuration for the device from |storage|. |
| 111 | virtual bool Load(StoreInterface *storage); |
| 112 | |
| 113 | // Save configuration for the device to |storage|. |
| 114 | virtual bool Save(StoreInterface *storage); |
| 115 | |
Darin Petkov | 4d6d941 | 2011-08-24 13:19:54 -0700 | [diff] [blame] | 116 | // Asynchronously connects the modem to the network. Populates |error| on |
| 117 | // failure, leaves it unchanged otherwise. |
| 118 | void Connect(Error *error); |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 119 | |
Darin Petkov | fb0625e | 2012-01-16 13:05:56 +0100 | [diff] [blame] | 120 | // Asynchronously disconnects the modem from the network. Populates |error| on |
| 121 | // failure, leaves it unchanged otherwise. |
| 122 | void Disconnect(Error *error); |
| 123 | |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 124 | // Asynchronously activates the modem. Returns an error on failure. |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 125 | void Activate(const std::string &carrier, Error *error, |
| 126 | const ResultCallback &callback); |
Darin Petkov | c408e69 | 2011-08-17 13:47:15 -0700 | [diff] [blame] | 127 | |
Darin Petkov | 3e50924 | 2011-11-10 14:46:44 +0100 | [diff] [blame] | 128 | const CellularServiceRefPtr &service() const { return service_; } |
| 129 | |
Darin Petkov | a3d3be5 | 2011-11-14 21:34:16 +0100 | [diff] [blame] | 130 | static std::string GetStateString(State state); |
| 131 | |
Darin Petkov | ac635a8 | 2012-01-10 16:51:58 +0100 | [diff] [blame] | 132 | std::string CreateFriendlyServiceName(); |
| 133 | |
Darin Petkov | a3d3be5 | 2011-11-14 21:34:16 +0100 | [diff] [blame] | 134 | State state() const { return state_; } |
| 135 | |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 136 | void set_modem_state(ModemState state) { modem_state_ = state; } |
| 137 | ModemState modem_state() const { return modem_state_; } |
Eric Shienbrood | 7fce52c | 2012-04-13 19:11:02 -0400 | [diff] [blame] | 138 | bool IsUnderlyingDeviceEnabled() const; |
| 139 | static bool IsEnabledModemState(ModemState state); |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 140 | |
Darin Petkov | 1272a43 | 2011-11-10 15:53:37 +0100 | [diff] [blame] | 141 | mobile_provider_db *provider_db() const { return provider_db_; } |
| 142 | |
Darin Petkov | daf4386 | 2011-10-27 11:37:28 +0200 | [diff] [blame] | 143 | const std::string &dbus_owner() const { return dbus_owner_; } |
| 144 | const std::string &dbus_path() const { return dbus_path_; } |
| 145 | |
Darin Petkov | ae0c64e | 2011-11-15 15:50:27 +0100 | [diff] [blame] | 146 | const Operator &home_provider() const { return home_provider_; } |
| 147 | void set_home_provider(const Operator &oper); |
Darin Petkov | 184c54e | 2011-11-15 12:44:39 +0100 | [diff] [blame] | 148 | |
Darin Petkov | 3e50924 | 2011-11-10 14:46:44 +0100 | [diff] [blame] | 149 | void HandleNewSignalQuality(uint32 strength); |
| 150 | |
Darin Petkov | 184c54e | 2011-11-15 12:44:39 +0100 | [diff] [blame] | 151 | // Processes a change in the modem registration state, possibly creating, |
| 152 | // destroying or updating the CellularService. |
| 153 | void HandleNewRegistrationState(); |
| 154 | |
Jason Glasgow | 82f9ab3 | 2012-04-04 14:27:19 -0400 | [diff] [blame] | 155 | virtual void OnDBusPropertiesChanged( |
| 156 | const std::string &interface, |
| 157 | const DBusPropertiesMap &changed_properties, |
| 158 | const std::vector<std::string> &invalidated_properties); |
Darin Petkov | 184c54e | 2011-11-15 12:44:39 +0100 | [diff] [blame] | 159 | |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 160 | // Inherited from Device. |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 161 | virtual void Start(Error *error, const EnabledStateChangedCallback &callback); |
| 162 | virtual void Stop(Error *error, const EnabledStateChangedCallback &callback); |
Paul Stewart | fdd1607 | 2011-09-16 12:41:35 -0700 | [diff] [blame] | 163 | virtual bool TechnologyIs(Technology::Identifier type) const; |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 164 | virtual void LinkEvent(unsigned int flags, unsigned int change); |
Darin Petkov | c086531 | 2011-09-16 15:31:20 -0700 | [diff] [blame] | 165 | virtual void Scan(Error *error); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 166 | virtual void RegisterOnNetwork(const std::string &network_id, |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 167 | Error *error, |
| 168 | const ResultCallback &callback); |
| 169 | virtual void RequirePIN(const std::string &pin, bool require, |
| 170 | Error *error, const ResultCallback &callback); |
| 171 | virtual void EnterPIN(const std::string &pin, |
| 172 | Error *error, const ResultCallback &callback); |
Darin Petkov | e42e101 | 2011-08-31 12:35:04 -0700 | [diff] [blame] | 173 | virtual void UnblockPIN(const std::string &unblock_code, |
| 174 | const std::string &pin, |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 175 | Error *error, const ResultCallback &callback); |
Darin Petkov | e42e101 | 2011-08-31 12:35:04 -0700 | [diff] [blame] | 176 | virtual void ChangePIN(const std::string &old_pin, |
| 177 | const std::string &new_pin, |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 178 | Error *error, const ResultCallback &callback); |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 179 | |
Thieu Le | 37b9003 | 2012-05-15 15:18:41 -0700 | [diff] [blame] | 180 | void StartModemCallback(const EnabledStateChangedCallback &callback, |
| 181 | const Error &error); |
| 182 | void StopModemCallback(const EnabledStateChangedCallback &callback, |
| 183 | const Error &error); |
Eric Shienbrood | 7fce52c | 2012-04-13 19:11:02 -0400 | [diff] [blame] | 184 | void OnConnecting(); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 185 | void OnConnected(); |
Eric Shienbrood | 30bc0ec | 2012-03-21 18:19:46 -0400 | [diff] [blame] | 186 | void OnConnectFailed(const Error &error); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 187 | void OnDisconnected(); |
| 188 | void OnDisconnectFailed(); |
Eric Shienbrood | 0db6a9b | 2012-03-30 16:11:39 -0400 | [diff] [blame] | 189 | std::string GetTechnologyFamily(Error *error); |
Eric Shienbrood | 7fce52c | 2012-04-13 19:11:02 -0400 | [diff] [blame] | 190 | void OnModemStateChanged(ModemState old_state, |
| 191 | ModemState new_state, |
| 192 | uint32 reason); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 193 | |
Jason Glasgow | 7b461df | 2012-05-01 16:38:45 -0400 | [diff] [blame] | 194 | // accessor to read the allow roaming property |
| 195 | bool allow_roaming_property() const { return allow_roaming_; } |
| 196 | |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 197 | private: |
Darin Petkov | ab565bb | 2011-10-06 02:55:51 -0700 | [diff] [blame] | 198 | friend class CellularTest; |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 199 | friend class CellularCapabilityTest; |
Darin Petkov | 20c13ec | 2011-11-09 15:07:15 +0100 | [diff] [blame] | 200 | friend class CellularCapabilityCDMATest; |
| 201 | friend class CellularCapabilityGSMTest; |
Jason Glasgow | ef96556 | 2012-04-10 16:12:35 -0400 | [diff] [blame] | 202 | friend class CellularCapabilityUniversalTest; |
Jason Glasgow | 82f9ab3 | 2012-04-04 14:27:19 -0400 | [diff] [blame] | 203 | friend class CellularServiceTest; |
Darin Petkov | 721ac93 | 2011-11-16 15:43:09 +0100 | [diff] [blame] | 204 | friend class ModemTest; |
Darin Petkov | ac635a8 | 2012-01-10 16:51:58 +0100 | [diff] [blame] | 205 | FRIEND_TEST(CellularCapabilityCDMATest, CreateFriendlyServiceName); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 206 | FRIEND_TEST(CellularCapabilityCDMATest, GetRegistrationState); |
Darin Petkov | ac635a8 | 2012-01-10 16:51:58 +0100 | [diff] [blame] | 207 | FRIEND_TEST(CellularCapabilityGSMTest, CreateFriendlyServiceName); |
| 208 | FRIEND_TEST(CellularServiceTest, FriendlyName); |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 209 | FRIEND_TEST(CellularTest, CreateService); |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 210 | FRIEND_TEST(CellularTest, Connect); |
Eric Shienbrood | cc95c5d | 2012-03-30 15:25:49 -0400 | [diff] [blame] | 211 | FRIEND_TEST(CellularTest, ConnectFailure); |
Thieu Le | b5954a2 | 2012-05-18 10:37:34 -0700 | [diff] [blame] | 212 | FRIEND_TEST(CellularTest, ConnectFailureNoService); |
Darin Petkov | fb0625e | 2012-01-16 13:05:56 +0100 | [diff] [blame] | 213 | FRIEND_TEST(CellularTest, DisableModem); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 214 | FRIEND_TEST(CellularTest, Disconnect); |
Eric Shienbrood | 7fce52c | 2012-04-13 19:11:02 -0400 | [diff] [blame] | 215 | FRIEND_TEST(CellularTest, ModemStateChangeDisable); |
| 216 | FRIEND_TEST(CellularTest, ModemStateChangeEnable); |
Thieu Le | 37b9003 | 2012-05-15 15:18:41 -0700 | [diff] [blame] | 217 | FRIEND_TEST(CellularTest, StartModemCallback); |
| 218 | FRIEND_TEST(CellularTest, StartModemCallbackFail); |
| 219 | FRIEND_TEST(CellularTest, StopModemCallback); |
| 220 | FRIEND_TEST(CellularTest, StopModemCallbackFail); |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 221 | FRIEND_TEST(CellularTest, StartConnected); |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 222 | FRIEND_TEST(CellularTest, StartCDMARegister); |
Darin Petkov | 9bac6fe | 2011-08-26 12:49:05 -0700 | [diff] [blame] | 223 | FRIEND_TEST(CellularTest, StartGSMRegister); |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 224 | FRIEND_TEST(CellularTest, StartLinked); |
Darin Petkov | 9c1dcef | 2012-02-07 15:58:26 +0100 | [diff] [blame] | 225 | FRIEND_TEST(CellularCapabilityTest, AllowRoaming); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 226 | FRIEND_TEST(CellularCapabilityTest, EnableModemFail); |
| 227 | FRIEND_TEST(CellularCapabilityTest, EnableModemSucceed); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 228 | FRIEND_TEST(CellularCapabilityTest, FinishEnable); |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 229 | FRIEND_TEST(CellularCapabilityTest, GetModemInfo); |
| 230 | FRIEND_TEST(CellularCapabilityTest, GetModemStatus); |
Jason Glasgow | 02401cc | 2012-05-16 10:35:37 -0400 | [diff] [blame] | 231 | FRIEND_TEST(CellularCapabilityUniversalTest, StopModemConnected); |
Jason Glasgow | 1452187 | 2012-05-07 19:12:15 -0400 | [diff] [blame] | 232 | FRIEND_TEST(CellularCapabilityUniversalTest, Connect); |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 233 | |
Jason Glasgow | 7b461df | 2012-05-01 16:38:45 -0400 | [diff] [blame] | 234 | // Names of properties in storage |
| 235 | static const char kAllowRoaming[]; |
| 236 | |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 237 | void SetState(State state); |
| 238 | |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 239 | // Invoked when the modem is connected to the cellular network to transition |
| 240 | // to the network-connected state and bring the network interface up. |
| 241 | void EstablishLink(); |
| 242 | |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame] | 243 | void InitCapability(Type type, ProxyFactory *proxy_factory); |
Darin Petkov | f5f61e0 | 2011-07-29 11:35:40 -0700 | [diff] [blame] | 244 | |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 245 | void CreateService(); |
Darin Petkov | 2c37738 | 2012-01-11 11:40:43 +0100 | [diff] [blame] | 246 | void DestroyService(); |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 247 | |
Eric Shienbrood | 0db6a9b | 2012-03-30 16:11:39 -0400 | [diff] [blame] | 248 | // HelpRegisterDerived*: Expose a property over RPC, with the name |name|. |
| 249 | // |
| 250 | // Reads of the property will be handled by invoking |get|. |
| 251 | // Writes to the property will be handled by invoking |set|. |
| 252 | // Clearing the property will be handled by PropertyStore. |
Jason Glasgow | 7b461df | 2012-05-01 16:38:45 -0400 | [diff] [blame] | 253 | void HelpRegisterDerivedBool( |
| 254 | const std::string &name, |
| 255 | bool(Cellular::*get)(Error *error), |
| 256 | void(Cellular::*set)(const bool &value, Error *error)); |
Eric Shienbrood | 0db6a9b | 2012-03-30 16:11:39 -0400 | [diff] [blame] | 257 | void HelpRegisterDerivedString( |
| 258 | const std::string &name, |
| 259 | std::string(Cellular::*get)(Error *error), |
| 260 | void(Cellular::*set)(const std::string &value, Error *error)); |
| 261 | |
Nathan Williams | b54974f | 2012-04-19 11:16:30 -0400 | [diff] [blame] | 262 | void OnConnectReply(const Error &error); |
| 263 | void OnDisconnectReply(const Error &error); |
| 264 | |
Jason Glasgow | 7b461df | 2012-05-01 16:38:45 -0400 | [diff] [blame] | 265 | // DBUS accessors to read/modify the allow roaming property |
| 266 | bool GetAllowRoaming(Error */*error*/) { return allow_roaming_; } |
| 267 | void SetAllowRoaming(const bool &value, Error *error); |
| 268 | |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 269 | State state_; |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 270 | ModemState modem_state_; |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 271 | |
Darin Petkov | daf4386 | 2011-10-27 11:37:28 +0200 | [diff] [blame] | 272 | scoped_ptr<CellularCapability> capability_; |
| 273 | |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 274 | const std::string dbus_owner_; // ModemManager.Modem |
| 275 | const std::string dbus_path_; // ModemManager.Modem |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 276 | |
Darin Petkov | 137884a | 2011-10-26 18:52:47 +0200 | [diff] [blame] | 277 | mobile_provider_db *provider_db_; |
| 278 | |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 279 | CellularServiceRefPtr service_; |
Chris Masone | 853b81b | 2011-06-24 14:11:41 -0700 | [diff] [blame] | 280 | |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 281 | // Properties |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 282 | Operator home_provider_; |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 283 | |
Jason Glasgow | 7b461df | 2012-05-01 16:38:45 -0400 | [diff] [blame] | 284 | // User preference to allow or disallow roaming |
| 285 | bool allow_roaming_; |
| 286 | |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 287 | DISALLOW_COPY_AND_ASSIGN(Cellular); |
| 288 | }; |
| 289 | |
| 290 | } // namespace shill |
| 291 | |
| 292 | #endif // SHILL_CELLULAR_ |