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