Update interface implementations to reflect changes to libweave
Pulling current version of libweave and making necessary changes to
weaved implementation of libweave's interfaces
Change-Id: I31d5d00ce1c7d2338257d62ec2dd510608ff71af
diff --git a/buffet/shill_client.h b/buffet/shill_client.h
index 6f14226..2e4dc2c 100644
--- a/buffet/shill_client.h
+++ b/buffet/shill_client.h
@@ -16,15 +16,16 @@
#include <base/memory/ref_counted.h>
#include <base/memory/weak_ptr.h>
#include <dbus/bus.h>
-#include <weave/network.h>
-
-#include "shill/dbus-proxies.h"
+#include <shill/dbus-proxies.h>
+#include <weave/provider/network.h>
+#include <weave/provider/wifi.h>
namespace buffet {
class ApManagerClient;
-class ShillClient final : public weave::Network {
+class ShillClient final : public weave::provider::Network,
+ public weave::provider::Wifi {
public:
ShillClient(const scoped_refptr<dbus::Bus>& bus,
const std::set<std::string>& device_whitelist);
@@ -32,24 +33,23 @@
void Init();
- // Network implementation.
- void AddOnConnectionChangedCallback(
- const OnConnectionChangedCallback& listener) override;
- bool ConnectToService(const std::string& ssid,
- const std::string& passphrase,
- const base::Closure& on_success,
- weave::ErrorPtr* error) override;
- weave::NetworkState GetConnectionState() const override;
- void EnableAccessPoint(const std::string& ssid) override;
- void DisableAccessPoint() override;
- std::unique_ptr<weave::Stream> OpenSocketBlocking(const std::string& host,
- uint16_t port) override;
- void CreateTlsStream(
- std::unique_ptr<weave::Stream> socket,
- const std::string& host,
- const base::Callback<void(std::unique_ptr<weave::Stream>)>&
- success_callback,
- const base::Callback<void(const weave::Error*)>& error_callback) override;
+ // NetworkProvider implementation.
+ void AddConnectionChangedCallback(
+ const ConnectionChangedCallback& listener) override;
+ State GetConnectionState() const override;
+ void OpenSslSocket(const std::string& host,
+ uint16_t port,
+ const base::Callback<void(std::unique_ptr<weave::Stream>)>&
+ success_callback,
+ const weave::ErrorCallback& error_callback) override;
+
+ // WifiProvider implementation.
+ void Connect(const std::string& ssid,
+ const std::string& passphrase,
+ const weave::SuccessCallback& success_callback,
+ const weave::ErrorCallback& error_callback) override;
+ void StartAccessPoint(const std::string& ssid) override;
+ void StopAccessPoint() override;
private:
struct DeviceState {
@@ -59,7 +59,7 @@
// service (for instance, in the period between configuring a WiFi service
// with credentials, and when Connect() is called.)
std::shared_ptr<org::chromium::flimflam::ServiceProxy> selected_service;
- weave::NetworkState service_state{weave::NetworkState::kOffline};
+ State service_state{State::kOffline};
};
bool IsMonitoredDevice(org::chromium::flimflam::DeviceProxy* device);
@@ -85,42 +85,37 @@
const std::string& property_name,
const chromeos::Any& property_value);
- void OnStateChangeForConnectingService(const dbus::ObjectPath& service_path,
- const std::string& state);
- void OnStrengthChangeForConnectingService(
- const dbus::ObjectPath& service_path,
- uint8_t signal_strength);
+ void OnStateChangeForConnectingService(const std::string& state);
+ void OnErrorChangeForConnectingService(const std::string& error);
+ void OnStrengthChangeForConnectingService(uint8_t signal_strength);
void OnStateChangeForSelectedService(const dbus::ObjectPath& service_path,
const std::string& state);
void UpdateConnectivityState();
void NotifyConnectivityListeners(bool am_online);
- // Clean up state related to a connecting service. If
- // |check_for_reset_pending| is set, then we'll check to see if we've called
- // ConnectToService() in the time since a task to call this function was
- // posted.
- void CleanupConnectingService(bool check_for_reset_pending);
+ // Clean up state related to a connecting service.
+ void CleanupConnectingService();
- bool ConnectToServiceImpl(const std::string& ssid,
- const std::string& passphrase,
- const base::Closure& on_success,
- chromeos::ErrorPtr* error);
+ void ConnectToServiceError(
+ std::shared_ptr<org::chromium::flimflam::ServiceProxy>
+ connecting_service);
const scoped_refptr<dbus::Bus> bus_;
org::chromium::flimflam::ManagerProxy manager_proxy_;
// There is logic that assumes we will never change this device list
// in OnManagerPropertyChange. Do not be tempted to remove this const.
const std::set<std::string> device_whitelist_;
- std::vector<OnConnectionChangedCallback> connectivity_listeners_;
+ std::vector<ConnectionChangedCallback> connectivity_listeners_;
// State for tracking where we are in our attempts to connect to a service.
- bool connecting_service_reset_pending_{false};
bool have_called_connect_{false};
std::shared_ptr<org::chromium::flimflam::ServiceProxy> connecting_service_;
- base::CancelableClosure on_connect_success_;
+ std::string connecting_service_error_;
+ base::Closure connect_success_callback_;
+ base::Callback<void(const weave::Error*)> connect_error_callback_;
// State for tracking our online connectivity.
std::map<dbus::ObjectPath, DeviceState> devices_;
- weave::NetworkState connectivity_state_{weave::NetworkState::kOffline};
+ State connectivity_state_{State::kOffline};
std::unique_ptr<ApManagerClient> ap_manager_client_;