Darin Petkov | 096b347 | 2012-05-15 10:26:22 +0200 | [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/wimax_manager_proxy.h" |
| 6 | |
| 7 | #include <base/logging.h> |
| 8 | |
| 9 | #include "shill/error.h" |
| 10 | #include "shill/scope_logger.h" |
| 11 | |
| 12 | using std::vector; |
| 13 | |
| 14 | namespace shill { |
| 15 | |
| 16 | namespace { |
| 17 | // TODO(petkov): Declare these in chromeos/dbus/service_constants.h. |
| 18 | const char kWiMaxManagerServicePath[] = "/org/chromium/WiMaxManager"; |
| 19 | const char kWiMaxManagerServiceName[] = "org.chromium.WiMaxManager"; |
| 20 | } // namespace |
| 21 | |
| 22 | WiMaxManagerProxy::WiMaxManagerProxy(DBus::Connection *connection) |
| 23 | : proxy_(connection) {} |
| 24 | |
| 25 | WiMaxManagerProxy::~WiMaxManagerProxy() {} |
| 26 | |
| 27 | vector<RpcIdentifier> WiMaxManagerProxy::Devices(Error *error) { |
| 28 | SLOG(DBus, 2) << __func__; |
| 29 | vector<DBus::Path> dbus_devices; |
| 30 | try { |
| 31 | dbus_devices = proxy_.Devices(); |
| 32 | } catch (const DBus::Error &e) { |
| 33 | Error::PopulateAndLog(error, Error::kOperationFailed, e.what()); |
| 34 | } |
| 35 | vector<RpcIdentifier> devices; |
| 36 | for (vector<DBus::Path>::const_iterator it = dbus_devices.begin(); |
| 37 | it != dbus_devices.end(); ++it) { |
| 38 | devices.push_back(*it); |
| 39 | } |
| 40 | return devices; |
| 41 | } |
| 42 | |
| 43 | WiMaxManagerProxy::Proxy::Proxy(DBus::Connection *connection) |
| 44 | : DBus::ObjectProxy(*connection, |
| 45 | kWiMaxManagerServicePath, |
| 46 | kWiMaxManagerServiceName) {} |
| 47 | |
| 48 | WiMaxManagerProxy::Proxy::~Proxy() {} |
| 49 | |
| 50 | } // namespace shill |