mukesh agrawal | 8a3188d | 2011-12-01 20:56:44 +0000 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 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_interface_proxy.h" |
| 6 | |
| 7 | #include <map> |
| 8 | #include <string> |
| 9 | |
| 10 | #include <base/logging.h> |
| 11 | #include <dbus-c++/dbus.h> |
| 12 | |
| 13 | #include "shill/wifi.h" |
| 14 | |
| 15 | using std::map; |
| 16 | using std::string; |
| 17 | |
| 18 | namespace shill { |
| 19 | |
| 20 | SupplicantInterfaceProxy::SupplicantInterfaceProxy( |
| 21 | const WiFiRefPtr &wifi, |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 22 | DBus::Connection *bus, |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 23 | const ::DBus::Path &object_path, |
| 24 | const char *dbus_addr) |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 25 | : proxy_(wifi, bus, object_path, dbus_addr) {} |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 26 | |
| 27 | SupplicantInterfaceProxy::~SupplicantInterfaceProxy() {} |
| 28 | |
| 29 | ::DBus::Path SupplicantInterfaceProxy::AddNetwork( |
| 30 | const std::map<std::string, ::DBus::Variant> &args) { |
| 31 | return proxy_.AddNetwork(args); |
| 32 | } |
| 33 | |
mukesh agrawal | 0ed0f2e | 2011-12-05 20:36:17 +0000 | [diff] [blame] | 34 | void SupplicantInterfaceProxy::Disconnect() { |
| 35 | return proxy_.Disconnect(); |
| 36 | } |
| 37 | |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 38 | void SupplicantInterfaceProxy::FlushBSS(const uint32_t &age) { |
| 39 | return proxy_.FlushBSS(age); |
| 40 | } |
| 41 | |
| 42 | void SupplicantInterfaceProxy::RemoveAllNetworks() { |
| 43 | return proxy_.RemoveAllNetworks(); |
| 44 | } |
| 45 | |
mukesh agrawal | 1590839 | 2011-11-16 18:29:25 +0000 | [diff] [blame] | 46 | void SupplicantInterfaceProxy::RemoveNetwork(const ::DBus::Path &network) { |
| 47 | return proxy_.RemoveNetwork(network); |
| 48 | } |
| 49 | |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 50 | void SupplicantInterfaceProxy::Scan( |
| 51 | const std::map<std::string, ::DBus::Variant> &args) { |
| 52 | return proxy_.Scan(args); |
| 53 | } |
| 54 | |
| 55 | void SupplicantInterfaceProxy::SelectNetwork(const ::DBus::Path &network) { |
| 56 | return proxy_.SelectNetwork(network); |
| 57 | } |
| 58 | |
Paul Stewart | 2987dcf | 2012-01-30 15:47:42 -0800 | [diff] [blame^] | 59 | void SupplicantInterfaceProxy::SetFastReauth(bool enabled) { |
| 60 | return proxy_.FastReauth(enabled); |
| 61 | } |
| 62 | |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 63 | // definitions for private class SupplicantInterfaceProxy::Proxy |
| 64 | |
| 65 | SupplicantInterfaceProxy::Proxy::Proxy( |
| 66 | const WiFiRefPtr &wifi, DBus::Connection *bus, |
| 67 | const DBus::Path &dbus_path, const char *dbus_addr) |
| 68 | : DBus::ObjectProxy(*bus, dbus_path, dbus_addr), |
| 69 | wifi_(wifi) {} |
| 70 | |
| 71 | SupplicantInterfaceProxy::Proxy::~Proxy() {} |
| 72 | |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 73 | void SupplicantInterfaceProxy::Proxy::BlobAdded(const string &/*blobname*/) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 74 | LOG(INFO) << __func__; |
| 75 | // XXX |
| 76 | } |
| 77 | |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 78 | void SupplicantInterfaceProxy::Proxy::BlobRemoved(const string &/*blobname*/) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 79 | LOG(INFO) << __func__; |
| 80 | // XXX |
| 81 | } |
| 82 | |
| 83 | void SupplicantInterfaceProxy::Proxy::BSSAdded( |
| 84 | const ::DBus::Path &BSS, |
| 85 | const std::map<string, ::DBus::Variant> &properties) { |
| 86 | LOG(INFO) << __func__; |
| 87 | wifi_->BSSAdded(BSS, properties); |
| 88 | } |
| 89 | |
mukesh agrawal | 261daca | 2011-12-02 18:56:56 +0000 | [diff] [blame] | 90 | void SupplicantInterfaceProxy::Proxy::BSSRemoved(const ::DBus::Path &BSS) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 91 | LOG(INFO) << __func__; |
mukesh agrawal | 261daca | 2011-12-02 18:56:56 +0000 | [diff] [blame] | 92 | wifi_->BSSRemoved(BSS); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | void SupplicantInterfaceProxy::Proxy::NetworkAdded( |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 96 | const ::DBus::Path &/*network*/, |
| 97 | const std::map<string, ::DBus::Variant> &/*properties*/) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 98 | LOG(INFO) << __func__; |
| 99 | // XXX |
| 100 | } |
| 101 | |
| 102 | void SupplicantInterfaceProxy::Proxy::NetworkRemoved( |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 103 | const ::DBus::Path &/*network*/) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 104 | LOG(INFO) << __func__; |
mukesh agrawal | 8a3188d | 2011-12-01 20:56:44 +0000 | [diff] [blame] | 105 | // TODO(quiche): Pass this up to WiFi, so that it can clean its |
| 106 | // rpcid_by_service_ map. crosbug.com/24699 |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | void SupplicantInterfaceProxy::Proxy::NetworkSelected( |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 110 | const ::DBus::Path &/*network*/) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 111 | LOG(INFO) << __func__; |
| 112 | // XXX |
| 113 | } |
| 114 | |
| 115 | void SupplicantInterfaceProxy::Proxy::PropertiesChanged( |
mukesh agrawal | 7ec7131 | 2011-11-10 02:08:26 +0000 | [diff] [blame] | 116 | const std::map<string, ::DBus::Variant> &properties) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 117 | LOG(INFO) << __func__; |
mukesh agrawal | 7ec7131 | 2011-11-10 02:08:26 +0000 | [diff] [blame] | 118 | wifi_->PropertiesChanged(properties); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | void SupplicantInterfaceProxy::Proxy::ScanDone(const bool& success) { |
| 122 | LOG(INFO) << __func__ << " " << success; |
| 123 | if (success) { |
| 124 | wifi_->ScanDone(); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | } // namespace shill |