1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chromeos/dbus/fake_audio_dsp_client.h"
8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h"
16 void OnVoidDBusMethod(const VoidDBusMethodCallback
& callback
) {
17 callback
.Run(DBUS_METHOD_CALL_SUCCESS
);
20 void OnBoolDBusMethod(const BoolDBusMethodCallback
& callback
) {
21 callback
.Run(DBUS_METHOD_CALL_SUCCESS
, true);
24 void OnDoubleDBusMethod(
25 const AudioDspClient::DoubleDBusMethodCallback
& callback
) {
26 callback
.Run(DBUS_METHOD_CALL_SUCCESS
, 0.0);
29 void OnTwoStringDBusMethod(
30 const AudioDspClient::TwoStringDBusMethodCallback
& callback
) {
31 callback
.Run(DBUS_METHOD_CALL_SUCCESS
, std::string(), std::string());
34 void OnThreeStringDBusMethod(
35 const AudioDspClient::ThreeStringDBusMethodCallback
& callback
) {
36 callback
.Run(DBUS_METHOD_CALL_SUCCESS
, std::string(), std::string(),
40 } // anonymous namespace
42 FakeAudioDspClient::FakeAudioDspClient() {
45 FakeAudioDspClient::~FakeAudioDspClient() {
48 void FakeAudioDspClient::Init(dbus::Bus
* bus
) {
51 void FakeAudioDspClient::AddObserver(Observer
* observer
) {
54 void FakeAudioDspClient::RemoveObserver(Observer
* observer
) {
57 void FakeAudioDspClient::Initialize(const BoolDBusMethodCallback
& callback
) {
58 base::ThreadTaskRunnerHandle::Get()->PostTask(
59 FROM_HERE
, base::Bind(&OnBoolDBusMethod
, callback
));
62 void FakeAudioDspClient::SetStandbyMode(
64 const VoidDBusMethodCallback
& callback
) {
65 base::ThreadTaskRunnerHandle::Get()->PostTask(
66 FROM_HERE
, base::Bind(&OnVoidDBusMethod
, callback
));
69 void FakeAudioDspClient::SetNightMode(bool standby
,
70 const VoidDBusMethodCallback
& callback
) {
71 base::ThreadTaskRunnerHandle::Get()->PostTask(
72 FROM_HERE
, base::Bind(&OnVoidDBusMethod
, callback
));
75 void FakeAudioDspClient::GetNightMode(const BoolDBusMethodCallback
& callback
) {
76 base::ThreadTaskRunnerHandle::Get()->PostTask(
77 FROM_HERE
, base::Bind(&OnBoolDBusMethod
, callback
));
80 void FakeAudioDspClient::SetTreble(double db_fs
,
81 const VoidDBusMethodCallback
& callback
) {
82 base::ThreadTaskRunnerHandle::Get()->PostTask(
83 FROM_HERE
, base::Bind(&OnVoidDBusMethod
, callback
));
86 void FakeAudioDspClient::GetTreble(const DoubleDBusMethodCallback
& callback
) {
87 base::ThreadTaskRunnerHandle::Get()->PostTask(
88 FROM_HERE
, base::Bind(&OnDoubleDBusMethod
, callback
));
91 void FakeAudioDspClient::SetBass(double db_fs
,
92 const VoidDBusMethodCallback
& callback
) {
93 base::ThreadTaskRunnerHandle::Get()->PostTask(
94 FROM_HERE
, base::Bind(&OnVoidDBusMethod
, callback
));
97 void FakeAudioDspClient::GetBass(const DoubleDBusMethodCallback
& callback
) {
98 base::ThreadTaskRunnerHandle::Get()->PostTask(
99 FROM_HERE
, base::Bind(&OnDoubleDBusMethod
, callback
));
102 void FakeAudioDspClient::GetCapabilitiesOEM(
103 const ThreeStringDBusMethodCallback
& callback
) {
104 base::ThreadTaskRunnerHandle::Get()->PostTask(
105 FROM_HERE
, base::Bind(&OnThreeStringDBusMethod
, callback
));
108 void FakeAudioDspClient::SetCapabilitiesOEM(
110 const std::string
& speaker_capabilities
,
111 const std::string
& driver_capabilities
,
112 const VoidDBusMethodCallback
& callback
) {
113 base::ThreadTaskRunnerHandle::Get()->PostTask(
114 FROM_HERE
, base::Bind(&OnVoidDBusMethod
, callback
));
117 void FakeAudioDspClient::GetFilterConfigOEM(
119 const TwoStringDBusMethodCallback
& callback
) {
120 base::ThreadTaskRunnerHandle::Get()->PostTask(
121 FROM_HERE
, base::Bind(&OnTwoStringDBusMethod
, callback
));
124 void FakeAudioDspClient::SetFilterConfigOEM(
125 const std::string
& speaker_config
,
126 const std::string
& driver_config
,
127 const VoidDBusMethodCallback
& callback
) {
128 base::ThreadTaskRunnerHandle::Get()->PostTask(
129 FROM_HERE
, base::Bind(&OnVoidDBusMethod
, callback
));
132 void FakeAudioDspClient::SetSourceType(uint16 source_type
,
133 const VoidDBusMethodCallback
& callback
) {
134 base::ThreadTaskRunnerHandle::Get()->PostTask(
135 FROM_HERE
, base::Bind(&OnVoidDBusMethod
, callback
));
138 void FakeAudioDspClient::AmplifierVolumeChanged(
140 const VoidDBusMethodCallback
& callback
) {
141 base::ThreadTaskRunnerHandle::Get()->PostTask(
142 FROM_HERE
, base::Bind(&OnVoidDBusMethod
, callback
));
145 } // namespace chromeos