• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
19 #include <functional>
20 #include "common/message_loop_thread.h"
21 
22 namespace bluetooth {
23 namespace audio {
24 namespace hearing_aid {
25 
26 struct StreamCallbacks {
27   std::function<bool(bool start_media_task)> on_resume_;
28   std::function<bool(void)> on_suspend_;
29 };
30 
31 // Check if new bluetooth_audio is enabled
32 bool is_hal_2_0_enabled();
33 
34 // Initialize BluetoothAudio HAL: openProvider
35 bool init(StreamCallbacks stream_cb,
36           bluetooth::common::MessageLoopThread* message_loop);
37 
38 // Clean up BluetoothAudio HAL
39 void cleanup();
40 
41 // Send command to the BluetoothAudio HAL: StartSession, EndSession
42 void start_session();
43 void end_session();
44 
45 void set_remote_delay(uint16_t delay_report_ms);
46 
47 // Read from the FMQ of BluetoothAudio HAL
48 size_t read(uint8_t* p_buf, uint32_t len);
49 
50 }  // namespace hearing_aid
51 }  // namespace audio
52 }  // namespace bluetooth
53