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" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // 2 arguments, |volume_state| which containing both input and output volume | 56 // 2 arguments, |volume_state| which containing both input and output volume |
57 // state data, and |success| which indicates whether or not the request | 57 // state data, and |success| which indicates whether or not the request |
58 // succeeded. | 58 // succeeded. |
59 typedef base::Callback<void(const VolumeState&, bool)> GetVolumeStateCallback; | 59 typedef base::Callback<void(const VolumeState&, bool)> GetVolumeStateCallback; |
60 | 60 |
61 // GetNodesCallback is used for GetNodes method. It receives 2 arguments, | 61 // GetNodesCallback is used for GetNodes method. It receives 2 arguments, |
62 // |audio_nodes| which containing a list of audio nodes data and | 62 // |audio_nodes| which containing a list of audio nodes data and |
63 // |success| which indicates whether or not the request succeeded. | 63 // |success| which indicates whether or not the request succeeded. |
64 typedef base::Callback<void(const AudioNodeList&, bool)> GetNodesCallback; | 64 typedef base::Callback<void(const AudioNodeList&, bool)> GetNodesCallback; |
65 | 65 |
| 66 // ErrorCallback is used for cras dbus method error response. It receives 2 |
| 67 // arguments, |error_name| indicates the dbus error name, and |error_message| |
| 68 // contains the detailed dbus error message. |
| 69 typedef base::Callback<void(const std::string&, |
| 70 const std::string&)> ErrorCallback; |
| 71 |
66 // Gets the volume state, asynchronously. | 72 // Gets the volume state, asynchronously. |
67 virtual void GetVolumeState(const GetVolumeStateCallback& callback) = 0; | 73 virtual void GetVolumeState(const GetVolumeStateCallback& callback) = 0; |
68 | 74 |
69 // Gets an array of audio input and output nodes. | 75 // Gets an array of audio input and output nodes. |
70 virtual void GetNodes(const GetNodesCallback& callback) = 0; | 76 virtual void GetNodes(const GetNodesCallback& callback, |
| 77 const ErrorCallback& error_callback) = 0; |
71 | 78 |
72 // Sets output volume of the given |node_id| to |volume|, in the rage of | 79 // Sets output volume of the given |node_id| to |volume|, in the rage of |
73 // [0, 100]. | 80 // [0, 100]. |
74 virtual void SetOutputNodeVolume(uint64 node_id, int32 volume) = 0; | 81 virtual void SetOutputNodeVolume(uint64 node_id, int32 volume) = 0; |
75 | 82 |
76 // Sets output mute from user action. | 83 // Sets output mute from user action. |
77 virtual void SetOutputUserMute(bool mute_on) = 0; | 84 virtual void SetOutputUserMute(bool mute_on) = 0; |
78 | 85 |
79 // Sets input gain of the given |node_id| to |gain|, in the range of | 86 // Sets input gain of the given |node_id| to |gain|, in the range of |
80 // [0, 100]. | 87 // [0, 100]. |
(...skipping 16 matching lines...) Expand all Loading... |
97 CrasAudioClient(); | 104 CrasAudioClient(); |
98 | 105 |
99 private: | 106 private: |
100 | 107 |
101 DISALLOW_COPY_AND_ASSIGN(CrasAudioClient); | 108 DISALLOW_COPY_AND_ASSIGN(CrasAudioClient); |
102 }; | 109 }; |
103 | 110 |
104 } // namespace chromeos | 111 } // namespace chromeos |
105 | 112 |
106 #endif // CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_H_ | 113 #endif // CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_H_ |
OLD | NEW |