OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 21 matching lines...) Expand all Loading... | |
32 public BluetoothMediaTransportClient::Observer, | 32 public BluetoothMediaTransportClient::Observer, |
33 public BluetoothMediaEndpointServiceProvider::Delegate { | 33 public BluetoothMediaEndpointServiceProvider::Delegate { |
34 public: | 34 public: |
35 explicit BluetoothAudioSinkChromeOS( | 35 explicit BluetoothAudioSinkChromeOS( |
36 scoped_refptr<device::BluetoothAdapter> adapter); | 36 scoped_refptr<device::BluetoothAdapter> adapter); |
37 | 37 |
38 // device::BluetoothAudioSink overrides. | 38 // device::BluetoothAudioSink overrides. |
39 // Unregisters a BluetoothAudioSink. |callback| should handle | 39 // Unregisters a BluetoothAudioSink. |callback| should handle |
40 // the clean-up after the audio sink is deleted successfully, otherwise | 40 // the clean-up after the audio sink is deleted successfully, otherwise |
41 // |error_callback| will be called. | 41 // |error_callback| will be called. |
42 void Unregister( | 42 void Unregister(const base::Closure& callback) override; |
Ben Chan
2015/02/19 00:21:45
comment needs updated
Miao
2015/02/23 21:04:25
Recovered the error callback, so the the comment s
| |
43 const base::Closure& callback, | |
44 const device::BluetoothAudioSink::ErrorCallback& error_callback) override; | |
45 void AddObserver(BluetoothAudioSink::Observer* observer) override; | 43 void AddObserver(BluetoothAudioSink::Observer* observer) override; |
46 void RemoveObserver(BluetoothAudioSink::Observer* observer) override; | 44 void RemoveObserver(BluetoothAudioSink::Observer* observer) override; |
47 device::BluetoothAudioSink::State GetState() const override; | 45 device::BluetoothAudioSink::State GetState() const override; |
48 uint16_t GetVolume() const override; | 46 uint16_t GetVolume() const override; |
49 | 47 |
50 // device::BluetoothAdapter::Observer overrides. | 48 // device::BluetoothAdapter::Observer overrides. |
51 void AdapterPresentChanged(device::BluetoothAdapter* adapter, | 49 void AdapterPresentChanged(device::BluetoothAdapter* adapter, |
52 bool present) override; | 50 bool present) override; |
51 void AdapterPoweredChanged(device::BluetoothAdapter* adapter, | |
52 bool powered) override; | |
53 | 53 |
54 // BluetoothMediaClient::Observer overrides. | 54 // BluetoothMediaClient::Observer overrides. |
55 void MediaRemoved(const dbus::ObjectPath& object_path) override; | 55 void MediaRemoved(const dbus::ObjectPath& object_path) override; |
56 | 56 |
57 // BluetoothMediaTransportClient::Observer overrides. | 57 // BluetoothMediaTransportClient::Observer overrides. |
58 void MediaTransportRemoved(const dbus::ObjectPath& object_path) override; | 58 void MediaTransportRemoved(const dbus::ObjectPath& object_path) override; |
59 void MediaTransportPropertyChanged(const dbus::ObjectPath& object_path, | 59 void MediaTransportPropertyChanged(const dbus::ObjectPath& object_path, |
60 const std::string& property_name) override; | 60 const std::string& property_name) override; |
61 | 61 |
62 // BluetoothMediaEndpointServiceProvider::Delegate overrides. | 62 // BluetoothMediaEndpointServiceProvider::Delegate overrides. |
(...skipping 25 matching lines...) Expand all Loading... | |
88 void StateChanged(device::BluetoothAudioSink::State state); | 88 void StateChanged(device::BluetoothAudioSink::State state); |
89 | 89 |
90 // Called when the volume property of BluetoothMediaTransport has been | 90 // Called when the volume property of BluetoothMediaTransport has been |
91 // updated. | 91 // updated. |
92 void VolumeChanged(uint16_t volume); | 92 void VolumeChanged(uint16_t volume); |
93 | 93 |
94 // Called when the registration of Media Endpoint has succeeded. | 94 // Called when the registration of Media Endpoint has succeeded. |
95 void OnRegisterSucceeded(const base::Closure& callback); | 95 void OnRegisterSucceeded(const base::Closure& callback); |
96 | 96 |
97 // Called when the registration of Media Endpoint failed. | 97 // Called when the registration of Media Endpoint failed. |
98 void OnRegisterFailed(const BluetoothAudioSink::ErrorCallback& error_callback, | 98 void OnRegisterFailed( |
99 const std::string& error_name, | 99 const device::BluetoothAudioSink::ErrorCallback& error_callback, |
100 const std::string& error_message); | 100 const std::string& error_name, |
101 const std::string& error_message); | |
102 | |
103 // Called when the unregistration of Media Endpoint has succeeded. The | |
104 // clean-up of media, media transport and media endpoint will be handled here. | |
105 void OnUnregisterSucceeded(const base::Closure& callback); | |
106 | |
107 // Called when the unregistration of Media Endpoint failed. | |
108 void OnUnregisterFailed(const std::string& error_name, | |
109 const std::string& error_message); | |
101 | 110 |
102 // Reads from the file descriptor acquired via Media Transport object and | 111 // Reads from the file descriptor acquired via Media Transport object and |
103 // notify |observer_| while the audio data is available. | 112 // notify |observer_| while the audio data is available. |
104 void ReadFromFD(); | 113 void ReadFromFD(); |
105 | 114 |
106 // Helper functions to clean up media, media transport and media endpoint. | 115 // Helper functions to clean up media, media transport and media endpoint. |
107 // Called when the |state_| changes to either STATE_INVALID or | 116 // Called when the |state_| changes to either STATE_INVALID or |
108 // STATE_DISCONNECTED. | 117 // STATE_DISCONNECTED. |
109 void ResetMedia(); | 118 void ResetMedia(); |
110 void ResetTransport(); | 119 void ResetTransport(); |
111 void ResetEndpoint(); | 120 void ResetEndpoint(); |
112 | 121 |
113 // The connection state between the BluetoothAudioSinkChromeOS and the remote | 122 // The connection state between the BluetoothAudioSinkChromeOS and the remote |
114 // device. | 123 // device. |
115 device::BluetoothAudioSink::State state_; | 124 device::BluetoothAudioSink::State state_; |
116 | 125 |
117 // The volume control by the remote device during the streaming. | 126 // The volume control by the remote device during the streaming. |
118 uint16_t volume_; | 127 scoped_ptr<uint16_t> volume_; |
119 | 128 |
120 // Read MTU of the file descriptor acquired via Media Transport object. | 129 // Read MTU of the file descriptor acquired via Media Transport object. |
121 uint16_t read_mtu_; | 130 scoped_ptr<uint16_t> read_mtu_; |
122 | 131 |
123 // Write MTU of the file descriptor acquired via Media Transport object. | 132 // Write MTU of the file descriptor acquired via Media Transport object. |
124 uint16_t write_mtu_; | 133 scoped_ptr<uint16_t> write_mtu_; |
125 | 134 |
126 // File descriptor acquired via Media Transport object. | 135 // File descriptor acquired via Media Transport object. |
127 dbus::FileDescriptor fd_; | 136 dbus::FileDescriptor fd_; |
128 | 137 |
129 // Object path of the media object being used. | 138 // Object path of the media object being used. |
130 dbus::ObjectPath media_path_; | 139 dbus::ObjectPath media_path_; |
131 | 140 |
132 // Object path of the transport object being used. | 141 // Object path of the transport object being used. |
133 dbus::ObjectPath transport_path_; | 142 dbus::ObjectPath transport_path_; |
134 | 143 |
(...skipping 18 matching lines...) Expand all Loading... | |
153 // Note: This should remain the last member so it'll be destroyed and | 162 // Note: This should remain the last member so it'll be destroyed and |
154 // invalidate its weak pointers before any other members are destroyed. | 163 // invalidate its weak pointers before any other members are destroyed. |
155 base::WeakPtrFactory<BluetoothAudioSinkChromeOS> weak_ptr_factory_; | 164 base::WeakPtrFactory<BluetoothAudioSinkChromeOS> weak_ptr_factory_; |
156 | 165 |
157 DISALLOW_COPY_AND_ASSIGN(BluetoothAudioSinkChromeOS); | 166 DISALLOW_COPY_AND_ASSIGN(BluetoothAudioSinkChromeOS); |
158 }; | 167 }; |
159 | 168 |
160 } // namespace chromeos | 169 } // namespace chromeos |
161 | 170 |
162 #endif // DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_ | 171 #endif // DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_ |
OLD | NEW |