summaryrefslogtreecommitdiff
path: root/test-rpc-proxy
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2015-11-13 11:26:00 -0800
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-12-03 23:44:08 +0000
commit78dfe30f944f6eb63e6b56b632e3c048fbcd2524 (patch)
tree1c4b7f621707ef169ee1e84732809a6c7bd8c2fe /test-rpc-proxy
parent90259aacb47485f30a6f26796300fc069905772f (diff)
downloadshill-78dfe30f944f6eb63e6b56b632e3c048fbcd2524.tar.gz
shill-test-proxy: Implement dbus methods (Part 9)
Implementation of the following methods declared in the abstract ProxyShillWifiClient interface: 1. GetPropertyOnDevice 2. SetPropertyOnDevice Bug: 25516476 Change-Id: I451121b7856cb490d37674017f54ed10f272b138 TEST: mmm system/connectivity/shill
Diffstat (limited to 'test-rpc-proxy')
-rw-r--r--test-rpc-proxy/proxy_dbus_shill_wifi_client.cc35
-rw-r--r--test-rpc-proxy/proxy_dbus_shill_wifi_client.h11
-rw-r--r--test-rpc-proxy/proxy_shill_wifi_client.h11
3 files changed, 39 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 1a27a657..7b3f6daf 100644
--- a/test-rpc-proxy/proxy_dbus_shill_wifi_client.cc
+++ b/test-rpc-proxy/proxy_dbus_shill_wifi_client.cc
@@ -467,17 +467,36 @@ bool ProxyDbusShillWifiClient::SetSchedScan(bool enable) {
return dbus_client_->SetSchedScan(enable);
}
-std::string ProxyDbusShillWifiClient::GetPropertyOnDevice(
- std::string interface_name,
- std::string property_name) {
- return std::string();
+bool ProxyDbusShillWifiClient::GetPropertyOnDevice(
+ const std::string& interface_name,
+ const std::string& property_name,
+ brillo::Any* property_value) {
+ 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 dbus_client_->GetPropertyValueFromDeviceProxy(
+ device.get(), property_name, property_value);
}
bool ProxyDbusShillWifiClient::SetPropertyOnDevice(
- std::string interface_name,
- std::string property_name,
- std::string property_value) {
- return true;
+ const std::string& interface_name,
+ const std::string& property_name,
+ const brillo::Any& property_value) {
+ 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->SetProperty(
+ property_name, property_value, nullptr);
}
bool ProxyDbusShillWifiClient::RequestRoam(
diff --git a/test-rpc-proxy/proxy_dbus_shill_wifi_client.h b/test-rpc-proxy/proxy_dbus_shill_wifi_client.h
index 8b21e9cb..b90be9b8 100644
--- a/test-rpc-proxy/proxy_dbus_shill_wifi_client.h
+++ b/test-rpc-proxy/proxy_dbus_shill_wifi_client.h
@@ -82,11 +82,12 @@ class ProxyDbusShillWifiClient : public ProxyShillWifiClient {
bool GetServiceProperties(const std::string& ssid,
brillo::VariantDictionary* properties) override;
bool SetSchedScan(bool enable) override;
- std::string GetPropertyOnDevice(std::string interface_name,
- std::string property_name) override;
- bool SetPropertyOnDevice(std::string interface_name,
- std::string property_name,
- std::string property_value) override;
+ bool GetPropertyOnDevice(const std::string& interface_name,
+ const std::string& property_name,
+ brillo::Any* property_value) override;
+ bool SetPropertyOnDevice(const std::string& interface_name,
+ const std::string& property_name,
+ const brillo::Any& property_value) override;
bool RequestRoam(std::string bssid, std::string interface_name) override;
bool SetDeviceEnabled(std::string interface_name, bool enable) override;
bool DiscoverTDLSLink(std::string interface_name,
diff --git a/test-rpc-proxy/proxy_shill_wifi_client.h b/test-rpc-proxy/proxy_shill_wifi_client.h
index fe91155e..8e93f2e3 100644
--- a/test-rpc-proxy/proxy_shill_wifi_client.h
+++ b/test-rpc-proxy/proxy_shill_wifi_client.h
@@ -101,11 +101,12 @@ class ProxyShillWifiClient {
virtual bool GetServiceProperties(const std::string& ssid,
brillo::VariantDictionary* properties) = 0;
virtual bool SetSchedScan(bool enable) = 0;
- virtual std::string GetPropertyOnDevice(std::string interface_name,
- std::string property_name) = 0;
- virtual bool SetPropertyOnDevice(std::string interface_name,
- std::string property_name,
- std::string property_value) = 0;
+ virtual bool GetPropertyOnDevice(const std::string& interface_name,
+ const std::string& property_name,
+ brillo::Any* property_value) = 0;
+ virtual bool SetPropertyOnDevice(const std::string& interface_name,
+ const std::string& property_name,
+ const brillo::Any& property_value) = 0;
virtual bool RequestRoam(std::string bssid, std::string interface_name) = 0;
virtual bool SetDeviceEnabled(std::string interface_name, bool enable) = 0;
virtual bool DiscoverTDLSLink(std::string interface_name,