update_engine: Switch to use Binder interface to weaved
Now that weaved provides a binder interface for its IPC, switch
to using it instead.
Bug: 23782171
Change-Id: I0b981b366a7dc42aabc9b61c4e9f90e26a2d74b4
diff --git a/weave_service.h b/weave_service.h
index 6790d54..914777e 100644
--- a/weave_service.h
+++ b/weave_service.h
@@ -19,9 +19,9 @@
#include <memory>
-#include <dbus/bus.h>
+#include <base/memory/weak_ptr.h>
#include <libweaved/command.h>
-#include <libweaved/device.h>
+#include <libweaved/service.h>
#include "update_engine/weave_service_interface.h"
@@ -32,20 +32,23 @@
WeaveService() = default;
~WeaveService() override = default;
- bool Init(scoped_refptr<dbus::Bus> bus, DelegateInterface* delegate);
+ bool Init(DelegateInterface* delegate);
// WeaveServiceInterface override.
void UpdateWeaveState() override;
private:
+ void OnWeaveServiceConnected(const std::weak_ptr<weaved::Service>& service);
+
// Weave command handlers. These are called from the message loop whenever a
// command is received and dispatch the synchronous call to the |delegate_|.
- void OnCheckForUpdates(const std::weak_ptr<weaved::Command>& cmd);
- void OnTrackChannel(const std::weak_ptr<weaved::Command>& cmd);
+ void OnCheckForUpdates(std::unique_ptr<weaved::Command> cmd);
+ void OnTrackChannel(std::unique_ptr<weaved::Command> cmd);
WeaveServiceInterface::DelegateInterface* delegate_{nullptr};
- std::unique_ptr<weaved::Device> device_;
+ std::unique_ptr<weaved::Service::Subscription> weave_service_subscription_;
+ std::weak_ptr<weaved::Service> weave_service_;
};
} // namespace chromeos_update_engine