Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 1 | // 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 Chan | fd1144d | 2013-09-06 09:10:16 -0700 | [diff] [blame] | 7 | #include <ModemManager/ModemManager.h> |
| 8 | |
Ben Chan | fad4a0b | 2012-04-18 15:49:59 -0700 | [diff] [blame] | 9 | #include "shill/cellular_error.h" |
Christopher Wiley | b691efd | 2012-08-09 13:51:51 -0700 | [diff] [blame] | 10 | #include "shill/logging.h" |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 11 | |
| 12 | using std::string; |
| 13 | |
| 14 | namespace shill { |
| 15 | namespace mm1 { |
| 16 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 17 | ModemProxy::ModemProxy(DBus::Connection *connection, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 18 | const string &path, |
| 19 | const string &service) |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 20 | : proxy_(connection, path, service) {} |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 21 | |
| 22 | ModemProxy::~ModemProxy() {} |
| 23 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 24 | void ModemProxy::set_state_changed_callback( |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 25 | const ModemStateChangedSignalCallback &callback) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 26 | proxy_.set_state_changed_callback(callback); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 27 | } |
| 28 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 29 | void ModemProxy::Enable(bool enable, |
| 30 | Error *error, |
| 31 | const ResultCallback &callback, |
| 32 | int timeout) { |
Ben Chan | fad4a0b | 2012-04-18 15:49:59 -0700 | [diff] [blame] | 33 | SLOG(Modem, 2) << __func__ << "(" << enable << ", " << timeout << ")"; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 34 | scoped_ptr<ResultCallback> cb(new ResultCallback(callback)); |
| 35 | try { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 36 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 37 | proxy_.Enable(enable, cb.get(), timeout); |
| 38 | cb.release(); |
Ben Chan | 80326f3 | 2012-05-04 17:51:32 -0700 | [diff] [blame] | 39 | } catch (const DBus::Error &e) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 40 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 41 | CellularError::FromMM1DBusError(e, error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 42 | } |
| 43 | } |
| 44 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 45 | void ModemProxy::CreateBearer( |
| 46 | const DBusPropertiesMap &properties, |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 47 | Error *error, |
| 48 | const DBusPathCallback &callback, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 49 | int timeout) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 50 | scoped_ptr<DBusPathCallback> cb(new DBusPathCallback(callback)); |
| 51 | try { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 52 | SLOG(DBus, 2) << __func__; |
| 53 | proxy_.CreateBearer(properties, cb.get(), timeout); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 54 | cb.release(); |
Ben Chan | 80326f3 | 2012-05-04 17:51:32 -0700 | [diff] [blame] | 55 | } catch (const DBus::Error &e) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 56 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 57 | CellularError::FromMM1DBusError(e, error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 58 | } |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | void ModemProxy::DeleteBearer(const ::DBus::Path &bearer, |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 62 | Error *error, |
| 63 | const ResultCallback &callback, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 64 | int timeout) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 65 | scoped_ptr<ResultCallback> cb(new ResultCallback(callback)); |
| 66 | try { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 67 | SLOG(DBus, 2) << __func__; |
| 68 | proxy_.DeleteBearer(bearer, cb.get(), timeout); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 69 | cb.release(); |
Ben Chan | 80326f3 | 2012-05-04 17:51:32 -0700 | [diff] [blame] | 70 | } catch (const DBus::Error &e) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 71 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 72 | CellularError::FromMM1DBusError(e, error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 73 | } |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 74 | } |
| 75 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 76 | void ModemProxy::Reset(Error *error, |
| 77 | const ResultCallback &callback, |
| 78 | int timeout) { |
| 79 | scoped_ptr<ResultCallback> cb(new ResultCallback(callback)); |
| 80 | try { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 81 | SLOG(DBus, 2) << __func__; |
| 82 | proxy_.Reset(cb.get(), timeout); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 83 | cb.release(); |
Ben Chan | 80326f3 | 2012-05-04 17:51:32 -0700 | [diff] [blame] | 84 | } catch (const DBus::Error &e) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 85 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 86 | CellularError::FromMM1DBusError(e, error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 87 | } |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | void ModemProxy::FactoryReset(const std::string &code, |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 91 | Error *error, |
| 92 | const ResultCallback &callback, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 93 | int timeout) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 94 | scoped_ptr<ResultCallback> cb(new ResultCallback(callback)); |
| 95 | try { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 96 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 97 | proxy_.FactoryReset(code, cb.get(), timeout); |
| 98 | cb.release(); |
Ben Chan | 80326f3 | 2012-05-04 17:51:32 -0700 | [diff] [blame] | 99 | } catch (const DBus::Error &e) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 100 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 101 | CellularError::FromMM1DBusError(e, error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 102 | } |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 103 | } |
| 104 | |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 105 | void ModemProxy::SetCurrentCapabilities(const uint32_t &capabilities, |
| 106 | Error *error, |
| 107 | const ResultCallback &callback, |
| 108 | int timeout) { |
| 109 | scoped_ptr<ResultCallback> cb(new ResultCallback(callback)); |
| 110 | try { |
| 111 | SLOG(DBus, 2) << __func__; |
| 112 | proxy_.SetCurrentCapabilities(capabilities, cb.get(), timeout); |
| 113 | cb.release(); |
| 114 | } catch (const DBus::Error &e) { |
| 115 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 116 | CellularError::FromMM1DBusError(e, error); |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 117 | } |
| 118 | } |
| 119 | |
| 120 | void ModemProxy::SetCurrentModes( |
| 121 | const ::DBus::Struct<uint32_t, uint32_t> &modes, |
| 122 | Error *error, |
| 123 | const ResultCallback &callback, |
| 124 | int timeout) { |
| 125 | scoped_ptr<ResultCallback> cb(new ResultCallback(callback)); |
| 126 | try { |
| 127 | SLOG(DBus, 2) << __func__; |
| 128 | proxy_.SetCurrentModes(modes, cb.get(), timeout); |
| 129 | cb.release(); |
| 130 | } catch (const DBus::Error &e) { |
| 131 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 132 | CellularError::FromMM1DBusError(e, error); |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 133 | } |
| 134 | } |
| 135 | |
| 136 | void ModemProxy::SetCurrentBands(const std::vector<uint32_t> &bands, |
| 137 | Error *error, |
| 138 | const ResultCallback &callback, |
| 139 | int timeout) { |
| 140 | scoped_ptr<ResultCallback> cb(new ResultCallback(callback)); |
| 141 | try { |
| 142 | SLOG(DBus, 2) << __func__; |
| 143 | proxy_.SetCurrentBands(bands, cb.get(), timeout); |
| 144 | cb.release(); |
| 145 | } catch (const DBus::Error &e) { |
| 146 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 147 | CellularError::FromMM1DBusError(e, error); |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 148 | } |
| 149 | } |
| 150 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 151 | void ModemProxy::Command(const std::string &cmd, |
| 152 | const uint32_t &user_timeout, |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 153 | Error *error, |
| 154 | const StringCallback &callback, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 155 | int timeout) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 156 | scoped_ptr<StringCallback> cb(new StringCallback(callback)); |
| 157 | try { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 158 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 159 | proxy_.Command(cmd, user_timeout, cb.get(), timeout); |
| 160 | cb.release(); |
Ben Chan | 80326f3 | 2012-05-04 17:51:32 -0700 | [diff] [blame] | 161 | } catch (const DBus::Error &e) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 162 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 163 | CellularError::FromMM1DBusError(e, error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 164 | } |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 165 | } |
| 166 | |
Arman Uguray | ee464d3 | 2013-02-13 17:14:36 -0800 | [diff] [blame] | 167 | void ModemProxy::SetPowerState(const uint32_t &power_state, |
| 168 | Error *error, |
| 169 | const ResultCallback &callback, |
| 170 | int timeout) { |
| 171 | scoped_ptr<ResultCallback> cb(new ResultCallback(callback)); |
| 172 | try { |
| 173 | SLOG(DBus, 2) << __func__; |
| 174 | proxy_.SetPowerState(power_state, cb.get(), timeout); |
| 175 | cb.release(); |
| 176 | } catch (const DBus::Error &e) { |
| 177 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 178 | CellularError::FromMM1DBusError(e, error); |
Arman Uguray | ee464d3 | 2013-02-13 17:14:36 -0800 | [diff] [blame] | 179 | } |
| 180 | } |
| 181 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 182 | ModemProxy::Proxy::Proxy(DBus::Connection *connection, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 183 | const std::string &path, |
| 184 | const std::string &service) |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 185 | : DBus::ObjectProxy(*connection, path, service.c_str()) {} |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 186 | |
| 187 | ModemProxy::Proxy::~Proxy() {} |
| 188 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 189 | void ModemProxy::Proxy::set_state_changed_callback( |
| 190 | const ModemStateChangedSignalCallback &callback) { |
| 191 | state_changed_callback_ = callback; |
| 192 | } |
| 193 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 194 | // Signal callbacks inherited from Proxy |
Nathan Williams | a31e79c | 2012-03-30 15:07:00 -0400 | [diff] [blame] | 195 | void ModemProxy::Proxy::StateChanged(const int32_t &old, |
| 196 | const int32_t &_new, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 197 | const uint32_t &reason) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 198 | SLOG(DBus, 2) << __func__; |
Jason Glasgow | 82f9ab3 | 2012-04-04 14:27:19 -0400 | [diff] [blame] | 199 | if (!state_changed_callback_.is_null()) |
| 200 | state_changed_callback_.Run(old, _new, reason); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 201 | } |
| 202 | |
| 203 | // Method callbacks inherited from |
| 204 | // org::freedesktop::ModemManager1::ModemProxy |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 205 | void ModemProxy::Proxy::EnableCallback(const ::DBus::Error &dberror, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 206 | void *data) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 207 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 208 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 209 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 210 | CellularError::FromMM1DBusError(dberror, &error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 211 | callback->Run(error); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 212 | } |
| 213 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 214 | void ModemProxy::Proxy::CreateBearerCallback(const ::DBus::Path &path, |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 215 | const ::DBus::Error &dberror, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 216 | void *data) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 217 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 218 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 219 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 220 | CellularError::FromMM1DBusError(dberror, &error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 221 | callback->Run(error); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 222 | } |
| 223 | |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 224 | void ModemProxy::Proxy::DeleteBearerCallback(const ::DBus::Error &dberror, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 225 | void *data) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 226 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 227 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 228 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 229 | CellularError::FromMM1DBusError(dberror, &error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 230 | callback->Run(error); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 231 | } |
| 232 | |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 233 | void ModemProxy::Proxy::ResetCallback(const ::DBus::Error &dberror, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 234 | void *data) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 235 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 236 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 237 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 238 | CellularError::FromMM1DBusError(dberror, &error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 239 | callback->Run(error); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 240 | } |
| 241 | |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 242 | void ModemProxy::Proxy::FactoryResetCallback(const ::DBus::Error &dberror, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 243 | void *data) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 244 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 245 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 246 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 247 | CellularError::FromMM1DBusError(dberror, &error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 248 | callback->Run(error); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 249 | } |
| 250 | |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 251 | void ModemProxy::Proxy::SetCurrentCapabilitesCallback( |
| 252 | const ::DBus::Error &dberror, |
| 253 | void *data) { |
| 254 | SLOG(DBus, 2) << __func__; |
| 255 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
| 256 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 257 | CellularError::FromMM1DBusError(dberror, &error); |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 258 | callback->Run(error); |
| 259 | } |
| 260 | |
| 261 | void ModemProxy::Proxy::SetCurrentModesCallback(const ::DBus::Error &dberror, |
| 262 | void *data) { |
| 263 | SLOG(DBus, 2) << __func__; |
| 264 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
| 265 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 266 | CellularError::FromMM1DBusError(dberror, &error); |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 267 | callback->Run(error); |
| 268 | } |
| 269 | |
| 270 | void ModemProxy::Proxy::SetCurrentBandsCallback(const ::DBus::Error &dberror, |
| 271 | void *data) { |
| 272 | SLOG(DBus, 2) << __func__; |
| 273 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
| 274 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 275 | CellularError::FromMM1DBusError(dberror, &error); |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 276 | callback->Run(error); |
| 277 | } |
| 278 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 279 | void ModemProxy::Proxy::CommandCallback(const std::string &response, |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 280 | const ::DBus::Error &dberror, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 281 | void *data) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 282 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 283 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 284 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 285 | CellularError::FromMM1DBusError(dberror, &error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 286 | callback->Run(error); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 287 | } |
| 288 | |
Arman Uguray | ee464d3 | 2013-02-13 17:14:36 -0800 | [diff] [blame] | 289 | void ModemProxy::Proxy::SetPowerStateCallback(const ::DBus::Error &dberror, |
| 290 | void *data) { |
| 291 | SLOG(DBus, 2) << __func__; |
| 292 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
| 293 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 294 | CellularError::FromMM1DBusError(dberror, &error); |
Arman Uguray | ee464d3 | 2013-02-13 17:14:36 -0800 | [diff] [blame] | 295 | callback->Run(error); |
| 296 | } |
| 297 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 298 | } // namespace mm1 |
| 299 | } // namespace shill |