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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 const base::Closure& callback, | 43 const base::Closure& callback, |
44 const device::BluetoothAudioSink::ErrorCallback& error_callback) override; | 44 const device::BluetoothAudioSink::ErrorCallback& error_callback) override; |
45 void AddObserver(BluetoothAudioSink::Observer* observer) override; | 45 void AddObserver(BluetoothAudioSink::Observer* observer) override; |
46 void RemoveObserver(BluetoothAudioSink::Observer* observer) override; | 46 void RemoveObserver(BluetoothAudioSink::Observer* observer) override; |
47 device::BluetoothAudioSink::State GetState() const override; | 47 device::BluetoothAudioSink::State GetState() const override; |
48 uint16_t GetVolume() const override; | 48 uint16_t GetVolume() const override; |
49 | 49 |
50 // device::BluetoothAdapter::Observer overrides. | 50 // device::BluetoothAdapter::Observer overrides. |
51 void AdapterPresentChanged(device::BluetoothAdapter* adapter, | 51 void AdapterPresentChanged(device::BluetoothAdapter* adapter, |
52 bool present) override; | 52 bool present) override; |
53 void AdapterPoweredChanged(device::BluetoothAdapter* adapter, | |
54 bool powered) override; | |
53 | 55 |
54 // BluetoothMediaClient::Observer overrides. | 56 // BluetoothMediaClient::Observer overrides. |
55 void MediaRemoved(const dbus::ObjectPath& object_path) override; | 57 void MediaRemoved(const dbus::ObjectPath& object_path) override; |
56 | 58 |
57 // BluetoothMediaTransportClient::Observer overrides. | 59 // BluetoothMediaTransportClient::Observer overrides. |
58 void MediaTransportRemoved(const dbus::ObjectPath& object_path) override; | 60 void MediaTransportRemoved(const dbus::ObjectPath& object_path) override; |
59 void MediaTransportPropertyChanged(const dbus::ObjectPath& object_path, | 61 void MediaTransportPropertyChanged(const dbus::ObjectPath& object_path, |
60 const std::string& property_name) override; | 62 const std::string& property_name) override; |
61 | 63 |
62 // BluetoothMediaEndpointServiceProvider::Delegate overrides. | 64 // BluetoothMediaEndpointServiceProvider::Delegate overrides. |
(...skipping 25 matching lines...) Expand all Loading... | |
88 void StateChanged(device::BluetoothAudioSink::State state); | 90 void StateChanged(device::BluetoothAudioSink::State state); |
89 | 91 |
90 // Called when the volume property of BluetoothMediaTransport has been | 92 // Called when the volume property of BluetoothMediaTransport has been |
91 // updated. | 93 // updated. |
92 void VolumeChanged(uint16_t volume); | 94 void VolumeChanged(uint16_t volume); |
93 | 95 |
94 // Called when the registration of Media Endpoint has succeeded. | 96 // Called when the registration of Media Endpoint has succeeded. |
95 void OnRegisterSucceeded(const base::Closure& callback); | 97 void OnRegisterSucceeded(const base::Closure& callback); |
96 | 98 |
97 // Called when the registration of Media Endpoint failed. | 99 // Called when the registration of Media Endpoint failed. |
98 void OnRegisterFailed(const BluetoothAudioSink::ErrorCallback& error_callback, | 100 void OnRegisterFailed( |
99 const std::string& error_name, | 101 const device::BluetoothAudioSink::ErrorCallback& error_callback, |
100 const std::string& error_message); | 102 const std::string& error_name, |
103 const std::string& error_message); | |
104 | |
105 // Called when the unregistration of Media Endpoint has succeeded. The | |
106 // clean-up of media, media transport and media endpoint will be handled here. | |
107 void OnUnregisterSucceeded(const base::Closure& callback); | |
108 | |
109 // Called when the unregistration of Media Endpoint failed. | |
110 void OnUnregisterFailed( | |
111 const device::BluetoothAudioSink::ErrorCallback& error_callback, | |
112 const std::string& error_name, | |
113 const std::string& error_message); | |
114 | |
115 // A dummy error callback for calling Unregister() in destructor. | |
116 void UnregisterErrorCallback( | |
117 device::BluetoothAudioSink::ErrorCode error_code); | |
armansito
2015/02/23 22:07:06
if this is a dummy then why does it need to be a c
Miao
2015/02/24 01:12:13
Moved it to anonymous namespace.
| |
101 | 118 |
102 // Reads from the file descriptor acquired via Media Transport object and | 119 // Reads from the file descriptor acquired via Media Transport object and |
103 // notify |observer_| while the audio data is available. | 120 // notify |observer_| while the audio data is available. |
104 void ReadFromFD(); | 121 void ReadFromFD(); |
105 | 122 |
106 // Helper functions to clean up media, media transport and media endpoint. | 123 // Helper functions to clean up media, media transport and media endpoint. |
107 // Called when the |state_| changes to either STATE_INVALID or | 124 // Called when the |state_| changes to either STATE_INVALID or |
108 // STATE_DISCONNECTED. | 125 // STATE_DISCONNECTED. |
109 void ResetMedia(); | 126 void ResetMedia(); |
110 void ResetTransport(); | 127 void ResetTransport(); |
111 void ResetEndpoint(); | 128 void ResetEndpoint(); |
112 | 129 |
113 // The connection state between the BluetoothAudioSinkChromeOS and the remote | 130 // The connection state between the BluetoothAudioSinkChromeOS and the remote |
114 // device. | 131 // device. |
115 device::BluetoothAudioSink::State state_; | 132 device::BluetoothAudioSink::State state_; |
116 | 133 |
117 // The volume control by the remote device during the streaming. | 134 // The volume control by the remote device during the streaming. |
118 uint16_t volume_; | 135 scoped_ptr<uint16_t> volume_; |
119 | 136 |
120 // Read MTU of the file descriptor acquired via Media Transport object. | 137 // Read MTU of the file descriptor acquired via Media Transport object. |
121 uint16_t read_mtu_; | 138 scoped_ptr<uint16_t> read_mtu_; |
122 | 139 |
123 // Write MTU of the file descriptor acquired via Media Transport object. | 140 // Write MTU of the file descriptor acquired via Media Transport object. |
124 uint16_t write_mtu_; | 141 scoped_ptr<uint16_t> write_mtu_; |
125 | 142 |
126 // File descriptor acquired via Media Transport object. | 143 // File descriptor acquired via Media Transport object. |
127 dbus::FileDescriptor fd_; | 144 dbus::FileDescriptor fd_; |
128 | 145 |
129 // Object path of the media object being used. | 146 // Object path of the media object being used. |
130 dbus::ObjectPath media_path_; | 147 dbus::ObjectPath media_path_; |
131 | 148 |
132 // Object path of the transport object being used. | 149 // Object path of the transport object being used. |
133 dbus::ObjectPath transport_path_; | 150 dbus::ObjectPath transport_path_; |
134 | 151 |
(...skipping 18 matching lines...) Expand all Loading... | |
153 // Note: This should remain the last member so it'll be destroyed and | 170 // Note: This should remain the last member so it'll be destroyed and |
154 // invalidate its weak pointers before any other members are destroyed. | 171 // invalidate its weak pointers before any other members are destroyed. |
155 base::WeakPtrFactory<BluetoothAudioSinkChromeOS> weak_ptr_factory_; | 172 base::WeakPtrFactory<BluetoothAudioSinkChromeOS> weak_ptr_factory_; |
156 | 173 |
157 DISALLOW_COPY_AND_ASSIGN(BluetoothAudioSinkChromeOS); | 174 DISALLOW_COPY_AND_ASSIGN(BluetoothAudioSinkChromeOS); |
158 }; | 175 }; |
159 | 176 |
160 } // namespace chromeos | 177 } // namespace chromeos |
161 | 178 |
162 #endif // DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_ | 179 #endif // DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_ |
OLD | NEW |