1 /*
2 * Copyright (C) 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 PATH(android/hardware/audio/CORE_TYPES_FILE_VERSION/types.h)
20 #include <hidl/HidlSupport.h>
21
22 using ::android::hardware::audio::CORE_TYPES_CPP_VERSION::ParameterValue;
23 using ::android::hardware::audio::CORE_TYPES_CPP_VERSION::Result;
24 using ::android::hardware::Return;
25 using ::android::hardware::hidl_vec;
26 using ::android::hardware::hidl_string;
27
28 namespace android {
29 namespace utils {
30
31 #if MAJOR_VERSION == 2
32 template <class T, class Callback>
getParameters(T & object,hidl_vec<ParameterValue>,hidl_vec<hidl_string> keys,Callback callback)33 Return<void> getParameters(T& object, hidl_vec<ParameterValue> /*context*/,
34 hidl_vec<hidl_string> keys, Callback callback) {
35 return object->getParameters(keys, callback);
36 }
37
38 template <class T>
setParameters(T & object,hidl_vec<ParameterValue>,hidl_vec<ParameterValue> keys)39 Return<Result> setParameters(T& object, hidl_vec<ParameterValue> /*context*/,
40 hidl_vec<ParameterValue> keys) {
41 return object->setParameters(keys);
42 }
43 #elif MAJOR_VERSION >= 4
44 template <class T, class Callback>
45 Return<void> getParameters(T& object, hidl_vec<ParameterValue> context,
46 hidl_vec<hidl_string> keys, Callback callback) {
47 return object->getParameters(context, keys, callback);
48 }
49
50 template <class T>
51 Return<Result> setParameters(T& object, hidl_vec<ParameterValue> context,
52 hidl_vec<ParameterValue> keys) {
53 return object->setParameters(context, keys);
54 }
55 #endif
56
57 } // namespace utils
58 } // namespace android
59