Paul Stewart | 835934a | 2012-12-06 19:27:09 -0800 | [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/supplicant_network_proxy.h" |
| 6 | |
| 7 | #include <map> |
| 8 | #include <string> |
| 9 | |
| 10 | #include <dbus-c++/dbus.h> |
| 11 | |
| 12 | #include "shill/logging.h" |
| 13 | |
| 14 | using std::map; |
| 15 | using std::string; |
| 16 | |
| 17 | namespace shill { |
| 18 | |
| 19 | SupplicantNetworkProxy::SupplicantNetworkProxy( |
| 20 | DBus::Connection *bus, |
| 21 | const ::DBus::Path &object_path, |
| 22 | const char *dbus_addr) |
| 23 | : proxy_(bus, object_path, dbus_addr) {} |
| 24 | |
| 25 | SupplicantNetworkProxy::~SupplicantNetworkProxy() {} |
| 26 | |
| 27 | void SupplicantNetworkProxy::SetEnabled(bool enabled) { |
| 28 | SLOG(DBus, 2) << __func__; |
| 29 | try { |
| 30 | return proxy_.Enabled(enabled); |
| 31 | } catch (const DBus::Error &e) { |
| 32 | LOG(ERROR) << "DBus exception: " << e.name() << ": " << e.what() |
| 33 | << "enabled: " << enabled; |
| 34 | throw; // Re-throw the exception. |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | // definitions for private class SupplicantNetworkProxy::Proxy |
| 39 | |
| 40 | SupplicantNetworkProxy::Proxy::Proxy( |
| 41 | DBus::Connection *bus, const DBus::Path &dbus_path, const char *dbus_addr) |
| 42 | : DBus::ObjectProxy(*bus, dbus_path, dbus_addr) {} |
| 43 | |
| 44 | SupplicantNetworkProxy::Proxy::~Proxy() {} |
| 45 | |
| 46 | void SupplicantNetworkProxy::Proxy::PropertiesChanged( |
| 47 | const map<string, ::DBus::Variant> &properties) { |
| 48 | SLOG(DBus, 2) << __func__; |
| 49 | // TODO(pstew): Some day we could notify someone about this state change. |
| 50 | } |
| 51 | |
| 52 | } // namespace shill |