cellular_capability_universal.h revision 9f3dcf80a84c07701b7c224fca5ed637c966fa3e
172fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow// Use of this source code is governed by a BSD-style license that can be
382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow// found in the LICENSE file.
482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
5145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow#ifndef SHILL_CELLULAR_CAPABILITY_UNIVERSAL_H_
6145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow#define SHILL_CELLULAR_CAPABILITY_UNIVERSAL_H_
782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include <deque>
9af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow#include <map>
1082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include <string>
1182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include <vector>
1282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
1382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include <base/memory/scoped_ptr.h>
1482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include <base/memory/weak_ptr.h>
1582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include <gtest/gtest_prod.h>  // for FRIEND_TEST
165c853ef21b9247d2ad3d60736b3dea77b8681ed8Ben Chan#include <ModemManager/ModemManager.h>
1782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
1882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include "shill/accessor_interface.h"
1982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include "shill/cellular.h"
2082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include "shill/cellular_capability.h"
2107193fdb601f4cea6301ebb85ebf20596807e126Ben Chan#include "shill/cellular_operator_info.h"
226e5639f9ef54db278c5f2265d5364e5994966f4aArman Uguray#include "shill/mm1_bearer_proxy_interface.h"
2382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include "shill/mm1_modem_modem3gpp_proxy_interface.h"
2482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include "shill/mm1_modem_proxy_interface.h"
2582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include "shill/mm1_modem_simple_proxy_interface.h"
2682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include "shill/mm1_sim_proxy_interface.h"
2782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
2882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgowstruct mobile_provider;
2982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
3082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgownamespace shill {
3182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
3227526f1dad75e135f437e023cb34b0919d9a981fPrathmesh Prabhuclass ModemInfo;
33c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray
3482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow// CellularCapabilityUniversal handles modems using the
3582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow// org.chromium.ModemManager1 DBUS interface.  This class is used for
3682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow// all types of modems, i.e. CDMA, GSM, and LTE modems.
3782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgowclass CellularCapabilityUniversal : public CellularCapability {
3882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow public:
3982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  typedef std::vector<DBusPropertiesMap> ScanResults;
4082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  typedef DBusPropertiesMap ScanResult;
4174924d87cc111f8603751f09cd009c830f43e668Ben Chan  typedef std::map<uint32_t, uint32_t> LockRetryData;
4282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
43145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // Constants used in connect method call.  Make available to test matchers.
44145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // TODO(jglasgow): Generate from modem manager into
45145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // ModemManager-names.h.
46ee6b3d7f9d49fa52072a352fbb59f06127b1ba4cPaul Stewart  // See http://crbug.com/212909.
47145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectPin[];
48145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectOperatorId[];
49145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectApn[];
50145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectIPType[];
51145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectUser[];
52145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectPassword[];
53145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectNumber[];
54145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectAllowRoaming[];
55145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectRMProtocol[];
56145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow
57ce4483e054058ab3f6d940c7aa2e7b5697af325aThieu Le  CellularCapabilityUniversal(Cellular *cellular,
58ce4483e054058ab3f6d940c7aa2e7b5697af325aThieu Le                              ProxyFactory *proxy_factory,
5927526f1dad75e135f437e023cb34b0919d9a981fPrathmesh Prabhu                              ModemInfo *modem_info);
6082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
6182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Inherited from CellularCapability.
62e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // Checks the modem state.  If the state is kModemStateDisabled, then the
63e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // modem is enabled.  Otherwise, the enable command is buffered until the
64e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // modem becomes disabled.  ModemManager rejects the enable command if the
651ee9391c97a19fc6e618d8f23748b49acbf868d0Arman Uguray  // modem is not disabled, for example, if it is initializing instead.
6682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void StartModem(Error *error, const ResultCallback &callback);
6782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void StopModem(Error *error, const ResultCallback &callback);
6882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void Connect(const DBusPropertiesMap &properties, Error *error,
6982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                       const ResultCallback &callback);
7082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void Disconnect(Error *error, const ResultCallback &callback);
718a46890363301a4e28fe3175e194703409e344dcChristopher Wiley  virtual void DisconnectCleanup();
7282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void Activate(const std::string &carrier,
7382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                        Error *error, const ResultCallback &callback);
74c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  virtual void CompleteActivation(Error *error);
7582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
7682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void OnServiceCreated();
7782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void SetupConnectProperties(DBusPropertiesMap *properties);
78ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  virtual void GetProperties();
7972fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  virtual bool IsRegistered();
8015786033dc85e3dd7fea18ba936957b8b2c34e29Ben Chan  virtual bool IsServiceActivationRequired() const;
8182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void Register(const ResultCallback &callback);
8282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
8382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void RegisterOnNetwork(const std::string &network_id,
8482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                                 Error *error,
8582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                                 const ResultCallback &callback);
867fce52c4afdc5e73a9e740dc9b90f1e61ae8cea4Eric Shienbrood  virtual void SetUnregistered(bool searching);
8782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual std::string CreateFriendlyServiceName();
8882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void RequirePIN(const std::string &pin, bool require,
8982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                          Error *error, const ResultCallback &callback);
9082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void EnterPIN(const std::string &pin,
9182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                        Error *error, const ResultCallback &callback);
9282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void UnblockPIN(const std::string &unblock_code,
9382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                          const std::string &pin,
9482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                          Error *error, const ResultCallback &callback);
9582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void ChangePIN(const std::string &old_pin,
9682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                         const std::string &new_pin,
9782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                         Error *error, const ResultCallback &callback);
985d0d32c1b5e2370ff0739f7a2dbb641726d4bf87Ben Chan  virtual void Reset(Error *error, const ResultCallback &callback);
9982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
10082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void Scan(Error *error, const ResultCallback &callback);
10182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual std::string GetNetworkTechnologyString() const;
10282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual std::string GetRoamingStateString() const;
10382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void GetSignalQuality();
1049f09aeffcd088960c5b1a7d507c3705ce14b2b0dJason Glasgow  virtual std::string GetTypeString() const;
10582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void OnDBusPropertiesChanged(
10682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow      const std::string &interface,
10782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow      const DBusPropertiesMap &changed_properties,
10882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow      const std::vector<std::string> &invalidated_properties);
109af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  virtual bool AllowRoaming();
110f84a4242b4218dc375449ab2d68085226f43ce5bArman Uguray  virtual bool ShouldDetectOutOfCredit() const;
111145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow
11282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow protected:
11382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void InitProxies();
11482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void ReleaseProxies();
11582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
11672fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // Updates the |sim_path_| variable and creates a new proxy to the
11772fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // DBUS ModemManager1.Sim interface.
11872fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // TODO(armansito): Put this method in a 3GPP-only subclass.
11972fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  virtual void OnSimPathChanged(const std::string &sim_path);
12072fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray
12172fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // Updates the online payment portal information, if any, for the cellular
12272fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // provider.
12372fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  virtual void UpdateOLP();
12472fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray
1250a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  // Post-payment activation handlers.
1260a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  virtual void UpdatePendingActivationState();
1270a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray
128c539123120725dedc9055ec0b4171215946ac307Arman Uguray  // Updates the storage identifier used for the current cellular service.
129c539123120725dedc9055ec0b4171215946ac307Arman Uguray  virtual void UpdateStorageIdentifier();
130c539123120725dedc9055ec0b4171215946ac307Arman Uguray
13107193fdb601f4cea6301ebb85ebf20596807e126Ben Chan  // Returns the operator-specific form of |mdn_|, which is passed to the online
13207193fdb601f4cea6301ebb85ebf20596807e126Ben Chan  // payment portal of a cellular operator.
13307193fdb601f4cea6301ebb85ebf20596807e126Ben Chan  std::string GetMdnForOLP(
13407193fdb601f4cea6301ebb85ebf20596807e126Ben Chan      const CellularOperatorInfo::CellularOperator &cellular_operator) const;
13507193fdb601f4cea6301ebb85ebf20596807e126Ben Chan
1360a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  const std::string &mdn() const { return mdn_; }
1370a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  void set_mdn(const std::string &mdn) { mdn_ = mdn; }
1380a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray
1390a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  const std::string &min() const { return min_; }
1400a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  void set_min(const std::string &min) { min_ = min; }
14172fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray
14272fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  const std::string &meid() const { return meid_; }
14372fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  void set_meid(const std::string &meid) { meid_ = meid; }
14472fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray
14572fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  const std::string &esn() const { return esn_; }
14672fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  void set_esn(const std::string &esn) { esn_ = esn; }
14772fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray
14882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow private:
14974924d87cc111f8603751f09cd009c830f43e668Ben Chan  struct ModemModes {
15074924d87cc111f8603751f09cd009c830f43e668Ben Chan    ModemModes()
15174924d87cc111f8603751f09cd009c830f43e668Ben Chan        : allowed_modes(MM_MODEM_MODE_NONE),
15274924d87cc111f8603751f09cd009c830f43e668Ben Chan          preferred_mode(MM_MODEM_MODE_NONE) {}
15374924d87cc111f8603751f09cd009c830f43e668Ben Chan
15474924d87cc111f8603751f09cd009c830f43e668Ben Chan    ModemModes(uint32 allowed, MMModemMode preferred)
15574924d87cc111f8603751f09cd009c830f43e668Ben Chan        : allowed_modes(allowed),
15674924d87cc111f8603751f09cd009c830f43e668Ben Chan          preferred_mode(preferred) {}
15774924d87cc111f8603751f09cd009c830f43e668Ben Chan
15874924d87cc111f8603751f09cd009c830f43e668Ben Chan    uint32 allowed_modes;        // Bits based on MMModemMode.
15974924d87cc111f8603751f09cd009c830f43e668Ben Chan    MMModemMode preferred_mode;  // A single MMModemMode bit.
16074924d87cc111f8603751f09cd009c830f43e668Ben Chan  };
16174924d87cc111f8603751f09cd009c830f43e668Ben Chan
162cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  // Constants used in scan results.  Make available to unit tests.
163cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  // TODO(jglasgow): Generate from modem manager into ModemManager-names.h.
164ee6b3d7f9d49fa52072a352fbb59f06127b1ba4cPaul Stewart  // See http://crbug.com/212909.
165cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kStatusProperty[];
166cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kOperatorLongProperty[];
167cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kOperatorShortProperty[];
168cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kOperatorCodeProperty[];
169cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kOperatorAccessTechnologyProperty[];
170cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow
1719da07771df3dbbc99ff99114c26317d01f29f7fcmukesh agrawal  // As above, consider having this in ModemManager-names.h.
1729da07771df3dbbc99ff99114c26317d01f29f7fcmukesh agrawal  static const char kIpConfigPropertyMethod[];
1739da07771df3dbbc99ff99114c26317d01f29f7fcmukesh agrawal
174145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // Modem Model ID strings.  From modem firmware via modemmanager.
1754ffc03bc64007b999baa7b2749b385add3fac50eBen Chan  static const char kALT3100ModelId[];
176145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kE362ModelId[];
177145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow
1782717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray  // Generic service name prefix, shown when the correct carrier name is
1792717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray  // unknown.
1802717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray  static const char kGenericServiceNamePrefix[];
1812717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray
182a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  static const int64 kActivationRegistrationTimeoutMilliseconds;
183a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  static const int64 kDefaultScanningOrSearchingTimeoutMilliseconds;
184f6366ac746f63e4bacaa03ea8e524c2e8ec65aa8Arman Uguray  static const int64 kEnterPinTimeoutMilliseconds;
1858f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  static const int64 kRegistrationDroppedUpdateTimeoutMilliseconds;
1862cac294eff9415574cb9066e88f5cf43180a5092Thieu Le  static const int kSetPowerStateTimeoutMilliseconds;
187ee464d3c77dc7662973bfa5cb3c6eeb207366eacArman Uguray
1881361c0366043f3d2628dc7c339339116ce31085eArman Uguray
1896552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // Root path. The SIM path is reported by ModemManager to be the root path
1906552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // when no SIM is present.
1916552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  static const char kRootPath[];
1926552f8c74196782e9adf09f4fea01c836f551255Arman Uguray
19382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  friend class CellularTest;
19482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  friend class CellularCapabilityTest;
1953d27539b13590e0b149440ce017fdc401ef6e735Thieu Le  friend class CellularCapabilityUniversalTest;
19672fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  friend class CellularCapabilityUniversalCDMATest;
1970a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  FRIEND_TEST(CellularCapabilityUniversalCDMAMainTest, PropertiesChanged);
1980a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  FRIEND_TEST(CellularCapabilityUniversalCDMAMainTest, UpdateOLP);
199c539123120725dedc9055ec0b4171215946ac307Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalCDMAMainTest,
200c539123120725dedc9055ec0b4171215946ac307Arman Uguray              UpdateStorageIdentifier);
2011361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, AllowRoaming);
202a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
203a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray              ActivationWaitForRegisterTimeout);
2041361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, Connect);
2051361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, ConnectApns);
2061361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, CreateFriendlyServiceName);
2071361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, DisconnectNoProxy);
2087af0fac103deceec063554ef5705901d6d82d42fArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2098f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu              DisconnectWithDeferredCallback);
2108f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2117af0fac103deceec063554ef5705901d6d82d42fArman Uguray              GetNetworkTechnologyStringOnE362);
21207193fdb601f4cea6301ebb85ebf20596807e126Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, GetMdnForOLP);
2131361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, GetTypeString);
214c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, IsMdnValid);
2151361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, IsServiceActivationRequired);
2166552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, IsValidSimPath);
217510cc80c9a76755e3c38e92e677d379f39fa640bmukesh agrawal  FRIEND_TEST(CellularCapabilityUniversalMainTest,
218510cc80c9a76755e3c38e92e677d379f39fa640bmukesh agrawal              ListBearersOnModemStateChangedToConnected);
219d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, NormalizeMdn);
2201361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, OnListBearersReply);
221c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, OnLockRetriesChanged);
222c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, OnLockTypeChanged);
2231361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
224fcca27bd166ce485d9ef8afce5e060be935ece97Ben Chan              OnModemCurrentCapabilitiesChanged);
225c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, OnSimLockPropertiesChanged);
2261361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, PropertiesChanged);
2271361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, Reset);
2281361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, Scan);
2291361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, ScanFailure);
2301361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SetHomeProvider);
231d42d8ec85a9a1bdc406870b75d1b9e266fbaaa02Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
232f84a4242b4218dc375449ab2d68085226f43ce5bArman Uguray              ShouldDetectOutOfCredit);
2331361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SimLockStatusChanged);
234c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SimLockStatusToProperty);
2351361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SimPathChanged);
2361361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SimPropertiesChanged);
2371361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, StartModem);
238151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, StartModemFailure);
239151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, StartModemInWrongState);
240151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest,
241151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan              StartModemWithDeferredEnableFailure);
2421361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, StopModem);
2431361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, StopModemConnected);
2449f3dcf80a84c07701b7c224fca5ed637c966fa3eBen Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, TerminationAction);
2459f3dcf80a84c07701b7c224fca5ed637c966fa3eBen Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2469f3dcf80a84c07701b7c224fca5ed637c966fa3eBen Chan              TerminationActionRemovedByStopModem);
247510cc80c9a76755e3c38e92e677d379f39fa640bmukesh agrawal  FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateBearerPath);
2480a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2490a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray              UpdatePendingActivationState);
250efea6e0f28c3270038914e80166702d5ac23095eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2518f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu              UpdateRegistrationState);
2528f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2538f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu              UpdateRegistrationStateModemNotConnected);
2548f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  FRIEND_TEST(CellularCapabilityUniversalMainTest,
255efea6e0f28c3270038914e80166702d5ac23095eArman Uguray              UpdateServiceActivationState);
2561361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateServiceName);
2571361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateStorageIdentifier);
2581361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateOLP);
2591361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateOperatorInfo);
2601361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2611361c0366043f3d2628dc7c339339116ce31085eArman Uguray              UpdateOperatorInfoViaOperatorId);
2621361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateScanningProperty);
263a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalTimerTest, CompleteActivation);
2641361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalTimerTest,
2651361c0366043f3d2628dc7c339339116ce31085eArman Uguray              UpdateScanningPropertyTimeout);
266d42d8ec85a9a1bdc406870b75d1b9e266fbaaa02Arman Uguray  FRIEND_TEST(CellularTest, EnableTrafficMonitor);
26709fa2a0e9c0feed7b3ca23fc7d8ad59783f4c6a7Ben Chan  FRIEND_TEST(CellularTest,
26809fa2a0e9c0feed7b3ca23fc7d8ad59783f4c6a7Ben Chan              HandleNewRegistrationStateForServiceRequiringActivation);
2695218cf2bb1301197e0e3c9381bc4c66e8adf80b0Thieu Le  FRIEND_TEST(CellularTest, ModemStateChangeLostRegistration);
270f407d5934100e6f2106aeeede46bafb0074cee35mukesh agrawal  FRIEND_TEST(CellularTest, OnPPPDied);
27182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
272c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  // SimLockStatus represents the fields in the Cellular.SIMLockStatus
273c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  // DBUS property of the shill device.
274c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  struct SimLockStatus {
275c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray   public:
276c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray    SimLockStatus() : enabled(false),
277c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray                      lock_type(MM_MODEM_LOCK_UNKNOWN),
278c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray                      retries_left(0) {}
279c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray
280c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray    bool enabled;
281c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray    MMModemLock lock_type;
282c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray    uint32 retries_left;
283c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  };
284c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray
285ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  // Methods used in starting a modem
286151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  void EnableModem(bool deferralbe,
287151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan                   Error *error,
288151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan                   const ResultCallback& callback);
289151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  void EnableModemCompleted(bool deferrable,
290151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan                            const ResultCallback &callback,
291151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan                            const Error &error);
292ef96556fff984bbc79597669af2465905666ed09Jason Glasgow
293ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  // Methods used in stopping a modem
294ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  void Stop_Disable(const ResultCallback &callback);
295ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  void Stop_DisableCompleted(const ResultCallback &callback,
296ef96556fff984bbc79597669af2465905666ed09Jason Glasgow                             const Error &error);
297ee464d3c77dc7662973bfa5cb3c6eeb207366eacArman Uguray  void Stop_PowerDown(const ResultCallback &callback);
298ee464d3c77dc7662973bfa5cb3c6eeb207366eacArman Uguray  void Stop_PowerDownCompleted(const ResultCallback &callback,
299ee464d3c77dc7662973bfa5cb3c6eeb207366eacArman Uguray                               const Error &error);
300ef96556fff984bbc79597669af2465905666ed09Jason Glasgow
3012717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray  // Updates the name property that is exposed by the service to Chrome.
3022717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray  void UpdateServiceName();
3032717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray
3048a2c01e2d7fb27724f529adc3a0aa2daba9b1b44Ben Chan  void UpdateScanningProperty();
3058a2c01e2d7fb27724f529adc3a0aa2daba9b1b44Ben Chan
306d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray  // Methods used in acquiring information related to the carrier;
307d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray
30882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Updates the Universal operator name and country based on a newly
30982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // obtained network id.
31082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  void UpdateOperatorInfo();
31182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
312d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray  // Sets the upper level information about the home cellular provider from the
313d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray  // modem's IMSI and SPN.
314d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray  void SetHomeProvider();
315d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray
31682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Updates the serving operator on the active service.
31782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  void UpdateServingOperator();
31882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
319d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray  // Initializes the |apn_list_| property based on the current |home_provider_|.
320d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray  void InitAPNList();
321d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray
3226e5639f9ef54db278c5f2265d5364e5994966f4aArman Uguray  // Updates |bearer_path_| to match the currently active bearer.
3236e5639f9ef54db278c5f2265d5364e5994966f4aArman Uguray  void UpdateBearerPath();
3246e5639f9ef54db278c5f2265d5364e5994966f4aArman Uguray
32582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  Stringmap ParseScanResult(const ScanResult &result);
32682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
32782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  KeyValueStore SimLockStatusToProperty(Error *error);
32882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
32982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  void SetupApnTryList();
33082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  void FillConnectPropertyMap(DBusPropertiesMap *properties);
33182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
332bebf1b8bce52b88c2cc2d93200b9405f9c19cf21mukesh agrawal  void HelpRegisterConstDerivedKeyValueStore(
33382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow      const std::string &name,
334bebf1b8bce52b88c2cc2d93200b9405f9c19cf21mukesh agrawal      KeyValueStore(CellularCapabilityUniversal::*get)(Error *error));
33582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
336145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // Returns true if a connect error should be retried.  This function
337145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // abstracts modem specific behavior for modems which do a lousy job
338145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // of returning specific errors on connect failures.
339145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  bool RetriableConnectError(const Error &error) const;
340145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow
34182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Signal callbacks
3423022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams  void OnNetworkModeSignal(uint32 mode);
3437fce52c4afdc5e73a9e740dc9b90f1e61ae8cea4Eric Shienbrood  void OnModemStateChangedSignal(int32 old_state,
3447fce52c4afdc5e73a9e740dc9b90f1e61ae8cea4Eric Shienbrood                                 int32 new_state,
3457fce52c4afdc5e73a9e740dc9b90f1e61ae8cea4Eric Shienbrood                                 uint32 reason);
34682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
34782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Property Change notification handlers
3483022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams  void OnModemPropertiesChanged(
3494c0724af38d0eaf7155bb789280940a41ef9f08cJason Glasgow      const DBusPropertiesMap &properties,
3504c0724af38d0eaf7155bb789280940a41ef9f08cJason Glasgow      const std::vector<std::string> &invalidated_properties);
3514c0724af38d0eaf7155bb789280940a41ef9f08cJason Glasgow
3523022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams  void OnSignalQualityChanged(uint32 quality);
35374924d87cc111f8603751f09cd009c830f43e668Ben Chan
35474924d87cc111f8603751f09cd009c830f43e668Ben Chan  void OnSupportedCapabilitesChanged(
35574924d87cc111f8603751f09cd009c830f43e668Ben Chan      const std::vector<uint32> &supported_capabilities);
356af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnModemCurrentCapabilitiesChanged(uint32 current_capabilities);
357af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnMdnChanged(const std::string &mdn);
358af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnModemManufacturerChanged(const std::string &manufacturer);
359af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnModemModelChanged(const std::string &model);
360af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnModemRevisionChanged(const std::string &revision);
361af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnModemStateChanged(Cellular::ModemState state);
362af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnAccessTechnologiesChanged(uint32 access_technologies);
36374924d87cc111f8603751f09cd009c830f43e668Ben Chan  void OnSupportedModesChanged(const std::vector<ModemModes> &supported_modes);
36474924d87cc111f8603751f09cd009c830f43e668Ben Chan  void OnCurrentModesChanged(const ModemModes &current_modes);
365c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  void OnLockRetriesChanged(const LockRetryData &lock_retries);
366c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  void OnLockTypeChanged(MMModemLock unlock_required);
367af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnSimLockStatusChanged();
368af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow
369c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  // Returns false if the MDN is empty or if the MDN consists of all 0s.
370c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  bool IsMdnValid() const;
371c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray
372af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  // 3GPP property change handlers
373af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  virtual void OnModem3GPPPropertiesChanged(
374af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow      const DBusPropertiesMap &properties,
375af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow      const std::vector<std::string> &invalidated_properties);
376af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnImeiChanged(const std::string &imei);
377af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void On3GPPRegistrationChanged(MMModem3gppRegistrationState state,
378af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow                                 const std::string &operator_code,
379af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow                                 const std::string &operator_name);
3808f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  void Handle3GPPRegistrationChange(
3818f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu      MMModem3gppRegistrationState updated_state,
3828f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu      std::string updated_operator_code,
3838f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu      std::string updated_operator_name);
384af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnFacilityLocksChanged(uint32 locks);
385af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow
386af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  // SIM property change handlers
38772fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // TODO(armansito): Put these methods in a 3GPP-only subclass.
388af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnSimPropertiesChanged(
389af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow      const DBusPropertiesMap &props,
390af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow      const std::vector<std::string> &invalidated_properties);
391af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnImsiChanged(const std::string &imsi);
392d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray  void OnSpnChanged(const std::string &spn);
393af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnSimIdentifierChanged(const std::string &id);
394af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnOperatorIdChanged(const std::string &operator_id);
395af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnOperatorNameChanged(const std::string &operator_name);
396ef96556fff984bbc79597669af2465905666ed09Jason Glasgow
39782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Method callbacks
3983022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams  void OnRegisterReply(const ResultCallback &callback,
3993022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams                       const Error &error);
4005d0d32c1b5e2370ff0739f7a2dbb641726d4bf87Ben Chan  void OnResetReply(const ResultCallback &callback, const Error &error);
4013022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams  void OnScanReply(const ResultCallback &callback,
4023022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams                   const ScanResults &results,
4033022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams                   const Error &error);
404b54974f033f713690135f3f3516ca14aa7ee6cfdNathan Williams  void OnConnectReply(const ResultCallback &callback,
405b54974f033f713690135f3f3516ca14aa7ee6cfdNathan Williams                      const DBus::Path &bearer,
406b54974f033f713690135f3f3516ca14aa7ee6cfdNathan Williams                      const Error &error);
4076e5639f9ef54db278c5f2265d5364e5994966f4aArman Uguray  void OnListBearersReply(const std::vector<DBus::Path> &paths,
4086e5639f9ef54db278c5f2265d5364e5994966f4aArman Uguray                          const Error &error);
40982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
4101361c0366043f3d2628dc7c339339116ce31085eArman Uguray  // Timeout callback for the network scan initiated when Cellular connectivity
4111361c0366043f3d2628dc7c339339116ce31085eArman Uguray  // gets enabled.
4121361c0366043f3d2628dc7c339339116ce31085eArman Uguray  void OnScanningOrSearchingTimeout();
4131361c0366043f3d2628dc7c339339116ce31085eArman Uguray
414a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  // Timeout callback that is called if the modem takes too long to register to
415a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  // a network after online payment is complete. Resets the modem.
416a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  void OnActivationWaitForRegisterTimeout();
417a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray
4186552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // Returns true, if |sim_path| constitutes a valid SIM path. Currently, a
4196552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // path is accepted to be valid, as long as it is not equal to one of ""
4206552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // and "/".
4216552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  bool IsValidSimPath(const std::string &sim_path) const;
4226552f8c74196782e9adf09f4fea01c836f551255Arman Uguray
423d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan  // Returns the normalized version of |mdn| by keeping only digits in |mdn|
424d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan  // and removing other non-digit characters.
425d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan  std::string NormalizeMdn(const std::string &mdn) const;
426d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan
4272717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray  static std::string GenerateNewGenericServiceName();
4282717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray
429c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  // Post-payment activation handlers.
430c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  void ResetAfterActivation();
431efea6e0f28c3270038914e80166702d5ac23095eArman Uguray  void UpdateServiceActivationState();
432c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  void OnResetAfterActivationReply(const Error &error);
433c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray
4348f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  static bool IsRegisteredState(MMModem3gppRegistrationState state);
4358f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu
43682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  scoped_ptr<mm1::ModemModem3gppProxyInterface> modem_3gpp_proxy_;
43782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  scoped_ptr<mm1::ModemProxyInterface> modem_proxy_;
43882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  scoped_ptr<mm1::ModemSimpleProxyInterface> modem_simple_proxy_;
43982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  scoped_ptr<mm1::SimProxyInterface> sim_proxy_;
44082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
44182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  base::WeakPtrFactory<CellularCapabilityUniversal> weak_ptr_factory_;
44282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
44382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  MMModem3gppRegistrationState registration_state_;
444af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow
445af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  // Bits based on MMModemCapabilities
44674924d87cc111f8603751f09cd009c830f43e668Ben Chan  std::vector<uint32> supported_capabilities_;  // Technologies supported
44774924d87cc111f8603751f09cd009c830f43e668Ben Chan  uint32 current_capabilities_;  // Technologies supported without a reload
448145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  uint32 access_technologies_;   // Bits based on MMModemAccessTechnology
44974924d87cc111f8603751f09cd009c830f43e668Ben Chan  std::vector<ModemModes> supported_modes_;
45074924d87cc111f8603751f09cd009c830f43e668Ben Chan  ModemModes current_modes_;
451af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow
45282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  Cellular::Operator serving_operator_;
45382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string spn_;
454af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  std::string sim_identifier_;
455af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  std::string operator_id_;
45682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  mobile_provider *home_provider_;
457f508c8273e6265599f184189a424e697598eb980Darin Petkov  bool provider_requires_roaming_;
45882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string desired_network_;
45982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
46082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Properties.
46182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string carrier_;
46282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string esn_;
46382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string firmware_revision_;
46482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string hardware_revision_;
46582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string imei_;
46682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string imsi_;
46782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string manufacturer_;
46882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string mdn_;
46982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string meid_;
47082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string min_;
47182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string model_id_;
47282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string selected_network_;
47382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  Stringmaps found_networks_;
47482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::deque<Stringmap> apn_try_list_;
4755d0d32c1b5e2370ff0739f7a2dbb641726d4bf87Ben Chan  bool resetting_;
47682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  bool scanning_supported_;
47782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  bool scanning_;
4788a2c01e2d7fb27724f529adc3a0aa2daba9b1b44Ben Chan  bool scanning_or_searching_;
47982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  uint16 scan_interval_;
48082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  SimLockStatus sim_lock_status_;
48182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  Stringmaps apn_list_;
482ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  std::string sim_path_;
483bd3aee80be371d838863eccf708fd107153503efBen Chan  bool sim_present_;
484b54974f033f713690135f3f3516ca14aa7ee6cfdNathan Williams  DBus::Path bearer_path_;
485c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  bool reset_done_;
486c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray
487e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // If the modem is not in a state to be enabled when StartModem is called,
488e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // enabling is deferred using this callback.
489e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  base::Closure deferred_enable_modem_callback_;
490e285a84b38b81f5557b576da187d037ad24ae4afGary Morain
4911361c0366043f3d2628dc7c339339116ce31085eArman Uguray  // Sometimes modems may be stuck in the SEARCHING state during the lack of
4921361c0366043f3d2628dc7c339339116ce31085eArman Uguray  // presence of a network. During this indefinite duration of time, keeping
4931361c0366043f3d2628dc7c339339116ce31085eArman Uguray  // the Device.Scanning property as |true| causes a bad user experience.
4941361c0366043f3d2628dc7c339339116ce31085eArman Uguray  // This callback sets it to |false| after a timeout period has passed.
4951361c0366043f3d2628dc7c339339116ce31085eArman Uguray  base::CancelableClosure scanning_or_searching_timeout_callback_;
496a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  int64 scanning_or_searching_timeout_milliseconds_;
497a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray
498a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  base::CancelableClosure activation_wait_for_registration_callback_;
499a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  int64 activation_registration_timeout_milliseconds_;
5001361c0366043f3d2628dc7c339339116ce31085eArman Uguray
5018f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  // Sometimes flaky cellular network causes the 3GPP registration state to
5028f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  // rapidly change from registered --> searching and back. Delay such updates
5038f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  // a little to smooth over temporary registration loss.
5048f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  base::CancelableClosure registration_dropped_update_callback_;
5058f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  int64 registration_dropped_update_timeout_milliseconds_;
5068f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu
50782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  static unsigned int friendly_service_name_id_;
50882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
50982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  DISALLOW_COPY_AND_ASSIGN(CellularCapabilityUniversal);
51082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow};
51182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
51282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow}  // namespace shill
51382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
514145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow#endif  // SHILL_CELLULAR_CAPABILITY_UNIVERSAL_H_
515