Skip to content
Snippets Groups Projects
Commit 790c5ee0 authored by Alex Vakulenko's avatar Alex Vakulenko
Browse files

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
parent 5d22bb6c
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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};
......
......@@ -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} {
}
......
......@@ -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:
......
......@@ -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} {
......
......@@ -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;
......
......@@ -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();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment