15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chromeos/dbus/shill_manager_client.h" 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/bind.h" 8c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "base/logging.h" 99ab5563a3196760eb381d102cbb2bc0f7abc6a50Ben Murdoch#include "base/message_loop/message_loop.h" 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/values.h" 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chromeos/dbus/shill_property_changed_observer.h" 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "dbus/bus.h" 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "dbus/message.h" 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "dbus/object_path.h" 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "dbus/object_proxy.h" 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "dbus/values_util.h" 171320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "net/base/ip_endpoint.h" 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "third_party/cros_system_api/dbus/service_constants.h" 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace chromeos { 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace { 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The ShillManagerClient implementation. 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ShillManagerClientImpl : public ShillManagerClient { 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 27424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) ShillManagerClientImpl() : proxy_(NULL) {} 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) //////////////////////////////////// 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // ShillManagerClient overrides. 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void AddPropertyChangedObserver( 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ShillPropertyChangedObserver* observer) OVERRIDE { 33424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) helper_->AddPropertyChangedObserver(observer); 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void RemovePropertyChangedObserver( 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ShillPropertyChangedObserver* observer) OVERRIDE { 38424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) helper_->RemovePropertyChangedObserver(observer); 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void GetProperties(const DictionaryValueCallback& callback) OVERRIDE { 4268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) dbus::MethodCall method_call(shill::kFlimflamManagerInterface, 4368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) shill::kGetPropertiesFunction); 44424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) helper_->CallDictionaryValueMethod(&method_call, callback); 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual void GetNetworksForGeolocation( 482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const DictionaryValueCallback& callback) OVERRIDE { 4968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) dbus::MethodCall method_call(shill::kFlimflamManagerInterface, 502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) shill::kGetNetworksForGeolocation); 51424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) helper_->CallDictionaryValueMethod(&method_call, callback); 522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void SetProperty(const std::string& name, 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const base::Value& value, 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const base::Closure& callback, 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const ErrorCallback& error_callback) OVERRIDE { 5868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) dbus::MethodCall method_call(shill::kFlimflamManagerInterface, 5968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) shill::kSetPropertyFunction); 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) dbus::MessageWriter writer(&method_call); 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) writer.AppendString(name); 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ShillClientHelper::AppendValueDataAsVariant(&writer, value); 63424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) helper_->CallVoidMethodWithErrorCallback(&method_call, 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) callback, 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) error_callback); 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void RequestScan(const std::string& type, 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const base::Closure& callback, 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const ErrorCallback& error_callback) OVERRIDE { 7168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) dbus::MethodCall method_call(shill::kFlimflamManagerInterface, 7268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) shill::kRequestScanFunction); 735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) dbus::MessageWriter writer(&method_call); 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) writer.AppendString(type); 75424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) helper_->CallVoidMethodWithErrorCallback(&method_call, 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) callback, 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) error_callback); 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void EnableTechnology( 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const std::string& type, 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const base::Closure& callback, 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const ErrorCallback& error_callback) OVERRIDE { 8468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) dbus::MethodCall method_call(shill::kFlimflamManagerInterface, 8568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) shill::kEnableTechnologyFunction); 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) dbus::MessageWriter writer(&method_call); 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) writer.AppendString(type); 88424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) helper_->CallVoidMethodWithErrorCallback(&method_call, 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) callback, 905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) error_callback); 915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void DisableTechnology( 945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const std::string& type, 955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const base::Closure& callback, 965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const ErrorCallback& error_callback) OVERRIDE { 9768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) dbus::MethodCall method_call(shill::kFlimflamManagerInterface, 9868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) shill::kDisableTechnologyFunction); 995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) dbus::MessageWriter writer(&method_call); 1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) writer.AppendString(type); 101424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) helper_->CallVoidMethodWithErrorCallback(&method_call, 1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) callback, 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) error_callback); 1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void ConfigureService( 1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const base::DictionaryValue& properties, 1082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const ObjectPathCallback& callback, 1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const ErrorCallback& error_callback) OVERRIDE { 11068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) dbus::MethodCall method_call(shill::kFlimflamManagerInterface, 11168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) shill::kConfigureServiceFunction); 1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) dbus::MessageWriter writer(&method_call); 1137dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch ShillClientHelper::AppendServicePropertiesDictionary(&writer, properties); 114424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) helper_->CallObjectPathMethodWithErrorCallback(&method_call, 1152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) callback, 1162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) error_callback); 1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 119c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) virtual void ConfigureServiceForProfile( 120c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const dbus::ObjectPath& profile_path, 121c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const base::DictionaryValue& properties, 122c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const ObjectPathCallback& callback, 123c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const ErrorCallback& error_callback) OVERRIDE { 12468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) dbus::MethodCall method_call(shill::kFlimflamManagerInterface, 125c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) shill::kConfigureServiceForProfileFunction); 126c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) dbus::MessageWriter writer(&method_call); 127c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) writer.AppendObjectPath(dbus::ObjectPath(profile_path)); 1287dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch ShillClientHelper::AppendServicePropertiesDictionary(&writer, properties); 129424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) helper_->CallObjectPathMethodWithErrorCallback(&method_call, 130c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) callback, 131c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) error_callback); 132c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) } 133c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void GetService( 1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const base::DictionaryValue& properties, 1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const ObjectPathCallback& callback, 1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const ErrorCallback& error_callback) OVERRIDE { 13868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) dbus::MethodCall method_call(shill::kFlimflamManagerInterface, 13968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) shill::kGetServiceFunction); 1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) dbus::MessageWriter writer(&method_call); 1417dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch ShillClientHelper::AppendServicePropertiesDictionary(&writer, properties); 142424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) helper_->CallObjectPathMethodWithErrorCallback(&method_call, 1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) callback, 1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) error_callback); 1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 147b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) virtual void VerifyDestination(const VerificationProperties& properties, 1482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const BooleanCallback& callback, 1492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const ErrorCallback& error_callback) OVERRIDE { 15068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) dbus::MethodCall method_call(shill::kFlimflamManagerInterface, 1512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) shill::kVerifyDestinationFunction); 1522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) dbus::MessageWriter writer(&method_call); 153b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.certificate); 154b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.public_key); 155b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.nonce); 156b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.signed_data); 157b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.device_serial); 158b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.device_ssid); 159b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.device_bssid); 160424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) helper_->CallBooleanMethodWithErrorCallback( 161b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) &method_call, callback, error_callback); 1622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 1632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual void VerifyAndEncryptCredentials( 165b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) const VerificationProperties& properties, 1662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string& service_path, 1672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const StringCallback& callback, 1682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const ErrorCallback& error_callback) OVERRIDE { 16968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) dbus::MethodCall method_call(shill::kFlimflamManagerInterface, 1702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) shill::kVerifyAndEncryptCredentialsFunction); 1712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) dbus::MessageWriter writer(&method_call); 172b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.certificate); 173b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.public_key); 174b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.nonce); 175b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.signed_data); 176b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.device_serial); 177b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.device_ssid); 178b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.device_bssid); 1792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) writer.AppendObjectPath(dbus::ObjectPath(service_path)); 180424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) helper_->CallStringMethodWithErrorCallback( 181b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) &method_call, callback, error_callback); 1822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 1832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 184c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) virtual void VerifyAndEncryptData( 185b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) const VerificationProperties& properties, 186c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const std::string& data, 187c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const StringCallback& callback, 188c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const ErrorCallback& error_callback) OVERRIDE { 18968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) dbus::MethodCall method_call(shill::kFlimflamManagerInterface, 1902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) shill::kVerifyAndEncryptDataFunction); 1912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) dbus::MessageWriter writer(&method_call); 192b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.certificate); 193b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.public_key); 194b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.nonce); 195b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.signed_data); 196b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.device_serial); 197b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.device_ssid); 198b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) writer.AppendString(properties.device_bssid); 1992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) writer.AppendString(data); 200424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) helper_->CallStringMethodWithErrorCallback( 201b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) &method_call, callback, error_callback); 2022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 2032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 204c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) virtual void ConnectToBestServices( 205c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const base::Closure& callback, 206c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const ErrorCallback& error_callback) OVERRIDE { 20768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) dbus::MethodCall method_call(shill::kFlimflamManagerInterface, 208c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) shill::kConnectToBestServicesFunction); 209424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) helper_->CallVoidMethodWithErrorCallback(&method_call, 210c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) callback, 211c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) error_callback); 2121320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } 2131320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 2141320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci virtual void AddWakeOnPacketConnection( 2151320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci const net::IPEndPoint& ip_endpoint, 2161320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci const base::Closure& callback, 2171320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci const ErrorCallback& error_callback) OVERRIDE { 2181320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if (ip_endpoint.address().empty()) { 2191320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci LOG(ERROR) << "AddWakeOnPacketConnection: null address"; 2201320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return; 2211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } 2221320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci dbus::MethodCall method_call(shill::kFlimflamManagerInterface, 2231320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci shill::kAddWakeOnPacketConnectionFunction); 2241320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci dbus::MessageWriter writer(&method_call); 2251320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci writer.AppendString(net::IPAddressToString(ip_endpoint.address())); 2261320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci helper_->CallVoidMethodWithErrorCallback(&method_call, 2271320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci callback, 2281320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci error_callback); 2291320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } 2301320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 2311320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci virtual void RemoveWakeOnPacketConnection( 2321320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci const net::IPEndPoint& ip_endpoint, 2331320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci const base::Closure& callback, 2341320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci const ErrorCallback& error_callback) OVERRIDE { 2351320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if (ip_endpoint.address().empty()) { 2361320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci LOG(ERROR) << "RemoveWakeOnPacketConnection: null address"; 2371320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return; 2381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } 2391320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci dbus::MethodCall method_call(shill::kFlimflamManagerInterface, 2401320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci shill::kRemoveWakeOnPacketConnectionFunction); 2411320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci dbus::MessageWriter writer(&method_call); 2421320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci writer.AppendString(net::IPAddressToString(ip_endpoint.address())); 2431320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci helper_->CallVoidMethodWithErrorCallback(&method_call, 2441320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci callback, 2451320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci error_callback); 2461320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } 2471320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 2481320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci virtual void RemoveAllWakeOnPacketConnections( 2491320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci const base::Closure& callback, 2501320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci const ErrorCallback& error_callback) OVERRIDE { 2511320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci dbus::MethodCall method_call( 2521320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci shill::kFlimflamManagerInterface, 2531320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci shill::kRemoveAllWakeOnPacketConnectionsFunction); 2541320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci helper_->CallVoidMethodWithErrorCallback(&method_call, 2551320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci callback, 2561320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci error_callback); 257c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) } 258c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 2595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual TestInterface* GetTestInterface() OVERRIDE { 2605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return NULL; 2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 2625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 263424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) protected: 264424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) virtual void Init(dbus::Bus* bus) OVERRIDE { 26568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) proxy_ = bus->GetObjectProxy(shill::kFlimflamServiceName, 26668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) dbus::ObjectPath(shill::kFlimflamServicePath)); 2674e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) helper_.reset(new ShillClientHelper(proxy_)); 26868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) helper_->MonitorPropertyChanged(shill::kFlimflamManagerInterface); 269424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) } 270424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 2715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private: 2725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) dbus::ObjectProxy* proxy_; 273424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) scoped_ptr<ShillClientHelper> helper_; 2745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(ShillManagerClientImpl); 2765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 2775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace 2795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)ShillManagerClient::ShillManagerClient() {} 2815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)ShillManagerClient::~ShillManagerClient() {} 2835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// static 285a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)ShillManagerClient* ShillManagerClient::Create() { 286a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) return new ShillManagerClientImpl(); 2875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 2885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 289b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)// ShillManagerClient::VerificationProperties implementation. 290b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)ShillManagerClient::VerificationProperties::VerificationProperties() { 291b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)} 292b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 293b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)ShillManagerClient::VerificationProperties::~VerificationProperties() { 294b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)} 295b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 2965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace chromeos 297