1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include "A2dpOffloadCodecFactory.h"
20 #include "BluetoothAudioProvider.h"
21 
22 namespace aidl {
23 namespace android {
24 namespace hardware {
25 namespace bluetooth {
26 namespace audio {
27 
28 class A2dpOffloadAudioProvider : public BluetoothAudioProvider {
29  public:
30   bool isValid(const SessionType& session_type) override;
31 
32   ndk::ScopedAStatus startSession(
33       const std::shared_ptr<IBluetoothAudioPort>& host_if,
34       const AudioConfiguration& audio_config,
35       const std::vector<LatencyMode>& latency_modes,
36       DataMQDesc* _aidl_return) override;
37 
38   ndk::ScopedAStatus parseA2dpConfiguration(
39       const CodecId& codec_id, const std::vector<uint8_t>& configuration,
40       CodecParameters* codec_parameters, A2dpStatus* _aidl_return) override;
41 
42   ndk::ScopedAStatus getA2dpConfiguration(
43       const std::vector<A2dpRemoteCapabilities>& remote_a2dp_capabilities,
44       const A2dpConfigurationHint& hint,
45       std::optional<audio::A2dpConfiguration>* _aidl_return) override;
46 
47  protected:
48   A2dpOffloadAudioProvider(const A2dpOffloadCodecFactory&);
49 
50  private:
51   const A2dpOffloadCodecFactory& codec_factory_;
52 
53   ndk::ScopedAStatus onSessionReady(DataMQDesc* _aidl_return) override;
54 };
55 
56 class A2dpOffloadEncodingAudioProvider : public A2dpOffloadAudioProvider {
57  public:
58   A2dpOffloadEncodingAudioProvider(const A2dpOffloadCodecFactory&);
59 };
60 
61 class A2dpOffloadDecodingAudioProvider : public A2dpOffloadAudioProvider {
62  public:
63   A2dpOffloadDecodingAudioProvider(const A2dpOffloadCodecFactory&);
64 };
65 
66 }  // namespace audio
67 }  // namespace bluetooth
68 }  // namespace hardware
69 }  // namespace android
70 }  // namespace aidl
71