cellular_capability_universal.h revision 539ab0266ef93a3198f12b8be83a6312d35d6ba0
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"
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
32539ab0266ef93a3198f12b8be83a6312d35d6ba0Ben Chanclass CellularBearer;
3327526f1dad75e135f437e023cb34b0919d9a981fPrathmesh Prabhuclass ModemInfo;
34c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray
3582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow// CellularCapabilityUniversal handles modems using the
3682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow// org.chromium.ModemManager1 DBUS interface.  This class is used for
3782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow// all types of modems, i.e. CDMA, GSM, and LTE modems.
3882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgowclass CellularCapabilityUniversal : public CellularCapability {
3982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow public:
4082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  typedef std::vector<DBusPropertiesMap> ScanResults;
4182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  typedef DBusPropertiesMap ScanResult;
4274924d87cc111f8603751f09cd009c830f43e668Ben Chan  typedef std::map<uint32_t, uint32_t> LockRetryData;
4382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
44145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // Constants used in connect method call.  Make available to test matchers.
45145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // TODO(jglasgow): Generate from modem manager into
46145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // ModemManager-names.h.
47ee6b3d7f9d49fa52072a352fbb59f06127b1ba4cPaul Stewart  // See http://crbug.com/212909.
48145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectPin[];
49145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectOperatorId[];
50145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectApn[];
51145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectIPType[];
52145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectUser[];
53145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectPassword[];
54145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectNumber[];
55145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectAllowRoaming[];
56145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectRMProtocol[];
57145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow
58ce4483e054058ab3f6d940c7aa2e7b5697af325aThieu Le  CellularCapabilityUniversal(Cellular *cellular,
59ce4483e054058ab3f6d940c7aa2e7b5697af325aThieu Le                              ProxyFactory *proxy_factory,
6027526f1dad75e135f437e023cb34b0919d9a981fPrathmesh Prabhu                              ModemInfo *modem_info);
6182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
6282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Inherited from CellularCapability.
63e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // Checks the modem state.  If the state is kModemStateDisabled, then the
64e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // modem is enabled.  Otherwise, the enable command is buffered until the
65e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // modem becomes disabled.  ModemManager rejects the enable command if the
661ee9391c97a19fc6e618d8f23748b49acbf868d0Arman Uguray  // modem is not disabled, for example, if it is initializing instead.
6782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void StartModem(Error *error, const ResultCallback &callback);
6882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void StopModem(Error *error, const ResultCallback &callback);
6982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void Connect(const DBusPropertiesMap &properties, Error *error,
7082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                       const ResultCallback &callback);
7182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void Disconnect(Error *error, const ResultCallback &callback);
728a46890363301a4e28fe3175e194703409e344dcChristopher Wiley  virtual void DisconnectCleanup();
7382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void Activate(const std::string &carrier,
7482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                        Error *error, const ResultCallback &callback);
75c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  virtual void CompleteActivation(Error *error);
7682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
7782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void OnServiceCreated();
7882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void SetupConnectProperties(DBusPropertiesMap *properties);
79ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  virtual void GetProperties();
8031ce564d64f68172299d4cde60edd7a5c004b38eBen Chan  virtual bool IsRegistered() const;
8115786033dc85e3dd7fea18ba936957b8b2c34e29Ben Chan  virtual bool IsServiceActivationRequired() const;
8282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void Register(const ResultCallback &callback);
8382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
8482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void RegisterOnNetwork(const std::string &network_id,
8582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                                 Error *error,
8682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                                 const ResultCallback &callback);
877fce52c4afdc5e73a9e740dc9b90f1e61ae8cea4Eric Shienbrood  virtual void SetUnregistered(bool searching);
8882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual std::string CreateFriendlyServiceName();
8982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void RequirePIN(const std::string &pin, bool require,
9082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                          Error *error, const ResultCallback &callback);
9182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void EnterPIN(const std::string &pin,
9282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                        Error *error, const ResultCallback &callback);
9382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void UnblockPIN(const std::string &unblock_code,
9482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                          const std::string &pin,
9582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                          Error *error, const ResultCallback &callback);
9682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void ChangePIN(const std::string &old_pin,
9782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                         const std::string &new_pin,
9882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow                         Error *error, const ResultCallback &callback);
995d0d32c1b5e2370ff0739f7a2dbb641726d4bf87Ben Chan  virtual void Reset(Error *error, const ResultCallback &callback);
10082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
10149ffffd458c2407c67c2d0d572974e91c7e9bea7Prathmesh Prabhu  virtual void Scan(Error *error, const ResultStringmapsCallback &callback);
102539ab0266ef93a3198f12b8be83a6312d35d6ba0Ben Chan  virtual CellularBearer *GetActiveBearer() const;
10382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual std::string GetNetworkTechnologyString() const;
10482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual std::string GetRoamingStateString() const;
10582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void GetSignalQuality();
1069f09aeffcd088960c5b1a7d507c3705ce14b2b0dJason Glasgow  virtual std::string GetTypeString() const;
10782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void OnDBusPropertiesChanged(
10882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow      const std::string &interface,
10982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow      const DBusPropertiesMap &changed_properties,
11082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow      const std::vector<std::string> &invalidated_properties);
111af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  virtual bool AllowRoaming();
112145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow
11382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow protected:
11482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void InitProxies();
11582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void ReleaseProxies();
11682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
11772fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // Updates the |sim_path_| variable and creates a new proxy to the
11872fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // DBUS ModemManager1.Sim interface.
11972fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // TODO(armansito): Put this method in a 3GPP-only subclass.
12072fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  virtual void OnSimPathChanged(const std::string &sim_path);
12172fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray
12272fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // Updates the online payment portal information, if any, for the cellular
12372fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // provider.
12472fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  virtual void UpdateOLP();
12572fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray
1260a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  // Post-payment activation handlers.
1270a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  virtual void UpdatePendingActivationState();
1280a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray
129c539123120725dedc9055ec0b4171215946ac307Arman Uguray  // Updates the storage identifier used for the current cellular service.
130c539123120725dedc9055ec0b4171215946ac307Arman Uguray  virtual void UpdateStorageIdentifier();
131c539123120725dedc9055ec0b4171215946ac307Arman Uguray
1329f06c870229b00cdd19224cb12c4202de65772aePrathmesh Prabhu  // Returns the operator-specific form of |mdn|, which is passed to the online
13307193fdb601f4cea6301ebb85ebf20596807e126Ben Chan  // payment portal of a cellular operator.
13407193fdb601f4cea6301ebb85ebf20596807e126Ben Chan  std::string GetMdnForOLP(
13507193fdb601f4cea6301ebb85ebf20596807e126Ben Chan      const CellularOperatorInfo::CellularOperator &cellular_operator) const;
13607193fdb601f4cea6301ebb85ebf20596807e126Ben Chan
13782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow private:
13874924d87cc111f8603751f09cd009c830f43e668Ben Chan  struct ModemModes {
13974924d87cc111f8603751f09cd009c830f43e668Ben Chan    ModemModes()
14074924d87cc111f8603751f09cd009c830f43e668Ben Chan        : allowed_modes(MM_MODEM_MODE_NONE),
14174924d87cc111f8603751f09cd009c830f43e668Ben Chan          preferred_mode(MM_MODEM_MODE_NONE) {}
14274924d87cc111f8603751f09cd009c830f43e668Ben Chan
14374924d87cc111f8603751f09cd009c830f43e668Ben Chan    ModemModes(uint32 allowed, MMModemMode preferred)
14474924d87cc111f8603751f09cd009c830f43e668Ben Chan        : allowed_modes(allowed),
14574924d87cc111f8603751f09cd009c830f43e668Ben Chan          preferred_mode(preferred) {}
14674924d87cc111f8603751f09cd009c830f43e668Ben Chan
14774924d87cc111f8603751f09cd009c830f43e668Ben Chan    uint32 allowed_modes;        // Bits based on MMModemMode.
14874924d87cc111f8603751f09cd009c830f43e668Ben Chan    MMModemMode preferred_mode;  // A single MMModemMode bit.
14974924d87cc111f8603751f09cd009c830f43e668Ben Chan  };
15074924d87cc111f8603751f09cd009c830f43e668Ben Chan
151cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  // Constants used in scan results.  Make available to unit tests.
152cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  // TODO(jglasgow): Generate from modem manager into ModemManager-names.h.
153ee6b3d7f9d49fa52072a352fbb59f06127b1ba4cPaul Stewart  // See http://crbug.com/212909.
154cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kStatusProperty[];
155cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kOperatorLongProperty[];
156cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kOperatorShortProperty[];
157cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kOperatorCodeProperty[];
158cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kOperatorAccessTechnologyProperty[];
159cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow
160145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // Modem Model ID strings.  From modem firmware via modemmanager.
16143ce4d428d619bda64eea6d37534f02c179a1756Thieu Le  static const char kALT3100ModelId[];
162145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kE362ModelId[];
163145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow
1642717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray  // Generic service name prefix, shown when the correct carrier name is
1652717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray  // unknown.
1662717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray  static const char kGenericServiceNamePrefix[];
1672717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray
168a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  static const int64 kActivationRegistrationTimeoutMilliseconds;
169f6366ac746f63e4bacaa03ea8e524c2e8ec65aa8Arman Uguray  static const int64 kEnterPinTimeoutMilliseconds;
1708f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  static const int64 kRegistrationDroppedUpdateTimeoutMilliseconds;
1712cac294eff9415574cb9066e88f5cf43180a5092Thieu Le  static const int kSetPowerStateTimeoutMilliseconds;
172ee464d3c77dc7662973bfa5cb3c6eeb207366eacArman Uguray
1731361c0366043f3d2628dc7c339339116ce31085eArman Uguray
1746552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // Root path. The SIM path is reported by ModemManager to be the root path
1756552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // when no SIM is present.
1766552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  static const char kRootPath[];
1776552f8c74196782e9adf09f4fea01c836f551255Arman Uguray
17882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  friend class CellularTest;
17982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  friend class CellularCapabilityTest;
1803d27539b13590e0b149440ce017fdc401ef6e735Thieu Le  friend class CellularCapabilityUniversalTest;
18172fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  friend class CellularCapabilityUniversalCDMATest;
1820a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  FRIEND_TEST(CellularCapabilityUniversalCDMAMainTest, PropertiesChanged);
1830a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  FRIEND_TEST(CellularCapabilityUniversalCDMAMainTest, UpdateOLP);
184c539123120725dedc9055ec0b4171215946ac307Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalCDMAMainTest,
185c539123120725dedc9055ec0b4171215946ac307Arman Uguray              UpdateStorageIdentifier);
1861361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, AllowRoaming);
187a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
188a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray              ActivationWaitForRegisterTimeout);
1891361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, Connect);
1901361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, ConnectApns);
1911361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, CreateFriendlyServiceName);
1921361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, DisconnectNoProxy);
1937af0fac103deceec063554ef5705901d6d82d42fArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
1948f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu              DisconnectWithDeferredCallback);
19543ce4d428d619bda64eea6d37534f02c179a1756Thieu Le  FRIEND_TEST(CellularCapabilityUniversalMainTest, ExtractPcoValue);
19643ce4d428d619bda64eea6d37534f02c179a1756Thieu Le  FRIEND_TEST(CellularCapabilityUniversalMainTest, GetMdnForOLP);
1978f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  FRIEND_TEST(CellularCapabilityUniversalMainTest,
1987af0fac103deceec063554ef5705901d6d82d42fArman Uguray              GetNetworkTechnologyStringOnE362);
19943ce4d428d619bda64eea6d37534f02c179a1756Thieu Le  FRIEND_TEST(CellularCapabilityUniversalMainTest,
20043ce4d428d619bda64eea6d37534f02c179a1756Thieu Le              GetOutOfCreditsDetectionType);
2011361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, GetTypeString);
202c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, IsMdnValid);
20331ce564d64f68172299d4cde60edd7a5c004b38eBen Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, IsRegistered);
2041361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, IsServiceActivationRequired);
2056552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, IsValidSimPath);
206d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, NormalizeMdn);
207c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, OnLockRetriesChanged);
208c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, OnLockTypeChanged);
2091361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
210fcca27bd166ce485d9ef8afce5e060be935ece97Ben Chan              OnModemCurrentCapabilitiesChanged);
211c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, OnSimLockPropertiesChanged);
2121361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, PropertiesChanged);
2131361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, Reset);
2141361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, Scan);
2151361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, ScanFailure);
2161361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SetHomeProvider);
2171361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SimLockStatusChanged);
218c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SimLockStatusToProperty);
2191361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SimPathChanged);
2201361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SimPropertiesChanged);
2211361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, StartModem);
222151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, StartModemFailure);
223151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, StartModemInWrongState);
224151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest,
225151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan              StartModemWithDeferredEnableFailure);
2261361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, StopModem);
2271361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, StopModemConnected);
2289f3dcf80a84c07701b7c224fca5ed637c966fa3eBen Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, TerminationAction);
2299f3dcf80a84c07701b7c224fca5ed637c966fa3eBen Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2309f3dcf80a84c07701b7c224fca5ed637c966fa3eBen Chan              TerminationActionRemovedByStopModem);
231539ab0266ef93a3198f12b8be83a6312d35d6ba0Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateActiveBearer);
2320a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2330a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray              UpdatePendingActivationState);
234efea6e0f28c3270038914e80166702d5ac23095eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2358f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu              UpdateRegistrationState);
2368f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2378f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu              UpdateRegistrationStateModemNotConnected);
2388f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  FRIEND_TEST(CellularCapabilityUniversalMainTest,
239efea6e0f28c3270038914e80166702d5ac23095eArman Uguray              UpdateServiceActivationState);
2401361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateServiceName);
2411361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateStorageIdentifier);
2421361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateOLP);
2431361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateOperatorInfo);
2441361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2451361c0366043f3d2628dc7c339339116ce31085eArman Uguray              UpdateOperatorInfoViaOperatorId);
246a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalTimerTest, CompleteActivation);
247d42d8ec85a9a1bdc406870b75d1b9e266fbaaa02Arman Uguray  FRIEND_TEST(CellularTest, EnableTrafficMonitor);
24809fa2a0e9c0feed7b3ca23fc7d8ad59783f4c6a7Ben Chan  FRIEND_TEST(CellularTest,
24909fa2a0e9c0feed7b3ca23fc7d8ad59783f4c6a7Ben Chan              HandleNewRegistrationStateForServiceRequiringActivation);
2505218cf2bb1301197e0e3c9381bc4c66e8adf80b0Thieu Le  FRIEND_TEST(CellularTest, ModemStateChangeLostRegistration);
251f407d5934100e6f2106aeeede46bafb0074cee35mukesh agrawal  FRIEND_TEST(CellularTest, OnPPPDied);
25282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
253c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  // SimLockStatus represents the fields in the Cellular.SIMLockStatus
254c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  // DBUS property of the shill device.
255c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  struct SimLockStatus {
256c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray   public:
257c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray    SimLockStatus() : enabled(false),
258c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray                      lock_type(MM_MODEM_LOCK_UNKNOWN),
259c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray                      retries_left(0) {}
260c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray
261c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray    bool enabled;
262c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray    MMModemLock lock_type;
263c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray    uint32 retries_left;
264c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  };
265c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray
2669a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  // SubscriptionState represents the provisioned state of SIM. It is used
2679a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  // currently by activation logic for LTE to determine if activation process is
2689a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  // complete.
2699a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  enum SubscriptionState {
2709a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu    kSubscriptionStateUnknown = 0,
2719a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu    kSubscriptionStateUnprovisioned = 1,
2729a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu    kSubscriptionStateProvisioned = 2,
2739a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu    kSubscriptionStateOutOfData = 3
2749a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  };
2759a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu
276ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  // Methods used in starting a modem
277151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  void EnableModem(bool deferralbe,
278151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan                   Error *error,
279151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan                   const ResultCallback& callback);
280151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  void EnableModemCompleted(bool deferrable,
281151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan                            const ResultCallback &callback,
282151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan                            const Error &error);
283ef96556fff984bbc79597669af2465905666ed09Jason Glasgow
284ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  // Methods used in stopping a modem
285ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  void Stop_Disable(const ResultCallback &callback);
286ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  void Stop_DisableCompleted(const ResultCallback &callback,
287ef96556fff984bbc79597669af2465905666ed09Jason Glasgow                             const Error &error);
288ee464d3c77dc7662973bfa5cb3c6eeb207366eacArman Uguray  void Stop_PowerDown(const ResultCallback &callback);
289ee464d3c77dc7662973bfa5cb3c6eeb207366eacArman Uguray  void Stop_PowerDownCompleted(const ResultCallback &callback,
290ee464d3c77dc7662973bfa5cb3c6eeb207366eacArman Uguray                               const Error &error);
291ef96556fff984bbc79597669af2465905666ed09Jason Glasgow
2922717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray  // Updates the name property that is exposed by the service to Chrome.
2932717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray  void UpdateServiceName();
2942717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray
295d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray  // Methods used in acquiring information related to the carrier;
296d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray
29782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Updates the Universal operator name and country based on a newly
29882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // obtained network id.
29982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  void UpdateOperatorInfo();
30082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
301d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray  // Sets the upper level information about the home cellular provider from the
302d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray  // modem's IMSI and SPN.
303d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray  void SetHomeProvider();
304d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray
30582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Updates the serving operator on the active service.
30682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  void UpdateServingOperator();
30782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
3089f06c870229b00cdd19224cb12c4202de65772aePrathmesh Prabhu  // Initializes the |apn_list| property based on the current
30999ec94d3ef0049e5013e590017e8714b5fc9c682Prathmesh Prabhu  // |home_provider_info_|.
310d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray  void InitAPNList();
311d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray
312539ab0266ef93a3198f12b8be83a6312d35d6ba0Ben Chan  // Updates |active_bearer_| to match the currently active bearer.
313539ab0266ef93a3198f12b8be83a6312d35d6ba0Ben Chan  void UpdateActiveBearer();
3146e5639f9ef54db278c5f2265d5364e5994966f4aArman Uguray
31582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  Stringmap ParseScanResult(const ScanResult &result);
31682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
31782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  KeyValueStore SimLockStatusToProperty(Error *error);
31882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
31982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  void SetupApnTryList();
32082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  void FillConnectPropertyMap(DBusPropertiesMap *properties);
32182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
322bebf1b8bce52b88c2cc2d93200b9405f9c19cf21mukesh agrawal  void HelpRegisterConstDerivedKeyValueStore(
32382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow      const std::string &name,
324bebf1b8bce52b88c2cc2d93200b9405f9c19cf21mukesh agrawal      KeyValueStore(CellularCapabilityUniversal::*get)(Error *error));
32582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
326145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // Returns true if a connect error should be retried.  This function
327145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // abstracts modem specific behavior for modems which do a lousy job
328145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // of returning specific errors on connect failures.
329145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  bool RetriableConnectError(const Error &error) const;
330145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow
33182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Signal callbacks
3323022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams  void OnNetworkModeSignal(uint32 mode);
3337fce52c4afdc5e73a9e740dc9b90f1e61ae8cea4Eric Shienbrood  void OnModemStateChangedSignal(int32 old_state,
3347fce52c4afdc5e73a9e740dc9b90f1e61ae8cea4Eric Shienbrood                                 int32 new_state,
3357fce52c4afdc5e73a9e740dc9b90f1e61ae8cea4Eric Shienbrood                                 uint32 reason);
33682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
33782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Property Change notification handlers
3383022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams  void OnModemPropertiesChanged(
3394c0724af38d0eaf7155bb789280940a41ef9f08cJason Glasgow      const DBusPropertiesMap &properties,
3404c0724af38d0eaf7155bb789280940a41ef9f08cJason Glasgow      const std::vector<std::string> &invalidated_properties);
3414c0724af38d0eaf7155bb789280940a41ef9f08cJason Glasgow
3423022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams  void OnSignalQualityChanged(uint32 quality);
34374924d87cc111f8603751f09cd009c830f43e668Ben Chan
34474924d87cc111f8603751f09cd009c830f43e668Ben Chan  void OnSupportedCapabilitesChanged(
34574924d87cc111f8603751f09cd009c830f43e668Ben Chan      const std::vector<uint32> &supported_capabilities);
346af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnModemCurrentCapabilitiesChanged(uint32 current_capabilities);
347af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnMdnChanged(const std::string &mdn);
348af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnModemRevisionChanged(const std::string &revision);
349af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnModemStateChanged(Cellular::ModemState state);
350af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnAccessTechnologiesChanged(uint32 access_technologies);
35174924d87cc111f8603751f09cd009c830f43e668Ben Chan  void OnSupportedModesChanged(const std::vector<ModemModes> &supported_modes);
35274924d87cc111f8603751f09cd009c830f43e668Ben Chan  void OnCurrentModesChanged(const ModemModes &current_modes);
353cbef8123fa639622b1aa86d7a041a02347ddc69dBen Chan  void OnBearersChanged(const RpcIdentifiers &bearers);
354c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  void OnLockRetriesChanged(const LockRetryData &lock_retries);
355c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  void OnLockTypeChanged(MMModemLock unlock_required);
356af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnSimLockStatusChanged();
357af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow
358c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  // Returns false if the MDN is empty or if the MDN consists of all 0s.
359c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  bool IsMdnValid() const;
360c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray
361af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  // 3GPP property change handlers
362af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  virtual void OnModem3GPPPropertiesChanged(
363af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow      const DBusPropertiesMap &properties,
364af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow      const std::vector<std::string> &invalidated_properties);
365af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void On3GPPRegistrationChanged(MMModem3gppRegistrationState state,
366af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow                                 const std::string &operator_code,
367af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow                                 const std::string &operator_name);
3688f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  void Handle3GPPRegistrationChange(
3698f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu      MMModem3gppRegistrationState updated_state,
3708f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu      std::string updated_operator_code,
3718f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu      std::string updated_operator_name);
3729a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  void On3GPPSubscriptionStateChanged(MMModem3gppSubscriptionState state);
373af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnFacilityLocksChanged(uint32 locks);
374af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow
375af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  // SIM property change handlers
37672fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // TODO(armansito): Put these methods in a 3GPP-only subclass.
377af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnSimPropertiesChanged(
378af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow      const DBusPropertiesMap &props,
379af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow      const std::vector<std::string> &invalidated_properties);
380d73783fb016a4c9d7d8644db83c8caeb447b0063Arman Uguray  void OnSpnChanged(const std::string &spn);
381af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnSimIdentifierChanged(const std::string &id);
382af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnOperatorIdChanged(const std::string &operator_id);
383af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnOperatorNameChanged(const std::string &operator_name);
384ef96556fff984bbc79597669af2465905666ed09Jason Glasgow
38582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Method callbacks
3863022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams  void OnRegisterReply(const ResultCallback &callback,
3873022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams                       const Error &error);
3885d0d32c1b5e2370ff0739f7a2dbb641726d4bf87Ben Chan  void OnResetReply(const ResultCallback &callback, const Error &error);
38949ffffd458c2407c67c2d0d572974e91c7e9bea7Prathmesh Prabhu  void OnScanReply(const ResultStringmapsCallback &callback,
3903022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams                   const ScanResults &results,
3913022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams                   const Error &error);
392b54974f033f713690135f3f3516ca14aa7ee6cfdNathan Williams  void OnConnectReply(const ResultCallback &callback,
393b54974f033f713690135f3f3516ca14aa7ee6cfdNathan Williams                      const DBus::Path &bearer,
394b54974f033f713690135f3f3516ca14aa7ee6cfdNathan Williams                      const Error &error);
39582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
396a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  // Timeout callback that is called if the modem takes too long to register to
397a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  // a network after online payment is complete. Resets the modem.
398a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  void OnActivationWaitForRegisterTimeout();
399a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray
4006552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // Returns true, if |sim_path| constitutes a valid SIM path. Currently, a
4016552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // path is accepted to be valid, as long as it is not equal to one of ""
4026552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // and "/".
4036552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  bool IsValidSimPath(const std::string &sim_path) const;
4046552f8c74196782e9adf09f4fea01c836f551255Arman Uguray
405d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan  // Returns the normalized version of |mdn| by keeping only digits in |mdn|
406d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan  // and removing other non-digit characters.
407d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan  std::string NormalizeMdn(const std::string &mdn) const;
408d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan
4092717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray  static std::string GenerateNewGenericServiceName();
4102717a10096e12e46413adf47b39c5b19cd33bce7Arman Uguray
411c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  // Post-payment activation handlers.
412c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  void ResetAfterActivation();
413efea6e0f28c3270038914e80166702d5ac23095eArman Uguray  void UpdateServiceActivationState();
414c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  void OnResetAfterActivationReply(const Error &error);
415c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray
4168f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  static bool IsRegisteredState(MMModem3gppRegistrationState state);
4178f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu
41843ce4d428d619bda64eea6d37534f02c179a1756Thieu Le  // Returns the out-of-credits detection algorithm to be used on this modem.
41943ce4d428d619bda64eea6d37534f02c179a1756Thieu Le  OutOfCreditsDetector::OOCType GetOutOfCreditsDetectionType() const;
42043ce4d428d619bda64eea6d37534f02c179a1756Thieu Le
42182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  scoped_ptr<mm1::ModemModem3gppProxyInterface> modem_3gpp_proxy_;
42282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  scoped_ptr<mm1::ModemProxyInterface> modem_proxy_;
42382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  scoped_ptr<mm1::ModemSimpleProxyInterface> modem_simple_proxy_;
42482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  scoped_ptr<mm1::SimProxyInterface> sim_proxy_;
42582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
42682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  base::WeakPtrFactory<CellularCapabilityUniversal> weak_ptr_factory_;
42782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
42882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  MMModem3gppRegistrationState registration_state_;
429af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow
430af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  // Bits based on MMModemCapabilities
43174924d87cc111f8603751f09cd009c830f43e668Ben Chan  std::vector<uint32> supported_capabilities_;  // Technologies supported
43274924d87cc111f8603751f09cd009c830f43e668Ben Chan  uint32 current_capabilities_;  // Technologies supported without a reload
433145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  uint32 access_technologies_;   // Bits based on MMModemAccessTechnology
43474924d87cc111f8603751f09cd009c830f43e668Ben Chan  std::vector<ModemModes> supported_modes_;
43574924d87cc111f8603751f09cd009c830f43e668Ben Chan  ModemModes current_modes_;
436af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow
43782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  Cellular::Operator serving_operator_;
43882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string spn_;
439af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  std::string operator_id_;
44099ec94d3ef0049e5013e590017e8714b5fc9c682Prathmesh Prabhu  mobile_provider *home_provider_info_;
44182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string desired_network_;
44282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
44382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Properties.
44482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::deque<Stringmap> apn_try_list_;
4455d0d32c1b5e2370ff0739f7a2dbb641726d4bf87Ben Chan  bool resetting_;
44682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  SimLockStatus sim_lock_status_;
4479a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  SubscriptionState subscription_state_;
448ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  std::string sim_path_;
449539ab0266ef93a3198f12b8be83a6312d35d6ba0Ben Chan  scoped_ptr<CellularBearer> active_bearer_;
450cbef8123fa639622b1aa86d7a041a02347ddc69dBen Chan  RpcIdentifiers bearer_paths_;
451c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  bool reset_done_;
452c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray
453e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // If the modem is not in a state to be enabled when StartModem is called,
454e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // enabling is deferred using this callback.
455e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  base::Closure deferred_enable_modem_callback_;
456e285a84b38b81f5557b576da187d037ad24ae4afGary Morain
457a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  base::CancelableClosure activation_wait_for_registration_callback_;
458a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  int64 activation_registration_timeout_milliseconds_;
4591361c0366043f3d2628dc7c339339116ce31085eArman Uguray
4608f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  // Sometimes flaky cellular network causes the 3GPP registration state to
4618f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  // rapidly change from registered --> searching and back. Delay such updates
4628f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  // a little to smooth over temporary registration loss.
4638f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  base::CancelableClosure registration_dropped_update_callback_;
4648f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  int64 registration_dropped_update_timeout_milliseconds_;
4658f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu
46682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  static unsigned int friendly_service_name_id_;
46782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
46882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  DISALLOW_COPY_AND_ASSIGN(CellularCapabilityUniversal);
46982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow};
47082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
47182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow}  // namespace shill
47282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
473145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow#endif  // SHILL_CELLULAR_CAPABILITY_UNIVERSAL_H_
474