blob: 49036dc52135db979ec5ad4858b76ff5cbc90906 [file] [log] [blame]
Mikhail Naganov10548292016-10-31 10:39:47 -07001/*
2 * Copyright (C) 2016 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_V2_0_ParametersUtil_H_
18#define android_hardware_audio_V2_0_ParametersUtil_H_
19
20#include <functional>
21#include <memory>
22
23#include <android/hardware/audio/2.0/types.h>
24#include <hidl/HidlSupport.h>
25#include <media/AudioParameter.h>
26
27namespace android {
28namespace hardware {
29namespace audio {
30namespace V2_0 {
31namespace implementation {
32
33using ::android::hardware::audio::V2_0::ParameterValue;
34using ::android::hardware::audio::V2_0::Result;
35using ::android::hardware::hidl_string;
36using ::android::hardware::hidl_vec;
37
38class ParametersUtil {
39 public:
40 Result getParam(const char* name, bool* value);
41 Result getParam(const char* name, int* value);
42 Result getParam(const char* name, String8* value);
43 void getParametersImpl(
44 const hidl_vec<hidl_string>& keys,
45 std::function<void(Result retval, const hidl_vec<ParameterValue>& parameters)> cb);
46 std::unique_ptr<AudioParameter> getParams(const AudioParameter& keys);
47 Result setParam(const char* name, bool value);
48 Result setParam(const char* name, int value);
49 Result setParam(const char* name, const char* value);
50 Result setParametersImpl(const hidl_vec<ParameterValue>& parameters);
51 Result setParams(const AudioParameter& param);
52
53 protected:
54 virtual ~ParametersUtil() {}
55
56 virtual char* halGetParameters(const char* keys) = 0;
57 virtual int halSetParameters(const char* keysAndValues) = 0;
58};
59
60} // namespace implementation
61} // namespace V2_0
62} // namespace audio
63} // namespace hardware
64} // namespace android
65
66#endif // android_hardware_audio_V2_0_ParametersUtil_H_