DM BT APIs
重要
The DM BT API v1.0 is the lastest stable DM BT APIs. All new applications should use DM BT API v1.0.
DM BT API Categories
Most of DM BT APIs can be categoried as:
- Interface specific DM BT APIs:
BT common interface
BT A2DP Sink interface
Application Example
Check projects/lvgl/soundbar folder, which contains the following application:
There is a A2DP sink client demo. This demo can be discovered and connected by A2DP source device and receive the audio stream from remote device
API Reference
Header File
Functions
-
bt_err_t bk_bt_gap_set_event_callback(bt_event_cb_t func)
sets BT event callback function
- 参数
func – [in] : callback
- 返回
BK_ERR_BT_SUCCESS : Succeed
BK_ERR_BT_FAIL: others
-
bt_err_t bk_bt_gap_linkkey_reply(uint8_t is_exist, bk_bt_linkkey_storage_t *key)
send linkkey when peer need authentication
- Attention
key->addr must be valued
- 参数
is_exist – [in] : if linkkey exist. If no exist, peer may trigger pair procedure
key – [in] : linkkey,
- 返回
BK_ERR_BT_SUCCESS : Succeed
BK_ERR_BT_FAIL: others
-
bt_err_t bk_bt_gap_set_visibility(bk_bt_conn_mode_t conn_mode, bk_bt_disc_mode_t disc_mode)
sets the Bluetooth connectable, discoverable
- 参数
conn_mode – [in] : one of the enums of bk_bt_conn_mode_t
disc_mode – [in] : one of the enums of bk_bt_disc_mode_t
- 返回
BK_ERR_BT_SUCCESS : Succeed
BK_ERR_BT_FAIL: others
-
bt_err_t bk_bt_gap_set_device_class(uint32_t cod)
set the class of device
参见
enum common_cod_t)
- 参数
cod, : – [in] Class of Device for the device(
- 返回
BK_ERR_BT_SUCCESS: succeed
others: fail
-
bt_err_t bk_bt_gap_set_local_name(uint8_t *name, uint8_t len)
set the local name
- 参数
name, : – [in] pointer of name
len, : – [in] the length of name
- 返回
BK_ERR_BT_SUCCESS: succeed
others: fail
-
bk_err_t bk_bt_gap_start_discovery(bk_bt_inq_mode_t mode, uint8_t inq_len, uint8_t num_rsps)
This function starts Inquiry and Name Discovery. This function should be called after esp_bluedroid_enable() completes successfully. When Inquiry is halted and cached results do not contain device name, then Name Discovery will connect to the peer target to get the device name. bk_bt_gap_cb_t will be called with BK_DM_BT_GAP_DISC_STATE_CHANGED_EVT when Inquiry is started or Name Discovery is completed. bk_bt_gap_cb_t will be called with BK_DM_BT_GAP_DISC_RES_EVT each time the two types of discovery results are got.
- 参数
mode – [in] - Inquiry mode
inq_len – [in] - Inquiry duration in 1.28 sec units, ranging from 0x01 to 0x30. This parameter only specifies the total duration of the Inquiry process,
when this time expires, Inquiry will be halted.
num_rsps – [in] - Number of responses that can be received before the Inquiry is halted, value 0 indicates an unlimited number of responses.
- 返回
BK_ERR_BT_SUCCESS : Succeed
others: fail
-
bt_err_t bk_bt_gap_cancel_discovery(void)
Cancel Inquiry and Name Discovery. This function should be called after esp_bluedroid_enable() completes successfully. bt_event_cb_t will be called with BK_DM_BT_GAP_DISC_STATE_CHANGED_EVT if Inquiry or Name Discovery is cancelled by calling this function.
- 返回
BK_ERR_BT_SUCCESS : Succeed
others: fail
-
bt_err_t bk_bt_a2dp_sink_init(uint8_t aac_supported)
Initialize the bluetooth A2DP sink module.
- Attention
sink/source must init only one.
- 参数
aac_supported, : – [in] 1 means aac is supported, 0 means aac is not supported.
- 返回
BK_ERR_BT_SUCCESS: the initialization request is successfully
others: fail
-
bt_err_t bk_bt_a2dp_sink_deinit(void)
Deinitialize the bluetooth A2DP sink module.
- Attention
sink/source must inited before.
- 返回
BK_ERR_BT_SUCCESS: the deinitialization request is successfully
others: fail
-
bt_err_t bk_bt_a2dp_register_callback(bk_bt_a2dp_cb_t callback)
Register application callback function to A2DP module. used by both A2DP source and sink.
- Attention
this function must call after sink or source init
- 参数
callback, : – [in] A2DP event callback function
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_a2dp_sink_register_data_callback(bk_bt_sink_data_cb_t callback)
Register A2DP sink data output function;.
- 参数
callback, : – [in] A2DP sink data callback function
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_a2dp_sink_connect(uint8_t *remote_bda)
Connect to remote bluetooth A2DP source device. This API must be called after bk_bt_a2dp_sink_init().
- 参数
remote_bda, : – [in] remote bluetooth device address
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_a2dp_sink_disconnect(uint8_t *remote_bda)
Disconnect from the remote A2DP source device. This API must be called after bk_bt_a2dp_sink_init().
- 参数
remote_bda, : – [in] remote bluetooth device address
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_avrcp_ct_init(void)
Initialize the bluetooth AVRCP controller module.
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_avrcp_ct_deinit(void)
Deinitialize the bluetooth AVRCP controller module.
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_avrcp_ct_register_callback(bk_avrcp_ct_cb_t callback)
Register application callbacks to AVRCP module.
- 参数
callback, : – [in] AVRCP controller callback function
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_avrcp_ct_send_get_rn_capabilities_cmd(uint8_t *remote_bda)
Send GetCapabilities PDU to AVRCP target to retrieve remote device’s supported notification event_ids. This function should be called after BK_AVRCP_CT_CONNECTION_STATE_EVT is received and AVRCP connection is established.
- 参数
remote_bda, : – [in] remote bluetooth device address
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_ct_send_register_notification_cmd(uint8_t *remote_bda, uint8_t event_id, uint32_t event_parameter)
Send register notification command to AVRCP target. This function should be called after BK_AVRCP_CT_CONNECTION_STATE_EVT is received and AVRCP connection is established.
- 参数
remote_bda, : – [in] remote bluetooth device address
event_id – [in] : id of events, e.g. BK_AVRCP_RN_PLAY_STATUS_CHANGE, BK_AVRCP_RN_TRACK_CHANGE, etc.
event_parameter – [in] : playback interval for BK_AVRCP_RN_PLAY_POS_CHANGED; For other events , value of this parameter is ignored.
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_avrcp_ct_send_passthrough_cmd(uint8_t *remote_bda, uint8_t key_code, uint8_t key_state)
Send passthrough command to AVRCP target. This function should be called after BK_AVRCP_CT_CONNECTION_STATE_EVT is received and AVRCP connection is established.
- 参数
remote_bda, : – [in] remote bluetooth device address.
key_code – [in] : passthrough command code, e.g. BK_AVRCP_PT_CMD_PLAY, BK_AVRCP_PT_CMD_STOP, etc.
key_state – [in] : passthrough command key state, BK_AVRCP_PT_CMD_STATE_PRESSED or BK_AVRCP_PT_CMD_STATE_RELEASED
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_avrcp_tg_init(void)
Initialize the bluetooth AVRCP target module.
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_avrcp_tg_deinit(void)
Deinitialize the bluetooth AVRCP target module.
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_avrcp_tg_register_callback(bk_avrcp_tg_cb_t callback)
Register application callbacks to AVRCP target module.
- 参数
callback, : – [in] AVRCP target callback function
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_avrcp_tg_get_rn_evt_cap(bk_avrcp_rn_cap_api_method_t cap, bk_avrcp_rn_evt_cap_mask_t *evt_set)
Get the requested event notification capabilies on local AVRC target. The capability is returned in a bit mask representation in evt_set. This function should be called after bk_avrcp_tg_init().
For capability type "BK_AVRCP_RN_CAP_API_METHOD_ALLOWED, the retrieved event set is constant and it covers all of the notification events that can possibly be supported with current implementation. For capability type BK_AVRCP_RN_CAP_API_METHOD_CURRENT_ENABLE, the event set covers the notification events selected to be supported under current configuration, The configuration can be changed using bk_avrcp_tg_set_rn_evt_cap().
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_avrcp_tg_set_rn_evt_cap(const bk_avrcp_rn_evt_cap_mask_t *evt_set)
Set the event notification capabilities on local AVRCP target. The capability is given in a bit mask representation in evt_set and must be a subset of allowed event IDs with current implementation. This function should be called after bk_avrcp_tg_init().
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_avrcp_tg_send_rn_rsp(uint8_t *addr, bk_avrcp_rn_event_ids_t event_id, bk_avrcp_rn_rsp_t rsp, bk_avrcp_rn_param_t *param)
Send RegisterNotification Response to remote AVRCP controller. Local event notification capability can be set using bk_avrcp_tg_set_rn_evt_cap(), in a bit mask representation in evt_set. This function should be called after bk_avrcp_tg_init().
- 参数
addr, : – [in] peer addr
event_id, : – [in] notification event ID that remote AVRCP CT registers
rsp, : – [in] notification response code
param, : – [in] parameters included in the specific notification
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_avrcp_connect(uint8_t *remote_bda)
Connect to remote bluetooth AVRCP. This API must be called after bk_bt_avrcp_ct_init() or bk_bt_avrcp_tg_init.
- 参数
remote_bda, : – [in] remote bluetooth device address
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_a2dp_source_init(void)
Initialize the bluetooth A2DP source module. A2DP can work independently.
- Attention
sink/source must init only one.
- 返回
BK_ERR_BT_SUCCESS: if the initialization request is sent to lower layer successfully
others: fail
-
bk_err_t bk_a2dp_source_register_data_callback(bk_a2dp_source_data_cb_t callback)
Register A2DP source data input function. For now, the input should be PCM data stream.
- 参数
callback, : – [in] A2DP source data callback function
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bk_err_t bk_a2dp_source_set_pcm_data_format(uint32_t sample_rate, uint8_t bit_depth, uint8_t channel_count)
set a2dp source data format
- 参数
sample_rate, : – [in] pcm data sample rate, such as 8000 16000 32000 44100 48000.
bit_depth – [in] : pcm data bit depth, now support 16 bits only.
channel_count – [in] : pcm data channel count, support 1 or 2 now.
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_a2dp_source_connect(uint8_t *addr)
Connect to remote A2DP sink device. This API must be called after bk_bt_a2dp_source_init()
- 参数
addr, : – [in] remote bluetooth device address
- 返回
BK_ERR_BT_SUCCESS: connect request is sent to lower layer successfully
others: fail
-
bt_err_t bk_bt_a2dp_source_disconnect(uint8_t *addr)
Disconnect from the remote A2DP sink device. This API must be called after bk_bt_a2dp_source_init()
- 参数
addr, : – [in] remote bluetooth device address
- 返回
- BK_ERR_BT_SUCCESS: connect request is sent to lower layer successfully - others: fail
-
bt_err_t bk_a2dp_media_ctrl(bk_a2dp_media_ctrl_t ctrl)
Media control commands. This API can be used for both A2DP sink and must be called after bk_bt_a2dp_source_init()
- Attention
this function only used for a2dp source
- 参数
ctrl, : – [in] control commands for A2DP action
- 返回
BK_ERR_BT_SUCCESS: control command is sent to lower layer successfully
others: fail
-
bt_err_t bk_bt_spp_init(bt_spp_event_notify_cb_t bt_spp_event_notify_cb)
Initialize the bluetooth SPP module.
- Attention
this function only used for SPP
- 参数
bt_spp_event_notify_cb, : – [in] SPP event callback function
- 返回
BK_ERR_BT_SUCCESS: control command is sent to lower layer successfully
others: fail
-
bt_err_t bk_bt_spp_start(uint32_t *spp_handle, uint8_t *local_server_channel, uint32_t *spp_record_handle)
Start the bluetooth SPP server.
- Attention
this function only used for SPP
- 参数
spp_handle, : – [out] the handle of the server.
local_server_channel, : – [out] the server channle.
spp_record_handle, : – [out] the db record handle
- 返回
BK_ERR_BT_SUCCESS: control command is sent to lower layer successfully
others: fail
-
bt_err_t bk_bt_spp_tx(uint32_t spp_handle, char *data, uint16_t len)
send spp data.
- Attention
this function only used for SPP
- 参数
spp_handle, : – [in] the handle of the server.
data, : – [in] the data buffer addr.
len, : – [in] the data len.
- 返回
BK_ERR_BT_SUCCESS: control command is sent to lower layer successfully
others: fail
-
bt_err_t bk_bt_disconnect_link(uint8_t *addr)
This API can be used to disconnect the acl link.
- 参数
addr, : – [in] remote bluetooth device address
- 返回
- BK_ERR_BT_SUCCESS: disconnect request is sent to lower layer successfully - others: fail
-
bt_err_t bk_bt_create_connection_cancel(uint8_t *addr)
This API can be used to request cancellation of the ongoing connection creation process.
- 参数
addr, : – [in] remote bluetooth device address
- 返回
- BK_ERR_BT_SUCCESS: cancel request is sent to lower layer successfully - others: fail
-
bt_err_t bk_bt_set_page_timeout(uint16_t timeout)
This api can be used to set the value for the Page_Timeout configuration parameter.
- 参数
timeout, : – [in] Page Timeout measured in number of Baseband slots, unit of 0.625ms
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
-
bt_err_t bk_bt_set_page_scan_activity(uint16_t interval, uint16_t window)
This api can be used to set the value for the Page_Scan_Interval and Page_Scan_Window configuration parameters.
- 参数
interval, : – [in] defines the amount of time between consecutive page scans, unit of 0.625ms,(Range: 0x0012 to 0x1000, only even values are valid)
window, : – [in] defines the amount of time for the duration of the page scan, unit of 0.625ms,(Range: 0x0011 to 0x1000, can only be less than or equal to the Page_Scan_Interval)
- 返回
BK_ERR_BT_SUCCESS: success
others: fail
API Typedefs
Header File
Unions
-
union bk_a2dp_cb_param_t
- #include <dm_bt_types.h>
A2DP state callback parameters.
Public Members
-
struct bk_a2dp_cb_param_t::a2dp_conn_state_param conn_state
A2DP connection status
-
struct bk_a2dp_cb_param_t::a2dp_audio_state_param audio_state
audio stream playing state
-
struct bk_a2dp_cb_param_t::a2dp_audio_cfg_param audio_cfg
media codec configuration information
-
struct bk_a2dp_cb_param_t::a2dp_audio_source_cfg_param audio_source_cfg
media codec configuration information
-
struct a2dp_audio_cfg_param
- #include <dm_bt_types.h>
BK_A2DP_AUDIO_CFG_EVT.
Public Members
-
uint8_t remote_bda[6]
remote bluetooth device address
-
bk_a2dp_mcc_t mcc
A2DP media codec capability information
-
uint8_t remote_bda[6]
-
struct a2dp_audio_source_cfg_param
- #include <dm_bt_types.h>
BK_A2DP_AUDIO_SOURCE_CFG_EVT.
Public Members
-
uint8_t remote_bda[6]
remote bluetooth device address
-
uint16_t mtu
-
bk_a2dp_mcc_t mcc
max payload len, only used in source A2DP media codec capability information
-
uint8_t remote_bda[6]
-
struct a2dp_audio_state_param
- #include <dm_bt_types.h>
BK_A2DP_AUDIO_STATE_EVT.
Public Members
-
bk_a2dp_audio_state_t state
one of the values from bk_a2dp_audio_state_t
-
uint8_t remote_bda[6]
remote bluetooth device address
-
bk_a2dp_audio_state_t state
-
struct a2dp_conn_state_param
- #include <dm_bt_types.h>
BK_A2DP_CONNECTION_STATE_EVT.
Public Members
-
bk_a2dp_connection_state_t state
one of values from bk_a2dp_connection_state_t
-
uint8_t remote_bda[6]
remote bluetooth device address
-
bk_a2dp_disc_rsn_t disc_rsn
reason of disconnection for “DISCONNECTED”
-
bk_a2dp_connection_state_t state
-
struct bk_a2dp_cb_param_t::a2dp_conn_state_param conn_state
-
union bk_bt_gap_cb_param_t
- #include <dm_bt_types.h>
GAP state callback parameters.
Public Members
-
struct bk_bt_gap_cb_param_t::disc_res_param disc_res
discovery result parameter struct
-
struct bk_bt_gap_cb_param_t::disc_state_changed_param disc_st_chg
discovery state changed parameter struct
-
struct bk_bt_gap_cb_param_t::auth_cmpl_param auth_cmpl
authentication complete parameter struct
-
struct bk_bt_gap_cb_param_t::acl_conn_cmpl_stat_param acl_conn_cmpl_stat
ACL connection complete status parameter struct
-
struct bk_bt_gap_cb_param_t::acl_disconn_cmpl_stat_param acl_disconn_cmpl_stat
ACL disconnection complete status parameter struct
-
struct acl_conn_cmpl_stat_param
- #include <dm_bt_types.h>
BK_DM_GAP_ACL_CONN_CMPL_STAT_EVT.
-
struct acl_disconn_cmpl_stat_param
- #include <dm_bt_types.h>
BK_DM_BT_GAP_ACL_DISCONN_CMPL_STAT_EVT.
-
struct auth_cmpl_param
- #include <dm_bt_types.h>
BK_DM_BT_GAP_AUTH_CMPL_EVT.
-
struct disc_res_param
- #include <dm_bt_types.h>
BK_DM_BT_GAP_DISC_RES_EVT.
Public Members
-
uint8_t bda[6]
remote bluetooth device address
-
int num_prop
number of properties got
-
bk_bt_gap_dev_prop_t *prop
properties discovered from the new device
-
uint8_t bda[6]
-
struct disc_state_changed_param
- #include <dm_bt_types.h>
BK_DM_BT_GAP_DISC_STATE_CHANGED_EVT.
Public Members
-
bk_bt_gap_discovery_state_t state
discovery state
-
bk_bt_gap_discovery_state_t state
-
struct bk_bt_gap_cb_param_t::disc_res_param disc_res
-
union bk_avrcp_rn_param_t
- #include <dm_bt_types.h>
AVRCP notification parameters.
Public Members
-
uint8_t volume
response data for BK_AVRCP_RN_VOLUME_CHANGE, ranges 0..127
-
bk_avrcp_playback_stat_t playback
response data for BK_AVRCP_RN_PLAY_STATUS_CHANGE
-
uint8_t elm_id[8]
response data for BK_AVRCP_RN_TRACK_CHANGE
-
uint32_t play_pos
response data for BK_AVRCP_RN_PLAY_POS_CHANGED, in millisecond
-
bk_avrcp_batt_stat_t batt
response data for BK_AVRCP_RN_BATTERY_STATUS_CHANGE
-
uint8_t volume
-
union bk_avrcp_ct_cb_param_t
- #include <dm_bt_types.h>
AVRCP controller callback parameters.
Public Members
-
struct bk_avrcp_ct_cb_param_t::avrcp_ct_conn_state_param conn_state
AVRCP connection status
-
struct bk_avrcp_ct_cb_param_t::avrcp_ct_change_notify_param change_ntf
notifications
-
struct bk_avrcp_ct_cb_param_t::avrcp_ct_get_rn_caps_rsp_param get_rn_caps_rsp
get supported event capabilities response from AVRCP target
-
struct avrcp_ct_change_notify_param
- #include <dm_bt_types.h>
BK_AVRCP_CT_CHANGE_NOTIFY_EVT.
Public Members
-
uint8_t event_id
id of AVRCP event notification
-
bk_avrcp_rn_param_t event_parameter
event notification parameter
-
uint8_t event_id
-
struct avrcp_ct_conn_state_param
- #include <dm_bt_types.h>
BK_AVRCP_CT_CONNECTION_STATE_EVT.
-
struct avrcp_ct_get_rn_caps_rsp_param
- #include <dm_bt_types.h>
BK_AVRCP_CT_GET_RN_CAPABILITIES_RSP_EVT.
Public Members
-
uint8_t cap_count
number of items provided in event or company_id according to cap_id used
-
bk_avrcp_rn_evt_cap_mask_t evt_set
supported event_ids represented in bit-mask
-
uint8_t cap_count
-
struct bk_avrcp_ct_cb_param_t::avrcp_ct_conn_state_param conn_state
-
union bk_avrcp_tg_cb_param_t
- #include <dm_bt_types.h>
AVRC target callback parameters.
Public Members
-
struct bk_avrcp_tg_cb_param_t::avrcp_tg_conn_stat_param conn_stat
AVRC connection status
-
struct bk_avrcp_tg_cb_param_t::avrcp_tg_psth_cmd_param psth_cmd
passthrough command
-
struct bk_avrcp_tg_cb_param_t::avrcp_tg_set_abs_vol_param set_abs_vol
set absolute volume command targeted on audio sink
-
struct bk_avrcp_tg_cb_param_t::avrcp_tg_reg_ntf_param reg_ntf
register notification
-
struct avrcp_tg_conn_stat_param
- #include <dm_bt_types.h>
BK_AVRCP_TG_CONNECTION_STATE_EVT.
-
struct avrcp_tg_psth_cmd_param
- #include <dm_bt_types.h>
BK_AVRCP_TG_PASSTHROUGH_CMD_EVT.
-
struct avrcp_tg_reg_ntf_param
- #include <dm_bt_types.h>
BK_AVRCP_TG_REGISTER_NOTIFICATION_EVT.
-
struct bk_avrcp_tg_cb_param_t::avrcp_tg_conn_stat_param conn_stat
Structures
-
struct bk_a2dp_mcc_t
A2DP media codec capabilities union.
Public Members
-
uint8_t type
A2DP media codec type
-
struct bk_a2dp_mcc_t::[anonymous]::[anonymous] sbc_codec
SBC codec capabilities.
-
struct bk_a2dp_mcc_t::[anonymous]::[anonymous] aac_codec
MPEG-2, 4 AAC codec capabilities.
-
union bk_a2dp_mcc_t::[anonymous] cie
A2DP codec information element
-
uint8_t type
-
struct bk_bt_gap_dev_prop_t
Bluetooth Device Property Descriptor.
Public Members
-
bk_bt_gap_dev_prop_type_t type
Device property type
-
int len
Device property value length
-
void *val
Device property value
-
bk_bt_gap_dev_prop_type_t type
-
struct bk_bt_linkkey_storage_t
bt link key storage
Type Definitions
-
typedef int32_t (*bk_a2dp_source_data_cb_t)(uint8_t *buf, int32_t len)
A2DP source data read callback function.
- Param buf
[in] : buffer to be filled with PCM data stream from higher layer
- Param len
[in] : size(in bytes) of data block to be copied to buf. -1 is an indication to user that data buffer shall be flushed
- Return
size of bytes read successfully, if the argument len is -1, this value is ignored.
-
typedef void (*bk_bt_a2dp_cb_t)(bk_a2dp_cb_event_t event, bk_a2dp_cb_param_t *param)
A2DP profile callback function type.
- Param event
: Event type
- Param param
: Pointer to callback parameter
-
typedef void (*bk_bt_sink_data_cb_t)(const uint8_t *buf, uint16_t len)
A2DP sink data callback function.
- Param buf
[in] : pointer to the data received from A2DP source device
- Param len
[in] : size(in bytes) in buf
-
typedef void (*bk_avrcp_ct_cb_t)(bk_avrcp_ct_cb_event_t event, bk_avrcp_ct_cb_param_t *param)
AVRCP controller callback function type.
- Param event
: Event type
- Param param
: Pointer to callback parameter union
-
typedef void (*bk_avrcp_tg_cb_t)(bk_avrcp_tg_cb_event_t event, bk_avrcp_tg_cb_param_t *param)
AVRCP target callback function type.
- Param event
: Event type
- Param param
: Pointer to callback parameter union
-
typedef uint32_t (*bt_event_cb_t)(bt_event_enum_t event, void *param)
for async dm_bt api event.
bt event report.
- Param event, :
event id. see bt_event_enum_t
param: param
-
typedef uint16_t (*bt_spp_event_notify_cb_t)(uint32_t spp_handle, uint8_t spp_event, uint16_t status, void *data, uint16_t data_length)
Application should register a callback through the API bk_bt_spp_init.
- Param spp_handle, :
[in] Handle associates a SPP connection to a remote SPP device.
- Param spp_event, :
[in] Event indicated to application by bk_spp_cb_event_t.
- Param status, :
[in] The status of the event.
- Param data, :
[in] Pointer to the array containing the parameters associated with the event.
- Param data_length, :
[in] Length of the parameters associated with the event.
- Return
0x00.
Enumerations
-
enum bk_bt_conn_mode_t
Discoverability and Connectability mode.
Values:
-
enumerator BK_BT_NON_CONNECTABLE
Non-connectable
-
enumerator BK_BT_CONNECTABLE
Connectable
-
enumerator BK_BT_NON_CONNECTABLE
-
enum bk_bt_disc_mode_t
Values:
-
enumerator BK_BT_NON_DISCOVERABLE
Non-discoverable
-
enumerator BK_BT_DISCOVERABLE
Discoverable
-
enumerator BK_BT_NON_DISCOVERABLE
-
enum bk_bt_inq_mode_t
Inquiry Mode
Values:
-
enumerator BK_BT_INQ_MODE_GENERAL_INQUIRY
General inquiry mode
-
enumerator BK_BT_INQ_MODE_GENERAL_INQUIRY
-
enum bk_a2dp_cb_event_t
A2DP callback events.
Values:
-
enumerator BK_A2DP_CONNECTION_STATE_EVT
connection state changed event
-
enumerator BK_A2DP_AUDIO_STATE_EVT
audio stream transmission state changed event
-
enumerator BK_A2DP_AUDIO_CFG_EVT
audio codec is configured, only used for A2DP SINK
-
enumerator BK_A2DP_AUDIO_SOURCE_CFG_EVT
audio codec is configured, only used for A2DP SOURCE
-
enumerator BK_A2DP_CONNECTION_STATE_EVT
-
enum bk_a2dp_connection_state_t
Bluetooth A2DP connection states.
Values:
-
enumerator BK_A2DP_CONNECTION_STATE_DISCONNECTED
connection released
-
enumerator BK_A2DP_CONNECTION_STATE_CONNECTING
connecting remote device
-
enumerator BK_A2DP_CONNECTION_STATE_CONNECTED
connection established
-
enumerator BK_A2DP_CONNECTION_STATE_DISCONNECTING
disconnecting remote device
-
enumerator BK_A2DP_CONNECTION_STATE_DISCONNECTED
-
enum bk_a2dp_disc_rsn_t
Bluetooth A2DP disconnection reason.
Values:
-
enumerator BK_A2DP_DISC_RSN_NORMAL
Finished disconnection that is initiated by local or remote device
-
enumerator BK_A2DP_DISC_RSN_ABNORMAL
Abnormal disconnection caused by signal loss
-
enumerator BK_A2DP_DISC_RSN_NORMAL
-
enum bk_a2dp_audio_state_t
Bluetooth A2DP datapath states.
Values:
-
enumerator BK_A2DP_AUDIO_STATE_SUSPEND
audio stream datapath suspend
-
enumerator BK_A2DP_AUDIO_STATE_STARTED
audio stream datapath started
-
enumerator BK_A2DP_AUDIO_STATE_SUSPEND
-
enum bk_a2dp_media_ctrl_t
A2DP media control commands.
Values:
-
enumerator BK_A2DP_MEDIA_CTRL_START
command to set up media transmission channel
-
enumerator BK_A2DP_MEDIA_CTRL_SUSPEND
command to suspend media transmission
-
enumerator BK_A2DP_MEDIA_CTRL_START
-
enum bk_bt_gap_dev_prop_type_t
Bluetooth Device Property type.
Values:
-
enumerator BK_BT_GAP_DEV_PROP_BDNAME
Bluetooth device name, value type is int8_t []
-
enumerator BK_BT_GAP_DEV_PROP_COD
Class of Device, value type is uint32_t
-
enumerator BK_BT_GAP_DEV_PROP_RSSI
Received Signal strength Indication, value type is int8_t, ranging from -128 to 127
-
enumerator BK_BT_GAP_DEV_PROP_EIR
Extended Inquiry Response, value type is uint8_t []
-
enumerator BK_BT_GAP_DEV_PROP_BDNAME
-
enum bk_bt_gap_discovery_state_t
Bluetooth Device Discovery state
Values:
-
enumerator BK_BT_GAP_DISCOVERY_STOPPED
Device discovery stopped
-
enumerator BK_BT_GAP_DISCOVERY_STARTED
Device discovery started
-
enumerator BK_BT_GAP_DISCOVERY_STOPPED
-
enum bt_event_enum_t
Values:
-
enumerator BK_DM_BT_EVENT_STACK_OK
bt stack init ok, param NULL
-
enumerator BK_DM_BT_EVENT_INQUIRY_RESULT
inquiry result, not used now
-
enumerator BK_DM_BT_EVENT_DISCONNECT
disconnect completed, param addr
-
enumerator BK_DM_BT_EVENT_CONNECTION_COMPLETE
connection completed, param addr
-
enumerator BK_DM_BT_EVENT_LINKKEY_NOTIFY
recv cb when pair success and get link key, param bk_bt_linkkey_storage_t
-
enumerator BK_DM_BT_EVENT_LINKKEY_REQ
recv cb when peer need user to input link key, param bd_addr_t
Device discovery result event, param bk_bt_gap_cb_param_t
-
enumerator BK_DM_BT_GAP_DISC_RES_EVT
Discovery state changed event, param bk_bt_gap_cb_param_t
-
enumerator BK_DM_BT_GAP_DISC_STATE_CHANGED_EVT
Authentication complete event, param bk_bt_gap_cb_param_t
-
enumerator BK_DM_BT_GAP_AUTH_CMPL_EVT
-
enumerator BK_DM_BT_EVENT_STACK_OK
-
enum bk_avrcp_rn_event_ids_t
AVRCP event notification ids.
Values:
-
enumerator BK_AVRCP_RN_PLAY_STATUS_CHANGE
track status change, eg. from playing to paused
-
enumerator BK_AVRCP_RN_TRACK_CHANGE
new track is loaded
-
enumerator BK_AVRCP_RN_TRACK_REACHED_END
current track reached end
-
enumerator BK_AVRCP_RN_TRACK_REACHED_START
current track reached start position
-
enumerator BK_AVRCP_RN_PLAY_POS_CHANGED
track playing position changed
-
enumerator BK_AVRCP_RN_BATTERY_STATUS_CHANGE
battery status changed
-
enumerator BK_AVRCP_RN_SYSTEM_STATUS_CHANGE
system status changed
-
enumerator BK_AVRCP_RN_APP_SETTING_CHANGE
application settings changed
-
enumerator BK_AVRCP_RN_NOW_PLAYING_CHANGE
now playing content changed
-
enumerator BK_AVRCP_RN_AVAILABLE_PLAYERS_CHANGE
available players changed
-
enumerator BK_AVRCP_RN_ADDRESSED_PLAYER_CHANGE
the addressed player changed
-
enumerator BK_AVRCP_RN_UIDS_CHANGE
UIDs changed
-
enumerator BK_AVRCP_RN_VOLUME_CHANGE
volume changed locally on TG
-
enumerator BK_AVRCP_RN_MAX_EVT
-
enumerator BK_AVRCP_RN_PLAY_STATUS_CHANGE
-
enum bk_avrcp_ct_cb_event_t
AVRCP Controller callback events.
Values:
-
enumerator BK_AVRCP_CT_CONNECTION_STATE_EVT
connection state changed event
-
enumerator BK_AVRCP_CT_PASSTHROUGH_RSP_EVT
passthrough response event
-
enumerator BK_AVRCP_CT_METADATA_RSP_EVT
metadata response event
-
enumerator BK_AVRCP_CT_PLAY_STATUS_RSP_EVT
play status response event
-
enumerator BK_AVRCP_CT_CHANGE_NOTIFY_EVT
notification event
-
enumerator BK_AVRCP_CT_REMOTE_FEATURES_EVT
feature of remote device indication event
-
enumerator BK_AVRCP_CT_GET_RN_CAPABILITIES_RSP_EVT
supported notification events capability of peer device
-
enumerator BK_AVRCP_CT_SET_ABSOLUTE_VOLUME_RSP_EVT
set absolute volume response event
-
enumerator BK_AVRCP_CT_CONNECTION_STATE_EVT
-
enum bk_avrcp_batt_stat_t
AVRCP battery status.
Values:
-
enumerator BK_AVRCP_BATT_NORMAL
normal state
-
enumerator BK_AVRCP_BATT_WARNING
unable to operate soon
-
enumerator BK_AVRCP_BATT_CRITICAL
cannot operate any more
-
enumerator BK_AVRCP_BATT_EXTERNAL
plugged to external power supply
-
enumerator BK_AVRCP_BATT_FULL_CHARGE
when completely charged from external power supply
-
enumerator BK_AVRCP_BATT_NORMAL
-
enum bk_avrcp_playback_stat_t
AVRCP current status of playback.
Values:
-
enumerator BK_AVRCP_PLAYBACK_STOPPED
stopped
-
enumerator BK_AVRCP_PLAYBACK_PLAYING
playing
-
enumerator BK_AVRCP_PLAYBACK_PAUSED
paused
-
enumerator BK_AVRCP_PLAYBACK_FWD_SEEK
forward seek
-
enumerator BK_AVRCP_PLAYBACK_REV_SEEK
reverse seek
-
enumerator BK_AVRCP_PLAYBACK_ERROR
error
-
enumerator BK_AVRCP_PLAYBACK_STOPPED
-
enum bk_avrcp_pt_cmd_t
AVRCP passthrough command code.
Values:
-
enumerator BK_AVRCP_PT_CMD_SELECT
select
-
enumerator BK_AVRCP_PT_CMD_UP
up
-
enumerator BK_AVRCP_PT_CMD_DOWN
down
-
enumerator BK_AVRCP_PT_CMD_LEFT
left
-
enumerator BK_AVRCP_PT_CMD_RIGHT
right
-
enumerator BK_AVRCP_PT_CMD_RIGHT_UP
right-up
-
enumerator BK_AVRCP_PT_CMD_RIGHT_DOWN
right-down
-
enumerator BK_AVRCP_PT_CMD_LEFT_UP
left-up
-
enumerator BK_AVRCP_PT_CMD_LEFT_DOWN
left-down
-
enumerator BK_AVRCP_PT_CMD_ROOT_MENU
root menu
-
enumerator BK_AVRCP_PT_CMD_SETUP_MENU
setup menu
-
enumerator BK_AVRCP_PT_CMD_CONT_MENU
contents menu
-
enumerator BK_AVRCP_PT_CMD_FAV_MENU
favorite menu
-
enumerator BK_AVRCP_PT_CMD_EXIT
exit
-
enumerator BK_AVRCP_PT_CMD_0
0
-
enumerator BK_AVRCP_PT_CMD_1
1
-
enumerator BK_AVRCP_PT_CMD_2
2
-
enumerator BK_AVRCP_PT_CMD_3
3
-
enumerator BK_AVRCP_PT_CMD_4
4
-
enumerator BK_AVRCP_PT_CMD_5
5
-
enumerator BK_AVRCP_PT_CMD_6
6
-
enumerator BK_AVRCP_PT_CMD_7
7
-
enumerator BK_AVRCP_PT_CMD_8
8
-
enumerator BK_AVRCP_PT_CMD_9
9
-
enumerator BK_AVRCP_PT_CMD_DOT
dot
-
enumerator BK_AVRCP_PT_CMD_ENTER
enter
-
enumerator BK_AVRCP_PT_CMD_CLEAR
clear
-
enumerator BK_AVRCP_PT_CMD_CHAN_UP
channel up
-
enumerator BK_AVRCP_PT_CMD_CHAN_DOWN
channel down
-
enumerator BK_AVRCP_PT_CMD_PREV_CHAN
previous channel
-
enumerator BK_AVRCP_PT_CMD_SOUND_SEL
sound select
-
enumerator BK_AVRCP_PT_CMD_INPUT_SEL
input select
-
enumerator BK_AVRCP_PT_CMD_DISP_INFO
display information
-
enumerator BK_AVRCP_PT_CMD_HELP
help
-
enumerator BK_AVRCP_PT_CMD_PAGE_UP
page up
-
enumerator BK_AVRCP_PT_CMD_PAGE_DOWN
page down
-
enumerator BK_AVRCP_PT_CMD_POWER
power
-
enumerator BK_AVRCP_PT_CMD_VOL_UP
volume up
-
enumerator BK_AVRCP_PT_CMD_VOL_DOWN
volume down
-
enumerator BK_AVRCP_PT_CMD_MUTE
mute
-
enumerator BK_AVRCP_PT_CMD_PLAY
play
-
enumerator BK_AVRCP_PT_CMD_STOP
stop
-
enumerator BK_AVRCP_PT_CMD_PAUSE
pause
-
enumerator BK_AVRCP_PT_CMD_RECORD
record
-
enumerator BK_AVRCP_PT_CMD_REWIND
rewind
-
enumerator BK_AVRCP_PT_CMD_FAST_FORWARD
fast forward
-
enumerator BK_AVRCP_PT_CMD_EJECT
eject
-
enumerator BK_AVRCP_PT_CMD_FORWARD
forward
-
enumerator BK_AVRCP_PT_CMD_BACKWARD
backward
-
enumerator BK_AVRCP_PT_CMD_ANGLE
angle
-
enumerator BK_AVRCP_PT_CMD_SUBPICT
subpicture
-
enumerator BK_AVRCP_PT_CMD_F1
F1
-
enumerator BK_AVRCP_PT_CMD_F2
F2
-
enumerator BK_AVRCP_PT_CMD_F3
F3
-
enumerator BK_AVRCP_PT_CMD_F4
F4
-
enumerator BK_AVRCP_PT_CMD_F5
F5
-
enumerator BK_AVRCP_PT_CMD_VENDOR
vendor unique
-
enumerator BK_AVRCP_PT_CMD_SELECT
-
enum bk_avrcp_pt_cmd_state_t
AVRCP passthrough command state.
Values:
-
enumerator BK_AVRCP_PT_CMD_STATE_PRESSED
key pressed
-
enumerator BK_AVRCP_PT_CMD_STATE_RELEASED
key released
-
enumerator BK_AVRCP_PT_CMD_STATE_PRESSED
-
enum bk_avrcp_rn_rsp_t
AVRC notification response type.
Values:
-
enumerator BK_AVRCP_RN_RSP_INTERIM
initial response to RegisterNotification, should be sent T_mtp(1000ms) from receiving the command
-
enumerator BK_AVRCP_RN_RSP_CHANGED
final response to RegisterNotification command
-
enumerator BK_AVRCP_RN_RSP_INTERIM
-
enum bk_avrcp_rn_cap_api_method_t
AVRC target notification event notification capability.
Values:
-
enumerator BK_AVRCP_RN_CAP_API_METHOD_ALLOWED
all of the notification events that can possibly be supported, immutable
-
enumerator BK_AVRCP_RN_CAP_API_METHOD_CURRENT_ENABLE
notification events selectively supported according to the current configuration
-
enumerator BK_AVRCP_RN_CAP_API_METHOD_MAX
-
enumerator BK_AVRCP_RN_CAP_API_METHOD_ALLOWED
-
enum bk_avrcp_tg_cb_event_t
AVRC Target callback events.
Values:
-
enumerator BK_AVRCP_TG_CONNECTION_STATE_EVT
connection state changed event
-
enumerator BK_AVRCP_TG_PASSTHROUGH_CMD_EVT
passthrough command event
-
enumerator BK_AVRCP_TG_SET_ABSOLUTE_VOLUME_CMD_EVT
set absolute volume command from remote device
-
enumerator BK_AVRCP_TG_REGISTER_NOTIFICATION_EVT
register notification event
-
enumerator BK_AVRCP_TG_CONNECTION_STATE_EVT
-
enum bk_spp_cb_event_t
SPP Callback Event Types.
Values:
-
enumerator BK_SPP_NO_EVENT
spp no event
-
enumerator BK_SPP_CONNECT_CNF
spp connect confirm event
-
enumerator BK_SPP_CONNECT_IND
spp connect request ind event
-
enumerator BK_SPP_DISCONNECT_CNF
spp disconnect confirm event
-
enumerator BK_SPP_DISCONNECT_IND
spp disconnect request ind event
-
enumerator BK_SPP_STOP_CNF
spp server stop confirm event
-
enumerator BK_SPP_SEND_CNF
spp send data confirm event
-
enumerator BK_SPP_RECVD_DATA_IND
spp receive data ind event
-
enumerator BK_SPP_NO_EVENT