Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chromeos / dbus / audio_dsp_client.h
bloba1aa2c47237cd4ceca8cacac164e530521fe1900
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 #ifndef CHROMEOS_DBUS_AUDIO_DSP_CLIENT_H_
6 #define CHROMEOS_DBUS_AUDIO_DSP_CLIENT_H_
8 #include "base/basictypes.h"
9 #include "chromeos/chromeos_export.h"
10 #include "chromeos/dbus/dbus_client.h"
11 #include "chromeos/dbus/dbus_method_call_status.h"
13 namespace chromeos {
15 // A DBus client class for the org.chromium.AudioDsp service.
16 class CHROMEOS_EXPORT AudioDspClient : public DBusClient {
17 public:
18 // A callback to handle responses of methods returning a double value.
19 typedef base::Callback<void(DBusMethodCallStatus call_status, double result)>
20 DoubleDBusMethodCallback;
22 // A callback to handle responses of methods returning two string values.
23 typedef base::Callback<void(DBusMethodCallStatus call_status,
24 const std::string& result1,
25 const std::string& result2)>
26 TwoStringDBusMethodCallback;
28 // A callback to handle responses of methods returning three string values.
29 typedef base::Callback<void(DBusMethodCallStatus call_status,
30 const std::string& result1,
31 const std::string& result2,
32 const std::string& result3)>
33 ThreeStringDBusMethodCallback;
35 // Interface for observing DSP events from a DSP client.
36 class Observer {
37 public:
38 virtual ~Observer() {}
40 // Called when the Error signal is received.
41 virtual void OnError(int32 error_code) = 0;
44 ~AudioDspClient() override;
46 // Adds and removes observers for AUDIO_DSP events.
47 virtual void AddObserver(Observer* observer) = 0;
48 virtual void RemoveObserver(Observer* observer) = 0;
50 // Factory function; creates a new instance which is owned by the caller.
51 // For normal usage, access the singleton via DBusThreadManager::Get().
52 static AudioDspClient* Create();
54 // Calls Initialize method.
55 // |callback| will be called with a DBusMethodCallStatus indicating whether
56 // the DBus method call succeeded, and a bool that is the return value from
57 // the DBus method.
58 virtual void Initialize(const BoolDBusMethodCallback& callback) = 0;
60 // Calls SetStandbyMode method.
61 // |callback| will be called with a DBusMethodCallStatus indicating whether
62 // the DBus method call succeeded.
63 virtual void SetStandbyMode(bool standby,
64 const VoidDBusMethodCallback& callback) = 0;
66 // Calls SetNightMode method.
67 // |callback| will be called with a DBusMethodCallStatus indicating whether
68 // the DBus method call succeeded.
69 virtual void SetNightMode(bool night_mode,
70 const VoidDBusMethodCallback& callback) = 0;
72 // Calls GetNightMode method.
73 // |callback| will be called with a DBusMethodCallStatus indicating whether
74 // the DBus method call succeeded, and a bool that is the return value from
75 // the DBus method.
76 virtual void GetNightMode(const BoolDBusMethodCallback& callback) = 0;
78 // Calls SetTreble method.
79 // |callback| will be called with a DBusMethodCallStatus indicating whether
80 // the DBus method call succeeded.
81 virtual void SetTreble(double db_fs,
82 const VoidDBusMethodCallback& callback) = 0;
84 // Calls GetTreble method.
85 // |callback| will be called with a DBusMethodCallStatus indicating whether
86 // the DBus method call succeeded, and a double that is the return value from
87 // the DBus method.
88 virtual void GetTreble(const DoubleDBusMethodCallback& callback) = 0;
90 // Calls SetBass method.
91 // |callback| will be called with a DBusMethodCallStatus indicating whether
92 // the DBus method call succeeded.
93 virtual void SetBass(double db_fs,
94 const VoidDBusMethodCallback& callback) = 0;
96 // Calls SetBass method.
97 // |callback| will be called with a DBusMethodCallStatus indicating whether
98 // the DBus method call succeeded, and a double that is the return value from
99 // the DBus method.
100 virtual void GetBass(const DoubleDBusMethodCallback& callback) = 0;
102 // Calls GetCapabilitiesOEM method.
103 // |callback| will be called with a DBusMethodCallStatus indicating whether
104 // the DBus method call succeeded, and three std::strings that constitute
105 // the return value from the DBus method.
106 virtual void GetCapabilitiesOEM(
107 const ThreeStringDBusMethodCallback& callback) = 0;
109 // Calls SetCapabilitiesOEM method.
110 // |callback| will be called with a DBusMethodCallStatus indicating whether
111 // the DBus method call succeeded.
112 virtual void SetCapabilitiesOEM(uint32 speaker_id,
113 const std::string& speaker_capabilities,
114 const std::string& driver_capabilities,
115 const VoidDBusMethodCallback& callback) = 0;
117 // Calls GetFilterConfigOEM method.
118 // |callback| will be called with a DBusMethodCallStatus indicating whether
119 // the DBus method call succeeded, and two std::strings that constitute
120 // the return value from the DBus method.
121 virtual void GetFilterConfigOEM(
122 uint32 speaker_id,
123 const TwoStringDBusMethodCallback& callback) = 0;
125 // Calls SetFilterConfigOEM method.
126 // |callback| will be called with a DBusMethodCallStatus indicating whether
127 // the DBus method call succeeded.
128 virtual void SetFilterConfigOEM(const std::string& speaker_config,
129 const std::string& driver_config,
130 const VoidDBusMethodCallback& callback) = 0;
132 // Calls SetSourceType method.
133 // |callback| will be called with a DBusMethodCallStatus indicating whether
134 // the DBus method call succeeded.
135 virtual void SetSourceType(uint16 source_type,
136 const VoidDBusMethodCallback& callback) = 0;
138 // Calls AmplifierVolumeChanged method.
139 // |callback| will be called with a DBusMethodCallStatus indicating whether
140 // the DBus method call succeeded.
141 virtual void AmplifierVolumeChanged(
142 double db_spl,
143 const VoidDBusMethodCallback& callback) = 0;
145 protected:
146 // Create() should be used instead.
147 AudioDspClient();
149 private:
150 DISALLOW_COPY_AND_ASSIGN(AudioDspClient);
153 } // namespace chromeos
155 #endif // CHROMEOS_DBUS_AUDIO_DSP_CLIENT_H_