1 /*
2  * Copyright 2024 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 <hardware/audio.h>
20 
21 #include <vector>
22 
23 #include "audio_aidl_interfaces.h"
24 #include "bta/le_audio/broadcaster/broadcaster_types.h"
25 #include "bta/le_audio/codec_manager.h"
26 #include "bta/le_audio/le_audio_types.h"
27 
28 namespace bluetooth {
29 namespace audio {
30 namespace aidl {
31 
32 ::aidl::android::hardware::bluetooth::audio::CodecId
33 GetAidlCodecIdFromStackFormat(
34     const ::bluetooth::le_audio::types::LeAudioCodecId& codec_id);
35 
36 ::bluetooth::le_audio::types::LeAudioCodecId GetStackCodecIdFromAidlFormat(
37     const ::aidl::android::hardware::bluetooth::audio::CodecId& codec_id);
38 
39 std::optional<std::vector<
40     std::optional<::aidl::android::hardware::bluetooth::audio::MetadataLtv>>>
41 GetAidlMetadataFromStackFormat(const std::vector<uint8_t>& vec);
42 
43 bluetooth::le_audio::types::LeAudioLtvMap GetStackMetadataFromAidlFormat(
44     const std::vector<std::optional<
45         ::aidl::android::hardware::bluetooth::audio::MetadataLtv>>& source);
46 
47 std::optional<std::vector<
48     std::optional<::aidl::android::hardware::bluetooth::audio::
49                       IBluetoothAudioProvider::LeAudioDeviceCapabilities>>>
50 GetAidlLeAudioDeviceCapabilitiesFromStackFormat(
51     const std::optional<
52         std::vector<::bluetooth::le_audio::types::acs_ac_record>>& pacs);
53 
54 ::aidl::android::hardware::bluetooth::audio::IBluetoothAudioProvider::
55     LeAudioBroadcastConfigurationRequirement
56     GetAidlLeAudioBroadcastConfigurationRequirementFromStackFormat(
57         const std::vector<std::pair<
58             ::bluetooth::le_audio::types::LeAudioContextType, uint8_t>>&
59             subgroup_quality);
60 
61 ::aidl::android::hardware::bluetooth::audio::IBluetoothAudioProvider::
62     LeAudioConfigurationRequirement
63     GetAidlLeAudioUnicastConfigurationRequirementsFromStackFormat(
64         ::bluetooth::le_audio::types::LeAudioContextType context_type,
65         const std::optional<std::vector<
66             ::bluetooth::le_audio::CodecManager::
67                 UnicastConfigurationRequirements::DeviceDirectionRequirements>>&
68             sink_reqs,
69         const std::optional<std::vector<
70             ::bluetooth::le_audio::CodecManager::
71                 UnicastConfigurationRequirements::DeviceDirectionRequirements>>&
72             source_reqs);
73 ::bluetooth::le_audio::types::LeAudioLtvMap GetStackLeAudioLtvMapFromAidlFormat(
74     const std::vector<::aidl::android::hardware::bluetooth::audio::
75                           CodecSpecificConfigurationLtv>& aidl_config_ltvs);
76 
77 ::bluetooth::le_audio::broadcaster::BroadcastSubgroupBisCodecConfig
78 GetStackBisConfigFromAidlFormat(
79     const ::aidl::android::hardware::bluetooth::audio::IBluetoothAudioProvider::
80         LeAudioSubgroupBisConfiguration& aidl_cfg,
81     ::bluetooth::le_audio::types::LeAudioCodecId& out_codec_id);
82 
83 std::vector<::bluetooth::le_audio::broadcaster::BroadcastSubgroupCodecConfig>
84 GetStackSubgroupsFromAidlFormat(
85     const std::vector<
86         ::aidl::android::hardware::bluetooth::audio::IBluetoothAudioProvider::
87             LeAudioBroadcastSubgroupConfiguration>& aidl_subgroups);
88 
89 struct ::bluetooth::le_audio::types::DataPathConfiguration
90 GetStackDataPathFromAidlFormat(
91     const ::aidl::android::hardware::bluetooth::audio::IBluetoothAudioProvider::
92         LeAudioDataPathConfiguration& dp);
93 
94 std::optional<::bluetooth::le_audio::broadcaster::BroadcastConfiguration>
95 GetStackBroadcastConfigurationFromAidlFormat(
96     const ::aidl::android::hardware::bluetooth::audio::IBluetoothAudioProvider::
97         LeAudioBroadcastConfigurationSetting& setting);
98 
99 std::optional<::bluetooth::le_audio::set_configurations::AudioSetConfiguration>
100 GetStackUnicastConfigurationFromAidlFormat(
101     ::bluetooth::le_audio::types::LeAudioContextType ctx_type,
102     const ::aidl::android::hardware::bluetooth::audio::IBluetoothAudioProvider::
103         LeAudioAseConfigurationSetting& config);
104 
105 }  // namespace aidl
106 }  // namespace audio
107 }  // namespace bluetooth
108