1c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu//
2c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// Copyright (C) 2013 The Android Open Source Project
3c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu//
4c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// Licensed under the Apache License, Version 2.0 (the "License");
5c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// you may not use this file except in compliance with the License.
6c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// You may obtain a copy of the License at
7c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu//
8c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu//      http://www.apache.org/licenses/LICENSE-2.0
9c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu//
10c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// Unless required by applicable law or agreed to in writing, software
11c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// distributed under the License is distributed on an "AS IS" BASIS,
12c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// See the License for the specific language governing permissions and
14c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// limitations under the License.
15c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu//
1682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
17c54afe521739065a5d77e7c049acdb5e603f0592Ben Chan#ifndef SHILL_CELLULAR_CELLULAR_CAPABILITY_UNIVERSAL_H_
18c54afe521739065a5d77e7c049acdb5e603f0592Ben Chan#define SHILL_CELLULAR_CELLULAR_CAPABILITY_UNIVERSAL_H_
1982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
2082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include <deque>
21af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow#include <map>
2282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include <string>
2305d87e34869f44473edc1eec25d2fe1110d777a7Peter Qiu#include <tuple>
2482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include <vector>
2582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
2682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include <base/memory/weak_ptr.h>
2782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include <gtest/gtest_prod.h>  // for FRIEND_TEST
285c853ef21b9247d2ad3d60736b3dea77b8681ed8Ben Chan#include <ModemManager/ModemManager.h>
2982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
3082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow#include "shill/accessor_interface.h"
31c54afe521739065a5d77e7c049acdb5e603f0592Ben Chan#include "shill/cellular/cellular.h"
32c54afe521739065a5d77e7c049acdb5e603f0592Ben Chan#include "shill/cellular/cellular_bearer.h"
33c54afe521739065a5d77e7c049acdb5e603f0592Ben Chan#include "shill/cellular/cellular_capability.h"
34c54afe521739065a5d77e7c049acdb5e603f0592Ben Chan#include "shill/cellular/mm1_modem_modem3gpp_proxy_interface.h"
35c54afe521739065a5d77e7c049acdb5e603f0592Ben Chan#include "shill/cellular/mm1_modem_proxy_interface.h"
36c54afe521739065a5d77e7c049acdb5e603f0592Ben Chan#include "shill/cellular/mm1_modem_simple_proxy_interface.h"
37c54afe521739065a5d77e7c049acdb5e603f0592Ben Chan#include "shill/cellular/mm1_sim_proxy_interface.h"
38c54afe521739065a5d77e7c049acdb5e603f0592Ben Chan#include "shill/cellular/out_of_credits_detector.h"
3982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
4082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgowstruct mobile_provider;
4182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
4282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgownamespace shill {
4382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
4427526f1dad75e135f437e023cb34b0919d9a981fPrathmesh Prabhuclass ModemInfo;
45c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray
4682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow// CellularCapabilityUniversal handles modems using the
4782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow// org.chromium.ModemManager1 DBUS interface.  This class is used for
4882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow// all types of modems, i.e. CDMA, GSM, and LTE modems.
4982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgowclass CellularCapabilityUniversal : public CellularCapability {
5082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow public:
5105d87e34869f44473edc1eec25d2fe1110d777a7Peter Qiu  typedef std::vector<KeyValueStore> ScanResults;
5205d87e34869f44473edc1eec25d2fe1110d777a7Peter Qiu  typedef KeyValueStore ScanResult;
5374924d87cc111f8603751f09cd009c830f43e668Ben Chan  typedef std::map<uint32_t, uint32_t> LockRetryData;
5405d87e34869f44473edc1eec25d2fe1110d777a7Peter Qiu  typedef std::tuple<uint32_t, bool> SignalQuality;
5505d87e34869f44473edc1eec25d2fe1110d777a7Peter Qiu  typedef std::tuple<uint32_t, uint32_t> ModesData;
5605d87e34869f44473edc1eec25d2fe1110d777a7Peter Qiu  typedef std::vector<ModesData> SupportedModes;
5782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
58145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // Constants used in connect method call.  Make available to test matchers.
59145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // TODO(jglasgow): Generate from modem manager into
60145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // ModemManager-names.h.
61ee6b3d7f9d49fa52072a352fbb59f06127b1ba4cPaul Stewart  // See http://crbug.com/212909.
62145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectPin[];
63145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectOperatorId[];
64145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectApn[];
65145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectIPType[];
66145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectUser[];
67145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectPassword[];
68145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectNumber[];
69145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectAllowRoaming[];
70145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  static const char kConnectRMProtocol[];
71145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow
72f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  CellularCapabilityUniversal(Cellular* cellular,
73608ec29525f553d51f0a92e84176e3d4b45930a9Peter Qiu                              ControlInterface* control_interface,
74f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                              ModemInfo* modem_info);
755ea763b83299b5fad76a87183fb39a74c2d3c61dBen Chan  ~CellularCapabilityUniversal() override;
7682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
7782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Inherited from CellularCapability.
78016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  std::string GetTypeString() const override;
7905d87e34869f44473edc1eec25d2fe1110d777a7Peter Qiu  void OnPropertiesChanged(
80f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart      const std::string& interface,
8105d87e34869f44473edc1eec25d2fe1110d777a7Peter Qiu      const KeyValueStore& changed_properties,
82f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart      const std::vector<std::string>& invalidated_properties) override;
83e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // Checks the modem state.  If the state is kModemStateDisabled, then the
84e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // modem is enabled.  Otherwise, the enable command is buffered until the
85e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // modem becomes disabled.  ModemManager rejects the enable command if the
861ee9391c97a19fc6e618d8f23748b49acbf868d0Arman Uguray  // modem is not disabled, for example, if it is initializing instead.
87f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void StartModem(Error* error, const ResultCallback& callback) override;
88f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void StopModem(Error* error, const ResultCallback& callback) override;
89f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void Reset(Error* error, const ResultCallback& callback) override;
90016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  bool AreProxiesInitialized() const override;
91016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  bool IsServiceActivationRequired() const override;
92f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void CompleteActivation(Error* error) override;
93f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void Scan(Error* error, const ResultStringmapsCallback& callback) override;
94f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void RegisterOnNetwork(const std::string& network_id,
95f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                         Error* error,
96f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                         const ResultCallback& callback) override;
97016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  bool IsRegistered() const override;
98016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void SetUnregistered(bool searching) override;
99016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void OnServiceCreated() override;
100016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  std::string GetNetworkTechnologyString() const override;
101016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  std::string GetRoamingStateString() const override;
102016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  bool AllowRoaming() override;
103016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void GetSignalQuality() override;
10405d87e34869f44473edc1eec25d2fe1110d777a7Peter Qiu  void SetupConnectProperties(KeyValueStore* properties) override;
10505d87e34869f44473edc1eec25d2fe1110d777a7Peter Qiu  void Connect(const KeyValueStore& properties,
106f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart               Error* error,
107f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart               const ResultCallback& callback) override;
108f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void Disconnect(Error* error, const ResultCallback& callback) override;
109f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  CellularBearer* GetActiveBearer() const override;
110f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void RequirePIN(const std::string& pin,
111016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko                  bool require,
112f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                  Error* error,
113f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                  const ResultCallback& callback) override;
114f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void EnterPIN(const std::string& pin,
115f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                Error* error,
116f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                const ResultCallback& callback) override;
117f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void UnblockPIN(const std::string& unblock_code,
118f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                  const std::string& pin,
119f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                  Error* error,
120f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                  const ResultCallback& callback) override;
121f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void ChangePIN(const std::string& old_pin,
122f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                 const std::string& new_pin,
123f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                 Error* error,
124f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                 const ResultCallback& callback) override;
12582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
126f98f00e52f3408fd3ca6184f19636efb7e66b986Ben Chan  virtual void GetProperties();
127f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  virtual void Register(const ResultCallback& callback);
128145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow
12982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow protected:
13082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  virtual void InitProxies();
1316acd966cabe0d75e0d9ae3f84c727c9b44a899b3Yunlian Jiang  void ReleaseProxies() override;
13282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
13372fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // Updates the |sim_path_| variable and creates a new proxy to the
13472fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // DBUS ModemManager1.Sim interface.
13572fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // TODO(armansito): Put this method in a 3GPP-only subclass.
136f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  virtual void OnSimPathChanged(const std::string& sim_path);
13772fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray
13872fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // Updates the online payment portal information, if any, for the cellular
13972fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // provider.
140016fa0e9c8f47630c8e6c440ace42ba99f8498dfAlex Vakulenko  void UpdateServiceOLP() override;
14172fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray
1420a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  // Post-payment activation handlers.
1430a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  virtual void UpdatePendingActivationState();
1440a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray
1459f06c870229b00cdd19224cb12c4202de65772aePrathmesh Prabhu  // Returns the operator-specific form of |mdn|, which is passed to the online
14607193fdb601f4cea6301ebb85ebf20596807e126Ben Chan  // payment portal of a cellular operator.
147f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  std::string GetMdnForOLP(const MobileOperatorInfo* operator_info) const;
14807193fdb601f4cea6301ebb85ebf20596807e126Ben Chan
14982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow private:
15074924d87cc111f8603751f09cd009c830f43e668Ben Chan  struct ModemModes {
15174924d87cc111f8603751f09cd009c830f43e668Ben Chan    ModemModes()
15274924d87cc111f8603751f09cd009c830f43e668Ben Chan        : allowed_modes(MM_MODEM_MODE_NONE),
15374924d87cc111f8603751f09cd009c830f43e668Ben Chan          preferred_mode(MM_MODEM_MODE_NONE) {}
15474924d87cc111f8603751f09cd009c830f43e668Ben Chan
1557fab89734d88724a288e96a9996b15548c5294c7Ben Chan    ModemModes(uint32_t allowed, MMModemMode preferred)
15674924d87cc111f8603751f09cd009c830f43e668Ben Chan        : allowed_modes(allowed),
15774924d87cc111f8603751f09cd009c830f43e668Ben Chan          preferred_mode(preferred) {}
15874924d87cc111f8603751f09cd009c830f43e668Ben Chan
1597fab89734d88724a288e96a9996b15548c5294c7Ben Chan    uint32_t allowed_modes;        // Bits based on MMModemMode.
16074924d87cc111f8603751f09cd009c830f43e668Ben Chan    MMModemMode preferred_mode;  // A single MMModemMode bit.
16174924d87cc111f8603751f09cd009c830f43e668Ben Chan  };
16274924d87cc111f8603751f09cd009c830f43e668Ben Chan
163cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  // Constants used in scan results.  Make available to unit tests.
164cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  // TODO(jglasgow): Generate from modem manager into ModemManager-names.h.
165ee6b3d7f9d49fa52072a352fbb59f06127b1ba4cPaul Stewart  // See http://crbug.com/212909.
166cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kStatusProperty[];
167cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kOperatorLongProperty[];
168cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kOperatorShortProperty[];
169cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kOperatorCodeProperty[];
170cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow  static const char kOperatorAccessTechnologyProperty[];
171cd0349c9bafcb5c250da25691ada7fcc3752e145Jason Glasgow
1723dddd04332b1ee3ed268d3b02092d6654fe906beBen Chan  // Plugin strings via ModemManager.
173c466ccb31d7f64d4dae38149c118d9612cbe5f30Thieu Le  static const char kAltairLTEMMPlugin[];
1743dddd04332b1ee3ed268d3b02092d6654fe906beBen Chan  static const char kNovatelLTEMMPlugin[];
175c466ccb31d7f64d4dae38149c118d9612cbe5f30Thieu Le
1767fab89734d88724a288e96a9996b15548c5294c7Ben Chan  static const int64_t kActivationRegistrationTimeoutMilliseconds;
1777fab89734d88724a288e96a9996b15548c5294c7Ben Chan  static const int64_t kEnterPinTimeoutMilliseconds;
1787fab89734d88724a288e96a9996b15548c5294c7Ben Chan  static const int64_t kRegistrationDroppedUpdateTimeoutMilliseconds;
1792cac294eff9415574cb9066e88f5cf43180a5092Thieu Le  static const int kSetPowerStateTimeoutMilliseconds;
180ee464d3c77dc7662973bfa5cb3c6eeb207366eacArman Uguray
1811361c0366043f3d2628dc7c339339116ce31085eArman Uguray
1826552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // Root path. The SIM path is reported by ModemManager to be the root path
1836552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // when no SIM is present.
1846552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  static const char kRootPath[];
1856552f8c74196782e9adf09f4fea01c836f551255Arman Uguray
18682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  friend class CellularTest;
18782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  friend class CellularCapabilityTest;
1883d27539b13590e0b149440ce017fdc401ef6e735Thieu Le  friend class CellularCapabilityUniversalTest;
18972fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  friend class CellularCapabilityUniversalCDMATest;
1900a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  FRIEND_TEST(CellularCapabilityUniversalCDMAMainTest, PropertiesChanged);
1911361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, AllowRoaming);
192a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
193a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray              ActivationWaitForRegisterTimeout);
1941361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, Connect);
1951361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, ConnectApns);
1961361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, DisconnectNoProxy);
1977af0fac103deceec063554ef5705901d6d82d42fArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
1988f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu              DisconnectWithDeferredCallback);
19943ce4d428d619bda64eea6d37534f02c179a1756Thieu Le  FRIEND_TEST(CellularCapabilityUniversalMainTest, ExtractPcoValue);
20043ce4d428d619bda64eea6d37534f02c179a1756Thieu Le  FRIEND_TEST(CellularCapabilityUniversalMainTest, GetMdnForOLP);
2018f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2027af0fac103deceec063554ef5705901d6d82d42fArman Uguray              GetNetworkTechnologyStringOnE362);
20343ce4d428d619bda64eea6d37534f02c179a1756Thieu Le  FRIEND_TEST(CellularCapabilityUniversalMainTest,
20443ce4d428d619bda64eea6d37534f02c179a1756Thieu Le              GetOutOfCreditsDetectionType);
2051361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, GetTypeString);
206c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, IsMdnValid);
20731ce564d64f68172299d4cde60edd7a5c004b38eBen Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, IsRegistered);
2081361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, IsServiceActivationRequired);
2096552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, IsValidSimPath);
210d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, NormalizeMdn);
211c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, OnLockRetriesChanged);
212c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, OnLockTypeChanged);
2131361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
214fcca27bd166ce485d9ef8afce5e060be935ece97Ben Chan              OnModemCurrentCapabilitiesChanged);
215c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, OnSimLockPropertiesChanged);
2161361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, PropertiesChanged);
2171361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, Reset);
2181361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, Scan);
2191361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, ScanFailure);
2201361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SimLockStatusChanged);
221c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SimLockStatusToProperty);
2221361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SimPathChanged);
2231361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, SimPropertiesChanged);
2241361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, StartModem);
225151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, StartModemFailure);
226151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, StartModemInWrongState);
227151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest,
228151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan              StartModemWithDeferredEnableFailure);
2291361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, StopModem);
230c466ccb31d7f64d4dae38149c118d9612cbe5f30Thieu Le  FRIEND_TEST(CellularCapabilityUniversalMainTest, StopModemAltair);
231b0074e8a58f829c602231f6387b1e654f657011fThieu Le  FRIEND_TEST(CellularCapabilityUniversalMainTest,
232c466ccb31d7f64d4dae38149c118d9612cbe5f30Thieu Le              StopModemAltairDeleteBearerFailure);
233c466ccb31d7f64d4dae38149c118d9612cbe5f30Thieu Le  FRIEND_TEST(CellularCapabilityUniversalMainTest, StopModemAltairNotConnected);
2341361c0366043f3d2628dc7c339339116ce31085eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest, StopModemConnected);
2359f3dcf80a84c07701b7c224fca5ed637c966fa3eBen Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, TerminationAction);
2369f3dcf80a84c07701b7c224fca5ed637c966fa3eBen Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2379f3dcf80a84c07701b7c224fca5ed637c966fa3eBen Chan              TerminationActionRemovedByStopModem);
238539ab0266ef93a3198f12b8be83a6312d35d6ba0Ben Chan  FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateActiveBearer);
2390a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2400a3e27994a45a9723f3867fe7f297e089bd2254bArman Uguray              UpdatePendingActivationState);
241efea6e0f28c3270038914e80166702d5ac23095eArman Uguray  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2428f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu              UpdateRegistrationState);
2438f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  FRIEND_TEST(CellularCapabilityUniversalMainTest,
2448f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu              UpdateRegistrationStateModemNotConnected);
2458f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  FRIEND_TEST(CellularCapabilityUniversalMainTest,
246efea6e0f28c3270038914e80166702d5ac23095eArman Uguray              UpdateServiceActivationState);
24792df619a98585c7fe7b072fe07f60b43c9ec52ddPrathmesh Prabhu  FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateServiceOLP);
248a14941d234722d4f867027a966ef85ae0f7ba3a9Arman Uguray  FRIEND_TEST(CellularCapabilityUniversalTimerTest, CompleteActivation);
249d42d8ec85a9a1bdc406870b75d1b9e266fbaaa02Arman Uguray  FRIEND_TEST(CellularTest, EnableTrafficMonitor);
25009fa2a0e9c0feed7b3ca23fc7d8ad59783f4c6a7Ben Chan  FRIEND_TEST(CellularTest,
25109fa2a0e9c0feed7b3ca23fc7d8ad59783f4c6a7Ben Chan              HandleNewRegistrationStateForServiceRequiringActivation);
2525218cf2bb1301197e0e3c9381bc4c66e8adf80b0Thieu Le  FRIEND_TEST(CellularTest, ModemStateChangeLostRegistration);
253f407d5934100e6f2106aeeede46bafb0074cee35mukesh agrawal  FRIEND_TEST(CellularTest, OnPPPDied);
25482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
255c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  // SimLockStatus represents the fields in the Cellular.SIMLockStatus
256c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  // DBUS property of the shill device.
257c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  struct SimLockStatus {
258c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray   public:
259c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray    SimLockStatus() : enabled(false),
260c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray                      lock_type(MM_MODEM_LOCK_UNKNOWN),
261c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray                      retries_left(0) {}
262c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray
263c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray    bool enabled;
264c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray    MMModemLock lock_type;
2657fab89734d88724a288e96a9996b15548c5294c7Ben Chan    uint32_t retries_left;
266c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  };
267c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray
2689a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  // SubscriptionState represents the provisioned state of SIM. It is used
2699a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  // currently by activation logic for LTE to determine if activation process is
2709a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  // complete.
2719a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  enum SubscriptionState {
2729a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu    kSubscriptionStateUnknown = 0,
2739a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu    kSubscriptionStateUnprovisioned = 1,
2749a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu    kSubscriptionStateProvisioned = 2,
2759a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu    kSubscriptionStateOutOfData = 3
2769a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  };
2779a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu
278ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  // Methods used in starting a modem
279151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  void EnableModem(bool deferralbe,
280f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                   Error* error,
281151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan                   const ResultCallback& callback);
282151d447d1f3a252a3f2ecbca0f75792e693f1d47Ben Chan  void EnableModemCompleted(bool deferrable,
283f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                            const ResultCallback& callback,
284f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                            const Error& error);
285ef96556fff984bbc79597669af2465905666ed09Jason Glasgow
286ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  // Methods used in stopping a modem
287f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void Stop_DeleteActiveBearer(const ResultCallback& callback);
288f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void Stop_DeleteActiveBearerCompleted(const ResultCallback& callback,
289f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                                        const Error& error);
290f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void Stop_Disable(const ResultCallback& callback);
291f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void Stop_DisableCompleted(const ResultCallback& callback,
292f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                             const Error& error);
293f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void Stop_PowerDown(const ResultCallback& callback);
294f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void Stop_PowerDownCompleted(const ResultCallback& callback,
295f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                               const Error& error);
296ef96556fff984bbc79597669af2465905666ed09Jason Glasgow
297539ab0266ef93a3198f12b8be83a6312d35d6ba0Ben Chan  // Updates |active_bearer_| to match the currently active bearer.
298539ab0266ef93a3198f12b8be83a6312d35d6ba0Ben Chan  void UpdateActiveBearer();
2996e5639f9ef54db278c5f2265d5364e5994966f4aArman Uguray
300f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  Stringmap ParseScanResult(const ScanResult& result);
30182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
302f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  KeyValueStore SimLockStatusToProperty(Error* error);
30382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
30482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  void SetupApnTryList();
30505d87e34869f44473edc1eec25d2fe1110d777a7Peter Qiu  void FillConnectPropertyMap(KeyValueStore* properties);
30682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
307bebf1b8bce52b88c2cc2d93200b9405f9c19cf21mukesh agrawal  void HelpRegisterConstDerivedKeyValueStore(
308f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart      const std::string& name,
309f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart      KeyValueStore(CellularCapabilityUniversal::*get)(Error* error));
31082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
311145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // Returns true if a connect error should be retried.  This function
312145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // abstracts modem specific behavior for modems which do a lousy job
313145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow  // of returning specific errors on connect failures.
314f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  bool RetriableConnectError(const Error& error) const;
315145218710c2daa27ab55690f2ca372200d2a4cdfJason Glasgow
31682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Signal callbacks
3177fab89734d88724a288e96a9996b15548c5294c7Ben Chan  void OnNetworkModeSignal(uint32_t mode);
3187fab89734d88724a288e96a9996b15548c5294c7Ben Chan  void OnModemStateChangedSignal(int32_t old_state,
3197fab89734d88724a288e96a9996b15548c5294c7Ben Chan                                 int32_t new_state,
3207fab89734d88724a288e96a9996b15548c5294c7Ben Chan                                 uint32_t reason);
32182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
32282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Property Change notification handlers
3233022be5da0e7e158c7f8fc4e3f5d005eb5dde7e7Nathan Williams  void OnModemPropertiesChanged(
32405d87e34869f44473edc1eec25d2fe1110d777a7Peter Qiu      const KeyValueStore& properties,
325f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart      const std::vector<std::string>& invalidated_properties);
3264c0724af38d0eaf7155bb789280940a41ef9f08cJason Glasgow
3277fab89734d88724a288e96a9996b15548c5294c7Ben Chan  void OnSignalQualityChanged(uint32_t quality);
32874924d87cc111f8603751f09cd009c830f43e668Ben Chan
32974924d87cc111f8603751f09cd009c830f43e668Ben Chan  void OnSupportedCapabilitesChanged(
330f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart      const std::vector<uint32_t>& supported_capabilities);
3317fab89734d88724a288e96a9996b15548c5294c7Ben Chan  void OnModemCurrentCapabilitiesChanged(uint32_t current_capabilities);
332f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void OnMdnChanged(const std::string& mdn);
333f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void OnModemRevisionChanged(const std::string& revision);
334af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnModemStateChanged(Cellular::ModemState state);
3357fab89734d88724a288e96a9996b15548c5294c7Ben Chan  void OnAccessTechnologiesChanged(uint32_t access_technologies);
336f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void OnSupportedModesChanged(const std::vector<ModemModes>& supported_modes);
337f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void OnCurrentModesChanged(const ModemModes& current_modes);
338f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void OnBearersChanged(const RpcIdentifiers& bearers);
339f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void OnLockRetriesChanged(const LockRetryData& lock_retries);
340c7e63afa9cfabf9aa022a0bf8e9ec5340f5d13bfArman Uguray  void OnLockTypeChanged(MMModemLock unlock_required);
341af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnSimLockStatusChanged();
342af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow
343c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  // Returns false if the MDN is empty or if the MDN consists of all 0s.
344c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  bool IsMdnValid() const;
345c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray
346af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  // 3GPP property change handlers
347af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  virtual void OnModem3GPPPropertiesChanged(
34805d87e34869f44473edc1eec25d2fe1110d777a7Peter Qiu      const KeyValueStore& properties,
349f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart      const std::vector<std::string>& invalidated_properties);
350af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void On3GPPRegistrationChanged(MMModem3gppRegistrationState state,
351f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                                 const std::string& operator_code,
352f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                                 const std::string& operator_name);
3538f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  void Handle3GPPRegistrationChange(
3548f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu      MMModem3gppRegistrationState updated_state,
3558f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu      std::string updated_operator_code,
3568f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu      std::string updated_operator_name);
3579a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  void On3GPPSubscriptionStateChanged(MMModem3gppSubscriptionState state);
3587fab89734d88724a288e96a9996b15548c5294c7Ben Chan  void OnFacilityLocksChanged(uint32_t locks);
359af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow
360af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  // SIM property change handlers
36172fab6ab6f6d481f904b5e259ce27a84e32760e4Arman Uguray  // TODO(armansito): Put these methods in a 3GPP-only subclass.
362af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  void OnSimPropertiesChanged(
36305d87e34869f44473edc1eec25d2fe1110d777a7Peter Qiu      const KeyValueStore& props,
364f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart      const std::vector<std::string>& invalidated_properties);
365f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void OnSpnChanged(const std::string& spn);
366f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void OnSimIdentifierChanged(const std::string& id);
367f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void OnOperatorIdChanged(const std::string& operator_id);
368f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void OnOperatorNameChanged(const std::string& operator_name);
369ef96556fff984bbc79597669af2465905666ed09Jason Glasgow
37082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Method callbacks
371f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void OnRegisterReply(const ResultCallback& callback,
372f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                       const Error& error);
373f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void OnResetReply(const ResultCallback& callback, const Error& error);
374f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void OnScanReply(const ResultStringmapsCallback& callback,
375f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                   const ScanResults& results,
376f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                   const Error& error);
377f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void OnConnectReply(const ResultCallback& callback,
37805d87e34869f44473edc1eec25d2fe1110d777a7Peter Qiu                      const std::string& bearer,
379f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart                      const Error& error);
38082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
3816552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // Returns true, if |sim_path| constitutes a valid SIM path. Currently, a
3826552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // path is accepted to be valid, as long as it is not equal to one of ""
3836552f8c74196782e9adf09f4fea01c836f551255Arman Uguray  // and "/".
384f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  bool IsValidSimPath(const std::string& sim_path) const;
3856552f8c74196782e9adf09f4fea01c836f551255Arman Uguray
386d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan  // Returns the normalized version of |mdn| by keeping only digits in |mdn|
387d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan  // and removing other non-digit characters.
388f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  std::string NormalizeMdn(const std::string& mdn) const;
389d759252158ec07b4a9edbcfdfb265f010b3e7e13Ben Chan
390c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  // Post-payment activation handlers.
391c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  void ResetAfterActivation();
392efea6e0f28c3270038914e80166702d5ac23095eArman Uguray  void UpdateServiceActivationState();
393f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void OnResetAfterActivationReply(const Error& error);
394c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray
3958f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  static bool IsRegisteredState(MMModem3gppRegistrationState state);
3968f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu
39743ce4d428d619bda64eea6d37534f02c179a1756Thieu Le  // Returns the out-of-credits detection algorithm to be used on this modem.
39843ce4d428d619bda64eea6d37534f02c179a1756Thieu Le  OutOfCreditsDetector::OOCType GetOutOfCreditsDetectionType() const;
39943ce4d428d619bda64eea6d37534f02c179a1756Thieu Le
4002849214ae17c9bd87c10f9012edfe469cf189a80Thieu Le  // For unit tests.
401f58b28e08efb9e3beccb993bc27dd68e0025a7daPaul Stewart  void set_active_bearer(CellularBearer* bearer) {
4022849214ae17c9bd87c10f9012edfe469cf189a80Thieu Le    active_bearer_.reset(bearer);  // Takes ownership
4032849214ae17c9bd87c10f9012edfe469cf189a80Thieu Le  }
4042849214ae17c9bd87c10f9012edfe469cf189a80Thieu Le
405c20ed13f5c0e87e7a5164d1b5330ccd99cced58fBen Chan  std::unique_ptr<mm1::ModemModem3gppProxyInterface> modem_3gpp_proxy_;
406c20ed13f5c0e87e7a5164d1b5330ccd99cced58fBen Chan  std::unique_ptr<mm1::ModemProxyInterface> modem_proxy_;
407c20ed13f5c0e87e7a5164d1b5330ccd99cced58fBen Chan  std::unique_ptr<mm1::ModemSimpleProxyInterface> modem_simple_proxy_;
408c20ed13f5c0e87e7a5164d1b5330ccd99cced58fBen Chan  std::unique_ptr<mm1::SimProxyInterface> sim_proxy_;
409afe636676760df31a8db2f4b77bfd19faae52782Prathmesh Prabhu  // Used to enrich information about the network operator in |ParseScanResult|.
410afe636676760df31a8db2f4b77bfd19faae52782Prathmesh Prabhu  // TODO(pprabhu) Instead instantiate a local |MobileOperatorInfo| instance
411afe636676760df31a8db2f4b77bfd19faae52782Prathmesh Prabhu  // once the context has been separated out. (crbug.com/363874)
412c20ed13f5c0e87e7a5164d1b5330ccd99cced58fBen Chan  std::unique_ptr<MobileOperatorInfo> mobile_operator_info_;
41382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
41482f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  base::WeakPtrFactory<CellularCapabilityUniversal> weak_ptr_factory_;
41582f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
41682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  MMModem3gppRegistrationState registration_state_;
417af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow
418af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow  // Bits based on MMModemCapabilities
4197fab89734d88724a288e96a9996b15548c5294c7Ben Chan  std::vector<uint32_t> supported_capabilities_;  // Technologies supported
4207fab89734d88724a288e96a9996b15548c5294c7Ben Chan  uint32_t current_capabilities_;  // Technologies supported without a reload
4217fab89734d88724a288e96a9996b15548c5294c7Ben Chan  uint32_t access_technologies_;   // Bits based on MMModemAccessTechnology
42274924d87cc111f8603751f09cd009c830f43e668Ben Chan  std::vector<ModemModes> supported_modes_;
42374924d87cc111f8603751f09cd009c830f43e668Ben Chan  ModemModes current_modes_;
424af5832853cf49fcfa34632a736aa4763ef2347d6Jason Glasgow
4254aef4066fd27a04b3fcc3e13898ce8593c5e4d23Roshan Pius  Stringmap serving_operator_;
42682f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string spn_;
42782f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::string desired_network_;
42882f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
42982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  // Properties.
43082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  std::deque<Stringmap> apn_try_list_;
4315d0d32c1b5e2370ff0739f7a2dbb641726d4bf87Ben Chan  bool resetting_;
43282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  SimLockStatus sim_lock_status_;
4339a0534e17ad58e38fd5db4ac67a67c964e2bcfbePrathmesh Prabhu  SubscriptionState subscription_state_;
434ef96556fff984bbc79597669af2465905666ed09Jason Glasgow  std::string sim_path_;
435c20ed13f5c0e87e7a5164d1b5330ccd99cced58fBen Chan  std::unique_ptr<CellularBearer> active_bearer_;
436cbef8123fa639622b1aa86d7a041a02347ddc69dBen Chan  RpcIdentifiers bearer_paths_;
437c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray  bool reset_done_;
438c7b1560b03c070fad239767f868322e6b3bdd932Arman Uguray
439e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // If the modem is not in a state to be enabled when StartModem is called,
440e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  // enabling is deferred using this callback.
441e285a84b38b81f5557b576da187d037ad24ae4afGary Morain  base::Closure deferred_enable_modem_callback_;
442e285a84b38b81f5557b576da187d037ad24ae4afGary Morain
4438f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  // Sometimes flaky cellular network causes the 3GPP registration state to
4448f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  // rapidly change from registered --> searching and back. Delay such updates
4458f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  // a little to smooth over temporary registration loss.
4468f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu  base::CancelableClosure registration_dropped_update_callback_;
4477fab89734d88724a288e96a9996b15548c5294c7Ben Chan  int64_t registration_dropped_update_timeout_milliseconds_;
4488f6479fed67969c162aa079eed04c55ee574a841Prathmesh Prabhu
44982f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow  DISALLOW_COPY_AND_ASSIGN(CellularCapabilityUniversal);
45082f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow};
45182f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
45282f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow}  // namespace shill
45382f9ab3f404c8f414348c6effdc57c4d3b9223d7Jason Glasgow
454c54afe521739065a5d77e7c049acdb5e603f0592Ben Chan#endif  // SHILL_CELLULAR_CELLULAR_CAPABILITY_UNIVERSAL_H_
455