1 /*
2  * Copyright 2020 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
3  * www.ehima.com
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #pragma once
19 
20 #include <android/hardware/bluetooth/audio/2.1/types.h>
21 #include <fmq/MessageQueue.h>
22 #include <hidl/MQDescriptor.h>
23 
24 #include "BluetoothAudioProvider.h"
25 
26 namespace android {
27 namespace hardware {
28 namespace bluetooth {
29 namespace audio {
30 namespace V2_1 {
31 namespace implementation {
32 
33 using ::android::hardware::kSynchronizedReadWrite;
34 using ::android::hardware::MessageQueue;
35 
36 using DataMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>;
37 
38 class LeAudioAudioProvider : public BluetoothAudioProvider {
39  public:
40   LeAudioAudioProvider();
41 
42   bool isValid(const SessionType& sessionType) override;
43   bool isValid(const V2_0::SessionType& sessionType) override;
44 
45   Return<void> startSession_2_1(const sp<V2_0::IBluetoothAudioPort>& hostIf,
46                                 const AudioConfiguration& audioConfig,
47                                 startSession_cb _hidl_cb) override;
48 
49  private:
50   /** queue for software encodec/decoded audio data */
51   std::unique_ptr<DataMQ> mDataMQ;
52 
53   Return<void> onSessionReady(startSession_cb _hidl_cb) override;
54 };
55 
56 class LeAudioOutputAudioProvider : public LeAudioAudioProvider {
57  public:
58   LeAudioOutputAudioProvider();
59 };
60 
61 class LeAudioInputAudioProvider : public LeAudioAudioProvider {
62  public:
63   LeAudioInputAudioProvider();
64 };
65 
66 }  // namespace implementation
67 }  // namespace V2_1
68 }  // namespace audio
69 }  // namespace bluetooth
70 }  // namespace hardware
71 }  // namespace android
72