xref: /aosp_15_r20/hardware/interfaces/audio/7.1/IDevice.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2022 The Android Open Source Project
3*4d7e907cSAndroid Build Coastguard Worker *
4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*4d7e907cSAndroid Build Coastguard Worker *
8*4d7e907cSAndroid Build Coastguard Worker *      http://www.apache.org/licenses/LICENSE-2.0
9*4d7e907cSAndroid Build Coastguard Worker *
10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License.
15*4d7e907cSAndroid Build Coastguard Worker */
16*4d7e907cSAndroid Build Coastguard Worker
17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected];
18*4d7e907cSAndroid Build Coastguard Worker
19*4d7e907cSAndroid Build Coastguard Workerimport [email protected];
20*4d7e907cSAndroid Build Coastguard Workerimport @7.0::AudioInOutFlag;
21*4d7e907cSAndroid Build Coastguard Workerimport @7.0::IDevice;
22*4d7e907cSAndroid Build Coastguard Workerimport @7.0::Result;
23*4d7e907cSAndroid Build Coastguard Workerimport IStreamOut;
24*4d7e907cSAndroid Build Coastguard Worker
25*4d7e907cSAndroid Build Coastguard Workerinterface IDevice extends @7.0::IDevice {
26*4d7e907cSAndroid Build Coastguard Worker    /**
27*4d7e907cSAndroid Build Coastguard Worker     * This method creates and opens the audio hardware output stream.
28*4d7e907cSAndroid Build Coastguard Worker     * If the stream can not be opened with the proposed audio config,
29*4d7e907cSAndroid Build Coastguard Worker     * HAL must provide suggested values for the audio config.
30*4d7e907cSAndroid Build Coastguard Worker     *
31*4d7e907cSAndroid Build Coastguard Worker     * Note: INVALID_ARGUMENTS is returned both in the case when the
32*4d7e907cSAndroid Build Coastguard Worker     * HAL can not use the provided config and in the case when
33*4d7e907cSAndroid Build Coastguard Worker     * the value of any argument is invalid. In the latter case the
34*4d7e907cSAndroid Build Coastguard Worker     * HAL must provide a default initialized suggested config.
35*4d7e907cSAndroid Build Coastguard Worker     *
36*4d7e907cSAndroid Build Coastguard Worker     * @param ioHandle handle assigned by AudioFlinger.
37*4d7e907cSAndroid Build Coastguard Worker     * @param device device type and (if needed) address.
38*4d7e907cSAndroid Build Coastguard Worker     * @param config stream configuration.
39*4d7e907cSAndroid Build Coastguard Worker     * @param flags additional flags.
40*4d7e907cSAndroid Build Coastguard Worker     * @param sourceMetadata Description of the audio that will be played.
41*4d7e907cSAndroid Build Coastguard Worker                             May be used by implementations to configure hardware effects.
42*4d7e907cSAndroid Build Coastguard Worker     * @return retval operation completion status.
43*4d7e907cSAndroid Build Coastguard Worker     * @return outStream created output stream.
44*4d7e907cSAndroid Build Coastguard Worker     * @return suggestedConfig in the case of rejection of the proposed config,
45*4d7e907cSAndroid Build Coastguard Worker     *                         a config suggested by the HAL.
46*4d7e907cSAndroid Build Coastguard Worker     */
47*4d7e907cSAndroid Build Coastguard Worker    openOutputStream_7_1(
48*4d7e907cSAndroid Build Coastguard Worker            AudioIoHandle ioHandle,
49*4d7e907cSAndroid Build Coastguard Worker            DeviceAddress device,
50*4d7e907cSAndroid Build Coastguard Worker            AudioConfig config,
51*4d7e907cSAndroid Build Coastguard Worker            vec<AudioInOutFlag> flags,
52*4d7e907cSAndroid Build Coastguard Worker            SourceMetadata sourceMetadata) generates (
53*4d7e907cSAndroid Build Coastguard Worker                    Result retval,
54*4d7e907cSAndroid Build Coastguard Worker                    IStreamOut outStream,
55*4d7e907cSAndroid Build Coastguard Worker                    AudioConfig suggestedConfig);
56*4d7e907cSAndroid Build Coastguard Worker
57*4d7e907cSAndroid Build Coastguard Worker    /**
58*4d7e907cSAndroid Build Coastguard Worker     * Notifies the device module about the connection state of an input/output
59*4d7e907cSAndroid Build Coastguard Worker     * device attached to it. The devicePort identifies the device and may also
60*4d7e907cSAndroid Build Coastguard Worker     * provide extra information such as raw audio descriptors.
61*4d7e907cSAndroid Build Coastguard Worker     *
62*4d7e907cSAndroid Build Coastguard Worker     * @param devicePort audio device port.
63*4d7e907cSAndroid Build Coastguard Worker     * @param connected whether the device is connected.
64*4d7e907cSAndroid Build Coastguard Worker     * @return retval operation completion status.
65*4d7e907cSAndroid Build Coastguard Worker     */
66*4d7e907cSAndroid Build Coastguard Worker    setConnectedState_7_1(AudioPort devicePort, bool connected)
67*4d7e907cSAndroid Build Coastguard Worker            generates (Result retval);
68*4d7e907cSAndroid Build Coastguard Worker};
69