Yongbing's Blog

A personal technical note.

Dissect Bluedroid From A2DP: Part v: Key Components

| Comments

1 Interface and implementation

bt_interface_t: Android defined, Bluedroid implemented as bluetoothInterface in external/bluetooth/bluedroid/btif/src/bluetooth.c: System control BT adapter.

btav_interface_t: Android defined, Bluedroid implemented as bt_av_interface in external/bluetooth/bluedroid/btif/src/btif_av.c: System control A2DP service.

audio_hw_device and audio_stream_out: Android defined, Bluedroid implemented in external/bluetooth/bluedroid/audio_a2dp_hw/audio_a2dp_hw.c: AudioFlinger use A2DP client as audio output device.

bt_vendor_interface_t: Bluedroid defined, BRCM implemented as BLUETOOTH_VENDOR_LIB_INTERFACE in device/common/libbt/src/bt_vendor_brcm.c: Bluedroid talk to BT char device driver, internal usage only.

tHCI_IF: Bluedroid defined, Bluedroid implemented as hci_h4_func_table in external/bluetooth/bluedroid/hci/src/hci_h4.c: Bluedroid HCI interface (data/cmd/evt in/out), internal usage only.

bt_hc_interface_t: Bluedroid defined, Bluedroid implemented as bluetoothHCLibInterface in external/bluetooth/bluedroid/hci/src/bt_hci_bdroid.c: Wrapper of tHCI_IF, has bt_hc_worker_thread to serialize downcoming HCI commands and read upcoming data/evt from HCI device.

L2CAP layer API, in external/bluetooth/bluedroid/stack/include/l2c_api.h, internal usage only.

LMP API, in external/bluetooth/bluedroid/stack/include/btm_api.h, internal usage only.

2 Tasks/Roles/Layers

btif_task, managing all messages being passed Android Bluetooth HAL and BTA.

btu_task, the main task of the Bluetooth Upper Layers unit, routing in/out BT cmd/event/data, processing timeout events.

bt_hc_worker_thread, HCI worker thread, all HCI traffic come through this thread.

userial_read_thread, monitoring incoming packets from BT char device driver, transfering these to bt_hc_worker_thread.

btif_media_task, task for A2DP SBC encoder.

uipc_read_task, A2DP server thread, receive audio input data from A2DP client, feed into btif_media_task.

UIPC/A2DP_CTRL_PATH/A2DP_DATA_PATH, socket based IPC, for A2DP client connect/control to A2DP server.

AVDT_CHAN_SIG/AVDT_CHAN_MEDIA/AVDT_CHAN_REPORT, A2DP channels, communicate with remote device.

Serial Finished.

Reference:

Comments