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

Side by Side Diff: device/bluetooth/bluetooth_audio_sink.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 22 matching lines...) Expand all
33 STATE_INVALID, // BluetoothAdapter not presented or not powered. 33 STATE_INVALID, // BluetoothAdapter not presented or not powered.
34 STATE_DISCONNECTED, // Not connected. 34 STATE_DISCONNECTED, // Not connected.
35 STATE_IDLE, // Connected but not streaming. 35 STATE_IDLE, // Connected but not streaming.
36 STATE_PENDING, // Connected, streaming but not acquired. 36 STATE_PENDING, // Connected, streaming but not acquired.
37 STATE_ACTIVE, // Connected, streaming and acquired. 37 STATE_ACTIVE, // Connected, streaming and acquired.
38 }; 38 };
39 39
40 // Possible types of error raised by Audio Sink object. 40 // Possible types of error raised by Audio Sink object.
41 enum ErrorCode { 41 enum ErrorCode {
42 ERROR_UNSUPPORTED_PLATFORM, // A2DP sink not supported on current platform. 42 ERROR_UNSUPPORTED_PLATFORM, // A2DP sink not supported on current platform.
43 ERROR_INVALID_ADAPTER, // BluetoothAdapter not presented/powered. 43 ERROR_INVALID_ADAPTER, // BluetoothAdapter not presented/powered.
44 ERROR_NOT_REGISTERED, // BluetoothAudioSink not registered. 44 ERROR_NOT_REGISTERED, // BluetoothAudioSink not registered.
45 }; 45 };
46 46
47 // Options to configure an A2DP audio sink. 47 // Options to configure an A2DP audio sink.
48 struct Options { 48 struct Options {
49 Options(); 49 Options();
50 ~Options(); 50 ~Options();
51 51
52 uint8_t codec; 52 uint8_t codec;
53 std::vector<uint8_t> capabilities; 53 std::vector<uint8_t> capabilities;
54 }; 54 };
(...skipping 21 matching lines...) Expand all
76 // the streaming. This method should associate with BluetoothAudioSink 76 // the streaming. This method should associate with BluetoothAudioSink
77 // specific IOBuffer wrapping fd, read_mtu and write_mtu. 77 // specific IOBuffer wrapping fd, read_mtu and write_mtu.
78 }; 78 };
79 79
80 // The ErrorCallback is used for the methods that can fail in which case it 80 // The ErrorCallback is used for the methods that can fail in which case it
81 // is called. 81 // is called.
82 typedef base::Callback<void(ErrorCode)> ErrorCallback; 82 typedef base::Callback<void(ErrorCode)> ErrorCallback;
83 83
84 // Unregisters the audio sink. An audio sink will unregister itself 84 // Unregisters the audio sink. An audio sink will unregister itself
85 // automatically in its destructor, but calling Unregister is recommended, 85 // automatically in its destructor, but calling Unregister is recommended,
86 // since user applications can be notified of an error returned by the call. 86 // since user applications can be notified of an error returned by the call.
Ben Chan 2015/02/19 00:21:45 is this comment still valid? "since user applicat
Miao 2015/02/23 21:04:24 Recovered the error callback, so the the comment s
87 virtual void Unregister(const base::Closure& callback, 87 virtual void Unregister(const base::Closure& callback) = 0;
armansito 2015/02/19 00:37:46 Why did you remove the error callback? Also, witho
Miao 2015/02/23 21:04:24 Done.
88 const ErrorCallback& error_callback) = 0;
89 88
90 // Adds and removes an observer for events on the BluetoothAudioSink object. 89 // Adds and removes an observer for events on the BluetoothAudioSink object.
91 // If monitoring multiple audio sinks, check the |audio_sink| parameter of 90 // If monitoring multiple audio sinks, check the |audio_sink| parameter of
92 // observer methods to determine which audio sink is issuing the event. 91 // observer methods to determine which audio sink is issuing the event.
93 virtual void AddObserver(Observer* observer) = 0; 92 virtual void AddObserver(Observer* observer) = 0;
94 virtual void RemoveObserver(Observer* observer) = 0; 93 virtual void RemoveObserver(Observer* observer) = 0;
95 94
96 // Getters for state and volume. 95 // Getters for state and volume.
97 virtual State GetState() const = 0; 96 virtual State GetState() const = 0;
98 virtual uint16_t GetVolume() const = 0; 97 virtual uint16_t GetVolume() const = 0;
99 98
100 protected: 99 protected:
101 friend class base::RefCounted<BluetoothAudioSink>; 100 friend class base::RefCounted<BluetoothAudioSink>;
102 BluetoothAudioSink(); 101 BluetoothAudioSink();
103 102
104 // The destructor invokes Unregister() to ensure the audio sink will be 103 // The destructor invokes Unregister() to ensure the audio sink will be
105 // unregistered even if the user applications fail to do so. 104 // unregistered even if the user applications fail to do so.
106 virtual ~BluetoothAudioSink(); 105 virtual ~BluetoothAudioSink();
107 106
108 private: 107 private:
109 DISALLOW_COPY_AND_ASSIGN(BluetoothAudioSink); 108 DISALLOW_COPY_AND_ASSIGN(BluetoothAudioSink);
110 }; 109 };
111 110
112 } // namespace device 111 } // namespace device
113 112
114 #endif // DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_H_ 113 #endif // DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698