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