From 790c5ee090ba020ff433a86fb2133b7a4272b8fc Mon Sep 17 00:00:00 2001
From: Alex Vakulenko <avakulenko@google.com>
Date: Tue, 8 Dec 2015 17:14:20 -0800
Subject: [PATCH] ledflasher: 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: Id0fcec14824188753290b60006f8e80714533d27
---
 src/ledflasher/animation.cpp         | 7 ++++---
 src/ledflasher/animation.h           | 6 +++---
 src/ledflasher/animation_blink.cpp   | 2 +-
 src/ledflasher/animation_blink.h     | 2 +-
 src/ledflasher/animation_marquee.cpp | 2 +-
 src/ledflasher/animation_marquee.h   | 7 ++++---
 src/ledflasher/ledflasher.cpp        | 8 ++++----
 7 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/ledflasher/animation.cpp b/src/ledflasher/animation.cpp
index 0dfaad3..dbc891d 100644
--- a/src/ledflasher/animation.cpp
+++ b/src/ledflasher/animation.cpp
@@ -21,8 +21,9 @@
 #include <base/bind.h>
 #include <base/message_loop/message_loop.h>
 
-Animation::Animation(com::android::LEDService::ServiceProxy* service_proxy,
-                     const base::TimeDelta& step_duration)
+Animation::Animation(
+    com::android::LEDService::ServiceProxyInterface* service_proxy,
+    const base::TimeDelta& step_duration)
   : service_proxy_{service_proxy}, step_duration_{step_duration} {
 }
 
@@ -54,7 +55,7 @@ void Animation::SetAllLEDs(bool on) {
 }
 
 std::unique_ptr<Animation> Animation::Create(
-    com::android::LEDService::ServiceProxy* service_proxy,
+    com::android::LEDService::ServiceProxyInterface* service_proxy,
     const std::string& type,
     const base::TimeDelta& duration) {
   std::unique_ptr<Animation> animation;
diff --git a/src/ledflasher/animation.h b/src/ledflasher/animation.h
index 63cd209..6df53c1 100644
--- a/src/ledflasher/animation.h
+++ b/src/ledflasher/animation.h
@@ -27,7 +27,7 @@
 
 class Animation {
  public:
-  Animation(com::android::LEDService::ServiceProxy* service_proxy,
+  Animation(com::android::LEDService::ServiceProxyInterface* service_proxy,
             const base::TimeDelta& step_duration);
   virtual ~Animation() = default;
 
@@ -35,7 +35,7 @@ class Animation {
   void Stop();
 
   static std::unique_ptr<Animation> Create(
-      com::android::LEDService::ServiceProxy* service_proxy,
+      com::android::LEDService::ServiceProxyInterface* service_proxy,
       const std::string& type,
       const base::TimeDelta& duration);
 
@@ -49,7 +49,7 @@ class Animation {
   void SetAllLEDs(bool on);
 
  private:
-  com::android::LEDService::ServiceProxy* service_proxy_;
+  com::android::LEDService::ServiceProxyInterface* service_proxy_;
   base::TimeDelta step_duration_;
 
   base::WeakPtrFactory<Animation> weak_ptr_factory_{this};
diff --git a/src/ledflasher/animation_blink.cpp b/src/ledflasher/animation_blink.cpp
index af0a736..5bf0978 100644
--- a/src/ledflasher/animation_blink.cpp
+++ b/src/ledflasher/animation_blink.cpp
@@ -17,7 +17,7 @@
 #include "animation_blink.h"
 
 AnimationBlink::AnimationBlink(
-    com::android::LEDService::ServiceProxy* service_proxy,
+    com::android::LEDService::ServiceProxyInterface* service_proxy,
     const base::TimeDelta& duration) : Animation{service_proxy, duration / 2} {
 }
 
diff --git a/src/ledflasher/animation_blink.h b/src/ledflasher/animation_blink.h
index 1509f75..c7ee1b8 100644
--- a/src/ledflasher/animation_blink.h
+++ b/src/ledflasher/animation_blink.h
@@ -21,7 +21,7 @@
 
 class AnimationBlink : public Animation {
  public:
-  AnimationBlink(com::android::LEDService::ServiceProxy* service_proxy,
+  AnimationBlink(com::android::LEDService::ServiceProxyInterface* service_proxy,
                  const base::TimeDelta& duration);
 
  protected:
diff --git a/src/ledflasher/animation_marquee.cpp b/src/ledflasher/animation_marquee.cpp
index cfffe8d..b2ad1e1 100644
--- a/src/ledflasher/animation_marquee.cpp
+++ b/src/ledflasher/animation_marquee.cpp
@@ -17,7 +17,7 @@
 #include "animation_marquee.h"
 
 AnimationMarquee::AnimationMarquee(
-    com::android::LEDService::ServiceProxy* service_proxy,
+    com::android::LEDService::ServiceProxyInterface* service_proxy,
     const base::TimeDelta& duration,
     Direction direction)
   : Animation{service_proxy, duration / num_leds}, direction_{direction} {
diff --git a/src/ledflasher/animation_marquee.h b/src/ledflasher/animation_marquee.h
index ce49e7a..a31382b 100644
--- a/src/ledflasher/animation_marquee.h
+++ b/src/ledflasher/animation_marquee.h
@@ -23,9 +23,10 @@ class AnimationMarquee : public Animation {
  public:
   enum class Direction {Left, Right};
 
-  AnimationMarquee(com::android::LEDService::ServiceProxy* service_proxy,
-                   const base::TimeDelta& duration,
-                   Direction direction);
+  AnimationMarquee(
+      com::android::LEDService::ServiceProxyInterface* service_proxy,
+      const base::TimeDelta& duration,
+      Direction direction);
 
  protected:
   void DoAnimationStep() override;
diff --git a/src/ledflasher/ledflasher.cpp b/src/ledflasher/ledflasher.cpp
index 5859647..e9bfa3c 100644
--- a/src/ledflasher/ledflasher.cpp
+++ b/src/ledflasher/ledflasher.cpp
@@ -27,7 +27,7 @@
 #include "animation.h"
 #include "ledservice/dbus-proxies.h"
 
-using com::android::LEDService::ServiceProxy;
+using com::android::LEDService::ServiceProxyInterface;
 
 class Daemon final : public brillo::DBusDaemon {
  public:
@@ -37,7 +37,7 @@ class Daemon final : public brillo::DBusDaemon {
   int OnInit() override;
 
  private:
-  void OnLEDServiceConnected(ServiceProxy* service);
+  void OnLEDServiceConnected(ServiceProxyInterface* service);
   void OnLEDServiceDisconnected(const dbus::ObjectPath& object_path);
 
   // Particular command handlers for various commands.
@@ -58,7 +58,7 @@ class Daemon final : public brillo::DBusDaemon {
   std::string status_{"idle"};
 
   // LED service interface.
-  ServiceProxy* led_service_{nullptr};
+  ServiceProxyInterface* led_service_{nullptr};
 
   // Current animation;
   std::unique_ptr<Animation> animation_;
@@ -93,7 +93,7 @@ int Daemon::OnInit() {
   return EX_OK;
 }
 
-void Daemon::OnLEDServiceConnected(ServiceProxy* service) {
+void Daemon::OnLEDServiceConnected(ServiceProxyInterface* service) {
   led_service_ = service;
   UpdateDeviceState();
 }
-- 
GitLab