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

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

Issue 787743002: device/bluetooth: Add BluetoothAudioSinkChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_
7
8 #include <stdint.h>
9 #include <string>
10 #include <vector>
11
12 #include "base/observer_list.h"
13 #include "chromeos/dbus/bluetooth_media_client.h"
14 #include "chromeos/dbus/bluetooth_media_endpoint_service_provider.h"
15 #include "chromeos/dbus/bluetooth_media_transport_client.h"
16 #include "dbus/object_path.h"
17 #include "device/bluetooth/bluetooth_adapter.h"
18 #include "device/bluetooth/bluetooth_audio_sink.h"
19 #include "device/bluetooth/bluetooth_export.h"
20
21 namespace chromeos {
22
23 class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkChromeOS
24 : public device::BluetoothAudioSink,
25 public device::BluetoothAdapter::Observer,
26 public BluetoothMediaClient::Observer,
27 public BluetoothMediaTransportClient::Observer,
28 public BluetoothMediaEndpointServiceProvider::Delegate {
29 public:
30 // device::BluetoothAudioSink overrides.
31 void AddObserver(BluetoothAudioSink::Observer* observer) override;
32 void RemoveObserver(BluetoothAudioSink::Observer* observer) override;
33 device::BluetoothAudioSink::State GetState() const override;
34 uint16_t GetVolume() const override;
35
36 // device::BluetoothAdapter::Observer overrides.
37 void AdapterPresentChanged(device::BluetoothAdapter* adapter,
38 bool present) override;
39 void AdapterPoweredChanged(device::BluetoothAdapter* adapter,
40 bool powered) override;
41
42 // BluetoothMediaClient::Observer overrides.
43 void MediaAdded(const dbus::ObjectPath& object_path) override;
44 void MediaRemoved(const dbus::ObjectPath& object_path) override;
45
46 // BluetoothMediaTransportClient::Observer overrides.
47 void MediaTransportAdded(const dbus::ObjectPath& object_path) override;
48 void MediaTransportRemoved(const dbus::ObjectPath& object_path) override;
49 void MediaTransportPropertyChanged(const dbus::ObjectPath& object_path,
50 const std::string& property_name) override;
51
52 // BluetoothMediaEndpointServiceProvider::Delegate overrides.
53 void SetConfiguration(const dbus::ObjectPath& transport_path,
54 const dbus::MessageReader& properties) override;
55 void SelectConfiguration(
56 const std::vector<uint8_t>& capabilities,
57 const SelectConfigurationCallback& callback) override;
58 void ClearConfiguration(const dbus::ObjectPath& transport_path) override;
59 void Release() override;
60
61 protected:
armansito 2014/12/09 00:30:28 Do these need to be protected? I'd just make Regis
Miao 2014/12/10 04:07:19 Done. User applications should have no access to B
62 // Registers a BluetoothAudioSink. User applications can use |options| to
63 // configure the audio sink. |callback| will be executed if the audio sink is
64 // successfully registered, otherwise |error_callback| will be called.
65 virtual void Register(
Ben Chan 2014/12/09 15:28:37 these methods don't need to be virtual
Miao 2014/12/10 04:07:19 Done.
66 const device::BluetoothAudioSink::Options& options,
67 const device::BluetoothAudioSink::AudioSinkAcquiredCallback& callback,
armansito 2014/12/09 00:30:28 This probably doesn't need to use this callback. I
armansito 2014/12/09 13:30:18 The name of this callback is too verbose, I would
Miao 2014/12/10 04:07:19 Done.
Miao 2014/12/10 04:07:20 Added a TODO in BluetoothAudioChromeOS.
68 const device::BluetoothAudioSink::ErrorCallback& error_callback);
69
70 // Unregisters a BluetoothAudioSink. |callback| should handle
71 // the clean-up after the audio sink is deleted successfully, otherwise
72 // |error_callback| will be called.
73 virtual void Unregister(
armansito 2014/12/09 00:30:28 Will this be an override of BluetoothAudioSink::Un
Miao 2014/12/10 04:07:20 It's not an override of BluetoothAudioSink::Unregi
74 const base::Closure& callback,
75 const device::BluetoothAudioSink::ErrorCallback& error_callback);
76
77 // Called when the state property of BluetoothMediaTransport has been updated.
78 virtual void StateChanged(const dbus::ObjectPath& object_path,
79 device::BluetoothAudioSink::State state);
80
81 // Called when the volume property of BluetoothMediaTransport has been
82 // updated.
83 virtual void VolumeChanged(const dbus::ObjectPath& object_path,
84 uint16_t volume);
armansito 2014/12/09 00:30:28 Make these two methods private (StateChanged & Vol
Miao 2014/12/10 04:07:19 Done.
85
86 private:
87 friend class BluetoothAdapterChromeOS;
armansito 2014/12/09 00:30:28 Is the friendship necessary here? You could probab
Miao 2014/12/10 04:07:20 Removed the friendship and made constructor public
88
89 BluetoothAudioSinkChromeOS();
armansito 2014/12/09 00:31:20 The constructor should probably take in a pointer
Miao 2014/12/10 04:07:19 Done. The original idea is that BluetoothAdapterCh
90 virtual ~BluetoothAudioSinkChromeOS();
Ben Chan 2014/12/09 15:28:37 ~BluetoothAudioSinkChromeOS() override;
Miao 2014/12/10 04:07:20 Done.
91
92 // The connection state between the BluetoothAudioSinkChromeOS and the remote
93 // device;
Ben Chan 2014/12/09 15:28:38 nit: ;->.
Miao 2014/12/10 04:07:19 Done.
94 device::BluetoothAudioSink::State state_;
95
96 // The volume control by the remote device during the streaming.
97 uint16_t volume_;
98
99 // Object Path of the media object being used.
Ben Chan 2014/12/09 15:28:38 nit: Path -> path
Miao 2014/12/10 04:07:19 Done.
100 dbus::ObjectPath media_path_;
101
102 // Object path of the transport object being used.
103 dbus::ObjectPath transport_path_;
104
105 // List of observers interested in event notifications from us.
106 ObserverList<BluetoothAudioSink::Observer> observers_;
107
108 DISALLOW_COPY_AND_ASSIGN(BluetoothAudioSinkChromeOS);
109 };
110
111 } // namespace chromeos
112
113 #endif // DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698