hearing_aid_software_encoding.h 1.4 KB

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