blob: 1d65df54ed8dd791790186f7393501cabfde1549 [file] [log] [blame]
Darin Petkovc64fe5e2012-01-11 12:46:13 +01001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Chris Masone3bd3c8c2011-06-13 08:20:26 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Darin Petkova4ca3c32012-08-17 16:05:24 +02005#ifndef SHILL_CELLULAR_H_
6#define SHILL_CELLULAR_H_
Chris Masone3bd3c8c2011-06-13 08:20:26 -07007
8#include <string>
Jason Glasgow82f9ab32012-04-04 14:27:19 -04009#include <vector>
Chris Masone3bd3c8c2011-06-13 08:20:26 -070010
11#include <base/basictypes.h>
Thieu Le64b0fe52012-08-08 14:57:36 -070012#include <base/memory/weak_ptr.h>
Liam McLoughlin0fec81c2013-02-28 10:31:47 -050013#include <base/gtest_prod_util.h> // for FRIEND_TEST_ALL_PREFIXES
Darin Petkove9d12e02011-07-27 15:09:37 -070014#include <gtest/gtest_prod.h> // for FRIEND_TEST
Chris Masone3bd3c8c2011-06-13 08:20:26 -070015
Darin Petkovc5f56562011-08-06 16:40:05 -070016#include "shill/dbus_properties.h"
Chris Masone3bd3c8c2011-06-13 08:20:26 -070017#include "shill/device.h"
Paul Stewart26b327e2011-10-19 11:38:09 -070018#include "shill/event_dispatcher.h"
Thieu Le26fc01b2013-01-28 12:08:48 -080019#include "shill/metrics.h"
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070020#include "shill/modem_info.h"
Darin Petkovc5f56562011-08-06 16:40:05 -070021#include "shill/modem_proxy_interface.h"
Chris Masone2b105542011-06-22 10:58:09 -070022#include "shill/refptr_types.h"
Chris Masone3bd3c8c2011-06-13 08:20:26 -070023
Darin Petkov137884a2011-10-26 18:52:47 +020024struct mobile_provider_db;
25
Chris Masone3bd3c8c2011-06-13 08:20:26 -070026namespace shill {
27
Darin Petkovdaf43862011-10-27 11:37:28 +020028class CellularCapability;
Darin Petkov4d6d9412011-08-24 13:19:54 -070029class Error;
Darin Petkovab565bb2011-10-06 02:55:51 -070030class ProxyFactory;
Darin Petkove9d12e02011-07-27 15:09:37 -070031
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050032class Cellular : public Device {
Chris Masone3bd3c8c2011-06-13 08:20:26 -070033 public:
Darin Petkove9d12e02011-07-27 15:09:37 -070034 enum Type {
35 kTypeGSM,
David Rochbergfa1d31d2012-03-20 10:38:07 -040036 kTypeCDMA,
37 kTypeUniversal, // ModemManager1
38 kTypeInvalid,
Darin Petkove9d12e02011-07-27 15:09:37 -070039 };
40
Darin Petkov0828f5f2011-08-11 10:18:52 -070041 // The device states progress linearly from Disabled to Linked.
Darin Petkove9d12e02011-07-27 15:09:37 -070042 enum State {
Darin Petkov0828f5f2011-08-11 10:18:52 -070043 // This is the initial state of the modem and indicates that the modem radio
44 // is not turned on.
Darin Petkove9d12e02011-07-27 15:09:37 -070045 kStateDisabled,
Darin Petkov0828f5f2011-08-11 10:18:52 -070046 // This state indicates that the modem radio is turned on, and it should be
47 // possible to measure signal strength.
Darin Petkove9d12e02011-07-27 15:09:37 -070048 kStateEnabled,
Darin Petkov0828f5f2011-08-11 10:18:52 -070049 // The modem has registered with a network and has signal quality
Darin Petkov51489002011-08-18 13:13:20 -070050 // measurements. A cellular service object is created.
Darin Petkove9d12e02011-07-27 15:09:37 -070051 kStateRegistered,
Darin Petkov0828f5f2011-08-11 10:18:52 -070052 // The modem has connected to a network.
Darin Petkove9d12e02011-07-27 15:09:37 -070053 kStateConnected,
Darin Petkov0828f5f2011-08-11 10:18:52 -070054 // The network interface is UP.
55 kStateLinked,
Darin Petkove9d12e02011-07-27 15:09:37 -070056 };
57
Darin Petkovbac96002011-08-09 13:22:00 -070058 enum ModemState {
59 kModemStateUnknown = 0,
Eric Shienbrood7fce52c2012-04-13 19:11:02 -040060 kModemStateInitializing = 1,
61 kModemStateLocked = 2,
62 kModemStateDisabled = 3,
David Rochbergfa1d31d2012-03-20 10:38:07 -040063 kModemStateDisabling = 4,
64 kModemStateEnabling = 5,
65 kModemStateEnabled = 6,
66 kModemStateSearching = 7,
67 kModemStateRegistered = 8,
68 kModemStateDisconnecting = 9,
69 kModemStateConnecting = 10,
70 kModemStateConnected = 11,
Darin Petkovbac96002011-08-09 13:22:00 -070071 };
72
Darin Petkov3335b372011-08-22 11:05:32 -070073 class Operator {
74 public:
75 Operator();
76 ~Operator();
77
78 void CopyFrom(const Operator &oper);
Darin Petkov9cb02682012-01-28 00:17:38 +010079 bool Equals(const Operator &oper) const { return dict_ == oper.dict_; }
Darin Petkov3335b372011-08-22 11:05:32 -070080
81 const std::string &GetName() const;
82 void SetName(const std::string &name);
83
84 const std::string &GetCode() const;
85 void SetCode(const std::string &code);
86
87 const std::string &GetCountry() const;
88 void SetCountry(const std::string &country);
89
90 const Stringmap &ToDict() const;
91
92 private:
93 Stringmap dict_;
94
95 DISALLOW_COPY_AND_ASSIGN(Operator);
96 };
97
Jason Glasgowa585fc32012-06-06 11:04:09 -040098 // |owner| is the ModemManager DBus service owner (e.g., ":1.17").
99 // |path| is the ModemManager.Modem DBus object path (e.g.,
Darin Petkove9d12e02011-07-27 15:09:37 -0700100 // "/org/chromium/ModemManager/Gobi/0").
Jason Glasgowa585fc32012-06-06 11:04:09 -0400101 // |service| is the modem mananager service name (e.g.,
Ben Chan8799a4a2013-04-13 16:00:13 -0700102 // /org/chromium/ModemManager or /org/freedesktop/ModemManager1).
Prathmesh Prabhu27526f12013-03-25 19:42:18 -0700103 Cellular(ModemInfo *modem_info,
Darin Petkove9d12e02011-07-27 15:09:37 -0700104 const std::string &link_name,
Chris Masone626719f2011-08-18 16:58:48 -0700105 const std::string &address,
Darin Petkove9d12e02011-07-27 15:09:37 -0700106 int interface_index,
107 Type type,
108 const std::string &owner,
Jason Glasgowa585fc32012-06-06 11:04:09 -0400109 const std::string &service,
Darin Petkov137884a2011-10-26 18:52:47 +0200110 const std::string &path,
Ben Chan3ecdf822012-08-06 12:29:23 -0700111 ProxyFactory *proxy_factory);
Darin Petkove9d12e02011-07-27 15:09:37 -0700112 virtual ~Cellular();
113
Jason Glasgow7b461df2012-05-01 16:38:45 -0400114 // Load configuration for the device from |storage|.
115 virtual bool Load(StoreInterface *storage);
116
117 // Save configuration for the device to |storage|.
118 virtual bool Save(StoreInterface *storage);
119
Darin Petkov4d6d9412011-08-24 13:19:54 -0700120 // Asynchronously connects the modem to the network. Populates |error| on
121 // failure, leaves it unchanged otherwise.
Thieu Le398b1da2013-03-11 17:31:10 -0700122 virtual void Connect(Error *error);
Darin Petkovc5f56562011-08-06 16:40:05 -0700123
Christopher Wiley8a468902012-11-30 11:52:38 -0800124 // Asynchronously disconnects the modem from the network and populates
125 // |error| on failure, leaves it unchanged otherwise.
Christopher Wiley7d0953e2012-11-16 00:37:10 -0800126 virtual void Disconnect(Error *error);
Darin Petkovfb0625e2012-01-16 13:05:56 +0100127
Eric Shienbrood5de44ab2011-12-05 10:46:27 -0500128 // Asynchronously activates the modem. Returns an error on failure.
Eric Shienbrood9a245532012-03-07 14:20:39 -0500129 void Activate(const std::string &carrier, Error *error,
130 const ResultCallback &callback);
Darin Petkovc408e692011-08-17 13:47:15 -0700131
Arman Ugurayc7b15602013-02-16 00:56:18 -0800132 // Performs the necessary steps to bring the service to the activated state,
133 // once an online payment has been done.
134 void CompleteActivation(Error *error);
135
Darin Petkov3e509242011-11-10 14:46:44 +0100136 const CellularServiceRefPtr &service() const { return service_; }
137
Darin Petkova0a0efe2012-06-27 12:50:01 +0200138 // Deregisters and destructs the current service and destroys the connection,
139 // if any. This also eliminates the circular references between this device
140 // and the associated service, allowing eventual device destruction.
141 virtual void DestroyService();
142
Darin Petkova3d3be52011-11-14 21:34:16 +0100143 static std::string GetStateString(State state);
144
Darin Petkovac635a82012-01-10 16:51:58 +0100145 std::string CreateFriendlyServiceName();
146
Darin Petkova3d3be52011-11-14 21:34:16 +0100147 State state() const { return state_; }
148
Darin Petkovbac96002011-08-09 13:22:00 -0700149 void set_modem_state(ModemState state) { modem_state_ = state; }
150 ModemState modem_state() const { return modem_state_; }
Eric Shienbrood7fce52c2012-04-13 19:11:02 -0400151 bool IsUnderlyingDeviceEnabled() const;
Thieu Led0012052012-07-25 16:09:09 -0700152 bool IsModemRegistered() const;
Eric Shienbrood7fce52c2012-04-13 19:11:02 -0400153 static bool IsEnabledModemState(ModemState state);
Darin Petkovbac96002011-08-09 13:22:00 -0700154
Darin Petkovdaf43862011-10-27 11:37:28 +0200155 const std::string &dbus_owner() const { return dbus_owner_; }
156 const std::string &dbus_path() const { return dbus_path_; }
157
Darin Petkovae0c64e2011-11-15 15:50:27 +0100158 const Operator &home_provider() const { return home_provider_; }
159 void set_home_provider(const Operator &oper);
Darin Petkov184c54e2011-11-15 12:44:39 +0100160
Darin Petkov3e509242011-11-10 14:46:44 +0100161 void HandleNewSignalQuality(uint32 strength);
162
Darin Petkov184c54e2011-11-15 12:44:39 +0100163 // Processes a change in the modem registration state, possibly creating,
164 // destroying or updating the CellularService.
165 void HandleNewRegistrationState();
166
Jason Glasgow82f9ab32012-04-04 14:27:19 -0400167 virtual void OnDBusPropertiesChanged(
168 const std::string &interface,
169 const DBusPropertiesMap &changed_properties,
170 const std::vector<std::string> &invalidated_properties);
Darin Petkov184c54e2011-11-15 12:44:39 +0100171
Darin Petkove9d12e02011-07-27 15:09:37 -0700172 // Inherited from Device.
Eric Shienbrood9a245532012-03-07 14:20:39 -0500173 virtual void Start(Error *error, const EnabledStateChangedCallback &callback);
174 virtual void Stop(Error *error, const EnabledStateChangedCallback &callback);
Darin Petkov0828f5f2011-08-11 10:18:52 -0700175 virtual void LinkEvent(unsigned int flags, unsigned int change);
Wade Guthrie68d41092013-04-02 12:56:02 -0700176 virtual void Scan(ScanType scan_type, Error *error);
Eric Shienbrood5de44ab2011-12-05 10:46:27 -0500177 virtual void RegisterOnNetwork(const std::string &network_id,
Eric Shienbrood9a245532012-03-07 14:20:39 -0500178 Error *error,
179 const ResultCallback &callback);
180 virtual void RequirePIN(const std::string &pin, bool require,
181 Error *error, const ResultCallback &callback);
182 virtual void EnterPIN(const std::string &pin,
183 Error *error, const ResultCallback &callback);
Darin Petkove42e1012011-08-31 12:35:04 -0700184 virtual void UnblockPIN(const std::string &unblock_code,
185 const std::string &pin,
Eric Shienbrood9a245532012-03-07 14:20:39 -0500186 Error *error, const ResultCallback &callback);
Darin Petkove42e1012011-08-31 12:35:04 -0700187 virtual void ChangePIN(const std::string &old_pin,
188 const std::string &new_pin,
Eric Shienbrood9a245532012-03-07 14:20:39 -0500189 Error *error, const ResultCallback &callback);
Ben Chan5d0d32c2013-01-08 02:05:29 -0800190 virtual void Reset(Error *error, const ResultCallback &callback);
Darin Petkovc37a9c42012-09-06 15:28:22 +0200191 virtual void SetCarrier(const std::string &carrier,
192 Error *error, const ResultCallback &callback);
Arman Ugurayd42d8ec2013-04-08 19:28:21 -0700193 virtual void OnNoNetworkRouting();
Chris Masone3bd3c8c2011-06-13 08:20:26 -0700194
Thieu Le37b90032012-05-15 15:18:41 -0700195 void StartModemCallback(const EnabledStateChangedCallback &callback,
196 const Error &error);
197 void StopModemCallback(const EnabledStateChangedCallback &callback,
198 const Error &error);
Eric Shienbrood7fce52c2012-04-13 19:11:02 -0400199 void OnConnecting();
Eric Shienbrood5de44ab2011-12-05 10:46:27 -0500200 void OnConnected();
Eric Shienbrood30bc0ec2012-03-21 18:19:46 -0400201 void OnConnectFailed(const Error &error);
Eric Shienbrood5de44ab2011-12-05 10:46:27 -0500202 void OnDisconnected();
203 void OnDisconnectFailed();
Eric Shienbrood0db6a9b2012-03-30 16:11:39 -0400204 std::string GetTechnologyFamily(Error *error);
Eric Shienbrood7fce52c2012-04-13 19:11:02 -0400205 void OnModemStateChanged(ModemState old_state,
206 ModemState new_state,
207 uint32 reason);
Eric Shienbrood5de44ab2011-12-05 10:46:27 -0500208
Jason Glasgow7b461df2012-05-01 16:38:45 -0400209 // accessor to read the allow roaming property
210 bool allow_roaming_property() const { return allow_roaming_; }
Christopher Wiley1582bdd2012-11-15 11:31:14 -0800211 // Is the underlying device in the process of activating?
212 bool IsActivating() const;
Jason Glasgow7b461df2012-05-01 16:38:45 -0400213
Arman Ugurayf84a4242013-04-09 20:01:07 -0700214 virtual void OnConnectionHealthCheckerResult(
215 ConnectionHealthChecker::Result result);
216 virtual void PortalDetectorCallback(const PortalDetector::Result &result);
217
Chris Masone3bd3c8c2011-06-13 08:20:26 -0700218 private:
Darin Petkovab565bb2011-10-06 02:55:51 -0700219 friend class CellularTest;
Eric Shienbrood5de44ab2011-12-05 10:46:27 -0500220 friend class CellularCapabilityTest;
Darin Petkov20c13ec2011-11-09 15:07:15 +0100221 friend class CellularCapabilityCDMATest;
222 friend class CellularCapabilityGSMTest;
Jason Glasgowef965562012-04-10 16:12:35 -0400223 friend class CellularCapabilityUniversalTest;
Jason Glasgow82f9ab32012-04-04 14:27:19 -0400224 friend class CellularServiceTest;
Darin Petkov721ac932011-11-16 15:43:09 +0100225 friend class ModemTest;
Darin Petkovac635a82012-01-10 16:51:58 +0100226 FRIEND_TEST(CellularCapabilityCDMATest, CreateFriendlyServiceName);
Eric Shienbrood9a245532012-03-07 14:20:39 -0500227 FRIEND_TEST(CellularCapabilityCDMATest, GetRegistrationState);
Darin Petkovf508c822012-09-21 13:43:17 +0200228 FRIEND_TEST(CellularCapabilityGSMTest, AllowRoaming);
Darin Petkovac635a82012-01-10 16:51:58 +0100229 FRIEND_TEST(CellularCapabilityGSMTest, CreateFriendlyServiceName);
Darin Petkova4ca3c32012-08-17 16:05:24 +0200230 FRIEND_TEST(CellularCapabilityTest, AllowRoaming);
231 FRIEND_TEST(CellularCapabilityTest, EnableModemFail);
232 FRIEND_TEST(CellularCapabilityTest, EnableModemSucceed);
233 FRIEND_TEST(CellularCapabilityTest, FinishEnable);
234 FRIEND_TEST(CellularCapabilityTest, GetModemInfo);
235 FRIEND_TEST(CellularCapabilityTest, GetModemStatus);
Arman Uguray1361c032013-02-11 17:53:39 -0800236 FRIEND_TEST(CellularCapabilityUniversalMainTest, AllowRoaming);
237 FRIEND_TEST(CellularCapabilityUniversalMainTest, CreateFriendlyServiceName);
238 FRIEND_TEST(CellularCapabilityUniversalMainTest, Connect);
239 FRIEND_TEST(CellularCapabilityUniversalMainTest, IsServiceActivationRequired);
240 FRIEND_TEST(CellularCapabilityUniversalMainTest, SetHomeProvider);
Thieu Leb9c05e02013-03-04 14:09:32 -0800241 FRIEND_TEST(CellularCapabilityUniversalMainTest, StartModemAlreadyEnabled);
Arman Uguray1361c032013-02-11 17:53:39 -0800242 FRIEND_TEST(CellularCapabilityUniversalMainTest, StopModemConnected);
Arman Ugurayc7b15602013-02-16 00:56:18 -0800243 FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateIccidActivationState);
Arman Uguray1361c032013-02-11 17:53:39 -0800244 FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateOLP);
245 FRIEND_TEST(CellularCapabilityUniversalMainTest,
246 UpdateOperatorInfoViaOperatorId);
247 FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateScanningProperty);
Arman Ugurayefea6e02013-02-21 13:28:04 -0800248 FRIEND_TEST(CellularCapabilityUniversalMainTest,
249 UpdateServiceActivationState);
Arman Uguray1361c032013-02-11 17:53:39 -0800250 FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateServiceName);
251 FRIEND_TEST(CellularCapabilityUniversalMainTest, UpdateStorageIdentifier);
Darin Petkovac635a82012-01-10 16:51:58 +0100252 FRIEND_TEST(CellularServiceTest, FriendlyName);
Darin Petkov3335b372011-08-22 11:05:32 -0700253 FRIEND_TEST(CellularTest, CreateService);
Darin Petkovc5f56562011-08-06 16:40:05 -0700254 FRIEND_TEST(CellularTest, Connect);
Liam McLoughlin0fec81c2013-02-28 10:31:47 -0500255 FRIEND_TEST_ALL_PREFIXES(CellularTest, ConnectAddsTerminationAction);
Eric Shienbroodcc95c5d2012-03-30 15:25:49 -0400256 FRIEND_TEST(CellularTest, ConnectFailure);
Thieu Leb5954a22012-05-18 10:37:34 -0700257 FRIEND_TEST(CellularTest, ConnectFailureNoService);
Darin Petkovfb0625e2012-01-16 13:05:56 +0100258 FRIEND_TEST(CellularTest, DisableModem);
Eric Shienbrood9a245532012-03-07 14:20:39 -0500259 FRIEND_TEST(CellularTest, Disconnect);
Arman Uguray539c4232012-09-11 10:00:22 -0700260 FRIEND_TEST(CellularTest, DisconnectFailure);
Christopher Wiley7d0953e2012-11-16 00:37:10 -0800261 FRIEND_TEST(CellularTest, DisconnectWithCallback);
Arman Ugurayd42d8ec2013-04-08 19:28:21 -0700262 FRIEND_TEST(CellularTest, EnableTrafficMonitor);
Ben Chan09fa2a02012-11-07 22:09:09 -0800263 FRIEND_TEST(CellularTest,
264 HandleNewRegistrationStateForServiceRequiringActivation);
Arman Uguray32c76402012-11-27 14:01:13 -0800265 FRIEND_TEST(CellularTest, LinkEventWontDestroyService);
Eric Shienbrood7fce52c2012-04-13 19:11:02 -0400266 FRIEND_TEST(CellularTest, ModemStateChangeDisable);
267 FRIEND_TEST(CellularTest, ModemStateChangeEnable);
Thieu Led0012052012-07-25 16:09:09 -0700268 FRIEND_TEST(CellularTest, ModemStateChangeStaleConnected);
269 FRIEND_TEST(CellularTest, ModemStateChangeValidConnected);
Arman Ugurayf84a4242013-04-09 20:01:07 -0700270 FRIEND_TEST(CellularTest, OnConnectionHealthCheckerResult);
Darin Petkove7c6ad32012-06-29 10:22:09 +0200271 FRIEND_TEST(CellularTest, SetAllowRoaming);
Thieu Le37b90032012-05-15 15:18:41 -0700272 FRIEND_TEST(CellularTest, StartModemCallback);
273 FRIEND_TEST(CellularTest, StartModemCallbackFail);
274 FRIEND_TEST(CellularTest, StopModemCallback);
275 FRIEND_TEST(CellularTest, StopModemCallbackFail);
Darin Petkovbac96002011-08-09 13:22:00 -0700276 FRIEND_TEST(CellularTest, StartConnected);
Darin Petkova1e0a1c2011-08-25 15:08:33 -0700277 FRIEND_TEST(CellularTest, StartCDMARegister);
Darin Petkov9bac6fe2011-08-26 12:49:05 -0700278 FRIEND_TEST(CellularTest, StartGSMRegister);
Darin Petkov0828f5f2011-08-11 10:18:52 -0700279 FRIEND_TEST(CellularTest, StartLinked);
Ben Chan876efd32012-09-28 15:25:13 -0700280 FRIEND_TEST(Modem1Test, CreateDeviceMM1);
Darin Petkove9d12e02011-07-27 15:09:37 -0700281
Jason Glasgow7b461df2012-05-01 16:38:45 -0400282 // Names of properties in storage
283 static const char kAllowRoaming[];
284
Darin Petkov0828f5f2011-08-11 10:18:52 -0700285 void SetState(State state);
286
Darin Petkovbac96002011-08-09 13:22:00 -0700287 // Invoked when the modem is connected to the cellular network to transition
288 // to the network-connected state and bring the network interface up.
289 void EstablishLink();
290
Ben Chan3ecdf822012-08-06 12:29:23 -0700291 void InitCapability(Type type);
Darin Petkovf5f61e02011-07-29 11:35:40 -0700292
Darin Petkovd9661952011-08-03 16:25:42 -0700293 void CreateService();
294
Eric Shienbrood0db6a9b2012-03-30 16:11:39 -0400295 // HelpRegisterDerived*: Expose a property over RPC, with the name |name|.
296 //
297 // Reads of the property will be handled by invoking |get|.
298 // Writes to the property will be handled by invoking |set|.
299 // Clearing the property will be handled by PropertyStore.
Jason Glasgow7b461df2012-05-01 16:38:45 -0400300 void HelpRegisterDerivedBool(
301 const std::string &name,
302 bool(Cellular::*get)(Error *error),
303 void(Cellular::*set)(const bool &value, Error *error));
Eric Shienbrood0db6a9b2012-03-30 16:11:39 -0400304 void HelpRegisterDerivedString(
305 const std::string &name,
306 std::string(Cellular::*get)(Error *error),
307 void(Cellular::*set)(const std::string &value, Error *error));
308
Nathan Williamsb54974f2012-04-19 11:16:30 -0400309 void OnConnectReply(const Error &error);
Christopher Wiley8a468902012-11-30 11:52:38 -0800310 void OnDisconnectReply(const Error &error);
Nathan Williamsb54974f2012-04-19 11:16:30 -0400311
Jason Glasgow7b461df2012-05-01 16:38:45 -0400312 // DBUS accessors to read/modify the allow roaming property
313 bool GetAllowRoaming(Error */*error*/) { return allow_roaming_; }
314 void SetAllowRoaming(const bool &value, Error *error);
315
Gary Moraina9fb3252012-05-31 12:05:31 -0700316 // When shill terminates or ChromeOS suspends, this function is called to
317 // disconnect from the cellular network.
318 void StartTermination();
319
Arman Uguray539c4232012-09-11 10:00:22 -0700320 // This function does the final cleanup once a disconnect request terminates.
321 // Returns true, if the device state is successfully changed.
322 bool DisconnectCleanup();
323
Thieu Le64b0fe52012-08-08 14:57:36 -0700324 base::WeakPtrFactory<Cellular> weak_ptr_factory_;
325
Darin Petkove9d12e02011-07-27 15:09:37 -0700326 State state_;
Darin Petkovbac96002011-08-09 13:22:00 -0700327 ModemState modem_state_;
Darin Petkove9d12e02011-07-27 15:09:37 -0700328
Darin Petkovdaf43862011-10-27 11:37:28 +0200329 scoped_ptr<CellularCapability> capability_;
330
Jason Glasgowa585fc32012-06-06 11:04:09 -0400331 const std::string dbus_owner_; // :x.y
332 const std::string dbus_service_; // org.*.ModemManager*
Darin Petkove9d12e02011-07-27 15:09:37 -0700333 const std::string dbus_path_; // ModemManager.Modem
Darin Petkovbec79a22011-08-01 14:47:17 -0700334
Prathmesh Prabhu27526f12013-03-25 19:42:18 -0700335 ModemInfo *modem_info_;
Ben Chan3ecdf822012-08-06 12:29:23 -0700336 ProxyFactory *proxy_factory_;
Darin Petkov137884a2011-10-26 18:52:47 +0200337
Darin Petkovd9661952011-08-03 16:25:42 -0700338 CellularServiceRefPtr service_;
Chris Masone853b81b2011-06-24 14:11:41 -0700339
Chris Masoneb925cc82011-06-22 15:39:57 -0700340 // Properties
Darin Petkov3335b372011-08-22 11:05:32 -0700341 Operator home_provider_;
Chris Masoneb925cc82011-06-22 15:39:57 -0700342
Jason Glasgow7b461df2012-05-01 16:38:45 -0400343 // User preference to allow or disallow roaming
344 bool allow_roaming_;
345
Thieu Le26fc01b2013-01-28 12:08:48 -0800346 // Flag indicating that a disconnect has been explicitly requested.
347 bool explicit_disconnect_;
348
Chris Masone3bd3c8c2011-06-13 08:20:26 -0700349 DISALLOW_COPY_AND_ASSIGN(Cellular);
350};
351
352} // namespace shill
353
Darin Petkova4ca3c32012-08-17 16:05:24 +0200354#endif // SHILL_CELLULAR_H_