summaryrefslogtreecommitdiffstats
blob: 52a580f8487c5ade082b6de925d4574df867c4e0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.bluetooth.a2dp@1.0;

import IBluetoothAudioHost;

/**
 * HAL interface for Bluetooth A2DP Offload functionality where
 * the encoding of the A2DP data packets is offloaded to platform
 * specific encoders. The A2DP control path is maintained in the
 * Bluetooth stack.
 *
 * This interface is from HAL client to HAL server.
 *
 * The HAL client must provide the handle of IBluetoothAudioHost as well
 * as codec configuration to the HAL server, when its connected to an
 * active A2DP Sink device. HAL Server, based on the feedback from the Audio
 * framework must call into the commands provided by the IBluetoothAudioHost.
 * HAL client must call into IBluetoothAudioOffload to provide the status of
 * these commands. Once the device becomes inactive, the HAL client must
 * call the endSession to terminate the session with the HAL server.
 */
interface IBluetoothAudioOffload {

    /**
     * Indicates that the HAL client is connected to an A2DP Sink device
     * and is ready to stream audio. This function is also used to register
     * the BluetoothAudioHost interface and the provide the current negotiated
     * codec.
     *
     * |endSession| must be called to unregister the interface.
     *
     * @param hostIf interface used to request stream control
     * @param codecConfig Codec configuration as negotiated with the A2DP Sink
     *    device
     * @return status one of the following
     *    SUCCESS if HAL server successfully initializes the platform with the
     *        given codec configuration
     *    UNSUPPORTED_CODEC_CONFIGURATION if HAL server cannot initialize the
     *        platform with the given codec configuration
     *    FAILURE if HAL server cannot initialize the platform for any other
     *        reason
     */
    startSession(IBluetoothAudioHost hostIf, CodecConfiguration codecConfig) generates (Status status);

    /**
     * Updates status for start stream request. The HAL client may need
     * to communicate to Bluetooth Controller and remote Sink device, in which
     * case it must update with PENDING status. Once the operation is
     * completed, it must return with either SUCCESS or FAILURE.
     *
     * @param status SUCCESS, FAILURE or PENDING
     */
    oneway streamStarted(Status status);

    /**
     * Updates status for suspend stream request. The HAL client may need
     * to communicate to Bluetooth Controller and remote device, in which case
     * it must update with PENDING status. Once the operation is completed, it
     * must return with either SUCCESS or FAILURE.
     *
     * @param status SUCCESS, FAILURE or PENDING
     */
    oneway streamSuspended(Status status);

    /**
     * Ends the current A2DP offload session and unregisters the
     * BluetoothAudioHost interface.
     */
    oneway endSession();
};