blob: 40c26e0cbf11808f963f9dd0eb9eaf689c10ceb4 [file] [log] [blame]
Alice Kuo84e87672021-10-28 12:53:38 +08001/*
2 * Copyright 2021 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 <android/hardware/bluetooth/audio/2.2/types.h>
20#include <fmq/MessageQueue.h>
21#include <hidl/MQDescriptor.h>
22
23#include "BluetoothAudioProvider.h"
24
25namespace android {
26namespace hardware {
27namespace bluetooth {
28namespace audio {
29namespace V2_2 {
30namespace implementation {
31
32using ::android::hardware::kSynchronizedReadWrite;
33using ::android::hardware::MessageQueue;
34
35using DataMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>;
36
37class LeAudioAudioProvider : public BluetoothAudioProvider {
38 public:
39 LeAudioAudioProvider();
40
41 bool isValid(const V2_1::SessionType& sessionType) override;
42 bool isValid(const V2_0::SessionType& sessionType) override;
43
44 Return<void> startSession_2_1(const sp<V2_0::IBluetoothAudioPort>& hostIf,
45 const V2_1::AudioConfiguration& audioConfig,
46 startSession_cb _hidl_cb) override;
47
48 Return<void> startSession_2_2(const sp<V2_0::IBluetoothAudioPort>& hostIf,
49 const AudioConfiguration& audioConfig,
50 startSession_cb _hidl_cb) override;
51
52 private:
53 /** queue for software encodec/decoded audio data */
54 std::unique_ptr<DataMQ> mDataMQ;
55
56 Return<void> onSessionReady(startSession_cb _hidl_cb) override;
57};
58
59class LeAudioOutputAudioProvider : public LeAudioAudioProvider {
60 public:
61 LeAudioOutputAudioProvider();
62};
63
64class LeAudioInputAudioProvider : public LeAudioAudioProvider {
65 public:
66 LeAudioInputAudioProvider();
67};
68
69} // namespace implementation
70} // namespace V2_2
71} // namespace audio
72} // namespace bluetooth
73} // namespace hardware
74} // namespace android