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

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: 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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);
101 114
102 // Reads from the file descriptor acquired via Media Transport object and 115 // Reads from the file descriptor acquired via Media Transport object and
103 // notify |observer_| while the audio data is available. 116 // notify |observer_| while the audio data is available.
104 void ReadFromFD(); 117 void ReadFromFD();
105 118
106 // Helper functions to clean up media, media transport and media endpoint. 119 // Helper functions to clean up media, media transport and media endpoint.
107 // Called when the |state_| changes to either STATE_INVALID or 120 // Called when the |state_| changes to either STATE_INVALID or
108 // STATE_DISCONNECTED. 121 // STATE_DISCONNECTED.
109 void ResetMedia(); 122 void ResetMedia();
110 void ResetTransport(); 123 void ResetTransport();
111 void ResetEndpoint(); 124 void ResetEndpoint();
112 125
113 // The connection state between the BluetoothAudioSinkChromeOS and the remote 126 // The connection state between the BluetoothAudioSinkChromeOS and the remote
114 // device. 127 // device.
115 device::BluetoothAudioSink::State state_; 128 device::BluetoothAudioSink::State state_;
116 129
117 // The volume control by the remote device during the streaming. 130 // The volume control by the remote device during the streaming. The valid
131 // range of volume is 0-127, and 128 is used to represent invalid volume.
118 uint16_t volume_; 132 uint16_t volume_;
119 133
120 // Read MTU of the file descriptor acquired via Media Transport object. 134 // Read MTU of the file descriptor acquired via Media Transport object.
121 uint16_t read_mtu_; 135 scoped_ptr<uint16_t> read_mtu_;
122 136
123 // Write MTU of the file descriptor acquired via Media Transport object. 137 // Write MTU of the file descriptor acquired via Media Transport object.
124 uint16_t write_mtu_; 138 scoped_ptr<uint16_t> write_mtu_;
125 139
126 // File descriptor acquired via Media Transport object. 140 // File descriptor acquired via Media Transport object.
127 dbus::FileDescriptor fd_; 141 dbus::FileDescriptor fd_;
128 142
129 // Object path of the media object being used. 143 // Object path of the media object being used.
130 dbus::ObjectPath media_path_; 144 dbus::ObjectPath media_path_;
131 145
132 // Object path of the transport object being used. 146 // Object path of the transport object being used.
133 dbus::ObjectPath transport_path_; 147 dbus::ObjectPath transport_path_;
134 148
(...skipping 18 matching lines...) Expand all
153 // Note: This should remain the last member so it'll be destroyed and 167 // Note: This should remain the last member so it'll be destroyed and
154 // invalidate its weak pointers before any other members are destroyed. 168 // invalidate its weak pointers before any other members are destroyed.
155 base::WeakPtrFactory<BluetoothAudioSinkChromeOS> weak_ptr_factory_; 169 base::WeakPtrFactory<BluetoothAudioSinkChromeOS> weak_ptr_factory_;
156 170
157 DISALLOW_COPY_AND_ASSIGN(BluetoothAudioSinkChromeOS); 171 DISALLOW_COPY_AND_ASSIGN(BluetoothAudioSinkChromeOS);
158 }; 172 };
159 173
160 } // namespace chromeos 174 } // namespace chromeos
161 175
162 #endif // DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_ 176 #endif // DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_audio_sink.cc ('k') | device/bluetooth/bluetooth_audio_sink_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698