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 | |
| 59 | // definitions for private class SupplicantInterfaceProxy::Proxy |
| 60 | |
| 61 | SupplicantInterfaceProxy::Proxy::Proxy( |
| 62 | const WiFiRefPtr &wifi, DBus::Connection *bus, |
| 63 | const DBus::Path &dbus_path, const char *dbus_addr) |
| 64 | : DBus::ObjectProxy(*bus, dbus_path, dbus_addr), |
| 65 | wifi_(wifi) {} |
| 66 | |
| 67 | SupplicantInterfaceProxy::Proxy::~Proxy() {} |
| 68 | |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 69 | void SupplicantInterfaceProxy::Proxy::BlobAdded(const string &/*blobname*/) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 70 | LOG(INFO) << __func__; |
| 71 | // XXX |
| 72 | } |
| 73 | |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 74 | void SupplicantInterfaceProxy::Proxy::BlobRemoved(const string &/*blobname*/) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 75 | LOG(INFO) << __func__; |
| 76 | // XXX |
| 77 | } |
| 78 | |
| 79 | void SupplicantInterfaceProxy::Proxy::BSSAdded( |
| 80 | const ::DBus::Path &BSS, |
| 81 | const std::map<string, ::DBus::Variant> &properties) { |
| 82 | LOG(INFO) << __func__; |
| 83 | wifi_->BSSAdded(BSS, properties); |
| 84 | } |
| 85 | |
mukesh agrawal | 261daca | 2011-12-02 18:56:56 +0000 | [diff] [blame] | 86 | void SupplicantInterfaceProxy::Proxy::BSSRemoved(const ::DBus::Path &BSS) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 87 | LOG(INFO) << __func__; |
mukesh agrawal | 261daca | 2011-12-02 18:56:56 +0000 | [diff] [blame] | 88 | wifi_->BSSRemoved(BSS); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | void SupplicantInterfaceProxy::Proxy::NetworkAdded( |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 92 | const ::DBus::Path &/*network*/, |
| 93 | const std::map<string, ::DBus::Variant> &/*properties*/) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 94 | LOG(INFO) << __func__; |
| 95 | // XXX |
| 96 | } |
| 97 | |
| 98 | void SupplicantInterfaceProxy::Proxy::NetworkRemoved( |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 99 | const ::DBus::Path &/*network*/) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 100 | LOG(INFO) << __func__; |
mukesh agrawal | 8a3188d | 2011-12-01 20:56:44 +0000 | [diff] [blame] | 101 | // TODO(quiche): Pass this up to WiFi, so that it can clean its |
| 102 | // rpcid_by_service_ map. crosbug.com/24699 |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | void SupplicantInterfaceProxy::Proxy::NetworkSelected( |
mukesh agrawal | 1830fa1 | 2011-09-26 14:31:40 -0700 | [diff] [blame] | 106 | const ::DBus::Path &/*network*/) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 107 | LOG(INFO) << __func__; |
| 108 | // XXX |
| 109 | } |
| 110 | |
| 111 | void SupplicantInterfaceProxy::Proxy::PropertiesChanged( |
mukesh agrawal | 7ec7131 | 2011-11-10 02:08:26 +0000 | [diff] [blame] | 112 | const std::map<string, ::DBus::Variant> &properties) { |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 113 | LOG(INFO) << __func__; |
mukesh agrawal | 7ec7131 | 2011-11-10 02:08:26 +0000 | [diff] [blame] | 114 | wifi_->PropertiesChanged(properties); |
mukesh agrawal | af57195 | 2011-07-14 14:31:12 -0700 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | void SupplicantInterfaceProxy::Proxy::ScanDone(const bool& success) { |
| 118 | LOG(INFO) << __func__ << " " << success; |
| 119 | if (success) { |
| 120 | wifi_->ScanDone(); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | } // namespace shill |