Cheney Ni | ad05f3e | 2018-11-08 16:41:02 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 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 | |
Cheney Ni | 74f321c5 | 2019-12-02 19:51:56 +0800 | [diff] [blame] | 19 | #include <vector> |
| 20 | |
Cheney Ni | ad05f3e | 2018-11-08 16:41:02 +0800 | [diff] [blame] | 21 | #include "audio_a2dp_hw/include/audio_a2dp_hw.h" |
| 22 | #include "common/message_loop_thread.h" |
| 23 | |
| 24 | namespace bluetooth { |
| 25 | namespace audio { |
| 26 | namespace a2dp { |
| 27 | |
Cheney Ni | 74f321c5 | 2019-12-02 19:51:56 +0800 | [diff] [blame] | 28 | bool update_codec_offloading_capabilities( |
| 29 | const std::vector<btav_a2dp_codec_config_t>& framework_preference); |
| 30 | |
Cheney Ni | ad05f3e | 2018-11-08 16:41:02 +0800 | [diff] [blame] | 31 | // Check if new bluetooth_audio is enabled |
| 32 | bool is_hal_2_0_enabled(); |
| 33 | |
Cheney Ni | 13a4af5 | 2019-12-11 18:42:28 +0800 | [diff] [blame] | 34 | // Check if new bluetooth_audio is running with offloading encoders |
| 35 | bool is_hal_2_0_offloading(); |
| 36 | |
Cheney Ni | ad05f3e | 2018-11-08 16:41:02 +0800 | [diff] [blame] | 37 | // Initialize BluetoothAudio HAL: openProvider |
| 38 | bool init(bluetooth::common::MessageLoopThread* message_loop); |
| 39 | |
| 40 | // Clean up BluetoothAudio HAL |
| 41 | void cleanup(); |
| 42 | |
| 43 | // Set up the codec into BluetoothAudio HAL |
| 44 | bool setup_codec(); |
| 45 | |
| 46 | // Send command to the BluetoothAudio HAL: StartSession, EndSession, |
| 47 | // StreamStarted, StreamSuspended |
| 48 | void start_session(); |
| 49 | void end_session(); |
| 50 | void ack_stream_started(const tA2DP_CTRL_ACK& status); |
| 51 | void ack_stream_suspended(const tA2DP_CTRL_ACK& status); |
| 52 | |
| 53 | // Read from the FMQ of BluetoothAudio HAL |
| 54 | size_t read(uint8_t* p_buf, uint32_t len); |
| 55 | |
| 56 | // Update A2DP delay report to BluetoothAudio HAL |
| 57 | void set_remote_delay(uint16_t delay_report); |
| 58 | |
| 59 | } // namespace a2dp |
| 60 | } // namespace audio |
| 61 | } // namespace bluetooth |