1/*
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
17package android.hardware.audio@2.0;
18
19import android.hardware.audio.common@2.0;
20import IDevice;
21
22interface IPrimaryDevice extends IDevice {
23    typedef android.hardware.audio@2.0::Result Result;
24
25    /**
26     * Sets the audio volume of a voice call.
27     *
28     * @param volume 1.0f means unity, 0.0f is zero.
29     * @return retval operation completion status.
30     */
31    setVoiceVolume(float volume) generates (Result retval);
32
33    /**
34     * This method is used to notify the HAL about audio mode changes.
35     *
36     * @param mode new mode.
37     * @return retval operation completion status.
38     */
39    setMode(AudioMode mode) generates (Result retval);
40
41    /**
42     * Gets whether BT SCO Noise Reduction and Echo Cancellation are enabled.
43     * Calling this method is equivalent to getting AUDIO_PARAMETER_KEY_BT_NREC
44     * on the legacy HAL.
45     *
46     * @return retval operation completion status.
47     * @return enabled whether BT SCO NR + EC are enabled.
48     */
49    getBtScoNrecEnabled() generates (Result retval, bool enabled);
50
51    /**
52     * Sets whether BT SCO Noise Reduction and Echo Cancellation are enabled.
53     * Calling this method is equivalent to setting AUDIO_PARAMETER_KEY_BT_NREC
54     * on the legacy HAL.
55     *
56     * @param enabled whether BT SCO NR + EC are enabled.
57     * @return retval operation completion status.
58     */
59    setBtScoNrecEnabled(bool enabled) generates (Result retval);
60
61    /**
62     * Gets whether BT SCO Wideband mode is enabled. Calling this method is
63     * equivalent to getting AUDIO_PARAMETER_KEY_BT_SCO_WB on the legacy HAL.
64     *
65     * @return retval operation completion status.
66     * @return enabled whether BT Wideband is enabled.
67     */
68    getBtScoWidebandEnabled() generates (Result retval, bool enabled);
69
70    /**
71     * Sets whether BT SCO Wideband mode is enabled. Calling this method is
72     * equivalent to setting AUDIO_PARAMETER_KEY_BT_SCO_WB on the legacy HAL.
73     *
74     * @param enabled whether BT Wideband is enabled.
75     * @return retval operation completion status.
76     */
77    setBtScoWidebandEnabled(bool enabled) generates (Result retval);
78
79    enum TtyMode : int32_t {
80        OFF,
81        VCO,
82        HCO,
83        FULL
84    };
85
86    /**
87     * Gets current TTY mode selection. Calling this method is equivalent to
88     * getting AUDIO_PARAMETER_KEY_TTY_MODE on the legacy HAL.
89     *
90     * @return retval operation completion status.
91     * @return mode TTY mode.
92     */
93    getTtyMode() generates (Result retval, TtyMode mode);
94
95    /**
96     * Sets current TTY mode. Calling this method is equivalent to setting
97     * AUDIO_PARAMETER_KEY_TTY_MODE on the legacy HAL.
98     *
99     * @param mode TTY mode.
100     * @return retval operation completion status.
101     */
102    setTtyMode(TtyMode mode) generates (Result retval);
103
104    /**
105     * Gets whether Hearing Aid Compatibility - Telecoil (HAC-T) mode is
106     * enabled. Calling this method is equivalent to getting
107     * AUDIO_PARAMETER_KEY_HAC on the legacy HAL.
108     *
109     * @return retval operation completion status.
110     * @return enabled whether HAC mode is enabled.
111     */
112    getHacEnabled() generates (Result retval, bool enabled);
113
114    /**
115     * Sets whether Hearing Aid Compatibility - Telecoil (HAC-T) mode is
116     * enabled. Calling this method is equivalent to setting
117     * AUDIO_PARAMETER_KEY_HAC on the legacy HAL.
118     *
119     * @param enabled whether HAC mode is enabled.
120     * @return retval operation completion status.
121     */
122    setHacEnabled(bool enabled) generates (Result retval);
123};
124