1 /*
2  * Copyright (C) 2018 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 #ifndef ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H
18 #define ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H
19 
20 // A workaround for b/216149583 (vendor code having its own copy of VersionMacro.h)
21 #ifndef COMMON_TYPES_MINOR_VERSION
22 #define COMMON_TYPES_MINOR_VERSION MINOR_VERSION
23 #endif
24 #ifndef CORE_TYPES_MINOR_VERSION
25 #define CORE_TYPES_MINOR_VERSION MINOR_VERSION
26 #endif
27 #ifndef COMMON_TYPES_FILE_VERSION
28 #define COMMON_TYPES_FILE_VERSION EXPAND_CONCAT_3(MAJOR_VERSION, ., COMMON_TYPES_MINOR_VERSION)
29 #endif
30 #ifndef CORE_TYPES_FILE_VERSION
31 #define CORE_TYPES_FILE_VERSION EXPAND_CONCAT_3(MAJOR_VERSION, ., CORE_TYPES_MINOR_VERSION)
32 #endif
33 #ifndef COMMON_TYPES_CPP_VERSION
34 #define COMMON_TYPES_CPP_VERSION EXPAND_CONCAT_4(V, MAJOR_VERSION, _, COMMON_TYPES_MINOR_VERSION)
35 #endif
36 #ifndef CORE_TYPES_CPP_VERSION
37 #define CORE_TYPES_CPP_VERSION EXPAND_CONCAT_4(V, MAJOR_VERSION, _, CORE_TYPES_MINOR_VERSION)
38 #endif
39 // End of workaround
40 
41 // clang-format off
42 #include PATH(android/hardware/audio/common/COMMON_TYPES_FILE_VERSION/types.h)
43 // clang-format on
44 
45 namespace android {
46 namespace hardware {
47 namespace audio {
48 namespace common {
49 namespace CPP_VERSION {
50 namespace implementation {
51 
52 #if MAJOR_VERSION == 2
53 typedef common::CPP_VERSION::AudioDevice AudioDeviceBitfield;
54 typedef common::CPP_VERSION::AudioChannelMask AudioChannelBitfield;
55 typedef common::CPP_VERSION::AudioOutputFlag AudioOutputFlagBitfield;
56 typedef common::CPP_VERSION::AudioInputFlag AudioInputFlagBitfield;
57 #elif MAJOR_VERSION >= 4 && MAJOR_VERSION <= 6
58 typedef hidl_bitfield<common::CPP_VERSION::AudioDevice> AudioDeviceBitfield;
59 typedef hidl_bitfield<common::CPP_VERSION::AudioChannelMask> AudioChannelBitfield;
60 typedef hidl_bitfield<common::CPP_VERSION::AudioOutputFlag> AudioOutputFlagBitfield;
61 typedef hidl_bitfield<common::CPP_VERSION::AudioInputFlag> AudioInputFlagBitfield;
62 #endif
63 
64 }  // namespace implementation
65 }  // namespace CPP_VERSION
66 }  // namespace common
67 }  // namespace audio
68 }  // namespace hardware
69 }  // namespace android
70 
71 #endif  // ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H
72