blob: d95511b7745d509dce5a1754c43d82177b9053df [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
Steven Morelandd6e4f032016-11-28 18:37:07 -080017#ifndef ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H
18#define ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H
Mikhail Naganov10548292016-10-31 10:39:47 -070019
20#include <android/hardware/audio/2.0/IPrimaryDevice.h>
21#include <hidl/Status.h>
22
23#include <hidl/MQDescriptor.h>
24
25#include "Device.h"
26
27namespace android {
28namespace hardware {
29namespace audio {
30namespace V2_0 {
31namespace implementation {
32
33using ::android::hardware::audio::common::V2_0::AudioConfig;
34using ::android::hardware::audio::common::V2_0::AudioInputFlag;
35using ::android::hardware::audio::common::V2_0::AudioMode;
36using ::android::hardware::audio::common::V2_0::AudioOutputFlag;
37using ::android::hardware::audio::common::V2_0::AudioPort;
38using ::android::hardware::audio::common::V2_0::AudioPortConfig;
39using ::android::hardware::audio::common::V2_0::AudioSource;
40using ::android::hardware::audio::V2_0::DeviceAddress;
41using ::android::hardware::audio::V2_0::IDevice;
42using ::android::hardware::audio::V2_0::IPrimaryDevice;
43using ::android::hardware::audio::V2_0::IStreamIn;
44using ::android::hardware::audio::V2_0::IStreamOut;
45using ::android::hardware::audio::V2_0::ParameterValue;
46using ::android::hardware::audio::V2_0::Result;
47using ::android::hardware::Return;
48using ::android::hardware::Void;
49using ::android::hardware::hidl_vec;
50using ::android::hardware::hidl_string;
51using ::android::sp;
52
53struct PrimaryDevice : public IPrimaryDevice {
54 explicit PrimaryDevice(audio_hw_device_t* device);
55
56 // Methods from ::android::hardware::audio::V2_0::IDevice follow.
57 Return<Result> initCheck() override;
58 Return<Result> setMasterVolume(float volume) override;
59 Return<void> getMasterVolume(getMasterVolume_cb _hidl_cb) override;
60 Return<Result> setMicMute(bool mute) override;
61 Return<void> getMicMute(getMicMute_cb _hidl_cb) override;
62 Return<Result> setMasterMute(bool mute) override;
63 Return<void> getMasterMute(getMasterMute_cb _hidl_cb) override;
64 Return<void> getInputBufferSize(
65 const AudioConfig& config, getInputBufferSize_cb _hidl_cb) override;
66 Return<void> openOutputStream(
67 int32_t ioHandle,
68 const DeviceAddress& device,
69 const AudioConfig& config,
70 AudioOutputFlag flags,
71 openOutputStream_cb _hidl_cb) override;
72 Return<void> openInputStream(
73 int32_t ioHandle,
74 const DeviceAddress& device,
75 const AudioConfig& config,
76 AudioInputFlag flags,
77 AudioSource source,
78 openInputStream_cb _hidl_cb) override;
Mikhail Naganov6e81e9b2016-11-16 16:30:17 -080079 Return<bool> supportsAudioPatches() override;
Mikhail Naganov10548292016-10-31 10:39:47 -070080 Return<void> createAudioPatch(
81 const hidl_vec<AudioPortConfig>& sources,
82 const hidl_vec<AudioPortConfig>& sinks,
83 createAudioPatch_cb _hidl_cb) override;
84 Return<Result> releaseAudioPatch(int32_t patch) override;
85 Return<void> getAudioPort(const AudioPort& port, getAudioPort_cb _hidl_cb) override;
86 Return<Result> setAudioPortConfig(const AudioPortConfig& config) override;
87 Return<AudioHwSync> getHwAvSync() override;
88 Return<Result> setScreenState(bool turnedOn) override;
89 Return<void> getParameters(
90 const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) override;
91 Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
Martijn Coenen70b9a152016-11-18 15:29:32 +010092 Return<void> debugDump(const hidl_handle& fd) override;
Mikhail Naganov10548292016-10-31 10:39:47 -070093
94 // Methods from ::android::hardware::audio::V2_0::IPrimaryDevice follow.
95 Return<Result> setVoiceVolume(float volume) override;
96 Return<Result> setMode(AudioMode mode) override;
97 Return<void> getBtScoNrecEnabled(getBtScoNrecEnabled_cb _hidl_cb) override;
98 Return<Result> setBtScoNrecEnabled(bool enabled) override;
99 Return<void> getBtScoWidebandEnabled(getBtScoWidebandEnabled_cb _hidl_cb) override;
100 Return<Result> setBtScoWidebandEnabled(bool enabled) override;
101 Return<void> getTtyMode(getTtyMode_cb _hidl_cb) override;
102 Return<Result> setTtyMode(IPrimaryDevice::TtyMode mode) override;
103 Return<void> getHacEnabled(getHacEnabled_cb _hidl_cb) override;
104 Return<Result> setHacEnabled(bool enabled) override;
105
106 private:
107 sp<Device> mDevice;
108
109 virtual ~PrimaryDevice();
110};
111
112} // namespace implementation
113} // namespace V2_0
114} // namespace audio
115} // namespace hardware
116} // namespace android
117
Steven Morelandd6e4f032016-11-28 18:37:07 -0800118#endif // ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H