1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/*
17 * @addtogroup HdiA2dp
18 * @{
19 *
20 * @brief Provides unified APIs for the A2DP service.
21 *
22 * The Host can use the interface provided by the module to create an audio session,
23 * and exchange data with the audio subsystem.
24 *
25 * @since 4.0
26 */
27
28/**
29 * @file IBluetoothAudioCallback.idl
30 *
31 * @brief Defines the callback function, including the start, suspend, stop operations from audio.
32 *
33 * @since 4.0
34 * @version 2.0
35 */
36
37package ohos.hdi.bluetooth.a2dp.v2_0;
38
39import ohos.hdi.bluetooth.a2dp.v2_0.BluetoothAudioTypes;
40
41/**
42 * @brief Defines the callback function to start, suspend, stop audio render, change current codec.
43 *
44 * @since 4.0
45 * @version 2.0
46 */
47[callback] interface IBluetoothAudioCallback {
48    /**
49     * @brief Start audio render callback function.
50     *
51     * @return Returns <b>0</b> if the result is returned successfully; returns a negative value otherwise.
52     *
53     * @since 4.0
54     * @version 2.0
55     */
56    StartRender();
57
58    /**
59     * @brief Suspend audio render callback function.
60     *
61     * @return Returns <b>0</b> if the result is returned successfully; returns a negative value otherwise.
62     *
63     * @since 4.0
64     * @version 2.0
65     */
66    SuspendRender();
67
68    /**
69     * @brief Stop audio render callback function.
70     *
71     * @return Returns <b>0</b> if the result is returned successfully; returns a negative value otherwise.
72     *
73     * @since 4.0
74     * @version 2.0
75     */
76    StopRender();
77
78    /**
79     * @brief Change the audio encoder callback function.
80     *
81     * @return Returns <b>0</b> if the result is returned successfully; returns a negative value otherwise.
82     *
83     * @since 5.0
84     * @version 2.0
85     */
86     ChangeCodec([in] struct CodecParam codecParam);
87
88    /**
89     * @brief Obtains the last number of output audio frames.
90     *
91     * @param latencyNs Indicates the pointer to the latency.
92     * @param frames Indicates the pointer to the last number of output audio frames.
93     * @param time Indicates the pointer to the timestamp associated with the frame.
94     * @return Returns <b>0</b> if the last number is obtained; returns a negative value otherwise.
95     *
96     * @since 5.0
97     * @version 1.0
98     */
99     GetRenderPosition([out] unsigned long latencyNs, [out] unsigned long frames, [out] struct BluetoothTimeStamp time);
100}
101