diff options
author | Roshan Pius <rpius@google.com> | 2015-11-13 11:31:14 -0800 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2015-12-03 15:47:50 -0800 |
commit | be28266e1e51a76629f109063eb7fe1ea38823a8 (patch) | |
tree | 62f679d85a7d4aa210e0a8399d3ebc696a2bf008 /test-rpc-proxy | |
parent | 90d08ac5a43d06f6674edc394f4a0d05cf2298b9 (diff) | |
download | shill-be28266e1e51a76629f109063eb7fe1ea38823a8.tar.gz |
shill-test-proxy: Implement dbus methods (Part 12)
Implementation of the following methods declared in the abstract
ProxyShillWifiClient interface:
1. AddWakePacketSource
2. RemoveWakePacketSource
3. RemoveAllWakePacketSources
Bug: 25516476
Change-Id: I4d978a27b389899711ab9803ac6b652db4998b7d
TEST: mmm system/connectivity/shill
Diffstat (limited to 'test-rpc-proxy')
-rw-r--r-- | test-rpc-proxy/proxy_dbus_shill_wifi_client.cc | 40 | ||||
-rw-r--r-- | test-rpc-proxy/proxy_dbus_shill_wifi_client.h | 10 | ||||
-rw-r--r-- | test-rpc-proxy/proxy_shill_wifi_client.h | 10 |
3 files changed, 42 insertions, 18 deletions
diff --git a/test-rpc-proxy/proxy_dbus_shill_wifi_client.cc b/test-rpc-proxy/proxy_dbus_shill_wifi_client.cc index d951a7d0..fb739e1b 100644 --- a/test-rpc-proxy/proxy_dbus_shill_wifi_client.cc +++ b/test-rpc-proxy/proxy_dbus_shill_wifi_client.cc @@ -559,20 +559,44 @@ bool ProxyDbusShillWifiClient::QueryTdlsLink( } bool ProxyDbusShillWifiClient::AddWakePacketSource( - std::string interface_name, - std::string source_ip_address) { - return true; + const std::string& interface_name, + const std::string& source_ip_address) { + brillo::VariantDictionary device_params; + device_params.insert(std::make_pair( + shill::kNameProperty, brillo::Any(interface_name))); + std::unique_ptr<DeviceProxy> device = + dbus_client_->GetMatchingDeviceProxy(device_params); + if (!device) { + return false; + } + return device->AddWakeOnPacketConnection(source_ip_address, nullptr); } bool ProxyDbusShillWifiClient::RemoveWakePacketSource( - std::string interface_name, - std::string source_ip_address) { - return true; + const std::string& interface_name, + const std::string& source_ip_address) { + brillo::VariantDictionary device_params; + device_params.insert(std::make_pair( + shill::kNameProperty, brillo::Any(interface_name))); + std::unique_ptr<DeviceProxy> device = + dbus_client_->GetMatchingDeviceProxy(device_params); + if (!device) { + return false; + } + return device->RemoveWakeOnPacketConnection(source_ip_address, nullptr); } bool ProxyDbusShillWifiClient::RemoveAllWakePacketSources( - std::string interface_name) { - return true; + const std::string& interface_name) { + brillo::VariantDictionary device_params; + device_params.insert(std::make_pair( + shill::kNameProperty, brillo::Any(interface_name))); + std::unique_ptr<DeviceProxy> device = + dbus_client_->GetMatchingDeviceProxy(device_params); + if (!device) { + return false; + } + return device->RemoveAllWakeOnPacketConnections(nullptr); } void ProxyDbusShillWifiClient::SetAutoConnectInServiceParams( diff --git a/test-rpc-proxy/proxy_dbus_shill_wifi_client.h b/test-rpc-proxy/proxy_dbus_shill_wifi_client.h index 46b3411b..b02a0e1e 100644 --- a/test-rpc-proxy/proxy_dbus_shill_wifi_client.h +++ b/test-rpc-proxy/proxy_dbus_shill_wifi_client.h @@ -97,11 +97,11 @@ class ProxyDbusShillWifiClient : public ProxyShillWifiClient { bool QueryTdlsLink(const std::string& interface_name, const std::string& peer_mac_address, std::string* status) override; - bool AddWakePacketSource(std::string interface_name, - std::string source_ip_address) override; - bool RemoveWakePacketSource(std::string interface_name, - std::string source_ip_address) override; - bool RemoveAllWakePacketSources(std::string interface_name) override; + bool AddWakePacketSource(const std::string& interface_name, + const std::string& source_ip_address) override; + bool RemoveWakePacketSource(const std::string& interface_name, + const std::string& source_ip_address) override; + bool RemoveAllWakePacketSources(const std::string& interface_name) override; private: void SetAutoConnectInServiceParams(AutoConnectType autoconnect, diff --git a/test-rpc-proxy/proxy_shill_wifi_client.h b/test-rpc-proxy/proxy_shill_wifi_client.h index ffb34aaf..dc3c2a0f 100644 --- a/test-rpc-proxy/proxy_shill_wifi_client.h +++ b/test-rpc-proxy/proxy_shill_wifi_client.h @@ -116,11 +116,11 @@ class ProxyShillWifiClient { virtual bool QueryTdlsLink(const std::string& interface_name, const std::string& peer_mac_address, std::string* status) = 0; - virtual bool AddWakePacketSource(std::string interface_name, - std::string source_ip_address) = 0; - virtual bool RemoveWakePacketSource(std::string interface_name, - std::string source_ip_address) = 0; - virtual bool RemoveAllWakePacketSources(std::string interface_name) = 0; + virtual bool AddWakePacketSource(const std::string& interface_name, + const std::string& source_ip_address) = 0; + virtual bool RemoveWakePacketSource(const std::string& interface_name, + const std::string& source_ip_address) = 0; + virtual bool RemoveAllWakePacketSources(const std::string& interface_name) = 0; std::string GetModeFromStationType(StationType station_type); }; |