| OLD | NEW |
| 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> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "device/bluetooth/bluetooth_export.h" |
| 15 | 16 |
| 16 namespace device { | 17 namespace device { |
| 17 | 18 |
| 18 // TODO(mcchou): Define a BluetoothAudioSink specific IOBuffer abstraction. | 19 // TODO(mcchou): Define a BluetoothAudioSink specific IOBuffer abstraction. |
| 19 | 20 |
| 20 // BluetoothAudioSink represents a local A2DP audio sink where a remote device | 21 // BluetoothAudioSink represents a local A2DP audio sink where a remote device |
| 21 // can stream audio data. Once a BluetoothAudioSink is successfully registered, | 22 // can stream audio data. Once a BluetoothAudioSink is successfully registered, |
| 22 // user applications can obtain a pointer to a BluetoothAudioSink object via | 23 // user applications can obtain a pointer to a BluetoothAudioSink object via |
| 23 // the interface provided by BluetoothAdapter. The validity of a | 24 // the interface provided by BluetoothAdapter. The validity of a |
| 24 // BluetoothAudioSink depends on whether BluetoothAdapter is present and whether | 25 // BluetoothAudioSink depends on whether BluetoothAdapter is present and whether |
| 25 // it is powered. | 26 // it is powered. |
| 26 class BluetoothAudioSink : public base::RefCounted<BluetoothAudioSink> { | 27 class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSink |
| 28 : public base::RefCounted<BluetoothAudioSink> { |
| 27 public: | 29 public: |
| 28 // Possible values indicating the connection states between the | 30 // Possible values indicating the connection states between the |
| 29 // BluetoothAudioSink and the remote device. | 31 // BluetoothAudioSink and the remote device. |
| 30 enum State { | 32 enum State { |
| 31 STATE_INVALID, // BluetoothAdapter not presented or not powered. | 33 STATE_INVALID, // BluetoothAdapter not presented or not powered. |
| 32 STATE_DISCONNECTED, // Not connected. | 34 STATE_DISCONNECTED, // Not connected. |
| 33 STATE_IDLE, // Connected but not streaming. | 35 STATE_IDLE, // Connected but not streaming. |
| 34 STATE_PENDING, // Connected, streaming but not acquired. | 36 STATE_PENDING, // Connected, streaming but not acquired. |
| 35 STATE_ACTIVE, // Connected, streaming and acquired. | 37 STATE_ACTIVE, // Connected, streaming and acquired. |
| 36 }; | 38 }; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 virtual void AddObserver(Observer* observer) = 0; | 93 virtual void AddObserver(Observer* observer) = 0; |
| 92 virtual void RemoveObserver(Observer* observer) = 0; | 94 virtual void RemoveObserver(Observer* observer) = 0; |
| 93 | 95 |
| 94 // Getters for state and volume. | 96 // Getters for state and volume. |
| 95 virtual State GetState() const = 0; | 97 virtual State GetState() const = 0; |
| 96 virtual uint16_t GetVolume() const = 0; | 98 virtual uint16_t GetVolume() const = 0; |
| 97 | 99 |
| 98 protected: | 100 protected: |
| 99 friend class base::RefCounted<BluetoothAudioSink>; | 101 friend class base::RefCounted<BluetoothAudioSink>; |
| 100 BluetoothAudioSink(); | 102 BluetoothAudioSink(); |
| 103 |
| 104 // The destructor invokes Unregister() to ensure the audio sink will be |
| 105 // unregistered even if the user applications fail to do so. |
| 101 virtual ~BluetoothAudioSink(); | 106 virtual ~BluetoothAudioSink(); |
| 102 | 107 |
| 103 private: | 108 private: |
| 104 DISALLOW_COPY_AND_ASSIGN(BluetoothAudioSink); | 109 DISALLOW_COPY_AND_ASSIGN(BluetoothAudioSink); |
| 105 }; | 110 }; |
| 106 | 111 |
| 107 } // namespace device | 112 } // namespace device |
| 108 | 113 |
| 109 #endif // DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_H_ | 114 #endif // DEVICE_BLUETOOTH_BLUETOOTH_AUDIO_SINK_H_ |
| OLD | NEW |