Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -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_CELLULAR_ |
| 6 | #define SHILL_CELLULAR_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include <base/basictypes.h> |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 11 | #include <base/task.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" |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 16 | #include "shill/modem_cdma_proxy_interface.h" |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 17 | #include "shill/modem_gsm_card_proxy_interface.h" |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 18 | #include "shill/modem_gsm_network_proxy_interface.h" |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 19 | #include "shill/modem_proxy_interface.h" |
Chris Masone | 2b10554 | 2011-06-22 10:58:09 -0700 | [diff] [blame] | 20 | #include "shill/refptr_types.h" |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 21 | #include "shill/shill_event.h" |
| 22 | |
| 23 | namespace shill { |
| 24 | |
Darin Petkov | 4d6d941 | 2011-08-24 13:19:54 -0700 | [diff] [blame] | 25 | class Error; |
Darin Petkov | e604f70 | 2011-07-28 15:51:17 -0700 | [diff] [blame] | 26 | class ModemSimpleProxyInterface; |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 27 | |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 28 | class Cellular : public Device, |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 29 | public ModemCDMAProxyListener, |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 30 | public ModemGSMCardProxyListener, |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 31 | public ModemGSMNetworkProxyListener, |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 32 | public ModemProxyListener { |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 33 | public: |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 34 | enum Type { |
| 35 | kTypeGSM, |
| 36 | kTypeCDMA |
| 37 | }; |
| 38 | |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 39 | // The device states progress linearly from Disabled to Linked. |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 40 | enum State { |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 41 | // This is the initial state of the modem and indicates that the modem radio |
| 42 | // is not turned on. |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 43 | kStateDisabled, |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 44 | // This state indicates that the modem radio is turned on, and it should be |
| 45 | // possible to measure signal strength. |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 46 | kStateEnabled, |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 47 | // The modem has registered with a network and has signal quality |
Darin Petkov | 5148900 | 2011-08-18 13:13:20 -0700 | [diff] [blame] | 48 | // measurements. A cellular service object is created. |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 49 | kStateRegistered, |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 50 | // The modem has connected to a network. |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 51 | kStateConnected, |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 52 | // The network interface is UP. |
| 53 | kStateLinked, |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 54 | }; |
| 55 | |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 56 | // These should be kept in sync with ModemManager's mm-modem.h:MMModemState. |
| 57 | enum ModemState { |
| 58 | kModemStateUnknown = 0, |
| 59 | kModemStateDisabled = 10, |
| 60 | kModemStateDisabling = 20, |
| 61 | kModemStateEnabling = 30, |
| 62 | kModemStateEnabled = 40, |
| 63 | kModemStateSearching = 50, |
| 64 | kModemStateRegistered = 60, |
| 65 | kModemStateDisconnecting = 70, |
| 66 | kModemStateConnecting = 80, |
| 67 | kModemStateConnected = 90, |
| 68 | }; |
| 69 | |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 70 | class Operator { |
| 71 | public: |
| 72 | Operator(); |
| 73 | ~Operator(); |
| 74 | |
| 75 | void CopyFrom(const Operator &oper); |
| 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 | |
Chris Masone | 889666b | 2011-07-03 12:58:50 -0700 | [diff] [blame] | 94 | struct SimLockStatus { |
| 95 | public: |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 96 | SimLockStatus() : retries_left(0) {} |
Darin Petkov | 48a511a | 2011-09-15 10:33:37 -0700 | [diff] [blame] | 97 | SimLockStatus(const std::string &in_lock_type, uint32 in_retries_left) |
| 98 | : lock_type(in_lock_type), |
| 99 | retries_left(in_retries_left) {} |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 100 | |
Chris Masone | 889666b | 2011-07-03 12:58:50 -0700 | [diff] [blame] | 101 | std::string lock_type; |
| 102 | uint32 retries_left; |
| 103 | }; |
| 104 | |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 105 | static const char kConnectPropertyPhoneNumber[]; |
| 106 | |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 107 | // |owner| is the ModemManager DBus service owner (e.g., ":1.17"). |path| is |
| 108 | // the ModemManager.Modem DBus object path (e.g., |
| 109 | // "/org/chromium/ModemManager/Gobi/0"). |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 110 | Cellular(ControlInterface *control_interface, |
| 111 | EventDispatcher *dispatcher, |
| 112 | Manager *manager, |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 113 | const std::string &link_name, |
Chris Masone | 626719f | 2011-08-18 16:58:48 -0700 | [diff] [blame] | 114 | const std::string &address, |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 115 | int interface_index, |
| 116 | Type type, |
| 117 | const std::string &owner, |
| 118 | const std::string &path); |
| 119 | virtual ~Cellular(); |
| 120 | |
Darin Petkov | 4d6d941 | 2011-08-24 13:19:54 -0700 | [diff] [blame] | 121 | // Asynchronously connects the modem to the network. Populates |error| on |
| 122 | // failure, leaves it unchanged otherwise. |
| 123 | void Connect(Error *error); |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 124 | |
Darin Petkov | b100ae7 | 2011-08-24 16:19:45 -0700 | [diff] [blame] | 125 | // Asynchronously activates the modem. Populates |error| on failure, leaves it |
| 126 | // unchanged otherwise. |
| 127 | void Activate(const std::string &carrier, Error *error); |
Darin Petkov | c408e69 | 2011-08-17 13:47:15 -0700 | [diff] [blame] | 128 | |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 129 | void set_modem_state(ModemState state) { modem_state_ = state; } |
| 130 | ModemState modem_state() const { return modem_state_; } |
| 131 | |
Darin Petkov | 48a511a | 2011-09-15 10:33:37 -0700 | [diff] [blame] | 132 | const SimLockStatus &sim_lock_status() const { return sim_lock_status_; } |
| 133 | void set_sim_lock_status(const SimLockStatus &s) { sim_lock_status_ = s; } |
| 134 | |
| 135 | void SetGSMAccessTechnology(uint32 access_technology); |
| 136 | |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 137 | // Inherited from Device. |
| 138 | virtual void Start(); |
| 139 | virtual void Stop(); |
Paul Stewart | fdd1607 | 2011-09-16 12:41:35 -0700 | [diff] [blame] | 140 | virtual bool TechnologyIs(Technology::Identifier type) const; |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 141 | virtual void LinkEvent(unsigned int flags, unsigned int change); |
Darin Petkov | c086531 | 2011-09-16 15:31:20 -0700 | [diff] [blame] | 142 | virtual void Scan(Error *error); |
Darin Petkov | 9ae310f | 2011-08-30 15:41:13 -0700 | [diff] [blame] | 143 | virtual void RegisterOnNetwork(const std::string &network_id, Error *error); |
Darin Petkov | e42e101 | 2011-08-31 12:35:04 -0700 | [diff] [blame] | 144 | virtual void RequirePIN(const std::string &pin, bool require, Error *error); |
| 145 | virtual void EnterPIN(const std::string &pin, Error *error); |
| 146 | virtual void UnblockPIN(const std::string &unblock_code, |
| 147 | const std::string &pin, |
| 148 | Error *error); |
| 149 | virtual void ChangePIN(const std::string &old_pin, |
| 150 | const std::string &new_pin, |
| 151 | Error *error); |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 152 | |
| 153 | private: |
Darin Petkov | c408e69 | 2011-08-17 13:47:15 -0700 | [diff] [blame] | 154 | FRIEND_TEST(CellularTest, Activate); |
Darin Petkov | 5148900 | 2011-08-18 13:13:20 -0700 | [diff] [blame] | 155 | FRIEND_TEST(CellularTest, ActivateError); |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 156 | FRIEND_TEST(CellularTest, CreateService); |
Darin Petkov | e42e101 | 2011-08-31 12:35:04 -0700 | [diff] [blame] | 157 | FRIEND_TEST(CellularTest, ChangePIN); |
| 158 | FRIEND_TEST(CellularTest, ChangePINError); |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 159 | FRIEND_TEST(CellularTest, Connect); |
Darin Petkov | c408e69 | 2011-08-17 13:47:15 -0700 | [diff] [blame] | 160 | FRIEND_TEST(CellularTest, GetCDMAActivationStateString); |
Darin Petkov | 5148900 | 2011-08-18 13:13:20 -0700 | [diff] [blame] | 161 | FRIEND_TEST(CellularTest, GetCDMAActivationErrorString); |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 162 | FRIEND_TEST(CellularTest, GetCDMAIdentifiers); |
Darin Petkov | 9bac6fe | 2011-08-26 12:49:05 -0700 | [diff] [blame] | 163 | FRIEND_TEST(CellularTest, GetCDMANetworkTechnologyString); |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 164 | FRIEND_TEST(CellularTest, GetCDMARegistrationState); |
Darin Petkov | 9bac6fe | 2011-08-26 12:49:05 -0700 | [diff] [blame] | 165 | FRIEND_TEST(CellularTest, GetCDMARoamingStateString); |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 166 | FRIEND_TEST(CellularTest, GetCDMASignalQuality); |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 167 | FRIEND_TEST(CellularTest, GetGSMIdentifiers); |
Darin Petkov | 9bac6fe | 2011-08-26 12:49:05 -0700 | [diff] [blame] | 168 | FRIEND_TEST(CellularTest, GetGSMNetworkTechnologyString); |
| 169 | FRIEND_TEST(CellularTest, GetGSMRoamingStateString); |
Darin Petkov | 22b72bf | 2011-08-29 14:01:20 -0700 | [diff] [blame] | 170 | FRIEND_TEST(CellularTest, GetGSMSignalQuality); |
Darin Petkov | ceb6817 | 2011-07-29 14:47:48 -0700 | [diff] [blame] | 171 | FRIEND_TEST(CellularTest, GetModemInfo); |
| 172 | FRIEND_TEST(CellularTest, GetModemStatus); |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 173 | FRIEND_TEST(CellularTest, GetStateString); |
| 174 | FRIEND_TEST(CellularTest, GetTypeString); |
Darin Petkov | e42e101 | 2011-08-31 12:35:04 -0700 | [diff] [blame] | 175 | FRIEND_TEST(CellularTest, EnterPIN); |
| 176 | FRIEND_TEST(CellularTest, EnterPINError); |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 177 | FRIEND_TEST(CellularTest, InitProxiesCDMA); |
| 178 | FRIEND_TEST(CellularTest, InitProxiesGSM); |
Darin Petkov | c086531 | 2011-09-16 15:31:20 -0700 | [diff] [blame] | 179 | FRIEND_TEST(CellularTest, ParseScanResult); |
Darin Petkov | 9ae310f | 2011-08-30 15:41:13 -0700 | [diff] [blame] | 180 | FRIEND_TEST(CellularTest, RegisterOnNetwork); |
| 181 | FRIEND_TEST(CellularTest, RegisterOnNetworkError); |
Darin Petkov | e42e101 | 2011-08-31 12:35:04 -0700 | [diff] [blame] | 182 | FRIEND_TEST(CellularTest, RequirePIN); |
| 183 | FRIEND_TEST(CellularTest, RequirePINError); |
Darin Petkov | 48a511a | 2011-09-15 10:33:37 -0700 | [diff] [blame] | 184 | FRIEND_TEST(CellularTest, SetGSMAccessTechnology); |
Darin Petkov | c086531 | 2011-09-16 15:31:20 -0700 | [diff] [blame] | 185 | FRIEND_TEST(CellularTest, Scan); |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 186 | FRIEND_TEST(CellularTest, StartConnected); |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 187 | FRIEND_TEST(CellularTest, StartCDMARegister); |
Darin Petkov | 9bac6fe | 2011-08-26 12:49:05 -0700 | [diff] [blame] | 188 | FRIEND_TEST(CellularTest, StartGSMRegister); |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 189 | FRIEND_TEST(CellularTest, StartLinked); |
Darin Petkov | e42e101 | 2011-08-31 12:35:04 -0700 | [diff] [blame] | 190 | FRIEND_TEST(CellularTest, UnblockPIN); |
| 191 | FRIEND_TEST(CellularTest, UnblockPINError); |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 192 | |
Darin Petkov | 9bac6fe | 2011-08-26 12:49:05 -0700 | [diff] [blame] | 193 | struct CDMA { |
| 194 | CDMA(); |
| 195 | |
| 196 | uint32 registration_state_evdo; |
| 197 | uint32 registration_state_1x; |
| 198 | uint32 activation_state; |
| 199 | |
| 200 | uint16 prl_version; |
| 201 | std::string payment_url; |
| 202 | std::string usage_url; |
| 203 | }; |
| 204 | |
| 205 | struct GSM { |
| 206 | GSM(); |
| 207 | |
| 208 | uint32 registration_state; |
| 209 | uint32 access_technology; |
| 210 | std::string network_id; |
| 211 | std::string operator_name; |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 212 | std::string spn; |
Darin Petkov | 9bac6fe | 2011-08-26 12:49:05 -0700 | [diff] [blame] | 213 | }; |
| 214 | |
Darin Petkov | c086531 | 2011-09-16 15:31:20 -0700 | [diff] [blame] | 215 | static const char kNetworkPropertyAccessTechnology[]; |
| 216 | static const char kNetworkPropertyID[]; |
| 217 | static const char kNetworkPropertyLongName[]; |
| 218 | static const char kNetworkPropertyShortName[]; |
| 219 | static const char kNetworkPropertyStatus[]; |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 220 | static const char kPhoneNumberCDMA[]; |
| 221 | static const char kPhoneNumberGSM[]; |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 222 | |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 223 | void SetState(State state); |
| 224 | |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 225 | void ConnectTask(const DBusPropertiesMap &properties); |
Darin Petkov | c086531 | 2011-09-16 15:31:20 -0700 | [diff] [blame] | 226 | void ScanTask(); |
Darin Petkov | c408e69 | 2011-08-17 13:47:15 -0700 | [diff] [blame] | 227 | void ActivateTask(const std::string &carrier); |
Darin Petkov | 9ae310f | 2011-08-30 15:41:13 -0700 | [diff] [blame] | 228 | void RegisterOnNetworkTask(const std::string &network_id); |
Darin Petkov | e42e101 | 2011-08-31 12:35:04 -0700 | [diff] [blame] | 229 | void RequirePINTask(const std::string &pin, bool require); |
| 230 | void EnterPINTask(const std::string &pin); |
| 231 | void UnblockPINTask(const std::string &unblock_code, const std::string &pin); |
| 232 | void ChangePINTask(const std::string &old_pin, const std::string &new_pin); |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 233 | |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 234 | // Invoked when the modem is connected to the cellular network to transition |
| 235 | // to the network-connected state and bring the network interface up. |
| 236 | void EstablishLink(); |
| 237 | |
Chris Masone | 889666b | 2011-07-03 12:58:50 -0700 | [diff] [blame] | 238 | StrIntPair SimLockStatusToProperty(); |
Darin Petkov | 48a511a | 2011-09-15 10:33:37 -0700 | [diff] [blame] | 239 | |
Chris Masone | 889666b | 2011-07-03 12:58:50 -0700 | [diff] [blame] | 240 | void HelpRegisterDerivedStringmaps(const std::string &name, |
| 241 | Stringmaps(Cellular::*get)(void), |
| 242 | bool(Cellular::*set)(const Stringmaps&)); |
| 243 | void HelpRegisterDerivedStrIntPair(const std::string &name, |
| 244 | StrIntPair(Cellular::*get)(void), |
| 245 | bool(Cellular::*set)(const StrIntPair&)); |
| 246 | |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 247 | void InitProxies(); |
| 248 | |
Darin Petkov | cc04442 | 2011-08-17 13:30:06 -0700 | [diff] [blame] | 249 | std::string GetTypeString() const; |
| 250 | static std::string GetStateString(State state); |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 251 | |
Darin Petkov | d204580 | 2011-08-23 11:09:25 -0700 | [diff] [blame] | 252 | // Returns an empty string if the network technology is unknown. |
| 253 | std::string GetNetworkTechnologyString() const; |
| 254 | |
| 255 | std::string GetRoamingStateString() const; |
| 256 | |
Darin Petkov | c408e69 | 2011-08-17 13:47:15 -0700 | [diff] [blame] | 257 | static std::string GetCDMAActivationStateString(uint32 state); |
Darin Petkov | 5148900 | 2011-08-18 13:13:20 -0700 | [diff] [blame] | 258 | static std::string GetCDMAActivationErrorString(uint32 error); |
Darin Petkov | c408e69 | 2011-08-17 13:47:15 -0700 | [diff] [blame] | 259 | |
Darin Petkov | f5f61e0 | 2011-07-29 11:35:40 -0700 | [diff] [blame] | 260 | void EnableModem(); |
| 261 | void GetModemStatus(); |
Darin Petkov | ceb6817 | 2011-07-29 14:47:48 -0700 | [diff] [blame] | 262 | void GetGSMProperties(); |
| 263 | void RegisterGSMModem(); |
Darin Petkov | ceb6817 | 2011-07-29 14:47:48 -0700 | [diff] [blame] | 264 | |
| 265 | // Obtains the modem identifiers: MEID for CDMA; IMEI, IMSI, SPN and MSISDN |
| 266 | // for GSM. |
| 267 | void GetModemIdentifiers(); |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 268 | void GetCDMAIdentifiers(); |
| 269 | void GetGSMIdentifiers(); |
Darin Petkov | ceb6817 | 2011-07-29 14:47:48 -0700 | [diff] [blame] | 270 | |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 271 | // Obtains modem's manufacturer, model ID, and hardware revision. |
Darin Petkov | ceb6817 | 2011-07-29 14:47:48 -0700 | [diff] [blame] | 272 | void GetModemInfo(); |
Darin Petkov | f5f61e0 | 2011-07-29 11:35:40 -0700 | [diff] [blame] | 273 | |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 274 | void GetModemRegistrationState(); |
| 275 | void GetCDMARegistrationState(); |
| 276 | void GetGSMRegistrationState(); |
| 277 | |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 278 | // Processes a change in the modem registration state, possibly creating, |
| 279 | // destroying or updating the CellularService. |
| 280 | void HandleNewRegistrationState(); |
Darin Petkov | 0828f5f | 2011-08-11 10:18:52 -0700 | [diff] [blame] | 281 | void HandleNewRegistrationStateTask(); |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 282 | |
| 283 | void CreateService(); |
| 284 | |
| 285 | void GetModemSignalQuality(); |
| 286 | uint32 GetCDMASignalQuality(); |
| 287 | uint32 GetGSMSignalQuality(); |
| 288 | |
| 289 | void HandleNewSignalQuality(uint32 strength); |
| 290 | |
Darin Petkov | c408e69 | 2011-08-17 13:47:15 -0700 | [diff] [blame] | 291 | void HandleNewCDMAActivationState(uint32 error); |
| 292 | |
Darin Petkov | c086531 | 2011-09-16 15:31:20 -0700 | [diff] [blame] | 293 | Stringmap ParseScanResult( |
| 294 | const ModemGSMNetworkProxyInterface::ScanResult &result); |
| 295 | |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 296 | // Signal callbacks inherited from ModemCDMAProxyListener. |
Darin Petkov | b27e544 | 2011-08-16 14:36:45 -0700 | [diff] [blame] | 297 | virtual void OnCDMAActivationStateChanged( |
| 298 | uint32 activation_state, |
| 299 | uint32 activation_error, |
| 300 | const DBusPropertiesMap &status_changes); |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 301 | virtual void OnCDMARegistrationStateChanged(uint32 state_1x, |
| 302 | uint32 state_evdo); |
| 303 | virtual void OnCDMASignalQualityChanged(uint32 strength); |
| 304 | |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 305 | // Signal callbacks inherited from ModemGSMNetworkProxyListener. |
| 306 | virtual void OnGSMNetworkModeChanged(uint32 mode); |
| 307 | virtual void OnGSMRegistrationInfoChanged(uint32 status, |
| 308 | const std::string &operator_code, |
| 309 | const std::string &operator_name); |
| 310 | virtual void OnGSMSignalQualityChanged(uint32 quality); |
| 311 | |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 312 | // Signal callbacks inherited from ModemProxyListener. |
| 313 | virtual void OnModemStateChanged(uint32 old_state, |
| 314 | uint32 new_state, |
| 315 | uint32 reason); |
| 316 | |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 317 | Type type_; |
| 318 | State state_; |
Darin Petkov | bac9600 | 2011-08-09 13:22:00 -0700 | [diff] [blame] | 319 | ModemState modem_state_; |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 320 | |
| 321 | const std::string dbus_owner_; // ModemManager.Modem |
| 322 | const std::string dbus_path_; // ModemManager.Modem |
| 323 | scoped_ptr<ModemProxyInterface> proxy_; |
Darin Petkov | e604f70 | 2011-07-28 15:51:17 -0700 | [diff] [blame] | 324 | scoped_ptr<ModemSimpleProxyInterface> simple_proxy_; |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 325 | scoped_ptr<ModemCDMAProxyInterface> cdma_proxy_; |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 326 | scoped_ptr<ModemGSMCardProxyInterface> gsm_card_proxy_; |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 327 | scoped_ptr<ModemGSMNetworkProxyInterface> gsm_network_proxy_; |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 328 | |
| 329 | CDMA cdma_; |
Darin Petkov | 9bac6fe | 2011-08-26 12:49:05 -0700 | [diff] [blame] | 330 | GSM gsm_; |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 331 | |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 332 | CellularServiceRefPtr service_; |
Chris Masone | 853b81b | 2011-06-24 14:11:41 -0700 | [diff] [blame] | 333 | |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 334 | ScopedRunnableMethodFactory<Cellular> task_factory_; |
| 335 | |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 336 | // Properties |
| 337 | bool allow_roaming_; |
| 338 | std::string carrier_; |
| 339 | std::string meid_; |
| 340 | std::string imei_; |
| 341 | std::string imsi_; |
| 342 | std::string esn_; |
| 343 | std::string mdn_; |
| 344 | std::string min_; |
| 345 | std::string model_id_; |
| 346 | std::string manufacturer_; |
| 347 | std::string firmware_revision_; |
| 348 | std::string hardware_revision_; |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 349 | bool scanning_; |
| 350 | uint16 scan_interval_; |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 351 | std::string selected_network_; |
Darin Petkov | c086531 | 2011-09-16 15:31:20 -0700 | [diff] [blame] | 352 | Stringmaps found_networks_; |
Chris Masone | 889666b | 2011-07-03 12:58:50 -0700 | [diff] [blame] | 353 | SimLockStatus sim_lock_status_; |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 354 | Operator home_provider_; |
Chris Masone | b925cc8 | 2011-06-22 15:39:57 -0700 | [diff] [blame] | 355 | |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 356 | DISALLOW_COPY_AND_ASSIGN(Cellular); |
| 357 | }; |
| 358 | |
| 359 | } // namespace shill |
| 360 | |
| 361 | #endif // SHILL_CELLULAR_ |