LE Audio Manager
This document aims to guide developers on how to use the LE audio manager.
The chapter LE Audio Manager Introduction describes the LE audio library.
The chapter LE Audio Manager Initialization describes how to initialize the LE audio library.
The chapter LE Audio Samples describes the LE audio samples based on the LE audio library.
LE Audio Manager Introduction
The functions of the LE audio manager are provided by the LE audio library. The library directory and header files directory are shown as follows.
IC Type |
Library Directory |
Header Files Directory |
---|---|---|
RTL87x3E |
|
|
RTL87x3D |
|
|
RTL87x3EP |
|
If APP wants to use the LE audio manager, the leaudio.lib
shall be included in the project as shown in the following figure.
LE Audio Manager Initialization
ble_audio_init()
is used to initialize the LE audio library.The initialization sample code is shown below:
void app_lea_profile_init(void) { gatt_svc_init(GATT_SVC_USE_EXT_SERVER, MAX_BLE_SRV_NUM); T_BLE_AUDIO_PARAMS ble_audio_param = {0}; ble_audio_param.evt_queue_handle = app_evt_queue_handle; ble_audio_param.io_queue_handle = app_io_queue_handle; ble_audio_param.bt_gatt_client_init = (GATT_CLIENT_DISCOV_MODE_REG_SVC_BIT | GATT_CLIENT_DISCOV_MODE_CCCD_STORAGE_BIT | GATT_CLIENT_DISCOV_MODE_USE_EXT_CLIENT); ble_audio_param.acl_link_num = APP_MAX_BLE_LINK_NUM; ble_audio_param.io_event_type = IO_MSG_TYPE_LE_AUDIO; ble_audio_init(&ble_audio_param); app_lea_acc_vc_mic_init(); app_lea_acc_bap_init(); app_lea_cap_init(); app_lea_audio_data_init(); }
ble_audio_handle_gap_msg()
andble_audio_handle_gap_cb()
are used to handle message.GAP message and callback handling functions are shown below:
void app_handle_gap_msg(T_IO_MSG *p_gap_msg) { T_LE_GAP_MSG gap_msg; uint8_t conn_id; memcpy(&gap_msg, &p_gap_msg->u.param, sizeof(p_gap_msg->u.param)); ...... ble_audio_handle_gap_msg(p_gap_msg->subtype, gap_msg); } T_APP_RESULT app_gap_callback(uint8_t cb_type, void *p_cb_data) { T_APP_RESULT result = APP_RESULT_SUCCESS; T_LE_CB_DATA *p_data = (T_LE_CB_DATA *)p_cb_data; ble_audio_handle_gap_cb(cb_type, p_cb_data); ...... }
ble_audio_handle_gap_msg()
is used to handle GAP messages.ble_audio_handle_gap_cb()
is used to handle GAP callback messages.ble_audio_handle_msg()
is used to handleIO_MSG_TYPE_LE_AUDIO
messages.IO message handling function is shown below:
void app_handle_io_msg(T_IO_MSG io_msg) { uint16_t msg_type = io_msg.type; uint8_t rx_char; switch (msg_type) { case IO_MSG_TYPE_LE_AUDIO: { ble_audio_handle_msg(&io_msg); } break; ...... default: break; } }
ble_audio_cback_register()
is used to register LE audio callback function.LE audio callback handling sample is shown below:
uint16_t app_lea_ini_cap_handle_msg(T_LE_AUDIO_MSG msg, void *buf) { uint16_t cb_result = BLE_AUDIO_CB_RESULT_SUCCESS; T_APP_LE_LINK *p_link = NULL; switch (msg) { case LE_AUDIO_MSG_CAP_DIS_DONE: { ...... } break; default: break; } return cb_result; } void app_lea_ini_cap_init(void) { ...... ble_audio_cback_register(app_lea_ini_cap_handle_msg); }
LE Audio Samples
CAP defines the roles of the Acceptor, Initiator, and Commander. SDK provides a corresponding demo application for the developer’s reference in development.
Acceptor Role
Can transmit and receive unicast audio streams.
Can receive broadcast audio streams.
Can scan for broadcast audio streams.
Can delegate scanning for broadcast audio streams to a commander.
Demo application: LE Audio CAP Acceptor.
Commander Role
Can request acceptors to start or stop reception of broadcast audio streams transmitted by an initiator.
Can control the mute state and/or the volume of the audio rendered by acceptors.
Can control the mute state and/or signal level of a microphone on acceptors.
Can coordinate a set of acceptors and discover acceptors that are members of a coordinated set.
Demo application: LE Audio CAP Commander.
Initiator Role
Can transmit and receive unicast audio streams.
Can transmit broadcast audio streams.
Provides Broadcast_Codes for encrypted broadcast audio streams.
Can coordinate a set of acceptors and discover acceptors that are members of a coordinated set.
Demo application: LE Audio CAP Initiator.
Supported Components
The table below lists the supported components for each LE audio sample project. The components are separated by Macros.
Component |
Macro |
GAP Role |
LE Audio CAP Acceptor |
LE Audio CAP Commander |
LE Audio CAP Initiator |
---|---|---|---|---|---|
BAP Unicast Client |
BAP_UNICAST_CLIENT |
GAP Central |
√ |
||
BAP Unicast Server |
BAP_UNICAST_SERVER |
GAP Peripheral |
√ |
||
BAP Broadcast Source |
BAP_BROADCAST_SOURCE |
GAP Broadcaster |
√ |
||
BAP Broadcast Sink |
BAP_BROADCAST_SINK |
GAP Peripheral GAP Observer |
√ |
||
BAP Broadcast Assistant |
BAP_BROADCAST_ASSISTANT |
GAP Central GAP Observer |
√ |
√ |
|
BAP Scan Delegator |
BAP_SCAN_DELEGATOR |
GAP Peripheral |
√ |
||
VCP Volume Controller |
VCP_VOLUME_CONTROLLER |
GAP Central |
√ |
√ |
|
VCP Volume Renderer |
VCP_VOLUME_RENDERER |
GAP Peripheral |
√ |
||
MICP Microphone Controller |
MICP_MIC_CONTROLLER |
GAP Central |
√ |
√ |
|
MICP Microphone Device |
MICP_MIC_DEVICE |
GAP Peripheral |
√ |
||
CCP Call Control Server |
CCP_CALL_CONTROL_SERVER |
GAP Central |
√ |
||
CCP Call Control Client |
CCP_CALL_CONTROL_CLIENT |
GAP Peripheral |
√ |
||
MCP Media Control Server |
MCP_MEDIA_CONTROL_SERVER |
GAP Central |
√ |
||
MCP Media Control Client |
MCP_MEDIA_CONTROL_CLIENT |
GAP Peripheral |
√ |
||
CSIP Set Coordinator |
CSIP_SET_COORDINATOR |
GAP Central |
√ |
√ |
|
CSIP Set Member |
CSIP_SET_MEMBER |
GAP Peripheral |
√ |