Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
|
armansito
2015/01/07 01:13:34
nit: 2015 now.
Miao
2015/01/17 02:02:59
Done.
| |
| 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_adapter_chromeos.h" | |
| 19 #include "device/bluetooth/bluetooth_audio_sink.h" | |
| 20 #include "device/bluetooth/bluetooth_export.h" | |
| 21 | |
| 22 namespace chromeos { | |
| 23 | |
| 24 class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkChromeOS | |
| 25 : public device::BluetoothAudioSink, | |
| 26 public device::BluetoothAdapter::Observer, | |
| 27 public BluetoothMediaClient::Observer, | |
| 28 public BluetoothMediaTransportClient::Observer, | |
| 29 public BluetoothMediaEndpointServiceProvider::Delegate { | |
| 30 public: | |
| 31 explicit BluetoothAudioSinkChromeOS(BluetoothAdapterChromeOS* adapter); | |
| 32 | |
| 33 // device::BluetoothAudioSink overrides. | |
| 34 void AddObserver(BluetoothAudioSink::Observer* observer) override; | |
| 35 void RemoveObserver(BluetoothAudioSink::Observer* observer) override; | |
| 36 device::BluetoothAudioSink::State GetState() const override; | |
| 37 uint16_t GetVolume() const override; | |
| 38 | |
| 39 // device::BluetoothAdapter::Observer overrides. | |
| 40 void AdapterPresentChanged(device::BluetoothAdapter* adapter, | |
| 41 bool present) override; | |
| 42 void AdapterPoweredChanged(device::BluetoothAdapter* adapter, | |
| 43 bool powered) override; | |
| 44 | |
| 45 // BluetoothMediaClient::Observer overrides. | |
| 46 void MediaAdded(const dbus::ObjectPath& object_path) override; | |
| 47 void MediaRemoved(const dbus::ObjectPath& object_path) override; | |
| 48 | |
| 49 // BluetoothMediaTransportClient::Observer overrides. | |
| 50 void MediaTransportAdded(const dbus::ObjectPath& object_path) override; | |
| 51 void MediaTransportRemoved(const dbus::ObjectPath& object_path) override; | |
| 52 void MediaTransportPropertyChanged(const dbus::ObjectPath& object_path, | |
| 53 const std::string& property_name) override; | |
| 54 | |
| 55 // BluetoothMediaEndpointServiceProvider::Delegate overrides. | |
| 56 void SetConfiguration(const dbus::ObjectPath& transport_path, | |
| 57 const dbus::MessageReader& properties) override; | |
| 58 void SelectConfiguration( | |
| 59 const std::vector<uint8_t>& capabilities, | |
| 60 const SelectConfigurationCallback& callback) override; | |
| 61 void ClearConfiguration(const dbus::ObjectPath& transport_path) override; | |
| 62 void Release() override; | |
| 63 | |
| 64 // Registers a BluetoothAudioSink. User applications can use |options| to | |
| 65 // configure the audio sink. |callback| will be executed if the audio sink is | |
| 66 // successfully registered, otherwise |error_callback| will be called. | |
| 67 virtual void Register( | |
| 68 const device::BluetoothAudioSink::Options& options, | |
| 69 const base::Closure& callback, | |
| 70 const device::BluetoothAudioSink::ErrorCallback& error_callback); | |
| 71 | |
| 72 // Unregisters a BluetoothAudioSink. |callback| should handle | |
| 73 // the clean-up after the audio sink is deleted successfully, otherwise | |
| 74 // |error_callback| will be called. | |
| 75 virtual void Unregister( | |
| 76 const base::Closure& callback, | |
| 77 const device::BluetoothAudioSink::ErrorCallback& error_callback); | |
|
armansito
2014/12/16 02:01:41
This will need to be "override"
Miao
2015/01/17 02:02:59
Done.
| |
| 78 | |
| 79 private: | |
| 80 ~BluetoothAudioSinkChromeOS() override; | |
| 81 | |
| 82 // Called when the state property of BluetoothMediaTransport has been updated. | |
| 83 void StateChanged(device::BluetoothAudioSink::State state); | |
| 84 | |
| 85 // Called when the volume property of BluetoothMediaTransport has been | |
| 86 // updated. | |
| 87 void VolumeChanged(uint16_t volume); | |
| 88 | |
| 89 // The connection state between the BluetoothAudioSinkChromeOS and the remote | |
| 90 // device. | |
| 91 device::BluetoothAudioSink::State state_; | |
| 92 | |
| 93 // The volume control by the remote device during the streaming. | |
| 94 uint16_t volume_; | |
| 95 | |
| 96 // Object path of the media object being used. | |
| 97 dbus::ObjectPath media_path_; | |
| 98 | |
| 99 // Object path of the transport object being used. | |
| 100 dbus::ObjectPath transport_path_; | |
| 101 | |
| 102 // BT adapter which the audio sink binds to. | |
| 103 BluetoothAdapterChromeOS* adapter_; | |
| 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_ | |
| OLD | NEW |