blob: 603e3360791934f090864a2d2213e46cb6bbb91f [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:
Mikhail Naganove4228e72017-04-28 13:20:56 -070040 virtual ~ParametersUtil() = default;
41 Result getParam(const char* name, bool* value);
42 Result getParam(const char* name, int* value);
43 Result getParam(const char* name, String8* value);
44 void getParametersImpl(
45 const hidl_vec<hidl_string>& keys,
46 std::function<void(Result retval,
47 const hidl_vec<ParameterValue>& parameters)>
48 cb);
49 std::unique_ptr<AudioParameter> getParams(const AudioParameter& keys);
50 Result setParam(const char* name, bool value);
51 Result setParam(const char* name, int value);
52 Result setParam(const char* name, const char* value);
53 Result setParametersImpl(const hidl_vec<ParameterValue>& parameters);
54 Result setParams(const AudioParameter& param);
Mikhail Naganov10548292016-10-31 10:39:47 -070055
56 protected:
Mikhail Naganov10548292016-10-31 10:39:47 -070057 virtual char* halGetParameters(const char* keys) = 0;
58 virtual int halSetParameters(const char* keysAndValues) = 0;
59};
60
61} // namespace implementation
62} // namespace V2_0
63} // namespace audio
64} // namespace hardware
65} // namespace android
66
67#endif // android_hardware_audio_V2_0_ParametersUtil_H_