blob: 447a49fc0ce2c7a6468825c77f242960a5b750e5 [file] [log] [blame]
Jason Glasgowee1081c2012-03-06 15:14:53 -05001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2// 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/mm1_modem_proxy.h"
6
Ben Chanfad4a0b2012-04-18 15:49:59 -07007#include "shill/cellular_error.h"
Christopher Wileyb691efd2012-08-09 13:51:51 -07008#include "shill/logging.h"
Jason Glasgowee1081c2012-03-06 15:14:53 -05009
10using std::string;
11
12namespace shill {
13namespace mm1 {
14
Eric Shienbrood9a245532012-03-07 14:20:39 -050015ModemProxy::ModemProxy(DBus::Connection *connection,
Jason Glasgowee1081c2012-03-06 15:14:53 -050016 const string &path,
17 const string &service)
Eric Shienbrood9a245532012-03-07 14:20:39 -050018 : proxy_(connection, path, service) {}
Jason Glasgowee1081c2012-03-06 15:14:53 -050019
20ModemProxy::~ModemProxy() {}
21
Eric Shienbrood9a245532012-03-07 14:20:39 -050022void ModemProxy::set_state_changed_callback(
23 const ModemStateChangedSignalCallback &callback) {
24 proxy_.set_state_changed_callback(callback);
Jason Glasgowee1081c2012-03-06 15:14:53 -050025}
26
Eric Shienbrood9a245532012-03-07 14:20:39 -050027void ModemProxy::Enable(bool enable,
28 Error *error,
29 const ResultCallback &callback,
30 int timeout) {
Ben Chanfad4a0b2012-04-18 15:49:59 -070031 SLOG(Modem, 2) << __func__ << "(" << enable << ", " << timeout << ")";
Eric Shienbrood9a245532012-03-07 14:20:39 -050032 scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
33 try {
mukesh agrawal06175d72012-04-23 16:46:01 -070034 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -050035 proxy_.Enable(enable, cb.get(), timeout);
36 cb.release();
Ben Chan80326f32012-05-04 17:51:32 -070037 } catch (const DBus::Error &e) {
Eric Shienbrood9a245532012-03-07 14:20:39 -050038 if (error)
39 CellularError::FromDBusError(e, error);
40 }
41}
42
43void ModemProxy::ListBearers(Error *error,
44 const DBusPathsCallback &callback,
Jason Glasgowee1081c2012-03-06 15:14:53 -050045 int timeout) {
Eric Shienbrood9a245532012-03-07 14:20:39 -050046 scoped_ptr<DBusPathsCallback> cb(new DBusPathsCallback(callback));
47 try {
mukesh agrawal06175d72012-04-23 16:46:01 -070048 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -050049 proxy_.ListBearers(cb.get(), timeout);
50 cb.release();
Ben Chan80326f32012-05-04 17:51:32 -070051 } catch (const DBus::Error &e) {
Eric Shienbrood9a245532012-03-07 14:20:39 -050052 if (error)
53 CellularError::FromDBusError(e, error);
54 }
Jason Glasgowee1081c2012-03-06 15:14:53 -050055}
56
57void ModemProxy::CreateBearer(
58 const DBusPropertiesMap &properties,
Eric Shienbrood9a245532012-03-07 14:20:39 -050059 Error *error,
60 const DBusPathCallback &callback,
Jason Glasgowee1081c2012-03-06 15:14:53 -050061 int timeout) {
Eric Shienbrood9a245532012-03-07 14:20:39 -050062 scoped_ptr<DBusPathCallback> cb(new DBusPathCallback(callback));
63 try {
mukesh agrawal06175d72012-04-23 16:46:01 -070064 SLOG(DBus, 2) << __func__;
65 proxy_.CreateBearer(properties, cb.get(), timeout);
Eric Shienbrood9a245532012-03-07 14:20:39 -050066 cb.release();
Ben Chan80326f32012-05-04 17:51:32 -070067 } catch (const DBus::Error &e) {
Eric Shienbrood9a245532012-03-07 14:20:39 -050068 if (error)
69 CellularError::FromDBusError(e, error);
70 }
Jason Glasgowee1081c2012-03-06 15:14:53 -050071}
72
73void ModemProxy::DeleteBearer(const ::DBus::Path &bearer,
Eric Shienbrood9a245532012-03-07 14:20:39 -050074 Error *error,
75 const ResultCallback &callback,
Jason Glasgowee1081c2012-03-06 15:14:53 -050076 int timeout) {
Eric Shienbrood9a245532012-03-07 14:20:39 -050077 scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
78 try {
mukesh agrawal06175d72012-04-23 16:46:01 -070079 SLOG(DBus, 2) << __func__;
80 proxy_.DeleteBearer(bearer, cb.get(), timeout);
Eric Shienbrood9a245532012-03-07 14:20:39 -050081 cb.release();
Ben Chan80326f32012-05-04 17:51:32 -070082 } catch (const DBus::Error &e) {
Eric Shienbrood9a245532012-03-07 14:20:39 -050083 if (error)
84 CellularError::FromDBusError(e, error);
85 }
Jason Glasgowee1081c2012-03-06 15:14:53 -050086}
87
Eric Shienbrood9a245532012-03-07 14:20:39 -050088void ModemProxy::Reset(Error *error,
89 const ResultCallback &callback,
90 int timeout) {
91 scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
92 try {
mukesh agrawal06175d72012-04-23 16:46:01 -070093 SLOG(DBus, 2) << __func__;
94 proxy_.Reset(cb.get(), timeout);
Eric Shienbrood9a245532012-03-07 14:20:39 -050095 cb.release();
Ben Chan80326f32012-05-04 17:51:32 -070096 } catch (const DBus::Error &e) {
Eric Shienbrood9a245532012-03-07 14:20:39 -050097 if (error)
98 CellularError::FromDBusError(e, error);
99 }
Jason Glasgowee1081c2012-03-06 15:14:53 -0500100}
101
102void ModemProxy::FactoryReset(const std::string &code,
Eric Shienbrood9a245532012-03-07 14:20:39 -0500103 Error *error,
104 const ResultCallback &callback,
Jason Glasgowee1081c2012-03-06 15:14:53 -0500105 int timeout) {
Eric Shienbrood9a245532012-03-07 14:20:39 -0500106 scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
107 try {
mukesh agrawal06175d72012-04-23 16:46:01 -0700108 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500109 proxy_.FactoryReset(code, cb.get(), timeout);
110 cb.release();
Ben Chan80326f32012-05-04 17:51:32 -0700111 } catch (const DBus::Error &e) {
Eric Shienbrood9a245532012-03-07 14:20:39 -0500112 if (error)
113 CellularError::FromDBusError(e, error);
114 }
Jason Glasgowee1081c2012-03-06 15:14:53 -0500115}
116
Jason Glasgowee1081c2012-03-06 15:14:53 -0500117void ModemProxy::Command(const std::string &cmd,
118 const uint32_t &user_timeout,
Eric Shienbrood9a245532012-03-07 14:20:39 -0500119 Error *error,
120 const StringCallback &callback,
Jason Glasgowee1081c2012-03-06 15:14:53 -0500121 int timeout) {
Eric Shienbrood9a245532012-03-07 14:20:39 -0500122 scoped_ptr<StringCallback> cb(new StringCallback(callback));
123 try {
mukesh agrawal06175d72012-04-23 16:46:01 -0700124 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500125 proxy_.Command(cmd, user_timeout, cb.get(), timeout);
126 cb.release();
Ben Chan80326f32012-05-04 17:51:32 -0700127 } catch (const DBus::Error &e) {
Eric Shienbrood9a245532012-03-07 14:20:39 -0500128 if (error)
129 CellularError::FromDBusError(e, error);
130 }
Jason Glasgowee1081c2012-03-06 15:14:53 -0500131}
132
Arman Ugurayee464d32013-02-13 17:14:36 -0800133void ModemProxy::SetPowerState(const uint32_t &power_state,
134 Error *error,
135 const ResultCallback &callback,
136 int timeout) {
137 scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
138 try {
139 SLOG(DBus, 2) << __func__;
140 proxy_.SetPowerState(power_state, cb.get(), timeout);
141 cb.release();
142 } catch (const DBus::Error &e) {
143 if (error)
144 CellularError::FromDBusError(e, error);
145 }
146}
147
Jason Glasgowee1081c2012-03-06 15:14:53 -0500148// Inherited properties from ModemProxyInterface.
149const ::DBus::Path ModemProxy::Sim() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700150 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700151 try {
152 return proxy_.Sim();
153 } catch (const DBus::Error &e) {
154 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
155 return ::DBus::Path(); // Make the compiler happy.
156 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400157}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500158uint32_t ModemProxy::CurrentCapabilities() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700159 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700160 try {
161 return proxy_.CurrentCapabilities();
162 } catch (const DBus::Error &e) {
163 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
164 return 0; // Make the compiler happy.
165 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400166}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500167uint32_t ModemProxy::MaxBearers() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700168 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700169 try {
170 return proxy_.MaxBearers();
171 } catch (const DBus::Error &e) {
172 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
173 return 0; // Make the compiler happy.
174 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400175}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500176uint32_t ModemProxy::MaxActiveBearers() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700177 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700178 try {
179 return proxy_.MaxActiveBearers();
180 } catch (const DBus::Error &e) {
181 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
182 return 0; // Make the compiler happy.
183 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400184}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500185const std::string ModemProxy::Manufacturer() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700186 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700187 try {
188 return proxy_.Manufacturer();
189 } catch (const DBus::Error &e) {
190 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
191 return std::string(); // Make the compiler happy.
192 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400193}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500194const std::string ModemProxy::Model() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700195 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700196 try {
197 return proxy_.Model();
198 } catch (const DBus::Error &e) {
199 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
200 return std::string(); // Make the compiler happy.
201 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400202}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500203const std::string ModemProxy::Revision() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700204 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700205 try {
206 return proxy_.Revision();
207 } catch (const DBus::Error &e) {
208 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
209 return std::string(); // Make the compiler happy.
210 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400211}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500212const std::string ModemProxy::DeviceIdentifier() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700213 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700214 try {
215 return proxy_.DeviceIdentifier();
216 } catch (const DBus::Error &e) {
217 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
218 return std::string(); // Make the compiler happy.
219 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400220}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500221const std::string ModemProxy::Device() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700222 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700223 try {
224 return proxy_.Device();
225 } catch (const DBus::Error &e) {
226 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
227 return std::string(); // Make the compiler happy.
228 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400229}
Ben Chan34e5d682012-08-24 19:10:49 -0700230const std::vector<std::string> ModemProxy::Drivers() {
231 SLOG(DBus, 2) << __func__;
232 try {
233 return proxy_.Drivers();
234 } catch (const DBus::Error &e) {
235 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
236 return std::vector<std::string>(); // Make the compiler happy.
237 }
238}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500239const std::string ModemProxy::Plugin() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700240 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700241 try {
242 return proxy_.Plugin();
243 } catch (const DBus::Error &e) {
244 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
245 return std::string(); // Make the compiler happy.
246 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400247}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500248const std::string ModemProxy::EquipmentIdentifier() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700249 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700250 try {
251 return proxy_.EquipmentIdentifier();
252 } catch (const DBus::Error &e) {
253 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
254 return std::string(); // Make the compiler happy.
255 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400256}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500257uint32_t ModemProxy::UnlockRequired() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700258 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700259 try {
260 return proxy_.UnlockRequired();
261 } catch (const DBus::Error &e) {
262 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
263 return 0; // Make the compiler happy.
264 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400265}
Gary Morain610977f2012-05-04 16:03:52 -0700266const std::map<uint32_t, uint32_t> ModemProxy::UnlockRetries() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700267 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700268 try {
269 return proxy_.UnlockRetries();
270 } catch (const DBus::Error &e) {
271 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
272 return std::map<uint32_t, uint32_t>(); // Make the compiler happy.
273 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400274}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500275uint32_t ModemProxy::State() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700276 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700277 try {
278 return proxy_.State();
279 } catch (const DBus::Error &e) {
280 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
281 return 0; // Make the compiler happy.
282 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400283}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500284uint32_t ModemProxy::AccessTechnologies() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700285 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700286 try {
287 return proxy_.AccessTechnologies();
288 } catch (const DBus::Error &e) {
289 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
290 return 0; // Make the compiler happy.
291 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400292}
Gary Morain610977f2012-05-04 16:03:52 -0700293const ::DBus::Struct<uint32_t, bool> ModemProxy::SignalQuality() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700294 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700295 try {
296 return proxy_.SignalQuality();
297 } catch (const DBus::Error &e) {
298 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
299 return ::DBus::Struct<uint32_t, bool>(); // Make the compiler happy.
300 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400301}
302const std::vector<string> ModemProxy::OwnNumbers() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700303 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700304 try {
305 return proxy_.OwnNumbers();
306 } catch (const DBus::Error &e) {
307 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
308 return std::vector<string>(); // Make the compiler happy.
309 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400310}
Gary Morain610977f2012-05-04 16:03:52 -0700311const std::vector<uint32_t> ModemProxy::SupportedBands() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700312 SLOG(DBus, 2) << __func__;
Gary Morain610977f2012-05-04 16:03:52 -0700313 try {
314 return proxy_.SupportedBands();
315 } catch (const DBus::Error &e) {
316 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
317 return std::vector<uint32_t>(); // Make the compiler happy.
318 }
Jason Glasgow90d216d2012-04-04 15:57:14 -0400319}
Arman Ugurayee464d32013-02-13 17:14:36 -0800320uint32_t ModemProxy::PowerState() {
321 SLOG(DBus, 2) << __func__;
322 try {
323 return proxy_.PowerState();
324 } catch (const DBus::Error &e) {
325 LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
326 return 0; // Make the compiler happy.
327 }
328}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500329
Eric Shienbrood9a245532012-03-07 14:20:39 -0500330ModemProxy::Proxy::Proxy(DBus::Connection *connection,
Jason Glasgowee1081c2012-03-06 15:14:53 -0500331 const std::string &path,
332 const std::string &service)
Eric Shienbrood9a245532012-03-07 14:20:39 -0500333 : DBus::ObjectProxy(*connection, path, service.c_str()) {}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500334
335ModemProxy::Proxy::~Proxy() {}
336
Eric Shienbrood9a245532012-03-07 14:20:39 -0500337void ModemProxy::Proxy::set_state_changed_callback(
338 const ModemStateChangedSignalCallback &callback) {
339 state_changed_callback_ = callback;
340}
341
Jason Glasgowee1081c2012-03-06 15:14:53 -0500342// Signal callbacks inherited from Proxy
Nathan Williamsa31e79c2012-03-30 15:07:00 -0400343void ModemProxy::Proxy::StateChanged(const int32_t &old,
344 const int32_t &_new,
Jason Glasgowee1081c2012-03-06 15:14:53 -0500345 const uint32_t &reason) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700346 SLOG(DBus, 2) << __func__;
Jason Glasgow82f9ab32012-04-04 14:27:19 -0400347 if (!state_changed_callback_.is_null())
348 state_changed_callback_.Run(old, _new, reason);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500349}
350
351// Method callbacks inherited from
352// org::freedesktop::ModemManager1::ModemProxy
353void ModemProxy::Proxy::EnableCallback(const ::DBus::Error& dberror,
354 void *data) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700355 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500356 scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Jason Glasgowee1081c2012-03-06 15:14:53 -0500357 Error error;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500358 CellularError::FromDBusError(dberror, &error);
359 callback->Run(error);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500360}
361
362void ModemProxy::Proxy::ListBearersCallback(
Gary Morain610977f2012-05-04 16:03:52 -0700363 const std::vector< ::DBus::Path> &bearers,
Jason Glasgowee1081c2012-03-06 15:14:53 -0500364 const ::DBus::Error& dberror,
365 void *data) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700366 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500367 scoped_ptr<DBusPathsCallback> callback(
368 reinterpret_cast<DBusPathsCallback *>(data));
Jason Glasgowee1081c2012-03-06 15:14:53 -0500369 Error error;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500370 CellularError::FromDBusError(dberror, &error);
371 callback->Run(bearers, error);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500372}
373
374void ModemProxy::Proxy::CreateBearerCallback(const ::DBus::Path &path,
375 const ::DBus::Error& dberror,
376 void *data) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700377 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500378 scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Jason Glasgowee1081c2012-03-06 15:14:53 -0500379 Error error;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500380 CellularError::FromDBusError(dberror, &error);
381 callback->Run(error);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500382}
383
384void ModemProxy::Proxy::DeleteBearerCallback(const ::DBus::Error& dberror,
385 void *data) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700386 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500387 scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Jason Glasgowee1081c2012-03-06 15:14:53 -0500388 Error error;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500389 CellularError::FromDBusError(dberror, &error);
390 callback->Run(error);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500391}
392
393void ModemProxy::Proxy::ResetCallback(const ::DBus::Error& dberror,
394 void *data) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700395 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500396 scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Jason Glasgowee1081c2012-03-06 15:14:53 -0500397 Error error;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500398 CellularError::FromDBusError(dberror, &error);
399 callback->Run(error);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500400}
401
402void ModemProxy::Proxy::FactoryResetCallback(const ::DBus::Error& dberror,
403 void *data) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700404 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500405 scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Jason Glasgowee1081c2012-03-06 15:14:53 -0500406 Error error;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500407 CellularError::FromDBusError(dberror, &error);
408 callback->Run(error);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500409}
410
Jason Glasgowee1081c2012-03-06 15:14:53 -0500411void ModemProxy::Proxy::CommandCallback(const std::string &response,
412 const ::DBus::Error& dberror,
413 void *data) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700414 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500415 scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Jason Glasgowee1081c2012-03-06 15:14:53 -0500416 Error error;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500417 CellularError::FromDBusError(dberror, &error);
418 callback->Run(error);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500419}
420
Arman Ugurayee464d32013-02-13 17:14:36 -0800421void ModemProxy::Proxy::SetPowerStateCallback(const ::DBus::Error &dberror,
422 void *data) {
423 SLOG(DBus, 2) << __func__;
424 scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
425 Error error;
426 CellularError::FromDBusError(dberror, &error);
427 callback->Run(error);
428}
429
Jason Glasgowee1081c2012-03-06 15:14:53 -0500430} // namespace mm1
431} // namespace shill