Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 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/modem_manager_proxy.h" |
| 6 | |
| 7 | #include <base/logging.h> |
| 8 | |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 9 | #include "shill/modem_manager.h" |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 10 | #include "shill/scope_logger.h" |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 11 | |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 12 | using std::string; |
| 13 | using std::vector; |
| 14 | |
| 15 | namespace shill { |
| 16 | |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 17 | ModemManagerProxy::ModemManagerProxy(DBus::Connection *connection, |
David Rochberg | 81030ea | 2012-03-02 15:44:25 -0500 | [diff] [blame] | 18 | ModemManagerClassic *manager, |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 19 | const string &path, |
| 20 | const string &service) |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 21 | : proxy_(connection, manager, path, service) {} |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 22 | |
| 23 | ModemManagerProxy::~ModemManagerProxy() {} |
| 24 | |
| 25 | vector<DBus::Path> ModemManagerProxy::EnumerateDevices() { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 26 | SLOG(DBus, 2) << __func__; |
Gary Morain | 610977f | 2012-05-04 16:03:52 -0700 | [diff] [blame] | 27 | try { |
| 28 | return proxy_.EnumerateDevices(); |
| 29 | } catch (const DBus::Error &e) { |
| 30 | LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what(); |
| 31 | return vector<DBus::Path>(); // Make the compiler happy. |
| 32 | } |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 33 | } |
| 34 | |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 35 | ModemManagerProxy::Proxy::Proxy(DBus::Connection *connection, |
David Rochberg | 81030ea | 2012-03-02 15:44:25 -0500 | [diff] [blame] | 36 | ModemManagerClassic *manager, |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 37 | const string &path, |
| 38 | const string &service) |
| 39 | : DBus::ObjectProxy(*connection, path, service.c_str()), |
| 40 | manager_(manager) {} |
| 41 | |
| 42 | ModemManagerProxy::Proxy::~Proxy() {} |
| 43 | |
| 44 | void ModemManagerProxy::Proxy::DeviceAdded(const DBus::Path &device) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 45 | SLOG(DBus, 2) << __func__; |
David Rochberg | fa1d31d | 2012-03-20 10:38:07 -0400 | [diff] [blame] | 46 | manager_->OnDeviceAdded(device); |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | void ModemManagerProxy::Proxy::DeviceRemoved(const DBus::Path &device) { |
mukesh agrawal | 06175d7 | 2012-04-23 16:46:01 -0700 | [diff] [blame] | 50 | SLOG(DBus, 2) << __func__; |
David Rochberg | fa1d31d | 2012-03-20 10:38:07 -0400 | [diff] [blame] | 51 | manager_->OnDeviceRemoved(device); |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | } // namespace shill |