blob: 752272d28ef00955294914d6dd6511bf2b685841 [file] [log] [blame]
Darin Petkovac635a82012-01-10 16:51:58 +01001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Darin Petkovdaf43862011-10-27 11:37:28 +02002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "shill/cellular_capability_cdma.h"
6
Jason Glasgow4c0724a2012-04-17 15:47:40 -04007#include <string>
8#include <vector>
9
Eric Shienbrood3e20a232012-02-16 11:35:56 -050010#include <base/bind.h>
Darin Petkovac635a82012-01-10 16:51:58 +010011#include <base/stringprintf.h>
Darin Petkov20c13ec2011-11-09 15:07:15 +010012#include <chromeos/dbus/service_constants.h>
13#include <mm/mm-modem.h>
Darin Petkovdaf43862011-10-27 11:37:28 +020014
15#include "shill/cellular.h"
Darin Petkov184c54e2011-11-15 12:44:39 +010016#include "shill/cellular_service.h"
Christopher Wileyb691efd2012-08-09 13:51:51 -070017#include "shill/logging.h"
Darin Petkovdaf43862011-10-27 11:37:28 +020018#include "shill/proxy_factory.h"
19
Eric Shienbrood3e20a232012-02-16 11:35:56 -050020using base::Bind;
Darin Petkov20c13ec2011-11-09 15:07:15 +010021using std::string;
Jason Glasgow4c0724a2012-04-17 15:47:40 -040022using std::vector;
Darin Petkov20c13ec2011-11-09 15:07:15 +010023
Darin Petkovdaf43862011-10-27 11:37:28 +020024namespace shill {
25
Darin Petkovac635a82012-01-10 16:51:58 +010026// static
27unsigned int CellularCapabilityCDMA::friendly_service_name_id_ = 0;
28
Darin Petkovae0c64e2011-11-15 15:50:27 +010029const char CellularCapabilityCDMA::kPhoneNumber[] = "#777";
30
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050031CellularCapabilityCDMA::CellularCapabilityCDMA(Cellular *cellular,
Thieu Lece4483e2013-01-23 15:12:03 -080032 ProxyFactory *proxy_factory,
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070033 ModemInfo *modem_info)
34 : CellularCapabilityClassic(cellular, proxy_factory, modem_info),
Eric Shienbrood3e20a232012-02-16 11:35:56 -050035 weak_ptr_factory_(this),
Christopher Wiley1582bdd2012-11-15 11:31:14 -080036 activation_starting_(false),
Darin Petkovae0c64e2011-11-15 15:50:27 +010037 activation_state_(MM_MODEM_CDMA_ACTIVATION_STATE_NOT_ACTIVATED),
Darin Petkov184c54e2011-11-15 12:44:39 +010038 registration_state_evdo_(MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN),
Darin Petkovae0c64e2011-11-15 15:50:27 +010039 registration_state_1x_(MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN),
40 prl_version_(0) {
Ben Chanfad4a0b2012-04-18 15:49:59 -070041 SLOG(Cellular, 2) << "Cellular capability constructed: CDMA";
Darin Petkovae0c64e2011-11-15 15:50:27 +010042 PropertyStore *store = cellular->mutable_store();
43 store->RegisterConstUint16(flimflam::kPRLVersionProperty, &prl_version_);
44}
Darin Petkovdaf43862011-10-27 11:37:28 +020045
Eric Shienbrood9a245532012-03-07 14:20:39 -050046void CellularCapabilityCDMA::InitProxies() {
Jason Glasgow82f9ab32012-04-04 14:27:19 -040047 CellularCapabilityClassic::InitProxies();
Darin Petkov184c54e2011-11-15 12:44:39 +010048 proxy_.reset(proxy_factory()->CreateModemCDMAProxy(
Eric Shienbrood9a245532012-03-07 14:20:39 -050049 cellular()->dbus_path(), cellular()->dbus_owner()));
50 proxy_->set_signal_quality_callback(
51 Bind(&CellularCapabilityCDMA::OnSignalQualitySignal,
52 weak_ptr_factory_.GetWeakPtr()));
53 proxy_->set_activation_state_callback(
54 Bind(&CellularCapabilityCDMA::OnActivationStateChangedSignal,
55 weak_ptr_factory_.GetWeakPtr()));
56 proxy_->set_registration_state_callback(
57 Bind(&CellularCapabilityCDMA::OnRegistrationStateChangedSignal,
58 weak_ptr_factory_.GetWeakPtr()));
Darin Petkovdaf43862011-10-27 11:37:28 +020059}
60
Eric Shienbrood9a245532012-03-07 14:20:39 -050061void CellularCapabilityCDMA::StartModem(Error *error,
62 const ResultCallback &callback) {
Ben Chanfad4a0b2012-04-18 15:49:59 -070063 SLOG(Cellular, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -050064 InitProxies();
65
66 CellularTaskList *tasks = new CellularTaskList();
67 ResultCallback cb =
68 Bind(&CellularCapabilityCDMA::StepCompletedCallback,
Thieu Le923006b2012-04-05 16:32:58 -070069 weak_ptr_factory_.GetWeakPtr(), callback, false, tasks);
Eric Shienbrood7fce52c2012-04-13 19:11:02 -040070 if (!cellular()->IsUnderlyingDeviceEnabled())
71 tasks->push_back(Bind(&CellularCapabilityCDMA::EnableModem,
72 weak_ptr_factory_.GetWeakPtr(), cb));
Eric Shienbrood9a245532012-03-07 14:20:39 -050073 tasks->push_back(Bind(&CellularCapabilityCDMA::GetModemStatus,
74 weak_ptr_factory_.GetWeakPtr(), cb));
75 tasks->push_back(Bind(&CellularCapabilityCDMA::GetMEID,
76 weak_ptr_factory_.GetWeakPtr(), cb));
77 tasks->push_back(Bind(&CellularCapabilityCDMA::GetModemInfo,
78 weak_ptr_factory_.GetWeakPtr(), cb));
79 tasks->push_back(Bind(&CellularCapabilityCDMA::FinishEnable,
80 weak_ptr_factory_.GetWeakPtr(), cb));
81
82 RunNextStep(tasks);
83}
84
Eric Shienbrood9a245532012-03-07 14:20:39 -050085void CellularCapabilityCDMA::ReleaseProxies() {
Jason Glasgow82f9ab32012-04-04 14:27:19 -040086 CellularCapabilityClassic::ReleaseProxies();
Darin Petkov721ac932011-11-16 15:43:09 +010087 proxy_.reset();
88}
89
Jason Glasgow82f9ab32012-04-04 14:27:19 -040090bool CellularCapabilityCDMA::AllowRoaming() {
91 return allow_roaming_property();
92}
93
94
Darin Petkov5f316f62011-11-18 12:10:26 +010095void CellularCapabilityCDMA::OnServiceCreated() {
Ben Chanfad4a0b2012-04-18 15:49:59 -070096 SLOG(Cellular, 2) << __func__;
Darin Petkov381928f2012-02-02 23:00:12 +010097 cellular()->service()->SetOLP(olp_);
98 cellular()->service()->SetUsageURL(usage_url_);
Darin Petkov5f316f62011-11-18 12:10:26 +010099 UpdateServingOperator();
100 HandleNewActivationState(MM_MODEM_CDMA_ACTIVATION_ERROR_NO_ERROR);
101}
102
Darin Petkovae0c64e2011-11-15 15:50:27 +0100103void CellularCapabilityCDMA::UpdateStatus(const DBusPropertiesMap &properties) {
104 string carrier;
105 if (DBusProperties::GetString(properties, "carrier", &carrier)) {
106 Cellular::Operator oper;
107 oper.SetName(carrier);
108 oper.SetCountry("us");
109 cellular()->set_home_provider(oper);
110 }
111 DBusProperties::GetUint32(
112 properties, "activation_state", &activation_state_);
113 DBusProperties::GetUint16(properties, "prl_version", &prl_version_);
Darin Petkov5f316f62011-11-18 12:10:26 +0100114 // TODO(petkov): For now, get the payment and usage URLs from ModemManager to
115 // match flimflam. In the future, get these from an alternative source (e.g.,
116 // database, carrier-specific properties, etc.).
Darin Petkov381928f2012-02-02 23:00:12 +0100117 string payment;
118 if (DBusProperties::GetString(properties, "payment_url", &payment)) {
119 olp_.SetURL(payment);
120 }
121 if (DBusProperties::GetString(properties, "payment_url_method", &payment)) {
122 olp_.SetMethod(payment);
123 }
124 if (DBusProperties::GetString(properties, "payment_url_postdata", &payment)) {
125 olp_.SetPostData(payment);
126 }
Darin Petkovae0c64e2011-11-15 15:50:27 +0100127 DBusProperties::GetString(properties, "usage_url", &usage_url_);
128}
129
130void CellularCapabilityCDMA::SetupConnectProperties(
131 DBusPropertiesMap *properties) {
Eric Shienbrood5de44ab2011-12-05 10:46:27 -0500132 (*properties)[kConnectPropertyPhoneNumber].writer().append_string(
Darin Petkovae0c64e2011-11-15 15:50:27 +0100133 kPhoneNumber);
134}
135
Eric Shienbrood5de44ab2011-12-05 10:46:27 -0500136void CellularCapabilityCDMA::Activate(const string &carrier,
Eric Shienbrood9a245532012-03-07 14:20:39 -0500137 Error *error,
138 const ResultCallback &callback) {
Ben Chanfad4a0b2012-04-18 15:49:59 -0700139 SLOG(Cellular, 2) << __func__ << "(" << carrier << ")";
Christopher Wiley1582bdd2012-11-15 11:31:14 -0800140 // We're going to trigger something which leads to an activation.
141 activation_starting_ = true;
Christopher Wiley7d0953e2012-11-16 00:37:10 -0800142 if (cellular()->state() == Cellular::kStateEnabled ||
143 cellular()->state() == Cellular::kStateRegistered) {
Christopher Wiley8a468902012-11-30 11:52:38 -0800144 ActivationResultCallback activation_callback =
Christopher Wiley7d0953e2012-11-16 00:37:10 -0800145 Bind(&CellularCapabilityCDMA::OnActivateReply,
146 weak_ptr_factory_.GetWeakPtr(),
147 callback);
Christopher Wiley8a468902012-11-30 11:52:38 -0800148 proxy_->Activate(carrier, error, activation_callback, kTimeoutActivate);
Christopher Wiley7d0953e2012-11-16 00:37:10 -0800149 } else if (cellular()->state() == Cellular::kStateConnected ||
150 cellular()->state() == Cellular::kStateLinked) {
Christopher Wiley8a468902012-11-30 11:52:38 -0800151 pending_activation_callback_ = callback;
152 pending_activation_carrier_ = carrier;
153 cellular()->Disconnect(error);
Christopher Wiley7d0953e2012-11-16 00:37:10 -0800154 } else {
Eric Shienbrood9a245532012-03-07 14:20:39 -0500155 Error::PopulateAndLog(error, Error::kInvalidArguments,
Darin Petkova3d3be52011-11-14 21:34:16 +0100156 "Unable to activate in " +
157 Cellular::GetStateString(cellular()->state()));
Christopher Wiley1582bdd2012-11-15 11:31:14 -0800158 activation_starting_ = false;
Darin Petkova3d3be52011-11-14 21:34:16 +0100159 }
Darin Petkovae0c64e2011-11-15 15:50:27 +0100160}
161
162void CellularCapabilityCDMA::HandleNewActivationState(uint32 error) {
Christopher Wiley8a468902012-11-30 11:52:38 -0800163 SLOG(Cellular, 2) << __func__ << "(" << error << ")";
Darin Petkovae0c64e2011-11-15 15:50:27 +0100164 if (!cellular()->service().get()) {
Christopher Wiley7d0953e2012-11-16 00:37:10 -0800165 LOG(ERROR) << "In " << __func__ << "(): service is null.";
Darin Petkovae0c64e2011-11-15 15:50:27 +0100166 return;
167 }
Darin Petkovb9c99332012-01-12 13:13:00 +0100168 cellular()->service()->SetActivationState(
Darin Petkovae0c64e2011-11-15 15:50:27 +0100169 GetActivationStateString(activation_state_));
170 cellular()->service()->set_error(GetActivationErrorString(error));
171}
172
Christopher Wiley8a468902012-11-30 11:52:38 -0800173void CellularCapabilityCDMA::DisconnectCleanup() {
174 CellularCapabilityClassic::DisconnectCleanup();
175 if (pending_activation_callback_.is_null()) {
176 return;
177 }
178 if (cellular()->state() == Cellular::kStateEnabled ||
179 cellular()->state() == Cellular::kStateRegistered) {
180 Error ignored_error;
181 Activate(pending_activation_carrier_,
182 &ignored_error,
183 pending_activation_callback_);
184 } else {
185 Error error;
186 Error::PopulateAndLog(
187 &error,
188 Error::kOperationFailed,
189 "Tried to disconnect before activating cellular service and failed");
190 HandleNewActivationState(MM_MODEM_CDMA_ACTIVATION_ERROR_UNKNOWN);
191 activation_starting_ = false;
192 pending_activation_callback_.Run(error);
193 }
194 pending_activation_callback_.Reset();
195 pending_activation_carrier_.clear();
196}
197
Darin Petkovae0c64e2011-11-15 15:50:27 +0100198// static
199string CellularCapabilityCDMA::GetActivationStateString(uint32 state) {
200 switch (state) {
201 case MM_MODEM_CDMA_ACTIVATION_STATE_ACTIVATED:
202 return flimflam::kActivationStateActivated;
203 case MM_MODEM_CDMA_ACTIVATION_STATE_ACTIVATING:
204 return flimflam::kActivationStateActivating;
205 case MM_MODEM_CDMA_ACTIVATION_STATE_NOT_ACTIVATED:
206 return flimflam::kActivationStateNotActivated;
207 case MM_MODEM_CDMA_ACTIVATION_STATE_PARTIALLY_ACTIVATED:
208 return flimflam::kActivationStatePartiallyActivated;
209 default:
210 return flimflam::kActivationStateUnknown;
211 }
212}
213
214// static
215string CellularCapabilityCDMA::GetActivationErrorString(uint32 error) {
216 switch (error) {
217 case MM_MODEM_CDMA_ACTIVATION_ERROR_WRONG_RADIO_INTERFACE:
218 return flimflam::kErrorNeedEvdo;
219 case MM_MODEM_CDMA_ACTIVATION_ERROR_ROAMING:
220 return flimflam::kErrorNeedHomeNetwork;
221 case MM_MODEM_CDMA_ACTIVATION_ERROR_COULD_NOT_CONNECT:
222 case MM_MODEM_CDMA_ACTIVATION_ERROR_SECURITY_AUTHENTICATION_FAILED:
223 case MM_MODEM_CDMA_ACTIVATION_ERROR_PROVISIONING_FAILED:
224 return flimflam::kErrorOtaspFailed;
225 case MM_MODEM_CDMA_ACTIVATION_ERROR_NO_ERROR:
226 return "";
227 case MM_MODEM_CDMA_ACTIVATION_ERROR_NO_SIGNAL:
228 default:
229 return flimflam::kErrorActivationFailed;
230 }
Darin Petkova3d3be52011-11-14 21:34:16 +0100231}
232
Eric Shienbrood9a245532012-03-07 14:20:39 -0500233void CellularCapabilityCDMA::GetMEID(const ResultCallback &callback) {
Ben Chanfad4a0b2012-04-18 15:49:59 -0700234 SLOG(Cellular, 2) << __func__;
Eric Shienbrood5de44ab2011-12-05 10:46:27 -0500235 if (meid_.empty()) {
Darin Petkovcb547732011-11-09 13:55:26 +0100236 // TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
Eric Shienbrood5de44ab2011-12-05 10:46:27 -0500237 meid_ = proxy_->MEID();
Ben Chanfad4a0b2012-04-18 15:49:59 -0700238 SLOG(Cellular, 2) << "MEID: " << meid_;
Darin Petkovcb547732011-11-09 13:55:26 +0100239 }
Eric Shienbrood9a245532012-03-07 14:20:39 -0500240 callback.Run(Error());
Darin Petkovcb547732011-11-09 13:55:26 +0100241}
242
Eric Shienbrood9a245532012-03-07 14:20:39 -0500243void CellularCapabilityCDMA::GetProperties(const ResultCallback &callback) {
Ben Chanfad4a0b2012-04-18 15:49:59 -0700244 SLOG(Cellular, 2) << __func__;
Darin Petkov184c54e2011-11-15 12:44:39 +0100245 // No properties.
Eric Shienbrood9a245532012-03-07 14:20:39 -0500246 callback.Run(Error());
Darin Petkov184c54e2011-11-15 12:44:39 +0100247}
248
Christopher Wiley1582bdd2012-11-15 11:31:14 -0800249bool CellularCapabilityCDMA::IsActivating() const {
250 return activation_starting_ ||
251 activation_state_ == MM_MODEM_CDMA_ACTIVATION_STATE_ACTIVATING;
252}
253
Darin Petkovb72cf402011-11-22 14:51:39 +0100254bool CellularCapabilityCDMA::IsRegistered() {
255 return registration_state_evdo_ != MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN ||
256 registration_state_1x_ != MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
257}
258
Eric Shienbrood7fce52c2012-04-13 19:11:02 -0400259void CellularCapabilityCDMA::SetUnregistered(bool searching) {
260 registration_state_evdo_ = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
261 registration_state_1x_ = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
262}
263
Darin Petkov20c13ec2011-11-09 15:07:15 +0100264string CellularCapabilityCDMA::GetNetworkTechnologyString() const {
Darin Petkov184c54e2011-11-15 12:44:39 +0100265 if (registration_state_evdo_ != MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN) {
Darin Petkov20c13ec2011-11-09 15:07:15 +0100266 return flimflam::kNetworkTechnologyEvdo;
267 }
Darin Petkov184c54e2011-11-15 12:44:39 +0100268 if (registration_state_1x_ != MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN) {
Darin Petkov20c13ec2011-11-09 15:07:15 +0100269 return flimflam::kNetworkTechnology1Xrtt;
270 }
271 return "";
272}
273
274string CellularCapabilityCDMA::GetRoamingStateString() const {
Darin Petkov184c54e2011-11-15 12:44:39 +0100275 uint32 state = registration_state_evdo_;
Darin Petkov20c13ec2011-11-09 15:07:15 +0100276 if (state == MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN) {
Darin Petkov184c54e2011-11-15 12:44:39 +0100277 state = registration_state_1x_;
Darin Petkov20c13ec2011-11-09 15:07:15 +0100278 }
279 switch (state) {
280 case MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN:
281 case MM_MODEM_CDMA_REGISTRATION_STATE_REGISTERED:
282 break;
283 case MM_MODEM_CDMA_REGISTRATION_STATE_HOME:
284 return flimflam::kRoamingStateHome;
285 case MM_MODEM_CDMA_REGISTRATION_STATE_ROAMING:
286 return flimflam::kRoamingStateRoaming;
287 default:
288 NOTREACHED();
289 }
290 return flimflam::kRoamingStateUnknown;
291}
292
Darin Petkov3e509242011-11-10 14:46:44 +0100293void CellularCapabilityCDMA::GetSignalQuality() {
Ben Chanfad4a0b2012-04-18 15:49:59 -0700294 SLOG(Cellular, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500295 SignalQualityCallback callback =
296 Bind(&CellularCapabilityCDMA::OnGetSignalQualityReply,
297 weak_ptr_factory_.GetWeakPtr());
298 proxy_->GetSignalQuality(NULL, callback, kTimeoutDefault);
Darin Petkov184c54e2011-11-15 12:44:39 +0100299}
300
Eric Shienbrood9a245532012-03-07 14:20:39 -0500301void CellularCapabilityCDMA::GetRegistrationState() {
Ben Chanfad4a0b2012-04-18 15:49:59 -0700302 SLOG(Cellular, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500303 RegistrationStateCallback callback =
304 Bind(&CellularCapabilityCDMA::OnGetRegistrationStateReply,
305 weak_ptr_factory_.GetWeakPtr());
306 proxy_->GetRegistrationState(NULL, callback, kTimeoutDefault);
Darin Petkov184c54e2011-11-15 12:44:39 +0100307}
308
Darin Petkovac635a82012-01-10 16:51:58 +0100309string CellularCapabilityCDMA::CreateFriendlyServiceName() {
Ben Chanfad4a0b2012-04-18 15:49:59 -0700310 SLOG(Cellular, 2) << __func__;
Eric Shienbrood5de44ab2011-12-05 10:46:27 -0500311 if (!carrier_.empty()) {
312 return carrier_;
Darin Petkovac635a82012-01-10 16:51:58 +0100313 }
314 return base::StringPrintf("CDMANetwork%u", friendly_service_name_id_++);
315}
316
Darin Petkovae0c64e2011-11-15 15:50:27 +0100317void CellularCapabilityCDMA::UpdateServingOperator() {
Ben Chanfad4a0b2012-04-18 15:49:59 -0700318 SLOG(Cellular, 2) << __func__;
Darin Petkovae0c64e2011-11-15 15:50:27 +0100319 if (cellular()->service().get()) {
Darin Petkov9cb02682012-01-28 00:17:38 +0100320 cellular()->service()->SetServingOperator(cellular()->home_provider());
Darin Petkovae0c64e2011-11-15 15:50:27 +0100321 }
322}
323
Eric Shienbrood9a245532012-03-07 14:20:39 -0500324void CellularCapabilityCDMA::OnActivateReply(
325 const ResultCallback &callback, uint32 status, const Error &error) {
Christopher Wiley1582bdd2012-11-15 11:31:14 -0800326 activation_starting_ = false;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500327 if (error.IsSuccess()) {
328 if (status == MM_MODEM_CDMA_ACTIVATION_ERROR_NO_ERROR) {
329 activation_state_ = MM_MODEM_CDMA_ACTIVATION_STATE_ACTIVATING;
Christopher Wiley7d0953e2012-11-16 00:37:10 -0800330 } else {
331 LOG(WARNING) << "Modem activation failed with status: "
332 << GetActivationErrorString(status) << " (" << status << ")";
Eric Shienbrood9a245532012-03-07 14:20:39 -0500333 }
334 HandleNewActivationState(status);
Christopher Wiley7d0953e2012-11-16 00:37:10 -0800335 } else {
336 LOG(ERROR) << "Activate() failed with error: " << error;
Eric Shienbrood5de44ab2011-12-05 10:46:27 -0500337 }
Eric Shienbrood9a245532012-03-07 14:20:39 -0500338 callback.Run(error);
Eric Shienbrood5de44ab2011-12-05 10:46:27 -0500339}
340
Eric Shienbrood9a245532012-03-07 14:20:39 -0500341void CellularCapabilityCDMA::OnGetRegistrationStateReply(
342 uint32 state_1x, uint32 state_evdo, const Error &error) {
Ben Chanfad4a0b2012-04-18 15:49:59 -0700343 SLOG(Cellular, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500344 if (error.IsSuccess())
345 OnRegistrationStateChangedSignal(state_1x, state_evdo);
346}
347
348void CellularCapabilityCDMA::OnGetSignalQualityReply(uint32 quality,
349 const Error &error) {
350 if (error.IsSuccess())
351 OnSignalQualitySignal(quality);
352}
353
354void CellularCapabilityCDMA::OnActivationStateChangedSignal(
Darin Petkov184c54e2011-11-15 12:44:39 +0100355 uint32 activation_state,
356 uint32 activation_error,
357 const DBusPropertiesMap &status_changes) {
Ben Chanfad4a0b2012-04-18 15:49:59 -0700358 SLOG(Cellular, 2) << __func__;
Eric Shienbrood5de44ab2011-12-05 10:46:27 -0500359 DBusProperties::GetString(status_changes, "mdn", &mdn_);
360 DBusProperties::GetString(status_changes, "min", &min_);
Darin Petkov381928f2012-02-02 23:00:12 +0100361 string payment;
362 if (DBusProperties::GetString(status_changes, "payment_url", &payment)) {
363 olp_.SetURL(payment);
364 }
365 if (DBusProperties::GetString(
366 status_changes, "payment_url_method", &payment)) {
367 olp_.SetMethod(payment);
368 }
369 if (DBusProperties::GetString(
370 status_changes, "payment_url_postdata", &payment)) {
371 olp_.SetPostData(payment);
372 }
373 if (cellular()->service().get()) {
374 cellular()->service()->SetOLP(olp_);
Darin Petkov184c54e2011-11-15 12:44:39 +0100375 }
Darin Petkovae0c64e2011-11-15 15:50:27 +0100376 activation_state_ = activation_state;
377 HandleNewActivationState(activation_error);
Darin Petkov184c54e2011-11-15 12:44:39 +0100378}
379
Eric Shienbrood9a245532012-03-07 14:20:39 -0500380void CellularCapabilityCDMA::OnRegistrationStateChangedSignal(
Darin Petkov184c54e2011-11-15 12:44:39 +0100381 uint32 state_1x, uint32 state_evdo) {
Ben Chanfad4a0b2012-04-18 15:49:59 -0700382 SLOG(Cellular, 2) << __func__;
Darin Petkov184c54e2011-11-15 12:44:39 +0100383 registration_state_1x_ = state_1x;
384 registration_state_evdo_ = state_evdo;
385 cellular()->HandleNewRegistrationState();
386}
387
Eric Shienbrood9a245532012-03-07 14:20:39 -0500388void CellularCapabilityCDMA::OnSignalQualitySignal(uint32 strength) {
Darin Petkov3e509242011-11-10 14:46:44 +0100389 cellular()->HandleNewSignalQuality(strength);
390}
391
Darin Petkovdaf43862011-10-27 11:37:28 +0200392} // namespace shill