diff options
author | Alex Vakulenko <avakulenko@google.com> | 2015-12-08 17:11:20 -0800 |
---|---|---|
committer | Alex Vakulenko <avakulenko@google.com> | 2015-12-09 08:38:34 -0800 |
commit | de94eb565149b5f69c780bd23cf1de53f2faf605 (patch) | |
tree | 45d1d2327315de1e2c42615f3d71c025835ca7aa /libweaved | |
parent | bae6c02cd98daa7b731c75d972a818b06997a9e4 (diff) | |
download | weaved-de94eb565149b5f69c780bd23cf1de53f2faf605.tar.gz |
weaved: Use abstract D-Bus proxy interfaces
D-Bus code generator now uses abstract proxy interfaces whenever
possible, so made necessary modifications on the caller side to
use them as well.
BUG: 26092352
Change-Id: I99fa287ea00646c3d9ad6225bfcce8a83284d672
Diffstat (limited to 'libweaved')
-rw-r--r-- | libweaved/command.cc | 3 | ||||
-rw-r--r-- | libweaved/command.h | 6 | ||||
-rw-r--r-- | libweaved/device.cc | 8 | ||||
-rw-r--r-- | libweaved/device.h | 14 |
4 files changed, 16 insertions, 15 deletions
diff --git a/libweaved/command.cc b/libweaved/command.cc index 55cfe2f..8b7427f 100644 --- a/libweaved/command.cc +++ b/libweaved/command.cc @@ -20,7 +20,8 @@ namespace weaved { -Command::Command(com::android::Weave::CommandProxy* proxy) : proxy_{proxy} {} +Command::Command(com::android::Weave::CommandProxyInterface* proxy) + : proxy_{proxy} {} const std::string& Command::GetID() const { return proxy_->id(); diff --git a/libweaved/command.h b/libweaved/command.h index 34753fe..f68b150 100644 --- a/libweaved/command.h +++ b/libweaved/command.h @@ -27,7 +27,7 @@ namespace com { namespace android { namespace Weave { -class CommandProxy; +class CommandProxyInterface; } // namespace Weave } // namespace android } // namespace com @@ -103,11 +103,11 @@ class LIBWEAVED_EXPORT Command final { bool Cancel(brillo::ErrorPtr* error); protected: - Command(com::android::Weave::CommandProxy* proxy); + Command(com::android::Weave::CommandProxyInterface* proxy); private: friend class Device; - com::android::Weave::CommandProxy* proxy_{nullptr}; + com::android::Weave::CommandProxyInterface* proxy_{nullptr}; DISALLOW_COPY_AND_ASSIGN(Command); }; diff --git a/libweaved/device.cc b/libweaved/device.cc index 02bacb6..0da4763 100644 --- a/libweaved/device.cc +++ b/libweaved/device.cc @@ -18,8 +18,8 @@ #include "buffet/dbus-proxies.h" -using com::android::Weave::CommandProxy; -using com::android::Weave::ManagerProxy; +using com::android::Weave::CommandProxyInterface; +using com::android::Weave::ManagerProxyInterface; namespace weaved { @@ -76,7 +76,7 @@ bool Device::SetStateProperty(const std::string& name, return SetStateProperties(brillo::VariantDictionary{{name, value}}, error); } -void Device::OnCommandAdded(CommandProxy* proxy) { +void Device::OnCommandAdded(CommandProxyInterface* proxy) { std::shared_ptr<Command>& command = command_map_[proxy]; auto iter = command_handler_map_.find(proxy->name()); if (iter == command_handler_map_.end()) @@ -93,7 +93,7 @@ void Device::OnCommandRemoved(const dbus::ObjectPath& object_path) { command_map_.erase(proxy); } -void Device::OnManagerAdded(ManagerProxy* proxy) { +void Device::OnManagerAdded(ManagerProxyInterface* proxy) { proxy_ = proxy; state_required_callback_.Run(); } diff --git a/libweaved/device.h b/libweaved/device.h index 7ce52c4..c1c5dd5 100644 --- a/libweaved/device.h +++ b/libweaved/device.h @@ -34,8 +34,8 @@ namespace com { namespace android { namespace Weave { -class CommandProxy; -class ManagerProxy; +class CommandProxyInterface; +class ManagerProxyInterface; class ObjectManagerProxy; } // namespace Weave } // namespace android @@ -81,17 +81,17 @@ class LIBWEAVED_EXPORT Device final { Device(const scoped_refptr<dbus::Bus>& bus, const base::Closure& state_required_callback); - void OnCommandAdded(com::android::Weave::CommandProxy* proxy); + void OnCommandAdded(com::android::Weave::CommandProxyInterface* proxy); void OnCommandRemoved(const dbus::ObjectPath& object_path); - void OnManagerAdded(com::android::Weave::ManagerProxy* proxy); + void OnManagerAdded(com::android::Weave::ManagerProxyInterface* proxy); void OnManagerRemoved(const dbus::ObjectPath& object_path); std::unique_ptr<com::android::Weave::ObjectManagerProxy> weaved_object_mgr_; - com::android::Weave::ManagerProxy* proxy_{nullptr}; + com::android::Weave::ManagerProxyInterface* proxy_{nullptr}; - using CommandMap = - std::map<com::android::Weave::CommandProxy*, std::shared_ptr<Command>>; + using CommandMap = std::map<com::android::Weave::CommandProxyInterface*, + std::shared_ptr<Command>>; CommandMap command_map_; std::map<std::string, CommandHandlerCallback> command_handler_map_; scoped_refptr<dbus::Bus> bus_; |