Blame android/hardware/bt_av.h

Packit 34410b
/*
Packit 34410b
 * Copyright (C) 2012 The Android Open Source Project
Packit 34410b
 *
Packit 34410b
 * Licensed under the Apache License, Version 2.0 (the "License");
Packit 34410b
 * you may not use this file except in compliance with the License.
Packit 34410b
 * You may obtain a copy of the License at
Packit 34410b
 *
Packit 34410b
 *      http://www.apache.org/licenses/LICENSE-2.0
Packit 34410b
 *
Packit 34410b
 * Unless required by applicable law or agreed to in writing, software
Packit 34410b
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 34410b
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 34410b
 * See the License for the specific language governing permissions and
Packit 34410b
 * limitations under the License.
Packit 34410b
 */
Packit 34410b
Packit 34410b
#ifndef ANDROID_INCLUDE_BT_AV_H
Packit 34410b
#define ANDROID_INCLUDE_BT_AV_H
Packit 34410b
Packit 34410b
__BEGIN_DECLS
Packit 34410b
Packit 34410b
/* Bluetooth AV connection states */
Packit 34410b
typedef enum {
Packit 34410b
    BTAV_CONNECTION_STATE_DISCONNECTED = 0,
Packit 34410b
    BTAV_CONNECTION_STATE_CONNECTING,
Packit 34410b
    BTAV_CONNECTION_STATE_CONNECTED,
Packit 34410b
    BTAV_CONNECTION_STATE_DISCONNECTING
Packit 34410b
} btav_connection_state_t;
Packit 34410b
Packit 34410b
/* Bluetooth AV datapath states */
Packit 34410b
typedef enum {
Packit 34410b
    BTAV_AUDIO_STATE_REMOTE_SUSPEND = 0,
Packit 34410b
    BTAV_AUDIO_STATE_STOPPED,
Packit 34410b
    BTAV_AUDIO_STATE_STARTED,
Packit 34410b
} btav_audio_state_t;
Packit 34410b
Packit 34410b
Packit 34410b
/** Callback for connection state change.
Packit 34410b
 *  state will have one of the values from btav_connection_state_t
Packit 34410b
 */
Packit 34410b
typedef void (* btav_connection_state_callback)(btav_connection_state_t state, 
Packit 34410b
                                                    bt_bdaddr_t *bd_addr);
Packit 34410b
Packit 34410b
/** Callback for audiopath state change.
Packit 34410b
 *  state will have one of the values from btav_audio_state_t
Packit 34410b
 */
Packit 34410b
typedef void (* btav_audio_state_callback)(btav_audio_state_t state, 
Packit 34410b
                                               bt_bdaddr_t *bd_addr);
Packit 34410b
Packit 34410b
/** Callback for audio configuration change.
Packit 34410b
 *  Used only for the A2DP sink interface.
Packit 34410b
 *  state will have one of the values from btav_audio_state_t
Packit 34410b
 *  sample_rate: sample rate in Hz
Packit 34410b
 *  channel_count: number of channels (1 for mono, 2 for stereo)
Packit 34410b
 */
Packit 34410b
typedef void (* btav_audio_config_callback)(bt_bdaddr_t *bd_addr,
Packit 34410b
                                                uint32_t sample_rate,
Packit 34410b
                                                uint8_t channel_count);
Packit 34410b
Packit 34410b
/** BT-AV callback structure. */
Packit 34410b
typedef struct {
Packit 34410b
    /** set to sizeof(btav_callbacks_t) */
Packit 34410b
    size_t      size;
Packit 34410b
    btav_connection_state_callback  connection_state_cb;
Packit 34410b
    btav_audio_state_callback audio_state_cb;
Packit 34410b
    btav_audio_config_callback audio_config_cb;
Packit 34410b
} btav_callbacks_t;
Packit 34410b
Packit 34410b
/** 
Packit 34410b
 * NOTE:
Packit 34410b
 *
Packit 34410b
 * 1. AVRCP 1.0 shall be supported initially. AVRCP passthrough commands
Packit 34410b
 *    shall be handled internally via uinput 
Packit 34410b
 *
Packit 34410b
 * 2. A2DP data path shall be handled via a socket pipe between the AudioFlinger
Packit 34410b
 *    android_audio_hw library and the Bluetooth stack.
Packit 34410b
 * 
Packit 34410b
 */
Packit 34410b
/** Represents the standard BT-AV interface.
Packit 34410b
 *  Used for both the A2DP source and sink interfaces.
Packit 34410b
 */
Packit 34410b
typedef struct {
Packit 34410b
Packit 34410b
    /** set to sizeof(btav_interface_t) */
Packit 34410b
    size_t          size;
Packit 34410b
    /**
Packit 34410b
     * Register the BtAv callbacks
Packit 34410b
     */
Packit 34410b
    bt_status_t (*init)( btav_callbacks_t* callbacks );
Packit 34410b
Packit 34410b
    /** connect to headset */
Packit 34410b
    bt_status_t (*connect)( bt_bdaddr_t *bd_addr );
Packit 34410b
Packit 34410b
    /** dis-connect from headset */
Packit 34410b
    bt_status_t (*disconnect)( bt_bdaddr_t *bd_addr );
Packit 34410b
Packit 34410b
    /** Closes the interface. */
Packit 34410b
    void  (*cleanup)( void );
Packit 34410b
} btav_interface_t;
Packit 34410b
Packit 34410b
__END_DECLS
Packit 34410b
Packit 34410b
#endif /* ANDROID_INCLUDE_BT_AV_H */