OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_H_ |
6 #define CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_H_ | 6 #define CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "chromeos/chromeos_export.h" | 10 #include "chromeos/chromeos_export.h" |
| 11 #include "chromeos/dbus/audio_node.h" |
11 #include "chromeos/dbus/dbus_client_implementation_type.h" | 12 #include "chromeos/dbus/dbus_client_implementation_type.h" |
12 #include "chromeos/dbus/volume_state.h" | 13 #include "chromeos/dbus/volume_state.h" |
13 | 14 |
14 namespace dbus { | 15 namespace dbus { |
15 class Bus; | 16 class Bus; |
16 } // namespace | 17 } // namespace |
17 | 18 |
18 namespace chromeos { | 19 namespace chromeos { |
19 | 20 |
20 // CrasAudioClient is used to communicate with the cras audio dbus interface. | 21 // CrasAudioClient is used to communicate with the cras audio dbus interface. |
(...skipping 17 matching lines...) Expand all Loading... |
38 | 39 |
39 virtual ~CrasAudioClient(); | 40 virtual ~CrasAudioClient(); |
40 | 41 |
41 // Adds and removes the observer. | 42 // Adds and removes the observer. |
42 virtual void AddObserver(Observer* observer) = 0; | 43 virtual void AddObserver(Observer* observer) = 0; |
43 virtual void RemoveObserver(Observer* observer) = 0; | 44 virtual void RemoveObserver(Observer* observer) = 0; |
44 // Returns true if this object has the given observer. | 45 // Returns true if this object has the given observer. |
45 virtual bool HasObserver(Observer* observer) = 0; | 46 virtual bool HasObserver(Observer* observer) = 0; |
46 | 47 |
47 // GetVolumeStateCallback is used for GetVolumeState method. It receives | 48 // GetVolumeStateCallback is used for GetVolumeState method. It receives |
48 // 1 argument, |volume_state| which containing both input and output volume | 49 // 2 arguments, |volume_state| which containing both input and output volume |
49 // state data. | 50 // state data, and |success| which indicates whether or not the request |
50 typedef base::Callback<void(const VolumeState&)> GetVolumeStateCallback; | 51 // succeeded. |
| 52 typedef base::Callback<void(const VolumeState&, bool)> GetVolumeStateCallback; |
| 53 |
| 54 // GetNodesCallback is used for GetNodes method. It receives 2 arguments, |
| 55 // |audio_nodes| which containing a list of audio nodes data and |
| 56 // |success| which indicates whether or not the request succeeded. |
| 57 typedef base::Callback<void(const AudioNodeList&, bool)> GetNodesCallback; |
51 | 58 |
52 // Gets the volume state, asynchronously. | 59 // Gets the volume state, asynchronously. |
53 virtual void GetVolumeState(const GetVolumeStateCallback& callback) = 0; | 60 virtual void GetVolumeState(const GetVolumeStateCallback& callback) = 0; |
54 | 61 |
| 62 // Gets an array of audio input and output nodes. |
| 63 virtual void GetNodes(const GetNodesCallback& callback) = 0; |
| 64 |
55 // Sets output volume to |volume|, in the range of [0, 100]. | 65 // Sets output volume to |volume|, in the range of [0, 100]. |
56 virtual void SetOutputVolume(int32 volume) = 0; | 66 virtual void SetOutputVolume(int32 volume) = 0; |
57 | 67 |
58 // Sets output mute state to |mute_on| value. | 68 // Sets output mute state to |mute_on| value. |
59 virtual void SetOutputMute(bool mute_on) = 0; | 69 virtual void SetOutputMute(bool mute_on) = 0; |
60 | 70 |
61 // Sets input gain to |input_gain|. |input_gain| is specified in dBFS * 100. | 71 // Sets input gain to |input_gain|. |input_gain| is specified in dBFS * 100. |
62 virtual void SetInputGain(int32 input_gain) = 0; | 72 virtual void SetInputGain(int32 input_gain) = 0; |
63 | 73 |
64 // Sets input mute state to |mute_on| value. | 74 // Sets input mute state to |mute_on| value. |
(...skipping 14 matching lines...) Expand all Loading... |
79 CrasAudioClient(); | 89 CrasAudioClient(); |
80 | 90 |
81 private: | 91 private: |
82 | 92 |
83 DISALLOW_COPY_AND_ASSIGN(CrasAudioClient); | 93 DISALLOW_COPY_AND_ASSIGN(CrasAudioClient); |
84 }; | 94 }; |
85 | 95 |
86 } // namespace chromeos | 96 } // namespace chromeos |
87 | 97 |
88 #endif // CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_H_ | 98 #endif // CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_H_ |
OLD | NEW |