blob: f03ae3a2281a69e44d8bd26232cb5087ecf1aaf5 [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
7#include <base/logging.h>
8
Ben Chanfad4a0b2012-04-18 15:49:59 -07009#include "shill/cellular_error.h"
10#include "shill/scope_logger.h"
Jason Glasgowee1081c2012-03-06 15:14:53 -050011
12using std::string;
13
14namespace shill {
15namespace mm1 {
16
Eric Shienbrood9a245532012-03-07 14:20:39 -050017ModemProxy::ModemProxy(DBus::Connection *connection,
Jason Glasgowee1081c2012-03-06 15:14:53 -050018 const string &path,
19 const string &service)
Eric Shienbrood9a245532012-03-07 14:20:39 -050020 : proxy_(connection, path, service) {}
Jason Glasgowee1081c2012-03-06 15:14:53 -050021
22ModemProxy::~ModemProxy() {}
23
Eric Shienbrood9a245532012-03-07 14:20:39 -050024void ModemProxy::set_state_changed_callback(
25 const ModemStateChangedSignalCallback &callback) {
26 proxy_.set_state_changed_callback(callback);
Jason Glasgowee1081c2012-03-06 15:14:53 -050027}
28
Eric Shienbrood9a245532012-03-07 14:20:39 -050029void ModemProxy::Enable(bool enable,
30 Error *error,
31 const ResultCallback &callback,
32 int timeout) {
Ben Chanfad4a0b2012-04-18 15:49:59 -070033 SLOG(Modem, 2) << __func__ << "(" << enable << ", " << timeout << ")";
Eric Shienbrood9a245532012-03-07 14:20:39 -050034 scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
35 try {
mukesh agrawal06175d72012-04-23 16:46:01 -070036 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -050037 proxy_.Enable(enable, cb.get(), timeout);
38 cb.release();
39 } catch (DBus::Error e) {
40 if (error)
41 CellularError::FromDBusError(e, error);
42 }
43}
44
45void ModemProxy::ListBearers(Error *error,
46 const DBusPathsCallback &callback,
Jason Glasgowee1081c2012-03-06 15:14:53 -050047 int timeout) {
Eric Shienbrood9a245532012-03-07 14:20:39 -050048 scoped_ptr<DBusPathsCallback> cb(new DBusPathsCallback(callback));
49 try {
mukesh agrawal06175d72012-04-23 16:46:01 -070050 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -050051 proxy_.ListBearers(cb.get(), timeout);
52 cb.release();
53 } catch (DBus::Error e) {
54 if (error)
55 CellularError::FromDBusError(e, error);
56 }
Jason Glasgowee1081c2012-03-06 15:14:53 -050057}
58
59void ModemProxy::CreateBearer(
60 const DBusPropertiesMap &properties,
Eric Shienbrood9a245532012-03-07 14:20:39 -050061 Error *error,
62 const DBusPathCallback &callback,
Jason Glasgowee1081c2012-03-06 15:14:53 -050063 int timeout) {
Eric Shienbrood9a245532012-03-07 14:20:39 -050064 scoped_ptr<DBusPathCallback> cb(new DBusPathCallback(callback));
65 try {
mukesh agrawal06175d72012-04-23 16:46:01 -070066 SLOG(DBus, 2) << __func__;
67 proxy_.CreateBearer(properties, cb.get(), timeout);
Eric Shienbrood9a245532012-03-07 14:20:39 -050068 cb.release();
69 } catch (DBus::Error e) {
70 if (error)
71 CellularError::FromDBusError(e, error);
72 }
Jason Glasgowee1081c2012-03-06 15:14:53 -050073}
74
75void ModemProxy::DeleteBearer(const ::DBus::Path &bearer,
Eric Shienbrood9a245532012-03-07 14:20:39 -050076 Error *error,
77 const ResultCallback &callback,
Jason Glasgowee1081c2012-03-06 15:14:53 -050078 int timeout) {
Eric Shienbrood9a245532012-03-07 14:20:39 -050079 scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
80 try {
mukesh agrawal06175d72012-04-23 16:46:01 -070081 SLOG(DBus, 2) << __func__;
82 proxy_.DeleteBearer(bearer, cb.get(), timeout);
Eric Shienbrood9a245532012-03-07 14:20:39 -050083 cb.release();
84 } catch (DBus::Error e) {
85 if (error)
86 CellularError::FromDBusError(e, error);
87 }
Jason Glasgowee1081c2012-03-06 15:14:53 -050088}
89
Eric Shienbrood9a245532012-03-07 14:20:39 -050090void ModemProxy::Reset(Error *error,
91 const ResultCallback &callback,
92 int timeout) {
93 scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
94 try {
mukesh agrawal06175d72012-04-23 16:46:01 -070095 SLOG(DBus, 2) << __func__;
96 proxy_.Reset(cb.get(), timeout);
Eric Shienbrood9a245532012-03-07 14:20:39 -050097 cb.release();
98 } catch (DBus::Error e) {
99 if (error)
100 CellularError::FromDBusError(e, error);
101 }
Jason Glasgowee1081c2012-03-06 15:14:53 -0500102}
103
104void ModemProxy::FactoryReset(const std::string &code,
Eric Shienbrood9a245532012-03-07 14:20:39 -0500105 Error *error,
106 const ResultCallback &callback,
Jason Glasgowee1081c2012-03-06 15:14:53 -0500107 int timeout) {
Eric Shienbrood9a245532012-03-07 14:20:39 -0500108 scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
109 try {
mukesh agrawal06175d72012-04-23 16:46:01 -0700110 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500111 proxy_.FactoryReset(code, cb.get(), timeout);
112 cb.release();
113 } catch (DBus::Error e) {
114 if (error)
115 CellularError::FromDBusError(e, error);
116 }
Jason Glasgowee1081c2012-03-06 15:14:53 -0500117}
118
119void ModemProxy::SetAllowedModes(const uint32_t &modes,
120 const uint32_t &preferred,
Eric Shienbrood9a245532012-03-07 14:20:39 -0500121 Error *error,
122 const ResultCallback &callback,
Jason Glasgowee1081c2012-03-06 15:14:53 -0500123 int timeout) {
Eric Shienbrood9a245532012-03-07 14:20:39 -0500124 scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
125 try {
mukesh agrawal06175d72012-04-23 16:46:01 -0700126 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500127 proxy_.SetAllowedModes(modes, preferred, cb.get(), timeout);
128 cb.release();
129 } catch (DBus::Error e) {
130 if (error)
131 CellularError::FromDBusError(e, error);
132 }
Jason Glasgowee1081c2012-03-06 15:14:53 -0500133}
134
135void ModemProxy::SetBands(const std::vector< uint32_t > &bands,
Eric Shienbrood9a245532012-03-07 14:20:39 -0500136 Error *error,
137 const ResultCallback &callback,
Jason Glasgowee1081c2012-03-06 15:14:53 -0500138 int timeout) {
Eric Shienbrood9a245532012-03-07 14:20:39 -0500139 scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
140 try {
mukesh agrawal06175d72012-04-23 16:46:01 -0700141 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500142 proxy_.SetBands(bands, cb.get(), timeout);
143 cb.release();
144 } catch (DBus::Error e) {
145 if (error)
146 CellularError::FromDBusError(e, error);
147 }
Jason Glasgowee1081c2012-03-06 15:14:53 -0500148}
149
150void ModemProxy::Command(const std::string &cmd,
151 const uint32_t &user_timeout,
Eric Shienbrood9a245532012-03-07 14:20:39 -0500152 Error *error,
153 const StringCallback &callback,
Jason Glasgowee1081c2012-03-06 15:14:53 -0500154 int timeout) {
Eric Shienbrood9a245532012-03-07 14:20:39 -0500155 scoped_ptr<StringCallback> cb(new StringCallback(callback));
156 try {
mukesh agrawal06175d72012-04-23 16:46:01 -0700157 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500158 proxy_.Command(cmd, user_timeout, cb.get(), timeout);
159 cb.release();
160 } catch (DBus::Error e) {
161 if (error)
162 CellularError::FromDBusError(e, error);
163 }
Jason Glasgowee1081c2012-03-06 15:14:53 -0500164}
165
166// Inherited properties from ModemProxyInterface.
167const ::DBus::Path ModemProxy::Sim() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700168 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500169 return proxy_.Sim();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400170}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500171uint32_t ModemProxy::ModemCapabilities() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700172 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500173 return proxy_.ModemCapabilities();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400174}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500175uint32_t ModemProxy::CurrentCapabilities() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700176 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500177 return proxy_.CurrentCapabilities();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400178}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500179uint32_t ModemProxy::MaxBearers() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700180 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500181 return proxy_.MaxBearers();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400182}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500183uint32_t ModemProxy::MaxActiveBearers() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700184 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500185 return proxy_.MaxActiveBearers();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400186}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500187const std::string ModemProxy::Manufacturer() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700188 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500189 return proxy_.Manufacturer();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400190}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500191const std::string ModemProxy::Model() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700192 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500193 return proxy_.Model();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400194}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500195const std::string ModemProxy::Revision() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700196 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500197 return proxy_.Revision();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400198}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500199const std::string ModemProxy::DeviceIdentifier() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700200 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500201 return proxy_.DeviceIdentifier();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400202}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500203const std::string ModemProxy::Device() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700204 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500205 return proxy_.Device();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400206}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500207const std::string ModemProxy::Driver() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700208 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500209 return proxy_.Driver();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400210}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500211const std::string ModemProxy::Plugin() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700212 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500213 return proxy_.Plugin();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400214}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500215const std::string ModemProxy::EquipmentIdentifier() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700216 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500217 return proxy_.EquipmentIdentifier();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400218}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500219uint32_t ModemProxy::UnlockRequired() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700220 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500221 return proxy_.UnlockRequired();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400222}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500223const std::map< uint32_t, uint32_t > ModemProxy::UnlockRetries() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700224 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500225 return proxy_.UnlockRetries();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400226}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500227uint32_t ModemProxy::State() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700228 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500229 return proxy_.State();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400230}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500231uint32_t ModemProxy::AccessTechnologies() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700232 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500233 return proxy_.AccessTechnologies();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400234}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500235const ::DBus::Struct< uint32_t, bool > ModemProxy::SignalQuality() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700236 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500237 return proxy_.SignalQuality();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400238}
239const std::vector<string> ModemProxy::OwnNumbers() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700240 SLOG(DBus, 2) << __func__;
Jason Glasgow90d216d2012-04-04 15:57:14 -0400241 return proxy_.OwnNumbers();
242}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500243uint32_t ModemProxy::SupportedModes() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700244 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500245 return proxy_.SupportedModes();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400246}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500247uint32_t ModemProxy::AllowedModes() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700248 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500249 return proxy_.AllowedModes();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400250}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500251uint32_t ModemProxy::PreferredMode() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700252 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500253 return proxy_.PreferredMode();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400254}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500255const std::vector< uint32_t > ModemProxy::SupportedBands() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700256 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500257 return proxy_.SupportedBands();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400258}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500259const std::vector< uint32_t > ModemProxy::Bands() {
mukesh agrawal06175d72012-04-23 16:46:01 -0700260 SLOG(DBus, 2) << __func__;
Jason Glasgowee1081c2012-03-06 15:14:53 -0500261 return proxy_.Bands();
Jason Glasgow90d216d2012-04-04 15:57:14 -0400262}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500263
Eric Shienbrood9a245532012-03-07 14:20:39 -0500264ModemProxy::Proxy::Proxy(DBus::Connection *connection,
Jason Glasgowee1081c2012-03-06 15:14:53 -0500265 const std::string &path,
266 const std::string &service)
Eric Shienbrood9a245532012-03-07 14:20:39 -0500267 : DBus::ObjectProxy(*connection, path, service.c_str()) {}
Jason Glasgowee1081c2012-03-06 15:14:53 -0500268
269ModemProxy::Proxy::~Proxy() {}
270
Eric Shienbrood9a245532012-03-07 14:20:39 -0500271void ModemProxy::Proxy::set_state_changed_callback(
272 const ModemStateChangedSignalCallback &callback) {
273 state_changed_callback_ = callback;
274}
275
Jason Glasgowee1081c2012-03-06 15:14:53 -0500276// Signal callbacks inherited from Proxy
Nathan Williamsa31e79c2012-03-30 15:07:00 -0400277void ModemProxy::Proxy::StateChanged(const int32_t &old,
278 const int32_t &_new,
Jason Glasgowee1081c2012-03-06 15:14:53 -0500279 const uint32_t &reason) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700280 SLOG(DBus, 2) << __func__;
Jason Glasgow82f9ab32012-04-04 14:27:19 -0400281 if (!state_changed_callback_.is_null())
282 state_changed_callback_.Run(old, _new, reason);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500283}
284
285// Method callbacks inherited from
286// org::freedesktop::ModemManager1::ModemProxy
287void ModemProxy::Proxy::EnableCallback(const ::DBus::Error& dberror,
288 void *data) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700289 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500290 scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Jason Glasgowee1081c2012-03-06 15:14:53 -0500291 Error error;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500292 CellularError::FromDBusError(dberror, &error);
293 callback->Run(error);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500294}
295
296void ModemProxy::Proxy::ListBearersCallback(
297 const std::vector< ::DBus::Path > &bearers,
298 const ::DBus::Error& dberror,
299 void *data) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700300 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500301 scoped_ptr<DBusPathsCallback> callback(
302 reinterpret_cast<DBusPathsCallback *>(data));
Jason Glasgowee1081c2012-03-06 15:14:53 -0500303 Error error;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500304 CellularError::FromDBusError(dberror, &error);
305 callback->Run(bearers, error);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500306}
307
308void ModemProxy::Proxy::CreateBearerCallback(const ::DBus::Path &path,
309 const ::DBus::Error& dberror,
310 void *data) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700311 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500312 scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Jason Glasgowee1081c2012-03-06 15:14:53 -0500313 Error error;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500314 CellularError::FromDBusError(dberror, &error);
315 callback->Run(error);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500316}
317
318void ModemProxy::Proxy::DeleteBearerCallback(const ::DBus::Error& dberror,
319 void *data) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700320 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500321 scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Jason Glasgowee1081c2012-03-06 15:14:53 -0500322 Error error;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500323 CellularError::FromDBusError(dberror, &error);
324 callback->Run(error);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500325}
326
327void ModemProxy::Proxy::ResetCallback(const ::DBus::Error& dberror,
328 void *data) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700329 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500330 scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Jason Glasgowee1081c2012-03-06 15:14:53 -0500331 Error error;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500332 CellularError::FromDBusError(dberror, &error);
333 callback->Run(error);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500334}
335
336void ModemProxy::Proxy::FactoryResetCallback(const ::DBus::Error& dberror,
337 void *data) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700338 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500339 scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Jason Glasgowee1081c2012-03-06 15:14:53 -0500340 Error error;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500341 CellularError::FromDBusError(dberror, &error);
342 callback->Run(error);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500343}
344
345void ModemProxy::Proxy::SetAllowedModesCallback(
346 const ::DBus::Error& dberror,
347 void *data) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700348 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500349 scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Jason Glasgowee1081c2012-03-06 15:14:53 -0500350 Error error;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500351 CellularError::FromDBusError(dberror, &error);
352 callback->Run(error);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500353}
354
355void ModemProxy::Proxy::SetBandsCallback(const ::DBus::Error& dberror,
356 void *data) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700357 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500358 scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Jason Glasgowee1081c2012-03-06 15:14:53 -0500359 Error error;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500360 CellularError::FromDBusError(dberror, &error);
361 callback->Run(error);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500362}
363
364void ModemProxy::Proxy::CommandCallback(const std::string &response,
365 const ::DBus::Error& dberror,
366 void *data) {
mukesh agrawal06175d72012-04-23 16:46:01 -0700367 SLOG(DBus, 2) << __func__;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500368 scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(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(error);
Jason Glasgowee1081c2012-03-06 15:14:53 -0500372}
373
374} // namespace mm1
375} // namespace shill