Chromium Code Reviews| Index: device/bluetooth/bluetooth_audio_sink_chromeos.h |
| diff --git a/device/bluetooth/bluetooth_audio_sink_chromeos.h b/device/bluetooth/bluetooth_audio_sink_chromeos.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3c97a73a14a63ed14146206d50537a40916928bb |
| --- /dev/null |
| +++ b/device/bluetooth/bluetooth_audio_sink_chromeos.h |
| @@ -0,0 +1,113 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_ |
| +#define DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_ |
| + |
| +#include <stdint.h> |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/observer_list.h" |
| +#include "chromeos/dbus/bluetooth_media_client.h" |
| +#include "chromeos/dbus/bluetooth_media_endpoint_service_provider.h" |
| +#include "chromeos/dbus/bluetooth_media_transport_client.h" |
| +#include "dbus/object_path.h" |
| +#include "device/bluetooth/bluetooth_adapter.h" |
| +#include "device/bluetooth/bluetooth_audio_sink.h" |
| +#include "device/bluetooth/bluetooth_export.h" |
| + |
| +namespace chromeos { |
| + |
| +class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkChromeOS |
| + : public device::BluetoothAudioSink, |
| + public device::BluetoothAdapter::Observer, |
| + public BluetoothMediaClient::Observer, |
| + public BluetoothMediaTransportClient::Observer, |
| + public BluetoothMediaEndpointServiceProvider::Delegate { |
| + public: |
| + // device::BluetoothAudioSink overrides. |
| + void AddObserver(BluetoothAudioSink::Observer* observer) override; |
| + void RemoveObserver(BluetoothAudioSink::Observer* observer) override; |
| + device::BluetoothAudioSink::State GetState() const override; |
| + uint16_t GetVolume() const override; |
| + |
| + // device::BluetoothAdapter::Observer overrides. |
| + void AdapterPresentChanged(device::BluetoothAdapter* adapter, |
| + bool present) override; |
| + void AdapterPoweredChanged(device::BluetoothAdapter* adapter, |
| + bool powered) override; |
| + |
| + // BluetoothMediaClient::Observer overrides. |
| + void MediaAdded(const dbus::ObjectPath& object_path) override; |
| + void MediaRemoved(const dbus::ObjectPath& object_path) override; |
| + |
| + // BluetoothMediaTransportClient::Observer overrides. |
| + void MediaTransportAdded(const dbus::ObjectPath& object_path) override; |
| + void MediaTransportRemoved(const dbus::ObjectPath& object_path) override; |
| + void MediaTransportPropertyChanged(const dbus::ObjectPath& object_path, |
| + const std::string& property_name) override; |
| + |
| + // BluetoothMediaEndpointServiceProvider::Delegate overrides. |
| + void SetConfiguration(const dbus::ObjectPath& transport_path, |
| + const dbus::MessageReader& properties) override; |
| + void SelectConfiguration( |
| + const std::vector<uint8_t>& capabilities, |
| + const SelectConfigurationCallback& callback) override; |
| + void ClearConfiguration(const dbus::ObjectPath& transport_path) override; |
| + void Release() override; |
| + |
| + 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
|
| + // Registers a BluetoothAudioSink. User applications can use |options| to |
| + // configure the audio sink. |callback| will be executed if the audio sink is |
| + // successfully registered, otherwise |error_callback| will be called. |
| + 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.
|
| + const device::BluetoothAudioSink::Options& options, |
| + 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.
|
| + const device::BluetoothAudioSink::ErrorCallback& error_callback); |
| + |
| + // Unregisters a BluetoothAudioSink. |callback| should handle |
| + // the clean-up after the audio sink is deleted successfully, otherwise |
| + // |error_callback| will be called. |
| + 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
|
| + const base::Closure& callback, |
| + const device::BluetoothAudioSink::ErrorCallback& error_callback); |
| + |
| + // Called when the state property of BluetoothMediaTransport has been updated. |
| + virtual void StateChanged(const dbus::ObjectPath& object_path, |
| + device::BluetoothAudioSink::State state); |
| + |
| + // Called when the volume property of BluetoothMediaTransport has been |
| + // updated. |
| + virtual void VolumeChanged(const dbus::ObjectPath& object_path, |
| + 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.
|
| + |
| + private: |
| + 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
|
| + |
| + 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
|
| + virtual ~BluetoothAudioSinkChromeOS(); |
|
Ben Chan
2014/12/09 15:28:37
~BluetoothAudioSinkChromeOS() override;
Miao
2014/12/10 04:07:20
Done.
|
| + |
| + // The connection state between the BluetoothAudioSinkChromeOS and the remote |
| + // device; |
|
Ben Chan
2014/12/09 15:28:38
nit: ;->.
Miao
2014/12/10 04:07:19
Done.
|
| + device::BluetoothAudioSink::State state_; |
| + |
| + // The volume control by the remote device during the streaming. |
| + uint16_t volume_; |
| + |
| + // 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.
|
| + dbus::ObjectPath media_path_; |
| + |
| + // Object path of the transport object being used. |
| + dbus::ObjectPath transport_path_; |
| + |
| + // List of observers interested in event notifications from us. |
| + ObserverList<BluetoothAudioSink::Observer> observers_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BluetoothAudioSinkChromeOS); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_CHROMEOS_H_ |