blob: 258c28b6930747ae44175229ade9c256fdd29f8a [file] [log] [blame]
Kevin Rocarda4e6d8b2018-01-20 21:52:01 -08001/*
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
17package android.hardware.audio@4.0;
18
19import android.hardware.audio.common@4.0;
20import IDevice;
21
22interface IPrimaryDevice extends IDevice {
Kevin Rocarda4e6d8b2018-01-20 21:52:01 -080023 /**
24 * Sets the audio volume of a voice call.
25 *
26 * @param volume 1.0f means unity, 0.0f is zero.
27 * @return retval operation completion status.
28 */
29 setVoiceVolume(float volume) generates (Result retval);
30
31 /**
32 * This method is used to notify the HAL about audio mode changes.
33 *
34 * @param mode new mode.
35 * @return retval operation completion status.
36 */
37 setMode(AudioMode mode) generates (Result retval);
38
39 /**
Mikhail Naganov8878f572018-02-12 15:55:49 -080040 * Sets the name of the current BT SCO headset. Calling this method
41 * is equivalent to setting legacy "bt_headset_name" parameter.
42 * The BT SCO headset name must only be used for debugging purposes.
43 * Optional method
44 *
45 * @param name the name of the current BT SCO headset (can be empty).
46 * @return retval operation completion status.
47 */
48 setBtScoHeadsetDebugName(string name) generates (Result retval);
49
50 /**
Kevin Rocarda4e6d8b2018-01-20 21:52:01 -080051 * Gets whether BT SCO Noise Reduction and Echo Cancellation are enabled.
52 * Calling this method is equivalent to getting AUDIO_PARAMETER_KEY_BT_NREC
53 * on the legacy HAL.
54 *
55 * @return retval operation completion status.
56 * @return enabled whether BT SCO NR + EC are enabled.
57 */
58 getBtScoNrecEnabled() generates (Result retval, bool enabled);
59
60 /**
61 * Sets whether BT SCO Noise Reduction and Echo Cancellation are enabled.
62 * Calling this method is equivalent to setting AUDIO_PARAMETER_KEY_BT_NREC
63 * on the legacy HAL.
Kevin Rocard74980b52018-01-20 22:12:57 -080064 * Optional method
Kevin Rocarda4e6d8b2018-01-20 21:52:01 -080065 *
66 * @param enabled whether BT SCO NR + EC are enabled.
67 * @return retval operation completion status.
68 */
69 setBtScoNrecEnabled(bool enabled) generates (Result retval);
70
71 /**
72 * Gets whether BT SCO Wideband mode is enabled. Calling this method is
73 * equivalent to getting AUDIO_PARAMETER_KEY_BT_SCO_WB on the legacy HAL.
74 *
75 * @return retval operation completion status.
76 * @return enabled whether BT Wideband is enabled.
77 */
78 getBtScoWidebandEnabled() generates (Result retval, bool enabled);
79
80 /**
81 * Sets whether BT SCO Wideband mode is enabled. Calling this method is
82 * equivalent to setting AUDIO_PARAMETER_KEY_BT_SCO_WB on the legacy HAL.
Kevin Rocard74980b52018-01-20 22:12:57 -080083 * Optional method
Kevin Rocarda4e6d8b2018-01-20 21:52:01 -080084 *
85 * @param enabled whether BT Wideband is enabled.
86 * @return retval operation completion status.
87 */
88 setBtScoWidebandEnabled(bool enabled) generates (Result retval);
89
Mikhail Naganov4899fba2018-02-12 16:40:41 -080090 /**
91 * Gets whether BT HFP (Hands-Free Profile) is enabled. Calling this method
92 * is equivalent to getting "hfp_enable" parameter value on the legacy HAL.
93 *
94 * @return retval operation completion status.
95 * @return enabled whether BT HFP is enabled.
96 */
97 getBtHfpEnabled() generates (Result retval, bool enabled);
98
99 /**
100 * Sets whether BT HFP (Hands-Free Profile) is enabled. Calling this method
101 * is equivalent to setting "hfp_enable" parameter on the legacy HAL.
102 * Optional method
103 *
104 * @param enabled whether BT HFP is enabled.
105 * @return retval operation completion status.
106 */
107 setBtHfpEnabled(bool enabled) generates (Result retval);
108
109 /**
110 * Sets the sampling rate of BT HFP (Hands-Free Profile). Calling this
111 * method is equivalent to setting "hfp_set_sampling_rate" parameter
112 * on the legacy HAL.
113 * Optional method
114 *
115 * @param sampleRateHz sample rate in Hz.
116 * @return retval operation completion status.
117 */
118 setBtHfpSampleRate(uint32_t sampleRateHz) generates (Result retval);
119
120 /**
121 * Sets the current output volume Hz for BT HFP (Hands-Free Profile).
122 * Calling this method is equivalent to setting "hfp_volume" parameter value
123 * on the legacy HAL (except that legacy HAL implementations expect
124 * an integer value in the range from 0 to 15.)
125 * Optional method
126 *
127 * @param volume 1.0f means unity, 0.0f is zero.
128 * @return retval operation completion status.
129 */
130 setBtHfpVolume(float volume) generates (Result retval);
131
Kevin Rocarda4e6d8b2018-01-20 21:52:01 -0800132 enum TtyMode : int32_t {
133 OFF,
134 VCO,
135 HCO,
136 FULL
137 };
138
139 /**
140 * Gets current TTY mode selection. Calling this method is equivalent to
141 * getting AUDIO_PARAMETER_KEY_TTY_MODE on the legacy HAL.
142 *
143 * @return retval operation completion status.
144 * @return mode TTY mode.
145 */
146 getTtyMode() generates (Result retval, TtyMode mode);
147
148 /**
149 * Sets current TTY mode. Calling this method is equivalent to setting
150 * AUDIO_PARAMETER_KEY_TTY_MODE on the legacy HAL.
151 *
152 * @param mode TTY mode.
153 * @return retval operation completion status.
154 */
155 setTtyMode(TtyMode mode) generates (Result retval);
156
157 /**
158 * Gets whether Hearing Aid Compatibility - Telecoil (HAC-T) mode is
159 * enabled. Calling this method is equivalent to getting
160 * AUDIO_PARAMETER_KEY_HAC on the legacy HAL.
161 *
162 * @return retval operation completion status.
163 * @return enabled whether HAC mode is enabled.
164 */
165 getHacEnabled() generates (Result retval, bool enabled);
166
167 /**
168 * Sets whether Hearing Aid Compatibility - Telecoil (HAC-T) mode is
169 * enabled. Calling this method is equivalent to setting
170 * AUDIO_PARAMETER_KEY_HAC on the legacy HAL.
Kevin Rocard74980b52018-01-20 22:12:57 -0800171 * Optional method
Kevin Rocarda4e6d8b2018-01-20 21:52:01 -0800172 *
173 * @param enabled whether HAC mode is enabled.
174 * @return retval operation completion status.
175 */
176 setHacEnabled(bool enabled) generates (Result retval);
Mikhail Naganov124fac02018-02-12 16:01:07 -0800177
178 enum Rotation : int32_t {
179 DEG_0,
180 DEG_90,
181 DEG_180,
182 DEG_270
183 };
184
185 /**
186 * Updates HAL on the current rotation of the device relative to natural
187 * orientation. Calling this method is equivalent to setting legacy
188 * parameter "rotation".
189 *
190 * @param rotation rotation in degrees relative to natural device
191 * orientation.
192 * @return retval operation completion status.
193 */
194 updateRotation(Rotation rotation) generates (Result retval);
Kevin Rocarda4e6d8b2018-01-20 21:52:01 -0800195};