AIROC™ BTSDK v4.2 - Documentation | ||||
Bluetooth L2CAP Application Programming Interface. More...
Data Structures | |
struct | wiced_bt_l2cap_fcr_options_t |
Structure for Enhanced Retransmission Mode Options Refer to Volume 3, Part A, section 5.4 of Bluetooth Core specification for details. More... | |
struct | wiced_bt_l2cap_cfg_information_t |
Define a structure to hold the configuration parameters. More... | |
struct | wiced_bt_l2cap_ertm_information_t |
Structure that applications use to create or accept connections with enhanced retransmission mode. More... | |
struct | wiced_bt_l2cap_appl_information_t |
Define the structure that applications use to register with L2CAP. More... | |
struct | wiced_bt_l2cap_le_appl_information_t |
Define the structure that applications use to register with LE L2CAP. More... | |
struct | wiced_bt_l2cap_fixed_chnl_reg_t |
Fixed channel registration info (the callback addresses and channel config) More... | |
Macros | |
#define | L2CAP_MINIMUM_OFFSET 13 |
Minimum offset that L2CAP needs in a buffer. More... | |
#define | L2CAP_BLE_CONN_MIN_OFFSET 9 |
HCI type(1), len(2), handle(2), L2CAP len(2) and CID(2) | |
#define | L2CAP_DEFAULT_BLE_CB_POOL_ID 0xFF |
Use the default HCI ACL buffer pool. | |
#define | L2CAP_BLE_COC_SDU_OFFSET 4 |
to provide upper layer some minimal offset possibly required to process incoming packets | |
#define | L2CAP_BROADCAST_MIN_OFFSET 11 |
Minimum offset for broadcast needs another two bytes for the PSM. | |
L2CAP ping result | |
#define | L2CAP_PING_RESULT_OK 0 |
Ping reply received OK. | |
#define | L2CAP_PING_RESULT_NO_LINK 1 |
Link could not be setup. | |
#define | L2CAP_PING_RESULT_NO_RESPONSE 2 |
Remote L2CAP did not reply. | |
L2CAP data write result | |
Result codes for wiced_bt_l2cap_data_write() | |
#define | L2CAP_DATAWRITE_FAILED FALSE |
If data not accepted and error. | |
#define | L2CAP_DATAWRITE_SUCCESS TRUE |
If data accepted. | |
#define | L2CAP_DATAWRITE_CONGESTED 2 |
if data accepted and the channel is congested | |
L2CAP data write flags | |
Flushable/Non Flushable flags parameter used in a call wiced_bt_l2cap_data_write() | |
#define | L2CAP_FLUSHABLE_MASK 0x0001 |
L2CAP Flushable mask. | |
#define | L2CAP_NON_FLUSHABLE_PACKET 0x0000 |
Non Flushable flag. | |
#define | L2CAP_FLUSHABLE_PACKET 0x0001 |
Flushable flag. | |
L2CAP PSM | |
#define | L2C_INVALID_PSM(psm) (((psm) & 0x0101) != 0x0001) |
Returns true on invalid PSM. | |
#define | L2C_IS_VALID_PSM(psm) (((psm) & 0x0101) == 0x0001) |
Returns true on valid PSM. | |
L2CAP channel configuration | |
L2CAP channel configured field bitmap. Used for wiced_bt_l2cap_ch_cfg_bits_t | |
#define | L2CAP_CH_CFG_MASK_MTU 0x0001 |
MTU channel configuration bit mask. | |
#define | L2CAP_CH_CFG_MASK_QOS 0x0002 |
QOS channel configuration bit mask. | |
#define | L2CAP_CH_CFG_MASK_FLUSH_TO 0x0004 |
Flush to channel configuration bit mask. | |
#define | L2CAP_CH_CFG_MASK_FCR 0x0008 |
FCR channel configuration bit mask. | |
#define | L2CAP_CH_CFG_MASK_FCS 0x0010 |
FCS channel configuration bit mask. | |
#define | L2CAP_CH_CFG_MASK_EXT_FLOW_SPEC 0x0020 |
Extended flow specification channel configuration bit mask. | |
L2CAP FCR Mode | |
L2CAP FCR mode configuring options and allowed modes bit mask. From below, first 3 used as a field wiced_bt_l2cap_fcr_options_t::mode and reamining used as a bit mask field wiced_bt_l2cap_ertm_information_t::allowed_modes | |
#define | L2CAP_FCR_BASIC_MODE 0x00 |
Basic mode (no FCR) | |
#define | L2CAP_FCR_ERTM_MODE 0x03 |
ERTM mode. | |
#define | L2CAP_FCR_STREAM_MODE 0x04 |
Streaming mode. | |
#define | L2CAP_FCR_CHAN_OPT_BASIC (1 << L2CAP_FCR_BASIC_MODE) |
Basic mode (no FCR) bit mask. | |
#define | L2CAP_FCR_CHAN_OPT_ERTM (1 << L2CAP_FCR_ERTM_MODE) |
ERTM mode bit mask. | |
#define | L2CAP_FCR_CHAN_OPT_STREAM (1 << L2CAP_FCR_STREAM_MODE) |
Streaming mode bit mask. | |
#define | L2CAP_FCR_CHAN_OPT_ALL_MASK (L2CAP_FCR_CHAN_OPT_BASIC | L2CAP_FCR_CHAN_OPT_ERTM | L2CAP_FCR_CHAN_OPT_STREAM) |
Mask for all modes Basic, ERTM and Streaming. | |
L2CAP flush channels | |
L2CAP flush channel and num_to_flush parameter used in a call wiced_bt_l2cap_flush_channel() | |
#define | L2CAP_FLUSH_CHANNELS_ALL 0xffff |
To flush all queued buffers. | |
#define | L2CAP_FLUSH_CHANNELS_GET 0x0000 |
To get queued buffers to flush. | |
L2CAP role | |
L2CAP role and new_role parameter used in a call wiced_bt_l2cap_set_desire_role()
| |
#define | L2CAP_ROLE_PERIPHERAL HCI_ROLE_PERIPHERAL |
L2CAP Peripheral role. | |
#define | L2CAP_ROLE_CENTRAL HCI_ROLE_CENTRAL |
L2CAP Central role. | |
#define | L2CAP_ROLE_ALLOW_SWITCH 0x80 |
set this bit to allow switch at create conn | |
#define | L2CAP_ROLE_DISALLOW_SWITCH 0x40 |
set this bit to disallow switch at create conn | |
#define | L2CAP_ROLE_CHECK_SWITCH 0xC0 |
To check the switch to allow or disallow. | |
#define | L2CAP_ROLE_SCATTERNET_ALLOWED 0x20 |
set this bit to allow scatternet | |
L2CAP ACL Priority Value | |
Values for priority parameter to wiced_bt_l2cap_set_acl_priority() and wiced_bt_l2cap_set_acl_priority_ext(). | |
#define | L2CAP_PRIORITY_NORMAL 0 |
Set ACL priority as normal. | |
#define | L2CAP_PRIORITY_HIGH 1 |
Set ACL priority as high. | |
L2CAP ACL Priority Direction | |
Values for direction parameter to wiced_bt_l2cap_set_acl_priority_ext() | |
#define | L2CAP_DIRECTION_IGNORE 0 |
Set ACL priority direction as ignore. | |
#define | L2CAP_DIRECTION_DATA_SOURCE 1 |
Set ACL priority direction as source. | |
#define | L2CAP_DIRECTION_DATA_SINK 2 |
Set ACL priority direction as sink. | |
L2CAP transmission channel priority | |
L2CAP channel transmission priority. Used for wiced_bt_l2cap_chnl_priority_t | |
#define | L2CAP_CHNL_PRIORITY_HIGH 0 |
Transmission priority as high for a channel (FCR Mode) | |
#define | L2CAP_CHNL_PRIORITY_MEDIUM 1 |
Transmission priority as medium for a channel (FCR Mode) | |
#define | L2CAP_CHNL_PRIORITY_LOW 2 |
Transmission priority as low for a channel (FCR Mode) | |
L2CAP LE PSM | |
#define | MINIMIUM_DYNAMIC_LE_PSM 0x0080 |
First application dynamic PSM allowed. | |
#define | MAXIMUM_LE_PSM 0x00FF |
LE PSM range limit. | |
#define | L2C_BLE_INVALID_PSM(le_psm) (!(le_psm) || (le_psm) > MAXIMUM_LE_PSM) |
Returns true on invalid LE PSM. | |
#define | L2C_BLE_IS_VALID_PSM(le_psm) (((le_psm) != 0) && ((le_psm) <= MAXIMUM_LE_PSM)) |
Returns true on valid LE PSM. | |
Typedefs | |
typedef uint16_t | wiced_bt_l2cap_ch_cfg_bits_t |
Channel configuration fields in bit map. More... | |
typedef uint8_t | wiced_bt_l2cap_chnl_priority_t |
Values for priority parameter to wiced_bt_l2cap_set_tx_priority(). More... | |
typedef void( | wiced_bt_l2cap_connected_cback_t )(wiced_bt_device_address_t bd_addr, uint16_t local_cid, uint16_t peer_mtu) |
Connection established callback prototype. More... | |
typedef void( | wiced_bt_l2cap_disconnect_indication_cback_t )(uint16_t local_cid, uint16_t reason, wiced_bool_t ack) |
Disconnect indication callback prototype. More... | |
typedef void( | wiced_bt_l2cap_disconnect_confirm_cback_t )(uint16_t local_cid, uint16_t result) |
Disconnect confirm callback prototype. More... | |
typedef void( | wiced_bt_l2cap_data_indication_cback_t )(uint16_t local_cid, tDRB *p_drb) |
Data received indication callback prototype. More... | |
typedef void( | wiced_bt_l2cap_tx_complete_cback_t )(uint16_t local_cid, void *p_data) |
Transmit complete callback protype. More... | |
typedef void( | wiced_bt_l2cap_fixed_chnl_cback_t )(wiced_bt_device_address_t bd_addr, wiced_bool_t connected, uint16_t reason, wiced_bt_transport_t transport) |
Fixed channel connected and disconnected. More... | |
typedef void( | wiced_bt_l2cap_fixed_data_cback_t )(wiced_bt_device_address_t bd_addr, uint8_t *p_data, uint16_t data_len) |
Signalling data received. More... | |
typedef void( | wiced_bt_l2cap_le_connect_indication_cback_t )(wiced_bt_device_address_t bd_addr, uint16_t local_cid, uint16_t psm, uint8_t id, uint16_t mtu_peer) |
LE Connection indication callback prototype. More... | |
typedef void( | wiced_bt_l2cap_drb_release_cb )(tDRB *p_drb) |
User DRB may be released callback prototype. More... | |
typedef void( | wiced_bt_l2cap_le_connect_confirm_cback_t )(uint16_t local_cid, uint16_t result, uint16_t mtu_peer) |
LE Connection confirmation callback prototype. More... | |
Functions | |
wiced_bool_t | wiced_bt_l2cap_register_fixed_channel (uint16_t fixed_cid, wiced_bt_l2cap_fixed_chnl_reg_t *p_freg) |
Register a fixed channel. More... | |
wiced_bool_t | wiced_bt_l2cap_connect_fixed_chnl (uint16_t fixed_cid, wiced_bt_device_address_t bd_addr, wiced_bt_ble_address_type_t ble_addr_type) |
Connect an fixed signalling channel to a remote device. More... | |
uint16_t | wiced_bt_l2cap_send_fixed_chnl_data (uint16_t fixed_cid, wiced_bt_device_address_t rem_bda, uint8_t *p_data, uint16_t data_len) |
Write data on a fixed signalling channel. More... | |
wiced_bool_t | wiced_bt_l2cap_remove_fixed_chnl (uint16_t fixed_cid, wiced_bt_device_address_t rem_bda) |
Remove a fixed channel to a remote device. More... | |
wiced_bool_t | wiced_bt_l2cap_set_fixed_channel_timeout (wiced_bt_device_address_t rem_bda, uint16_t fixed_cid, uint16_t idle_timeout) |
Higher layers call this function to set the idle timeout for a fixed channel. More... | |
wiced_bool_t | wiced_bt_l2cap_get_current_config (uint16_t lcid, wiced_bt_l2cap_cfg_information_t **pp_our_cfg, wiced_bt_l2cap_ch_cfg_bits_t *p_our_cfg_bits, wiced_bt_l2cap_cfg_information_t **pp_peer_cfg, wiced_bt_l2cap_ch_cfg_bits_t *p_peer_cfg_bits) |
This function returns configurations of L2CAP channel. More... | |
uint16_t | wiced_bt_l2cap_register (uint16_t psm, wiced_bt_l2cap_appl_information_t *p_cb_information) |
Other layers call this function to register for L2CAP services. More... | |
void | wiced_bt_l2cap_deregister (uint16_t psm) |
Other layers call this function to deregister for L2CAP services. More... | |
uint16_t | wiced_bt_l2cap_allocate_psm (void) |
Other layers call this function to find an unused PSM for L2CAP services. More... | |
wiced_bool_t | wiced_bt_l2cap_disconnect_req (uint16_t cid) |
Higher layers call this function to disconnect a channel. More... | |
wiced_bool_t | wiced_bt_l2cap_disconnect_rsp (uint16_t cid) |
Higher layers call this function to acknowledge the disconnection of a channel. More... | |
uint8_t | wiced_bt_l2cap_data_write (uint16_t cid, uint8_t *p_buf, uint16_t buf_len, uint16_t flags) |
Higher layers call this function to write data with extended. More... | |
wiced_bool_t | wiced_bt_l2cap_set_idle_timeout (uint16_t cid, uint16_t timeout, wiced_bool_t is_global) |
Higher layers call this function to set the idle timeout for a connection, or for all future connections. More... | |
wiced_bool_t | wiced_bt_l2cap_set_idle_timeout_by_bd_addr (wiced_bt_device_address_t bd_addr, uint16_t timeout, wiced_bt_transport_t transport) |
Higher layers call this function to set the idle timeout for a connection. More... | |
wiced_bool_t | wiced_bt_l2cap_get_bdaddrby_handle (uint16_t handle, wiced_bt_device_address_t bd_addr) |
Get BD address for the given HCI handle. More... | |
uint16_t | wiced_bt_l2cap_connect_req (uint16_t psm, wiced_bt_device_address_t p_bd_addr) |
Higher layers call this function to create an L2CAP connection. More... | |
void | wiced_bt_l2cap_ertm_enable (void) |
Enable ERTM. More... | |
uint16_t | wiced_bt_l2cap_ertm_connect_req (uint16_t psm, wiced_bt_device_address_t p_bd_addr, wiced_bt_l2cap_ertm_information_t *p_ertm_information) |
Higher layers call this function to create an L2CAP connection that needs to use Enhanced Retransmission Mode. More... | |
wiced_bool_t | wiced_bt_l2cap_register_ertm_drb (uint16_t lcid, tDRB *p_drb, uint16_t drb_max_payload_len, wiced_bt_l2cap_drb_release_cb *p_unreg_cb) |
Higher layers call this function to register a DRM for an ERTM connection. More... | |
uint8_t | wiced_bt_l2cap_set_desire_role (uint8_t new_role) |
This function sets the desire role for L2CAP. More... | |
uint16_t | wiced_bt_l2cap_flush_channel (uint16_t lcid, uint16_t num_to_flush) |
This function flushes none, some or all buffers queued up for xmission for a particular CID. More... | |
wiced_bool_t | wiced_bt_l2cap_set_acl_priority (wiced_bt_device_address_t bd_addr, uint8_t priority) |
Sets the priority for an ACL channel. More... | |
wiced_bool_t | wiced_bt_l2cap_set_acl_priority_ext (wiced_bt_device_address_t bd_addr, uint8_t priority, uint8_t direction) |
Sets the priority for an ACL channel with extended parameters. More... | |
wiced_bool_t | wiced_bt_l2cap_flow_control (uint16_t cid, wiced_bool_t data_enabled) |
Higher layers call this function to flow control a channel. More... | |
wiced_bool_t | wiced_bt_l2cap_set_tx_priority (uint16_t cid, wiced_bt_l2cap_chnl_priority_t priority) |
Sets the transmission priority for a channel. More... | |
wiced_bool_t | wiced_bt_l2cap_set_flush_timeout (wiced_bt_device_address_t bd_addr, uint16_t flush_timeout) |
This function set the automatic flush time out in Baseband for ACL-U packets. More... | |
wiced_bool_t | wiced_bt_l2cap_get_peer_features (wiced_bt_device_address_t bd_addr, uint32_t *p_ext_feat, uint8_t *p_chnl_mask) |
Get a peers features and fixed channel map. More... | |
uint8_t | wiced_bt_l2cap_get_chnl_fcr_mode (uint16_t lcid) |
Get the channel FCR mode. More... | |
wiced_bool_t | wiced_bt_l2cap_cancel_ble_connect_req (wiced_bt_device_address_t rem_bda) |
Cancel a pending connection attempt to a LE device. More... | |
wiced_bool_t | wiced_bt_l2cap_update_ble_conn_params (wiced_bt_device_address_t rem_bdRa, uint16_t min_int, uint16_t max_int, uint16_t latency, uint16_t timeout) |
Update LE connection parameters. More... | |
wiced_bool_t | wiced_bt_l2cap_enable_update_ble_conn_params (wiced_bt_device_address_t rem_bda, wiced_bool_t enable) |
Enable or disable updating LE connection params based on the request from the peer. More... | |
uint8_t | wiced_bt_l2cap_get_ble_conn_role (wiced_bt_device_address_t bd_addr) |
This function returns the connection role. More... | |
uint16_t | wiced_bt_l2cap_le_register (uint16_t le_psm, wiced_bt_l2cap_le_appl_information_t *p_cb_information) |
Other layers call this function to register L2CAP services for LE_PSM. More... | |
wiced_bool_t | wiced_bt_l2cap_le_deregister (uint16_t le_psm) |
Other layers call this function to deregister L2CAP services for LE_PSM. More... | |
uint16_t | wiced_bt_l2cap_le_connect_req (uint16_t le_psm, wiced_bt_device_address_t p_bd_addr, wiced_bt_ble_address_type_t bd_addr_type, wiced_bt_ble_conn_mode_t conn_mode, uint16_t rx_mtu, uint8_t req_security, uint8_t req_encr_key_size, tDRB *p_rx_drb) |
Higher layers call this function to create an L2CAP connection for LE_PSM. More... | |
wiced_bool_t | wiced_bt_l2cap_le_connect_rsp (wiced_bt_device_address_t p_bd_addr, uint8_t id, uint16_t lcid, uint16_t result, uint16_t rx_mtu, tDRB *p_rx_drb) |
Higher layers call this function to accept an incoming LE L2CAP connection, for which they had gotten an connect indication callback. More... | |
wiced_bool_t | wiced_bt_l2cap_le_disconnect_req (uint16_t lcid) |
Higher layers call this function to disconnect a LE COC channel. More... | |
wiced_bool_t | wiced_bt_l2cap_le_disconnect_rsp (uint16_t lcid) |
Higher layers call this function to acknowledge the disconnection of a LE COC channel. More... | |
uint8_t | wiced_bt_l2cap_le_data_write (uint16_t cid, uint8_t *p_data, uint16_t buf_len) |
Send data over LE connection-oriented channel. More... | |
wiced_bool_t | wiced_bt_l2cap_le_set_user_congestion (uint16_t lcid, wiced_bool_t is_congested) |
Higher layers call this function to tell if the connection is congested or not. More... | |
uint16_t | wiced_bt_l2cap_le_get_peer_mtu (uint16_t lcid) |
Higher layers call this function to get peer MTU. More... | |
uint16_t | wiced_bt_l2cap_le_determ_secur_rsp (wiced_bt_device_address_t bd_addr, uint8_t req_secur, uint8_t req_encr_key_size) |
Higher layers call this function to check if the current device security settings are sufficient to continue with call establishment. More... | |
int | wiced_bt_l2cap_get_num_queued_tx_packets (wiced_bt_device_address_t bd_addr, uint16_t lcid, int *p_fragments_with_controller) |
Utility function to get the number of packets queued to tx. More... | |
Bluetooth L2CAP Application Programming Interface.
int wiced_bt_l2cap_get_num_queued_tx_packets | ( | wiced_bt_device_address_t | bd_addr, |
uint16_t | lcid, | ||
int * | p_fragments_with_controller | ||
) |
Utility function to get the number of packets queued to tx.
[in] | bd_addr | bluetooth address of the peer device |
[in] | lcid | : local_cid |
[out] | p_fragments_with_controller | : fragments with the controller |