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 | fad4a0b | 2012-04-18 15:49:59 -0700 | [diff] [blame] | 7 | #include "shill/cellular_error.h" |
Christopher Wiley | b691efd | 2012-08-09 13:51:51 -0700 | [diff] [blame] | 8 | #include "shill/logging.h" |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 9 | |
| 10 | using std::string; |
| 11 | |
| 12 | namespace shill { |
| 13 | namespace mm1 { |
| 14 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 15 | ModemProxy::ModemProxy(DBus::Connection *connection, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 16 | const string &path, |
| 17 | const string &service) |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 18 | : proxy_(connection, path, service) {} |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 19 | |
| 20 | ModemProxy::~ModemProxy() {} |
| 21 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 22 | void ModemProxy::set_state_changed_callback( |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 23 | const ModemStateChangedSignalCallback &callback) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 24 | proxy_.set_state_changed_callback(callback); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 25 | } |
| 26 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 27 | void ModemProxy::Enable(bool enable, |
| 28 | Error *error, |
| 29 | const ResultCallback &callback, |
| 30 | int timeout) { |
Ben Chan | fad4a0b | 2012-04-18 15:49:59 -0700 | [diff] [blame] | 31 | SLOG(Modem, 2) << __func__ << "(" << enable << ", " << timeout << ")"; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 32 | scoped_ptr<ResultCallback> cb(new ResultCallback(callback)); |
| 33 | try { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 34 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 35 | proxy_.Enable(enable, cb.get(), timeout); |
| 36 | cb.release(); |
Ben Chan | 80326f3 | 2012-05-04 17:51:32 -0700 | [diff] [blame] | 37 | } catch (const DBus::Error &e) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 38 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 39 | CellularError::FromMM1DBusError(e, error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 40 | } |
| 41 | } |
| 42 | |
| 43 | void ModemProxy::ListBearers(Error *error, |
| 44 | const DBusPathsCallback &callback, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 45 | int timeout) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 46 | scoped_ptr<DBusPathsCallback> cb(new DBusPathsCallback(callback)); |
| 47 | try { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 48 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 49 | proxy_.ListBearers(cb.get(), timeout); |
| 50 | cb.release(); |
Ben Chan | 80326f3 | 2012-05-04 17:51:32 -0700 | [diff] [blame] | 51 | } catch (const DBus::Error &e) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 52 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 53 | CellularError::FromMM1DBusError(e, error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 54 | } |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | void ModemProxy::CreateBearer( |
| 58 | const DBusPropertiesMap &properties, |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 59 | Error *error, |
| 60 | const DBusPathCallback &callback, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 61 | int timeout) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 62 | scoped_ptr<DBusPathCallback> cb(new DBusPathCallback(callback)); |
| 63 | try { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 64 | SLOG(DBus, 2) << __func__; |
| 65 | proxy_.CreateBearer(properties, cb.get(), timeout); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 66 | cb.release(); |
Ben Chan | 80326f3 | 2012-05-04 17:51:32 -0700 | [diff] [blame] | 67 | } catch (const DBus::Error &e) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 68 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 69 | CellularError::FromMM1DBusError(e, error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 70 | } |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | void ModemProxy::DeleteBearer(const ::DBus::Path &bearer, |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 74 | Error *error, |
| 75 | const ResultCallback &callback, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 76 | int timeout) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 77 | scoped_ptr<ResultCallback> cb(new ResultCallback(callback)); |
| 78 | try { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 79 | SLOG(DBus, 2) << __func__; |
| 80 | proxy_.DeleteBearer(bearer, cb.get(), timeout); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 81 | cb.release(); |
Ben Chan | 80326f3 | 2012-05-04 17:51:32 -0700 | [diff] [blame] | 82 | } catch (const DBus::Error &e) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 83 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 84 | CellularError::FromMM1DBusError(e, error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 85 | } |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 86 | } |
| 87 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 88 | void ModemProxy::Reset(Error *error, |
| 89 | const ResultCallback &callback, |
| 90 | int timeout) { |
| 91 | scoped_ptr<ResultCallback> cb(new ResultCallback(callback)); |
| 92 | try { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 93 | SLOG(DBus, 2) << __func__; |
| 94 | proxy_.Reset(cb.get(), timeout); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 95 | cb.release(); |
Ben Chan | 80326f3 | 2012-05-04 17:51:32 -0700 | [diff] [blame] | 96 | } catch (const DBus::Error &e) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 97 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 98 | CellularError::FromMM1DBusError(e, error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 99 | } |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | void ModemProxy::FactoryReset(const std::string &code, |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 103 | Error *error, |
| 104 | const ResultCallback &callback, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 105 | int timeout) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 106 | scoped_ptr<ResultCallback> cb(new ResultCallback(callback)); |
| 107 | try { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 108 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 109 | proxy_.FactoryReset(code, cb.get(), timeout); |
| 110 | cb.release(); |
Ben Chan | 80326f3 | 2012-05-04 17:51:32 -0700 | [diff] [blame] | 111 | } catch (const DBus::Error &e) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 112 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 113 | CellularError::FromMM1DBusError(e, error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 114 | } |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 115 | } |
| 116 | |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 117 | void ModemProxy::SetCurrentCapabilities(const uint32_t &capabilities, |
| 118 | Error *error, |
| 119 | const ResultCallback &callback, |
| 120 | int timeout) { |
| 121 | scoped_ptr<ResultCallback> cb(new ResultCallback(callback)); |
| 122 | try { |
| 123 | SLOG(DBus, 2) << __func__; |
| 124 | proxy_.SetCurrentCapabilities(capabilities, cb.get(), timeout); |
| 125 | cb.release(); |
| 126 | } catch (const DBus::Error &e) { |
| 127 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 128 | CellularError::FromMM1DBusError(e, error); |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 129 | } |
| 130 | } |
| 131 | |
| 132 | void ModemProxy::SetCurrentModes( |
| 133 | const ::DBus::Struct<uint32_t, uint32_t> &modes, |
| 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_.SetCurrentModes(modes, cb.get(), timeout); |
| 141 | cb.release(); |
| 142 | } catch (const DBus::Error &e) { |
| 143 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 144 | CellularError::FromMM1DBusError(e, error); |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 145 | } |
| 146 | } |
| 147 | |
| 148 | void ModemProxy::SetCurrentBands(const std::vector<uint32_t> &bands, |
| 149 | Error *error, |
| 150 | const ResultCallback &callback, |
| 151 | int timeout) { |
| 152 | scoped_ptr<ResultCallback> cb(new ResultCallback(callback)); |
| 153 | try { |
| 154 | SLOG(DBus, 2) << __func__; |
| 155 | proxy_.SetCurrentBands(bands, cb.get(), timeout); |
| 156 | cb.release(); |
| 157 | } catch (const DBus::Error &e) { |
| 158 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 159 | CellularError::FromMM1DBusError(e, error); |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 160 | } |
| 161 | } |
| 162 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 163 | void ModemProxy::Command(const std::string &cmd, |
| 164 | const uint32_t &user_timeout, |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 165 | Error *error, |
| 166 | const StringCallback &callback, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 167 | int timeout) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 168 | scoped_ptr<StringCallback> cb(new StringCallback(callback)); |
| 169 | try { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 170 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 171 | proxy_.Command(cmd, user_timeout, cb.get(), timeout); |
| 172 | cb.release(); |
Ben Chan | 80326f3 | 2012-05-04 17:51:32 -0700 | [diff] [blame] | 173 | } catch (const DBus::Error &e) { |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 174 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 175 | CellularError::FromMM1DBusError(e, error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 176 | } |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 177 | } |
| 178 | |
Arman Uguray | ee464d3 | 2013-02-13 17:14:36 -0800 | [diff] [blame] | 179 | void ModemProxy::SetPowerState(const uint32_t &power_state, |
| 180 | Error *error, |
| 181 | const ResultCallback &callback, |
| 182 | int timeout) { |
| 183 | scoped_ptr<ResultCallback> cb(new ResultCallback(callback)); |
| 184 | try { |
| 185 | SLOG(DBus, 2) << __func__; |
| 186 | proxy_.SetPowerState(power_state, cb.get(), timeout); |
| 187 | cb.release(); |
| 188 | } catch (const DBus::Error &e) { |
| 189 | if (error) |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 190 | CellularError::FromMM1DBusError(e, error); |
Arman Uguray | ee464d3 | 2013-02-13 17:14:36 -0800 | [diff] [blame] | 191 | } |
| 192 | } |
| 193 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 194 | // Inherited properties from ModemProxyInterface. |
| 195 | const ::DBus::Path ModemProxy::Sim() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 196 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 197 | try { |
| 198 | return proxy_.Sim(); |
| 199 | } catch (const DBus::Error &e) { |
| 200 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 201 | return ::DBus::Path(); // Make the compiler happy. |
| 202 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 203 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 204 | |
| 205 | const std::vector<uint32_t> ModemProxy::SupportedCapabilities() { |
| 206 | SLOG(DBus, 2) << __func__; |
| 207 | try { |
| 208 | return proxy_.SupportedCapabilities(); |
| 209 | } catch (const DBus::Error &e) { |
| 210 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 211 | return std::vector<uint32_t>(); // Make the compiler happy. |
| 212 | } |
| 213 | } |
| 214 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 215 | uint32_t ModemProxy::CurrentCapabilities() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 216 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 217 | try { |
| 218 | return proxy_.CurrentCapabilities(); |
| 219 | } catch (const DBus::Error &e) { |
| 220 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 221 | return 0; // Make the compiler happy. |
| 222 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 223 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 224 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 225 | uint32_t ModemProxy::MaxBearers() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 226 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 227 | try { |
| 228 | return proxy_.MaxBearers(); |
| 229 | } catch (const DBus::Error &e) { |
| 230 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 231 | return 0; // Make the compiler happy. |
| 232 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 233 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 234 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 235 | uint32_t ModemProxy::MaxActiveBearers() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 236 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 237 | try { |
| 238 | return proxy_.MaxActiveBearers(); |
| 239 | } catch (const DBus::Error &e) { |
| 240 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 241 | return 0; // Make the compiler happy. |
| 242 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 243 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 244 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 245 | const std::string ModemProxy::Manufacturer() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 246 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 247 | try { |
| 248 | return proxy_.Manufacturer(); |
| 249 | } catch (const DBus::Error &e) { |
| 250 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 251 | return std::string(); // Make the compiler happy. |
| 252 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 253 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 254 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 255 | const std::string ModemProxy::Model() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 256 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 257 | try { |
| 258 | return proxy_.Model(); |
| 259 | } catch (const DBus::Error &e) { |
| 260 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 261 | return std::string(); // Make the compiler happy. |
| 262 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 263 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 264 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 265 | const std::string ModemProxy::Revision() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 266 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 267 | try { |
| 268 | return proxy_.Revision(); |
| 269 | } catch (const DBus::Error &e) { |
| 270 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 271 | return std::string(); // Make the compiler happy. |
| 272 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 273 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 274 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 275 | const std::string ModemProxy::DeviceIdentifier() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 276 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 277 | try { |
| 278 | return proxy_.DeviceIdentifier(); |
| 279 | } catch (const DBus::Error &e) { |
| 280 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 281 | return std::string(); // Make the compiler happy. |
| 282 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 283 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 284 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 285 | const std::string ModemProxy::Device() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 286 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 287 | try { |
| 288 | return proxy_.Device(); |
| 289 | } catch (const DBus::Error &e) { |
| 290 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 291 | return std::string(); // Make the compiler happy. |
| 292 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 293 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 294 | |
Ben Chan | 34e5d68 | 2012-08-24 19:10:49 -0700 | [diff] [blame] | 295 | const std::vector<std::string> ModemProxy::Drivers() { |
| 296 | SLOG(DBus, 2) << __func__; |
| 297 | try { |
| 298 | return proxy_.Drivers(); |
| 299 | } catch (const DBus::Error &e) { |
| 300 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 301 | return std::vector<std::string>(); // Make the compiler happy. |
| 302 | } |
| 303 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 304 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 305 | const std::string ModemProxy::Plugin() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 306 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 307 | try { |
| 308 | return proxy_.Plugin(); |
| 309 | } catch (const DBus::Error &e) { |
| 310 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 311 | return std::string(); // Make the compiler happy. |
| 312 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 313 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 314 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 315 | const std::string ModemProxy::EquipmentIdentifier() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 316 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 317 | try { |
| 318 | return proxy_.EquipmentIdentifier(); |
| 319 | } catch (const DBus::Error &e) { |
| 320 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 321 | return std::string(); // Make the compiler happy. |
| 322 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 323 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 324 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 325 | uint32_t ModemProxy::UnlockRequired() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 326 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 327 | try { |
| 328 | return proxy_.UnlockRequired(); |
| 329 | } catch (const DBus::Error &e) { |
| 330 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 331 | return 0; // Make the compiler happy. |
| 332 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 333 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 334 | |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 335 | const std::map<uint32_t, uint32_t> ModemProxy::UnlockRetries() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 336 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 337 | try { |
| 338 | return proxy_.UnlockRetries(); |
| 339 | } catch (const DBus::Error &e) { |
| 340 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 341 | return std::map<uint32_t, uint32_t>(); // Make the compiler happy. |
| 342 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 343 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 344 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 345 | uint32_t ModemProxy::State() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 346 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 347 | try { |
| 348 | return proxy_.State(); |
| 349 | } catch (const DBus::Error &e) { |
| 350 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 351 | return 0; // Make the compiler happy. |
| 352 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 353 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 354 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 355 | uint32_t ModemProxy::AccessTechnologies() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 356 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 357 | try { |
| 358 | return proxy_.AccessTechnologies(); |
| 359 | } catch (const DBus::Error &e) { |
| 360 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 361 | return 0; // Make the compiler happy. |
| 362 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 363 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 364 | |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 365 | const ::DBus::Struct<uint32_t, bool> ModemProxy::SignalQuality() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 366 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 367 | try { |
| 368 | return proxy_.SignalQuality(); |
| 369 | } catch (const DBus::Error &e) { |
| 370 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 371 | return ::DBus::Struct<uint32_t, bool>(); // Make the compiler happy. |
| 372 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 373 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 374 | |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 375 | const std::vector<string> ModemProxy::OwnNumbers() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 376 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 377 | try { |
| 378 | return proxy_.OwnNumbers(); |
| 379 | } catch (const DBus::Error &e) { |
| 380 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 381 | return std::vector<string>(); // Make the compiler happy. |
| 382 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 383 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 384 | |
| 385 | const std::vector<::DBus::Struct<uint32_t, uint32_t>> |
| 386 | ModemProxy::SupportedModes() { |
| 387 | SLOG(DBus, 2) << __func__; |
| 388 | try { |
| 389 | return proxy_.SupportedModes(); |
| 390 | } catch (const DBus::Error &e) { |
| 391 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 392 | // Make the compiler happy. |
| 393 | return std::vector<::DBus::Struct<uint32_t, uint32_t>>(); |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | const ::DBus::Struct<uint32_t, uint32_t> ModemProxy::CurrentModes() { |
| 398 | SLOG(DBus, 2) << __func__; |
| 399 | try { |
| 400 | return proxy_.CurrentModes(); |
| 401 | } catch (const DBus::Error &e) { |
| 402 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 403 | return ::DBus::Struct<uint32_t, uint32_t>(); // Make the compiler happy. |
| 404 | } |
| 405 | } |
| 406 | |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 407 | const std::vector<uint32_t> ModemProxy::SupportedBands() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 408 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 409 | try { |
| 410 | return proxy_.SupportedBands(); |
| 411 | } catch (const DBus::Error &e) { |
| 412 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 413 | return std::vector<uint32_t>(); // Make the compiler happy. |
| 414 | } |
Jason Glasgow | 90d216d | 2012-04-04 15:57:14 -0400 | [diff] [blame] | 415 | } |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 416 | |
| 417 | const std::vector<uint32_t> ModemProxy::CurrentBands() { |
| 418 | SLOG(DBus, 2) << __func__; |
| 419 | try { |
| 420 | return proxy_.CurrentBands(); |
| 421 | } catch (const DBus::Error &e) { |
| 422 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 423 | return std::vector<uint32_t>(); // Make the compiler happy. |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | uint32_t ModemProxy::SupportedIpFamilies() { |
| 428 | SLOG(DBus, 2) << __func__; |
| 429 | try { |
| 430 | return proxy_.SupportedIpFamilies(); |
| 431 | } catch (const DBus::Error &e) { |
| 432 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 433 | return 0; // Make the compiler happy. |
| 434 | } |
| 435 | } |
| 436 | |
Arman Uguray | ee464d3 | 2013-02-13 17:14:36 -0800 | [diff] [blame] | 437 | uint32_t ModemProxy::PowerState() { |
| 438 | SLOG(DBus, 2) << __func__; |
| 439 | try { |
| 440 | return proxy_.PowerState(); |
| 441 | } catch (const DBus::Error &e) { |
| 442 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 443 | return 0; // Make the compiler happy. |
| 444 | } |
| 445 | } |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 446 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 447 | ModemProxy::Proxy::Proxy(DBus::Connection *connection, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 448 | const std::string &path, |
| 449 | const std::string &service) |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 450 | : DBus::ObjectProxy(*connection, path, service.c_str()) {} |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 451 | |
| 452 | ModemProxy::Proxy::~Proxy() {} |
| 453 | |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 454 | void ModemProxy::Proxy::set_state_changed_callback( |
| 455 | const ModemStateChangedSignalCallback &callback) { |
| 456 | state_changed_callback_ = callback; |
| 457 | } |
| 458 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 459 | // Signal callbacks inherited from Proxy |
Nathan Williams | a31e79c | 2012-03-30 15:07:00 -0400 | [diff] [blame] | 460 | void ModemProxy::Proxy::StateChanged(const int32_t &old, |
| 461 | const int32_t &_new, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 462 | const uint32_t &reason) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 463 | SLOG(DBus, 2) << __func__; |
Jason Glasgow | 82f9ab3 | 2012-04-04 14:27:19 -0400 | [diff] [blame] | 464 | if (!state_changed_callback_.is_null()) |
| 465 | state_changed_callback_.Run(old, _new, reason); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 466 | } |
| 467 | |
| 468 | // Method callbacks inherited from |
| 469 | // org::freedesktop::ModemManager1::ModemProxy |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 470 | void ModemProxy::Proxy::EnableCallback(const ::DBus::Error &dberror, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 471 | void *data) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 472 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 473 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 474 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 475 | CellularError::FromMM1DBusError(dberror, &error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 476 | callback->Run(error); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 477 | } |
| 478 | |
| 479 | void ModemProxy::Proxy::ListBearersCallback( |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 480 | const std::vector< ::DBus::Path> &bearers, |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 481 | const ::DBus::Error &dberror, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 482 | void *data) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 483 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 484 | scoped_ptr<DBusPathsCallback> callback( |
| 485 | reinterpret_cast<DBusPathsCallback *>(data)); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 486 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 487 | CellularError::FromMM1DBusError(dberror, &error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 488 | callback->Run(bearers, error); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 489 | } |
| 490 | |
| 491 | void ModemProxy::Proxy::CreateBearerCallback(const ::DBus::Path &path, |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 492 | const ::DBus::Error &dberror, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 493 | void *data) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 494 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 495 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 496 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 497 | CellularError::FromMM1DBusError(dberror, &error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 498 | callback->Run(error); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 499 | } |
| 500 | |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 501 | void ModemProxy::Proxy::DeleteBearerCallback(const ::DBus::Error &dberror, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 502 | void *data) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 503 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 504 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 505 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 506 | CellularError::FromMM1DBusError(dberror, &error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 507 | callback->Run(error); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 508 | } |
| 509 | |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 510 | void ModemProxy::Proxy::ResetCallback(const ::DBus::Error &dberror, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 511 | void *data) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 512 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 513 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 514 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 515 | CellularError::FromMM1DBusError(dberror, &error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 516 | callback->Run(error); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 517 | } |
| 518 | |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 519 | void ModemProxy::Proxy::FactoryResetCallback(const ::DBus::Error &dberror, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 520 | void *data) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 521 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 522 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 523 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 524 | CellularError::FromMM1DBusError(dberror, &error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 525 | callback->Run(error); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 526 | } |
| 527 | |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 528 | void ModemProxy::Proxy::SetCurrentCapabilitesCallback( |
| 529 | const ::DBus::Error &dberror, |
| 530 | void *data) { |
| 531 | SLOG(DBus, 2) << __func__; |
| 532 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
| 533 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 534 | CellularError::FromMM1DBusError(dberror, &error); |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 535 | callback->Run(error); |
| 536 | } |
| 537 | |
| 538 | void ModemProxy::Proxy::SetCurrentModesCallback(const ::DBus::Error &dberror, |
| 539 | void *data) { |
| 540 | SLOG(DBus, 2) << __func__; |
| 541 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
| 542 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 543 | CellularError::FromMM1DBusError(dberror, &error); |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 544 | callback->Run(error); |
| 545 | } |
| 546 | |
| 547 | void ModemProxy::Proxy::SetCurrentBandsCallback(const ::DBus::Error &dberror, |
| 548 | void *data) { |
| 549 | SLOG(DBus, 2) << __func__; |
| 550 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
| 551 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 552 | CellularError::FromMM1DBusError(dberror, &error); |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 553 | callback->Run(error); |
| 554 | } |
| 555 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 556 | void ModemProxy::Proxy::CommandCallback(const std::string &response, |
Ben Chan | 74924d8 | 2013-06-15 17:52:55 -0700 | [diff] [blame] | 557 | const ::DBus::Error &dberror, |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 558 | void *data) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 559 | SLOG(DBus, 2) << __func__; |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 560 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 561 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 562 | CellularError::FromMM1DBusError(dberror, &error); |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 563 | callback->Run(error); |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 564 | } |
| 565 | |
Arman Uguray | ee464d3 | 2013-02-13 17:14:36 -0800 | [diff] [blame] | 566 | void ModemProxy::Proxy::SetPowerStateCallback(const ::DBus::Error &dberror, |
| 567 | void *data) { |
| 568 | SLOG(DBus, 2) << __func__; |
| 569 | scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data)); |
| 570 | Error error; |
Arman Uguray | 763df86 | 2013-07-02 12:49:10 -0700 | [diff] [blame] | 571 | CellularError::FromMM1DBusError(dberror, &error); |
Arman Uguray | ee464d3 | 2013-02-13 17:14:36 -0800 | [diff] [blame] | 572 | callback->Run(error); |
| 573 | } |
| 574 | |
Jason Glasgow | ee1081c | 2012-03-06 15:14:53 -0500 | [diff] [blame] | 575 | } // namespace mm1 |
| 576 | } // namespace shill |