cellular_capability_universal.h revision 016fa0e9c8f47630c8e6c440ace42ba99f8498df
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"
202849214ae17c9bd87c10f9012edfe469cf189a80Thieu Le#include "shill/cellular_bearer.h"
2182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include "shill/cellular_capability.h"
2282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include "shill/mm1_modem_modem3gpp_proxy_interface.h"
2382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include "shill/mm1_modem_proxy_interface.h"
2482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include "shill/mm1_modem_simple_proxy_interface.h"
2582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include "shill/mm1_sim_proxy_interface.h"
2643ce4d428d619bda64eea6d37534f02c179a1756Thieu Le#include "shill/out_of_credits_detector.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);
60f98f00e52f3408fd3ca6184f19636efb7e66b986Ben Chan  virtual ~CellularCapabilityUniversal();
6182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
6282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Inherited from CellularCapability.
63016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  std::string GetTypeString() const override;
64016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void OnDBusPropertiesChanged(
65f98f00e52f3408fd3ca6184f19636efb7e66b986Ben Chan      const std::string &interface,
66f98f00e52f3408fd3ca6184f19636efb7e66b986Ben Chan      const DBusPropertiesMap &changed_properties,
67f98f00e52f3408fd3ca6184f19636efb7e66b986Ben Chan      const std::vector<std::string> &invalidated_properties) override;
68e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // Checks the modem state.  If the state is kModemStateDisabled, then the
69e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // modem is enabled.  Otherwise, the enable command is buffered until the
70e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // modem becomes disabled.  ModemManager rejects the enable command if the
711ee9391c97a19fc6e618d8f23748b49acbf868d0Arman Uguray  // modem is not disabled, for example, if it is initializing instead.
72016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void StartModem(Error *error, const ResultCallback &callback) override;
73016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void StopModem(Error *error, const ResultCallback &callback) override;
74016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void Reset(Error *error, const ResultCallback &callback) override;
75016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  bool AreProxiesInitialized() const override;
76016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  bool IsServiceActivationRequired() const override;
77016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void CompleteActivation(Error *error) override;
78016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void Scan(Error *error, const ResultStringmapsCallback &callback) override;
79016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void RegisterOnNetwork(const std::string &network_id,
80f98f00e52f3408fd3ca6184f19636efb7e66b986Ben Chan                         Error *error,
81f98f00e52f3408fd3ca6184f19636efb7e66b986Ben Chan                         const ResultCallback &callback) override;
82016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  bool IsRegistered() const override;
83016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void SetUnregistered(bool searching) override;
84016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void OnServiceCreated() override;
85016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  std::string GetNetworkTechnologyString() const override;
86016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  std::string GetRoamingStateString() const override;
87016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  bool AllowRoaming() override;
88016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void GetSignalQuality() override;
89016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void SetupConnectProperties(DBusPropertiesMap *properties) override;
90016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void Connect(const DBusPropertiesMap &properties,
91016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko               Error *error,
92016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko               const ResultCallback &callback) override;
93016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void Disconnect(Error *error, const ResultCallback &callback) override;
94016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  CellularBearer *GetActiveBearer() const override;
95016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void RequirePIN(const std::string &pin,
96016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko                  bool require,
97016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko                  Error *error,
98016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko                  const ResultCallback &callback) override;
99016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void EnterPIN(const std::string &pin,
100016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko                Error *error,
101016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko                const ResultCallback &callback) override;
102016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void UnblockPIN(const std::string &unblock_code,
103016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko                  const std::string &pin,
104016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko                  Error *error,
105016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko                  const ResultCallback &callback) override;
106016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void ChangePIN(const std::string &old_pin,
107016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko                 const std::string &new_pin,
108016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko                 Error *error,
109016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko                 const ResultCallback &callback) override;
11082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
111f98f00e52f3408fd3ca6184f19636efb7e66b986Ben Chan  virtual void GetProperties();
112f98f00e52f3408fd3ca6184f19636efb7e66b986Ben Chan  virtual void Register(const ResultCallback &callback);
113145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow
11482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow protected:
11582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void InitProxies();
11682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void ReleaseProxies();
11782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
11872fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // Updates the |sim_path_| variable and creates a new proxy to the
11972fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // DBUS ModemManager1.Sim interface.
12072fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // TODO(armansito): Put this method in a 3GPP-only subclass.
12172fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  virtual void OnSimPathChanged(const std::string &sim_path);
12272fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray
12372fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // Updates the online payment portal information, if any, for the cellular
12472fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // provider.
125016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void UpdateServiceOLP() override;
12672fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray
1270a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  // Post-payment activation handlers.
1280a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  virtual void UpdatePendingActivationState();
1290a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray
1309f06c870229b00cdd19224cb12c4202de65772aePrathmesh Prabhu  // Returns the operator-specific form of |mdn|, which is passed to the online
13107193fdb601f4cea6301ebb85ebf20596807e126Ben Chan  // payment portal of a cellular operator.
13292df619a98585c7fe7b072fe07f60b43c9ec52ddPrathmesh Prabhu  std::string GetMdnForOLP(const MobileOperatorInfo *operator_info) const;
13307193fdb601f4cea6301ebb85ebf20596807e126Ben Chan
13482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow private:
13574924d87cc111f8603751f09cd009c830f43e668Ben Chan  struct ModemModes {
13674924d87cc111f8603751f09cd009c830f43e668Ben Chan    ModemModes()
13774924d87cc111f8603751f09cd009c830f43e668Ben Chan        : allowed_modes(MM_MODEM_MODE_NONE),
13874924d87cc111f8603751f09cd009c830f43e668Ben Chan          preferred_mode(MM_MODEM_MODE_NONE) {}
13974924d87cc111f8603751f09cd009c830f43e668Ben Chan
1407fab89734d88724a288e96a9996b15548c5294c7Ben Chan    ModemModes(uint32_t allowed, MMModemMode preferred)
14174924d87cc111f8603751f09cd009c830f43e668Ben Chan        : allowed_modes(allowed),
14274924d87cc111f8603751f09cd009c830f43e668Ben Chan          preferred_mode(preferred) {}
14374924d87cc111f8603751f09cd009c830f43e668Ben Chan
1447fab89734d88724a288e96a9996b15548c5294c7Ben Chan    uint32_t allowed_modes;        // Bits based on MMModemMode.
14574924d87cc111f8603751f09cd009c830f43e668Ben Chan    MMModemMode preferred_mode;  // A single MMModemMode bit.
14674924d87cc111f8603751f09cd009c830f43e668Ben Chan  };
14774924d87cc111f8603751f09cd009c830f43e668Ben Chan
148cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  // Constants used in scan results.  Make available to unit tests.
149cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  // TODO(jglasgow): Generate from modem manager into ModemManager-names.h.
150ee6b3d7f9d49fa52072a352fbb59f06127b1ba4cPaul Stewart  // See http://crbug.com/212909.
151cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kStatusProperty[];
152cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kOperatorLongProperty[];
153cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kOperatorShortProperty[];
154cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kOperatorCodeProperty[];
155cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kOperatorAccessTechnologyProperty[];
156cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow
157145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // Modem Model ID strings.  From modem firmware via modemmanager.
158145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kE362ModelId[];
159145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow
160c466ccb31d7f64d4dae38149c118d9612cbe5f30Thieu Le  // Plugin strings via modemmanager.
161c466ccb31d7f64d4dae38149c118d9612cbe5f30Thieu Le  static const char kAltairLTEMMPlugin[];
162c466ccb31d7f64d4dae38149c118d9612cbe5f30Thieu Le
1637fab89734d88724a288e96a9996b15548c5294c7Ben Chan  static const int64_t kActivationRegistrationTimeoutMilliseconds;
1647fab89734d88724a288e96a9996b15548c5294c7Ben Chan  static const int64_t kEnterPinTimeoutMilliseconds;
1657fab89734d88724a288e96a9996b15548c5294c7Ben Chan  static const int64_t kRegistrationDroppedUpdateTimeoutMilliseconds;
1662cac294eff9415574cb9066e88f5cf43180a5092Thieu Le  static const int kSetPowerStateTimeoutMilliseconds;
167ee464d3c77dc7662973bfa5cb3c6eeb207366eacArman Uguray
1681361c0366043f3d2628dc7c339339116ce31085eArman Uguray
1696552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // Root path. The SIM path is reported by ModemManager to be the root path
1706552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // when no SIM is present.
1716552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  static const char kRootPath[];
1726552f8c74196782e9adf09f4fea01c836f551255Arman Uguray
17382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  friend class CellularTest;
17482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  friend class CellularCapabilityTest;
1753d27539b13590e0b149440ce017fdc401ef6e735Thieu Le  friend class CellularCapabilityUniversalTest;
17672fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  friend class CellularCapabilityUniversalCDMATest;
1770a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  FRIEND_TEST(CellularCapabilityUniversalCDMAMainTest, PropertiesChanged);
1781361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, AllowRoaming);
179a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
180a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray              ActivationWaitForRegisterTimeout);
1811361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, Connect);
1821361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, ConnectApns);
1831361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, DisconnectNoProxy);
1847af0fac103deceec063554ef5705901d6d82d42fArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
1858f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu              DisconnectWithDeferredCallback);
18643ce4d428d619bda64eea6d37534f02c179a1756Thieu Le  FRIEND_TEST(CellularCapabilityUniversalMainTest, ExtractPcoValue);
18743ce4d428d619bda64eea6d37534f02c179a1756Thieu Le  FRIEND_TEST(CellularCapabilityUniversalMainTest, GetMdnForOLP);
1888f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  FRIEND_TEST(CellularCapabilityUniversalMainTest,
1897af0fac103deceec063554ef5705901d6d82d42fArman Uguray              GetNetworkTechnologyStringOnE362);
19043ce4d428d619bda64eea6d37534f02c179a1756Thieu Le  FRIEND_TEST(CellularCapabilityUniversalMainTest,
19143ce4d428d619bda64eea6d37534f02c179a1756Thieu Le              GetOutOfCreditsDetectionType);
1921361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, GetTypeString);
193c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, IsMdnValid);
19431ce564d64f68172299d4cde60edd7a5c004b38eBen Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, IsRegistered);
1951361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, IsServiceActivationRequired);
1966552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, IsValidSimPath);
197d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, NormalizeMdn);
198c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, OnLockRetriesChanged);
199c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, OnLockTypeChanged);
2001361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
201fcca27bd166ce485d9ef8afce5e060be935ece97Ben Chan              OnModemCurrentCapabilitiesChanged);
202c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, OnSimLockPropertiesChanged);
2031361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, PropertiesChanged);
2041361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, Reset);
2051361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, Scan);
2061361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, ScanFailure);
2071361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SimLockStatusChanged);
208c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SimLockStatusToProperty);
2091361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SimPathChanged);
2101361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SimPropertiesChanged);
2111361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, StartModem);
212151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, StartModemFailure);
213151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, StartModemInWrongState);
214151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest,
215151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan              StartModemWithDeferredEnableFailure);
2161361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, StopModem);
217c466ccb31d7f64d4dae38149c118d9612cbe5f30Thieu Le  FRIEND_TEST(CellularCapabilityUniversalMainTest, StopModemAltair);
218b0074e8a58f829c602231f6387b1e654f657011fThieu Le  FRIEND_TEST(CellularCapabilityUniversalMainTest,
219c466ccb31d7f64d4dae38149c118d9612cbe5f30Thieu Le              StopModemAltairDeleteBearerFailure);
220c466ccb31d7f64d4dae38149c118d9612cbe5f30Thieu Le  FRIEND_TEST(CellularCapabilityUniversalMainTest, StopModemAltairNotConnected);
2211361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, StopModemConnected);
2229f3dcf80a84c07701b7c224fca5ed637c966fa3eBen Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, TerminationAction);
2239f3dcf80a84c07701b7c224fca5ed637c966fa3eBen Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2249f3dcf80a84c07701b7c224fca5ed637c966fa3eBen Chan              TerminationActionRemovedByStopModem);
225539ab0266ef93a3198f12b8be83a6312d35d6ba0Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateActiveBearer);
2260a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2270a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray              UpdatePendingActivationState);
228efea6e0f28c3270038914e80166702d5ac23095eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2298f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu              UpdateRegistrationState);
2308f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2318f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu              UpdateRegistrationStateModemNotConnected);
2328f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  FRIEND_TEST(CellularCapabilityUniversalMainTest,
233efea6e0f28c3270038914e80166702d5ac23095eArman Uguray              UpdateServiceActivationState);
23492df619a98585c7fe7b072fe07f60b43c9ec52ddPrathmesh Prabhu  FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateServiceOLP);
235a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalTimerTest, CompleteActivation);
236d42d8ec85a9a1bdc406870b75d1b9e266fbaaa02Arman Uguray  FRIEND_TEST(CellularTest, EnableTrafficMonitor);
23709fa2a0e9c0feed7b3ca23fc7d8ad59783f4c6a7Ben Chan  FRIEND_TEST(CellularTest,
23809fa2a0e9c0feed7b3ca23fc7d8ad59783f4c6a7Ben Chan              HandleNewRegistrationStateForServiceRequiringActivation);
2395218cf2bb1301197e0e3c9381bc4c66e8adf80b0Thieu Le  FRIEND_TEST(CellularTest, ModemStateChangeLostRegistration);
240f407d5934100e6f2106aeeede46bafb0074cee35mukesh agrawal  FRIEND_TEST(CellularTest, OnPPPDied);
24182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
242c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  // SimLockStatus represents the fields in the Cellular.SIMLockStatus
243c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  // DBUS property of the shill device.
244c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  struct SimLockStatus {
245c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray   public:
246c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray    SimLockStatus() : enabled(false),
247c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray                      lock_type(MM_MODEM_LOCK_UNKNOWN),
248c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray                      retries_left(0) {}
249c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray
250c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray    bool enabled;
251c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray    MMModemLock lock_type;
2527fab89734d88724a288e96a9996b15548c5294c7Ben Chan    uint32_t retries_left;
253c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  };
254c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray
2559a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  // SubscriptionState represents the provisioned state of SIM. It is used
2569a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  // currently by activation logic for LTE to determine if activation process is
2579a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  // complete.
2589a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  enum SubscriptionState {
2599a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu    kSubscriptionStateUnknown = 0,
2609a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu    kSubscriptionStateUnprovisioned = 1,
2619a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu    kSubscriptionStateProvisioned = 2,
2629a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu    kSubscriptionStateOutOfData = 3
2639a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  };
2649a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu
265ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  // Methods used in starting a modem
266151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  void EnableModem(bool deferralbe,
267151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan                   Error *error,
268151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan                   const ResultCallback& callback);
269151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  void EnableModemCompleted(bool deferrable,
270151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan                            const ResultCallback &callback,
271151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan                            const Error &error);
272ef96556fff984bbc79597669af2465905666ed09Jason Glasgow
273ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  // Methods used in stopping a modem
2742849214ae17c9bd87c10f9012edfe469cf189a80Thieu Le  void Stop_DeleteActiveBearer(const ResultCallback &callback);
2752849214ae17c9bd87c10f9012edfe469cf189a80Thieu Le  void Stop_DeleteActiveBearerCompleted(const ResultCallback &callback,
2762849214ae17c9bd87c10f9012edfe469cf189a80Thieu Le                                        const Error &error);
277ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  void Stop_Disable(const ResultCallback &callback);
278ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  void Stop_DisableCompleted(const ResultCallback &callback,
279ef96556fff984bbc79597669af2465905666ed09Jason Glasgow                             const Error &error);
280ee464d3c77dc7662973bfa5cb3c6eeb207366eacArman Uguray  void Stop_PowerDown(const ResultCallback &callback);
281ee464d3c77dc7662973bfa5cb3c6eeb207366eacArman Uguray  void Stop_PowerDownCompleted(const ResultCallback &callback,
282ee464d3c77dc7662973bfa5cb3c6eeb207366eacArman Uguray                               const Error &error);
283ef96556fff984bbc79597669af2465905666ed09Jason Glasgow
284539ab0266ef93a3198f12b8be83a6312d35d6ba0Ben Chan  // Updates |active_bearer_| to match the currently active bearer.
285539ab0266ef93a3198f12b8be83a6312d35d6ba0Ben Chan  void UpdateActiveBearer();
2866e5639f9ef54db278c5f2265d5364e5994966f4aArman Uguray
28782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  Stringmap ParseScanResult(const ScanResult &result);
28882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
28982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  KeyValueStore SimLockStatusToProperty(Error *error);
29082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
29182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  void SetupApnTryList();
29282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  void FillConnectPropertyMap(DBusPropertiesMap *properties);
29382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
294bebf1b8bce52b88c2cc2d93200b9405f9c19cf21mukesh agrawal  void HelpRegisterConstDerivedKeyValueStore(
29582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow      const std::string &name,
296bebf1b8bce52b88c2cc2d93200b9405f9c19cf21mukesh agrawal      KeyValueStore(CellularCapabilityUniversal::*get)(Error *error));
29782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
298145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // Returns true if a connect error should be retried.  This function
299145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // abstracts modem specific behavior for modems which do a lousy job
300145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // of returning specific errors on connect failures.
301145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  bool RetriableConnectError(const Error &error) const;
302145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow
30382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Signal callbacks
3047fab89734d88724a288e96a9996b15548c5294c7Ben Chan  void OnNetworkModeSignal(uint32_t mode);
3057fab89734d88724a288e96a9996b15548c5294c7Ben Chan  void OnModemStateChangedSignal(int32_t old_state,
3067fab89734d88724a288e96a9996b15548c5294c7Ben Chan                                 int32_t new_state,
3077fab89734d88724a288e96a9996b15548c5294c7Ben Chan                                 uint32_t reason);
30882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
30982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Property Change notification handlers
3103022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams  void OnModemPropertiesChanged(
3114c0724af38d0eaf7155bb789280940a41ef9f08cJason Glasgow      const DBusPropertiesMap &properties,
3124c0724af38d0eaf7155bb789280940a41ef9f08cJason Glasgow      const std::vector<std::string> &invalidated_properties);
3134c0724af38d0eaf7155bb789280940a41ef9f08cJason Glasgow
3147fab89734d88724a288e96a9996b15548c5294c7Ben Chan  void OnSignalQualityChanged(uint32_t quality);
31574924d87cc111f8603751f09cd009c830f43e668Ben Chan
31674924d87cc111f8603751f09cd009c830f43e668Ben Chan  void OnSupportedCapabilitesChanged(
3177fab89734d88724a288e96a9996b15548c5294c7Ben Chan      const std::vector<uint32_t> &supported_capabilities);
3187fab89734d88724a288e96a9996b15548c5294c7Ben Chan  void OnModemCurrentCapabilitiesChanged(uint32_t current_capabilities);
319af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnMdnChanged(const std::string &mdn);
320af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnModemRevisionChanged(const std::string &revision);
321af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnModemStateChanged(Cellular::ModemState state);
3227fab89734d88724a288e96a9996b15548c5294c7Ben Chan  void OnAccessTechnologiesChanged(uint32_t access_technologies);
32374924d87cc111f8603751f09cd009c830f43e668Ben Chan  void OnSupportedModesChanged(const std::vector<ModemModes> &supported_modes);
32474924d87cc111f8603751f09cd009c830f43e668Ben Chan  void OnCurrentModesChanged(const ModemModes &current_modes);
325cbef8123fa639622b1aa86d7a041a02347ddc69dBen Chan  void OnBearersChanged(const RpcIdentifiers &bearers);
326c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  void OnLockRetriesChanged(const LockRetryData &lock_retries);
327c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  void OnLockTypeChanged(MMModemLock unlock_required);
328af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnSimLockStatusChanged();
329af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow
330c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  // Returns false if the MDN is empty or if the MDN consists of all 0s.
331c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  bool IsMdnValid() const;
332c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray
333af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  // 3GPP property change handlers
334af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  virtual void OnModem3GPPPropertiesChanged(
335af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow      const DBusPropertiesMap &properties,
336af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow      const std::vector<std::string> &invalidated_properties);
337af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void On3GPPRegistrationChanged(MMModem3gppRegistrationState state,
338af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow                                 const std::string &operator_code,
339af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow                                 const std::string &operator_name);
3408f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  void Handle3GPPRegistrationChange(
3418f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu      MMModem3gppRegistrationState updated_state,
3428f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu      std::string updated_operator_code,
3438f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu      std::string updated_operator_name);
3449a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  void On3GPPSubscriptionStateChanged(MMModem3gppSubscriptionState state);
3457fab89734d88724a288e96a9996b15548c5294c7Ben Chan  void OnFacilityLocksChanged(uint32_t locks);
346af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow
347af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  // SIM property change handlers
34872fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // TODO(armansito): Put these methods in a 3GPP-only subclass.
349af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnSimPropertiesChanged(
350af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow      const DBusPropertiesMap &props,
351af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow      const std::vector<std::string> &invalidated_properties);
352d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray  void OnSpnChanged(const std::string &spn);
353af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnSimIdentifierChanged(const std::string &id);
354af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnOperatorIdChanged(const std::string &operator_id);
355af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnOperatorNameChanged(const std::string &operator_name);
356ef96556fff984bbc79597669af2465905666ed09Jason Glasgow
35782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Method callbacks
3583022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams  void OnRegisterReply(const ResultCallback &callback,
3593022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams                       const Error &error);
3605d0d32c1b5e2370ff0739f7a2dbb641726d4bf87Ben Chan  void OnResetReply(const ResultCallback &callback, const Error &error);
36149ffffd458c2407c67c2d0d572974e91c7e9bea7Prathmesh Prabhu  void OnScanReply(const ResultStringmapsCallback &callback,
3623022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams                   const ScanResults &results,
3633022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams                   const Error &error);
364b54974f033f713690135f3f3516ca14aa7ee6cfdNathan Williams  void OnConnectReply(const ResultCallback &callback,
365b54974f033f713690135f3f3516ca14aa7ee6cfdNathan Williams                      const DBus::Path &bearer,
366b54974f033f713690135f3f3516ca14aa7ee6cfdNathan Williams                      const Error &error);
36782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
3686552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // Returns true, if |sim_path| constitutes a valid SIM path. Currently, a
3696552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // path is accepted to be valid, as long as it is not equal to one of ""
3706552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // and "/".
3716552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  bool IsValidSimPath(const std::string &sim_path) const;
3726552f8c74196782e9adf09f4fea01c836f551255Arman Uguray
373d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan  // Returns the normalized version of |mdn| by keeping only digits in |mdn|
374d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan  // and removing other non-digit characters.
375d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan  std::string NormalizeMdn(const std::string &mdn) const;
376d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan
377c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  // Post-payment activation handlers.
378c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  void ResetAfterActivation();
379efea6e0f28c3270038914e80166702d5ac23095eArman Uguray  void UpdateServiceActivationState();
380c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  void OnResetAfterActivationReply(const Error &error);
381c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray
3828f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  static bool IsRegisteredState(MMModem3gppRegistrationState state);
3838f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu
38443ce4d428d619bda64eea6d37534f02c179a1756Thieu Le  // Returns the out-of-credits detection algorithm to be used on this modem.
38543ce4d428d619bda64eea6d37534f02c179a1756Thieu Le  OutOfCreditsDetector::OOCType GetOutOfCreditsDetectionType() const;
38643ce4d428d619bda64eea6d37534f02c179a1756Thieu Le
3872849214ae17c9bd87c10f9012edfe469cf189a80Thieu Le  // For unit tests.
3882849214ae17c9bd87c10f9012edfe469cf189a80Thieu Le  void set_active_bearer(CellularBearer *bearer) {
3892849214ae17c9bd87c10f9012edfe469cf189a80Thieu Le    active_bearer_.reset(bearer);  // Takes ownership
3902849214ae17c9bd87c10f9012edfe469cf189a80Thieu Le  }
3912849214ae17c9bd87c10f9012edfe469cf189a80Thieu Le
39282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  scoped_ptr<mm1::ModemModem3gppProxyInterface> modem_3gpp_proxy_;
39382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  scoped_ptr<mm1::ModemProxyInterface> modem_proxy_;
39482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  scoped_ptr<mm1::ModemSimpleProxyInterface> modem_simple_proxy_;
39582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  scoped_ptr<mm1::SimProxyInterface> sim_proxy_;
396afe636676760df31a8db2f4b77bfd19faae52782Prathmesh Prabhu  // Used to enrich information about the network operator in |ParseScanResult|.
397afe636676760df31a8db2f4b77bfd19faae52782Prathmesh Prabhu  // TODO(pprabhu) Instead instantiate a local |MobileOperatorInfo| instance
398afe636676760df31a8db2f4b77bfd19faae52782Prathmesh Prabhu  // once the context has been separated out. (crbug.com/363874)
399afe636676760df31a8db2f4b77bfd19faae52782Prathmesh Prabhu  scoped_ptr<MobileOperatorInfo> mobile_operator_info_;
40082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
40182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  base::WeakPtrFactory<CellularCapabilityUniversal> weak_ptr_factory_;
40282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
40382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  MMModem3gppRegistrationState registration_state_;
404af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow
405af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  // Bits based on MMModemCapabilities
4067fab89734d88724a288e96a9996b15548c5294c7Ben Chan  std::vector<uint32_t> supported_capabilities_;  // Technologies supported
4077fab89734d88724a288e96a9996b15548c5294c7Ben Chan  uint32_t current_capabilities_;  // Technologies supported without a reload
4087fab89734d88724a288e96a9996b15548c5294c7Ben Chan  uint32_t access_technologies_;   // Bits based on MMModemAccessTechnology
40974924d87cc111f8603751f09cd009c830f43e668Ben Chan  std::vector<ModemModes> supported_modes_;
41074924d87cc111f8603751f09cd009c830f43e668Ben Chan  ModemModes current_modes_;
411af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow
41282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  Cellular::Operator serving_operator_;
41382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string spn_;
41482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string desired_network_;
41582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
41682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Properties.
41782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::deque<Stringmap> apn_try_list_;
4185d0d32c1b5e2370ff0739f7a2dbb641726d4bf87Ben Chan  bool resetting_;
41982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  SimLockStatus sim_lock_status_;
4209a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  SubscriptionState subscription_state_;
421ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  std::string sim_path_;
422539ab0266ef93a3198f12b8be83a6312d35d6ba0Ben Chan  scoped_ptr<CellularBearer> active_bearer_;
423cbef8123fa639622b1aa86d7a041a02347ddc69dBen Chan  RpcIdentifiers bearer_paths_;
424c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  bool reset_done_;
425c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray
426e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // If the modem is not in a state to be enabled when StartModem is called,
427e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // enabling is deferred using this callback.
428e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  base::Closure deferred_enable_modem_callback_;
429e285a84b38b81f5557b576da187d037ad24ae4afGary Morain
4308f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  // Sometimes flaky cellular network causes the 3GPP registration state to
4318f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  // rapidly change from registered --> searching and back. Delay such updates
4328f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  // a little to smooth over temporary registration loss.
4338f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  base::CancelableClosure registration_dropped_update_callback_;
4347fab89734d88724a288e96a9996b15548c5294c7Ben Chan  int64_t registration_dropped_update_timeout_milliseconds_;
4358f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu
43682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  DISALLOW_COPY_AND_ASSIGN(CellularCapabilityUniversal);
43782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow};
43882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
43982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow}  // namespace shill
44082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
441145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow#endif  // SHILL_CELLULAR_CAPABILITY_UNIVERSAL_H_
442