Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(967)

Side by Side Diff: device/bluetooth/bluetooth_audio_sink_chromeos.h

Issue 939753004: device/bluetooth: Implement Unregister() of BlueotoothAudioSinkChromeOS and disconnection-related c… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed volume_ back to uint16_t with a defined range. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 27 matching lines...) Expand all
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(
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
49 // Returns the current volume level of the audio sink. The possible volumes
50 // are 0-128, where 0-127 are valid volumes and 128 represents invalid volume.
armansito 2015/02/24 01:38:06 nit: I would define a constant for invalid volume
Miao 2015/02/24 05:11:39 Moved kInvalidVolume to BluetoothAudioSink and upd
48 uint16_t GetVolume() const override; 51 uint16_t GetVolume() const override;
49 52
50 // device::BluetoothAdapter::Observer overrides. 53 // device::BluetoothAdapter::Observer overrides.
51 void AdapterPresentChanged(device::BluetoothAdapter* adapter, 54 void AdapterPresentChanged(device::BluetoothAdapter* adapter,
52 bool present) override; 55 bool present) override;
56 void AdapterPoweredChanged(device::BluetoothAdapter* adapter,
57 bool powered) override;
53 58
54 // BluetoothMediaClient::Observer overrides. 59 // BluetoothMediaClient::Observer overrides.
55 void MediaRemoved(const dbus::ObjectPath& object_path) override; 60 void MediaRemoved(const dbus::ObjectPath& object_path) override;
56 61
57 // BluetoothMediaTransportClient::Observer overrides. 62 // BluetoothMediaTransportClient::Observer overrides.
58 void MediaTransportRemoved(const dbus::ObjectPath& object_path) override; 63 void MediaTransportRemoved(const dbus::ObjectPath& object_path) override;
59 void MediaTransportPropertyChanged(const dbus::ObjectPath& object_path, 64 void MediaTransportPropertyChanged(const dbus::ObjectPath& object_path,
60 const std::string& property_name) override; 65 const std::string& property_name) override;
61 66
62 // BluetoothMediaEndpointServiceProvider::Delegate overrides. 67 // BluetoothMediaEndpointServiceProvider::Delegate overrides.
(...skipping 25 matching lines...) Expand all
88 void StateChanged(device::BluetoothAudioSink::State state); 93 void StateChanged(device::BluetoothAudioSink::State state);
89 94
90 // Called when the volume property of BluetoothMediaTransport has been 95 // Called when the volume property of BluetoothMediaTransport has been
91 // updated. 96 // updated.
92 void VolumeChanged(uint16_t volume); 97 void VolumeChanged(uint16_t volume);
93 98
94 // Called when the registration of Media Endpoint has succeeded. 99 // Called when the registration of Media Endpoint has succeeded.
95 void OnRegisterSucceeded(const base::Closure& callback); 100 void OnRegisterSucceeded(const base::Closure& callback);
96 101
97 // Called when the registration of Media Endpoint failed. 102 // Called when the registration of Media Endpoint failed.
98 void OnRegisterFailed(const BluetoothAudioSink::ErrorCallback& error_callback, 103 void OnRegisterFailed(
99 const std::string& error_name, 104 const device::BluetoothAudioSink::ErrorCallback& error_callback,
100 const std::string& error_message); 105 const std::string& error_name,
106 const std::string& error_message);
107
108 // Called when the unregistration of Media Endpoint has succeeded. The
109 // clean-up of media, media transport and media endpoint will be handled here.
110 void OnUnregisterSucceeded(const base::Closure& callback);
111
112 // Called when the unregistration of Media Endpoint failed.
113 void OnUnregisterFailed(
114 const device::BluetoothAudioSink::ErrorCallback& error_callback,
115 const std::string& error_name,
116 const std::string& error_message);
101 117
102 // Reads from the file descriptor acquired via Media Transport object and 118 // Reads from the file descriptor acquired via Media Transport object and
103 // notify |observer_| while the audio data is available. 119 // notify |observer_| while the audio data is available.
104 void ReadFromFD(); 120 void ReadFromFD();
105 121
106 // Helper functions to clean up media, media transport and media endpoint. 122 // Helper functions to clean up media, media transport and media endpoint.
107 // Called when the |state_| changes to either STATE_INVALID or 123 // Called when the |state_| changes to either STATE_INVALID or
108 // STATE_DISCONNECTED. 124 // STATE_DISCONNECTED.
109 void ResetMedia(); 125 void ResetMedia();
110 void ResetTransport(); 126 void ResetTransport();
111 void ResetEndpoint(); 127 void ResetEndpoint();
112 128
113 // The connection state between the BluetoothAudioSinkChromeOS and the remote 129 // The connection state between the BluetoothAudioSinkChromeOS and the remote
114 // device. 130 // device.
115 device::BluetoothAudioSink::State state_; 131 device::BluetoothAudioSink::State state_;
116 132
117 // The volume control by the remote device during the streaming. 133 // The volume control by the remote device during the streaming. The valid
134 // range of volume is 0-127, and 128 is used to represent invalid volume.
118 uint16_t volume_; 135 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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698