1094332d3Sopenharmony_ci/*
2094332d3Sopenharmony_ci * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License.
5094332d3Sopenharmony_ci * You may obtain a copy of the License at
6094332d3Sopenharmony_ci *
7094332d3Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8094332d3Sopenharmony_ci *
9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and
13094332d3Sopenharmony_ci * limitations under the License.
14094332d3Sopenharmony_ci */
15094332d3Sopenharmony_ci
16094332d3Sopenharmony_ci/**
17094332d3Sopenharmony_ci * @addtogroup Audio
18094332d3Sopenharmony_ci * @{
19094332d3Sopenharmony_ci *
20094332d3Sopenharmony_ci * @brief Defines audio-related APIs, including custom data types and functions for loading drivers,
21094332d3Sopenharmony_ci * accessing a driver adapter, and rendering and capturing audios.
22094332d3Sopenharmony_ci *
23094332d3Sopenharmony_ci * @since 1.0
24094332d3Sopenharmony_ci * @version 1.0
25094332d3Sopenharmony_ci */
26094332d3Sopenharmony_ci
27094332d3Sopenharmony_ci/**
28094332d3Sopenharmony_ci * @file audio_control.h
29094332d3Sopenharmony_ci *
30094332d3Sopenharmony_ci * @brief Declares APIs for audio control.
31094332d3Sopenharmony_ci *
32094332d3Sopenharmony_ci * @since 1.0
33094332d3Sopenharmony_ci * @version 1.0
34094332d3Sopenharmony_ci */
35094332d3Sopenharmony_ci
36094332d3Sopenharmony_ci#ifndef AUDIO_CONTROL_H
37094332d3Sopenharmony_ci#define AUDIO_CONTROL_H
38094332d3Sopenharmony_ci
39094332d3Sopenharmony_ci#include "audio_types.h"
40094332d3Sopenharmony_cinamespace OHOS::HDI::Audio_Bluetooth {
41094332d3Sopenharmony_ci/**
42094332d3Sopenharmony_ci * @brief Provides control-related APIs for audio rendering or capturing, including functions to
43094332d3Sopenharmony_ci * start, stop, pause, and resume audio rendering or capturing, and flush data in the audio buffer.
44094332d3Sopenharmony_ci *
45094332d3Sopenharmony_ci * @since 1.0
46094332d3Sopenharmony_ci * @version 1.0
47094332d3Sopenharmony_ci */
48094332d3Sopenharmony_cistruct AudioControl {
49094332d3Sopenharmony_ci    /**
50094332d3Sopenharmony_ci     * @brief Starts audio rendering or capturing.
51094332d3Sopenharmony_ci     *
52094332d3Sopenharmony_ci     * @param handle Indicates the audio handle.
53094332d3Sopenharmony_ci     * @return Returns <b>0</b> if the rendering or capturing is successfully started;
54094332d3Sopenharmony_ci     * returns a negative value otherwise.
55094332d3Sopenharmony_ci     * @see Stop
56094332d3Sopenharmony_ci     */
57094332d3Sopenharmony_ci    int32_t (*Start)(AudioHandle handle);
58094332d3Sopenharmony_ci
59094332d3Sopenharmony_ci    /**
60094332d3Sopenharmony_ci     * @brief Stops audio rendering or capturing.
61094332d3Sopenharmony_ci     *
62094332d3Sopenharmony_ci     * @param handle Indicates the audio handle.
63094332d3Sopenharmony_ci     * @return Returns <b>0</b> if the rendering or capturing is successfully stopped;
64094332d3Sopenharmony_ci     * returns a negative value otherwise.
65094332d3Sopenharmony_ci     * @see Start
66094332d3Sopenharmony_ci     */
67094332d3Sopenharmony_ci    int32_t (*Stop)(AudioHandle handle);
68094332d3Sopenharmony_ci
69094332d3Sopenharmony_ci    /**
70094332d3Sopenharmony_ci     * @brief Pauses audio rendering or capturing.
71094332d3Sopenharmony_ci     *
72094332d3Sopenharmony_ci     * @param handle Indicates the audio handle.
73094332d3Sopenharmony_ci     * @return Returns <b>0</b> if the rendering or capturing is successfully paused;
74094332d3Sopenharmony_ci     * returns a negative value otherwise.
75094332d3Sopenharmony_ci     * @see Resume
76094332d3Sopenharmony_ci     */
77094332d3Sopenharmony_ci    int32_t (*Pause)(AudioHandle handle);
78094332d3Sopenharmony_ci
79094332d3Sopenharmony_ci    /**
80094332d3Sopenharmony_ci     * @brief Resumes audio rendering or capturing.
81094332d3Sopenharmony_ci     *
82094332d3Sopenharmony_ci     * @param handle Indicates the audio handle.
83094332d3Sopenharmony_ci     * @return Returns <b>0</b> if the rendering or capturing is successfully resumed;
84094332d3Sopenharmony_ci     * returns a negative value otherwise.
85094332d3Sopenharmony_ci     * @see Pause
86094332d3Sopenharmony_ci     */
87094332d3Sopenharmony_ci    int32_t (*Resume)(AudioHandle handle);
88094332d3Sopenharmony_ci
89094332d3Sopenharmony_ci    /**
90094332d3Sopenharmony_ci     * @brief Flushes data in the audio buffer.
91094332d3Sopenharmony_ci     *
92094332d3Sopenharmony_ci     * @param handle Indicates the audio handle.
93094332d3Sopenharmony_ci     * @return Returns <b>0</b> if the flush is successful; returns a negative value otherwise.
94094332d3Sopenharmony_ci     */
95094332d3Sopenharmony_ci    int32_t (*Flush)(AudioHandle handle);
96094332d3Sopenharmony_ci
97094332d3Sopenharmony_ci    /**
98094332d3Sopenharmony_ci     * @brief Sets or cancels the standby mode of the audio device.
99094332d3Sopenharmony_ci     *
100094332d3Sopenharmony_ci     * @param handle Indicates the audio handle.
101094332d3Sopenharmony_ci     * @return Returns <b>0</b> if the device is set to standby mode; returns a positive value if the standby mode is
102094332d3Sopenharmony_ci     * canceled; returns a negative value if the setting fails.
103094332d3Sopenharmony_ci     */
104094332d3Sopenharmony_ci    int32_t (*TurnStandbyMode)(AudioHandle handle);
105094332d3Sopenharmony_ci
106094332d3Sopenharmony_ci    /**
107094332d3Sopenharmony_ci     * @brief Dumps information about the audio device.
108094332d3Sopenharmony_ci     *
109094332d3Sopenharmony_ci     * @param handle Indicates the audio handle.
110094332d3Sopenharmony_ci     * @param range Indicates the range of the device information to dump, which can be brief or full information.
111094332d3Sopenharmony_ci     * @param fd Indicates the file to which the device information will be dumped.
112094332d3Sopenharmony_ci     * @return Returns <b>0</b> if the operation is successful; returns a negative value otherwise.
113094332d3Sopenharmony_ci     */
114094332d3Sopenharmony_ci    int32_t (*AudioDevDump)(AudioHandle handle, int32_t range, int32_t fd);
115094332d3Sopenharmony_ci};
116094332d3Sopenharmony_ci}
117094332d3Sopenharmony_ci#endif /* AUDIO_CONTROL_H */
118094332d3Sopenharmony_ci/** @} */
119