• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 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 <vector>
20 
21 #include "a2dp_sbc_constants.h"
22 #include "audio_a2dp_hw/include/audio_a2dp_hw.h"
23 #include "btif_a2dp_source.h"
24 #include "btif_av.h"
25 #include "btif_av_co.h"
26 #include "btif_hf.h"
27 #include "common/message_loop_thread.h"
28 #include "osi/include/log.h"
29 #include "osi/include/properties.h"
30 #include "types/raw_address.h"
31 
32 namespace bluetooth {
33 namespace audio {
34 namespace aidl {
35 namespace a2dp {
36 
37 bool update_codec_offloading_capabilities(
38     const std::vector<btav_a2dp_codec_config_t>& framework_preference);
39 
40 /***
41  * Check if new bluetooth_audio is enabled
42  ***/
43 bool is_hal_enabled();
44 
45 /***
46  * Check if new bluetooth_audio is running with offloading encoders
47  ***/
48 bool is_hal_offloading();
49 
50 /***
51  * Initialize BluetoothAudio HAL: openProvider
52  ***/
53 bool init(bluetooth::common::MessageLoopThread* message_loop);
54 
55 /***
56  * Clean up BluetoothAudio HAL
57  ***/
58 void cleanup();
59 
60 /***
61  * Set up the codec into BluetoothAudio HAL
62  ***/
63 bool setup_codec();
64 
65 /***
66  * Send command to the BluetoothAudio HAL: StartSession, EndSession,
67  * StreamStarted, StreamSuspended
68  ***/
69 void start_session();
70 void end_session();
71 void ack_stream_started(const tA2DP_CTRL_ACK& status);
72 void ack_stream_suspended(const tA2DP_CTRL_ACK& status);
73 
74 /***
75  * Read from the FMQ of BluetoothAudio HAL
76  ***/
77 size_t read(uint8_t* p_buf, uint32_t len);
78 
79 /***
80  * Update A2DP delay report to BluetoothAudio HAL
81  ***/
82 void set_remote_delay(uint16_t delay_report);
83 
84 /***
85  * Set low latency buffer mode allowed or disallowed
86  ***/
87 void set_low_latency_mode_allowed(bool allowed);
88 }  // namespace a2dp
89 }  // namespace aidl
90 }  // namespace audio
91 }  // namespace bluetooth
92