/* * Copyright 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include #include "common/message_loop_thread.h" namespace bluetooth { namespace audio { namespace le_audio { struct StreamCallbacks { std::function on_resume_; std::function on_suspend_; std::function on_gamemode_; }; // Check if new bluetooth_audio is enabled bool is_sink_hal_enabled(); bool is_source_hal_enabled(); //TODO bool is_leaudio_offload_enabled(); // Initialize BluetoothAudio HAL: openProvider bool init_sink(StreamCallbacks source_stream_cb, bluetooth::common::MessageLoopThread* message_loop); bool init_source(StreamCallbacks source_stream_cb, bluetooth::common::MessageLoopThread* message_loop); // Clean up BluetoothAudio HAL void cleanup_sink(); void cleanup_source(); // Send command to the BluetoothAudio HAL: StartSession, EndSession void start_sink_session(); void end_sink_session(); void start_source_session(); void end_source_session(); void update_source_conn_param(uint16_t l_cis_conn_hdl, uint16_t r_cis_conn_hdl, uint8_t bn); void update_sink_conn_param(uint16_t l_cis_conn_hdl, uint16_t r_cis_conn_hdl, uint8_t bn); void set_sink_remote_delay(uint16_t delay_report_ms); void set_source_remote_delay(uint16_t delay_report_ms); void set_sink_pcm_parameters(uint32_t sample_rate, uint8_t bit_rate, uint8_t channel_mode, int gamemode, int data_interval_ms); void set_sink_offload_parameters(uint8_t codec_type, uint8_t audio_channel_allocation, uint32_t encoded_audio_bitrate, uint8_t le_audio_type, uint32_t bits_per_sample, uint32_t sample_rate, uint16_t data_interval_ms, uint32_t sdu_size); void set_source_pcm_parameters(uint32_t sample_rate, uint8_t bit_rate, uint8_t channel_mode, int data_interval_ms); void set_source_offload_parameters(uint8_t codec_type, uint8_t audio_channel_allocation, uint32_t encoded_audio_bitrate, uint8_t le_audio_type, uint32_t bits_per_sample, uint32_t sample_rate, uint16_t data_interval_ms, uint32_t sdu_size); // Read/write from/to the FMQ of BluetoothAudio HAL size_t read(uint8_t* p_buf, uint32_t len); size_t write(const uint8_t* p_buf, uint32_t len); } // namespace le_audio } // namespace audio } // namespace bluetooth