| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // GetNodesCallback is used for GetNodes method. It receives 2 arguments, | 63 // GetNodesCallback is used for GetNodes method. It receives 2 arguments, |
| 64 // |audio_nodes| which containing a list of audio nodes data and | 64 // |audio_nodes| which containing a list of audio nodes data and |
| 65 // |success| which indicates whether or not the request succeeded. | 65 // |success| which indicates whether or not the request succeeded. |
| 66 typedef base::Callback<void(const AudioNodeList&, bool)> GetNodesCallback; | 66 typedef base::Callback<void(const AudioNodeList&, bool)> GetNodesCallback; |
| 67 | 67 |
| 68 // ErrorCallback is used for cras dbus method error response. It receives 2 | 68 // ErrorCallback is used for cras dbus method error response. It receives 2 |
| 69 // arguments, |error_name| indicates the dbus error name, and |error_message| | 69 // arguments, |error_name| indicates the dbus error name, and |error_message| |
| 70 // contains the detailed dbus error message. | 70 // contains the detailed dbus error message. |
| 71 typedef base::Callback<void(const std::string&, | 71 typedef base::Callback<void(const std::string&, |
| 72 const std::string&)> ErrorCallback; | 72 const std::string&)> ErrorCallback; |
| 73 // A callback for cras dbus method WaitForServiceToBeAvailable. |
| 74 typedef base::Callback<void(bool service_is_ready)> |
| 75 WaitForServiceToBeAvailableCallback; |
| 73 | 76 |
| 74 // Gets the volume state, asynchronously. | 77 // Gets the volume state, asynchronously. |
| 75 virtual void GetVolumeState(const GetVolumeStateCallback& callback) = 0; | 78 virtual void GetVolumeState(const GetVolumeStateCallback& callback) = 0; |
| 76 | 79 |
| 77 // Gets an array of audio input and output nodes. | 80 // Gets an array of audio input and output nodes. |
| 78 virtual void GetNodes(const GetNodesCallback& callback, | 81 virtual void GetNodes(const GetNodesCallback& callback, |
| 79 const ErrorCallback& error_callback) = 0; | 82 const ErrorCallback& error_callback) = 0; |
| 80 | 83 |
| 81 // Sets output volume of the given |node_id| to |volume|, in the rage of | 84 // Sets output volume of the given |node_id| to |volume|, in the rage of |
| 82 // [0, 100]. | 85 // [0, 100]. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // removing an active output node added by AddActiveOutputNode. | 121 // removing an active output node added by AddActiveOutputNode. |
| 119 virtual void RemoveActiveOutputNode(uint64_t node_id) = 0; | 122 virtual void RemoveActiveOutputNode(uint64_t node_id) = 0; |
| 120 | 123 |
| 121 // Swaps the left and right channel of the primary active output device. | 124 // Swaps the left and right channel of the primary active output device. |
| 122 // Swap the left and right channel if |swap| is true; otherwise, swap the left | 125 // Swap the left and right channel if |swap| is true; otherwise, swap the left |
| 123 // and right channel back to the normal mode. | 126 // and right channel back to the normal mode. |
| 124 // The dbus message will be dropped if this feature is not supported on the | 127 // The dbus message will be dropped if this feature is not supported on the |
| 125 // |node_id|. | 128 // |node_id|. |
| 126 virtual void SwapLeftRight(uint64_t node_id, bool swap) = 0; | 129 virtual void SwapLeftRight(uint64_t node_id, bool swap) = 0; |
| 127 | 130 |
| 131 // Runs the callback as soon as the service becomes available. |
| 132 virtual void WaitForServiceToBeAvailable( |
| 133 const WaitForServiceToBeAvailableCallback& callback) = 0; |
| 134 |
| 128 // Creates the instance. | 135 // Creates the instance. |
| 129 static CrasAudioClient* Create(); | 136 static CrasAudioClient* Create(); |
| 130 | 137 |
| 131 protected: | 138 protected: |
| 132 // Create() should be used instead. | 139 // Create() should be used instead. |
| 133 CrasAudioClient(); | 140 CrasAudioClient(); |
| 134 | 141 |
| 135 private: | 142 private: |
| 136 DISALLOW_COPY_AND_ASSIGN(CrasAudioClient); | 143 DISALLOW_COPY_AND_ASSIGN(CrasAudioClient); |
| 137 }; | 144 }; |
| 138 | 145 |
| 139 } // namespace chromeos | 146 } // namespace chromeos |
| 140 | 147 |
| 141 #endif // CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_H_ | 148 #endif // CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_H_ |
| OLD | NEW |