Infineon Logo AIROC BTSDK v4.9 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
wiced_bt_l2c.h File Reference

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_fixed_chnl_reg_t
 Fixed channel registration info (the callback addresses and channel config) More...
 
struct  wiced_bt_l2cap_le_appl_information_t
 Define the structure that applications use to register with LE L2CAP. More...
 

Macros

#define L2CAP_MINIMUM_OFFSET   13
 plus control(2), SDU length(2)
 
#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_BLE_TX_CONG_START_THRESH   3
 
#define L2CAP_BLE_TX_CONG_STOP_THRESH   1
 
#define L2CAP_BROADCAST_MIN_OFFSET   11
 Minimum offset for broadcast needs another two bytes for the PSM.
 
#define L2CAP_PING_RESULT_OK   0
 Ping result codes. More...
 
#define L2CAP_PING_RESULT_NO_LINK   1
 Link could not be setup.
 
#define L2CAP_PING_RESULT_NO_RESPONSE   2
 Remote L2CAP did not reply.
 
#define L2CAP_DATAWRITE_FAILED   FALSE
 Result codes for wiced_bt_l2cap_data_write()
 
#define L2CAP_DATAWRITE_SUCCESS   TRUE
 
#define L2CAP_DATAWRITE_CONGESTED   2
 
#define L2CAP_PRIORITY_NORMAL   0
 Values for priority parameter to wiced_bt_l2cap_set_acl_priority.
 
#define L2CAP_PRIORITY_HIGH   1
 
#define L2CAP_DIRECTION_IGNORE   0
 Values for direction parameter to wiced_bt_l2cap_set_acl_priority. More...
 
#define L2CAP_DIRECTION_DATA_SOURCE   1
 Set ACL priority direction as source.
 
#define L2CAP_DIRECTION_DATA_SINK   2
 Set ACL priority direction as sink.
 
#define L2CAP_CHNL_PRIORITY_HIGH   0
 Values for priority parameter to wiced_bt_l2cap_set_tx_priority.
 
#define L2CAP_CHNL_PRIORITY_MEDIUM   1
 
#define L2CAP_CHNL_PRIORITY_LOW   2
 
#define L2CAP_CHNL_DATA_RATE_HIGH   3
 Values for Tx/Rx data rate parameter to wiced_bt_l2cap_set_chnl_data_rate.
 
#define L2CAP_CHNL_DATA_RATE_MEDIUM   2
 
#define L2CAP_CHNL_DATA_RATE_LOW   1
 
#define L2CAP_CHNL_DATA_RATE_NO_TRAFFIC   0
 
#define L2CAP_FLUSHABLE_MASK   0x0003
 Data Packet Flags (bits 2-15 are reserved) layer specific 14-15 bits are used for FCR SAR. More...
 
#define L2CAP_FLUSHABLE_CH_BASED   0x0000
 
#define L2CAP_FLUSHABLE_PACKET   0x0001
 
#define L2CAP_NON_FLUSHABLE_PACKET   0x0002
 
#define L2CAP_FLUSH_CHANNELS_ALL   0xffff
 Used in wiced_bt_l2cap_flush_channel num_to_flush definitions.
 
#define L2CAP_FLUSH_CHANNELS_GET   0x0000
 
#define L2CAP_ROLE_PERIPHERAL   HCI_ROLE_PERIPHERAL
 Definition used for wiced_bt_l2cap_set_desire_role.
 
#define L2CAP_ROLE_CENTRAL   HCI_ROLE_CENTRAL
 
#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
 
#define L2CAP_FCR_CHAN_OPT_BASIC   (1 << L2CAP_FCR_BASIC_MODE)
 Values for 'allowed_modes' field passed in structure wiced_bt_l2cap_ertm_information_t.
 
#define L2CAP_FCR_CHAN_OPT_ERTM   (1 << L2CAP_FCR_ERTM_MODE)
 
#define L2CAP_FCR_CHAN_OPT_STREAM   (1 << L2CAP_FCR_STREAM_MODE)
 
#define L2CAP_FCR_CHAN_OPT_ALL_MASK   (L2CAP_FCR_CHAN_OPT_BASIC | L2CAP_FCR_CHAN_OPT_ERTM | L2CAP_FCR_CHAN_OPT_STREAM)
 
#define L2C_INVALID_PSM(psm)   (((psm) & 0x0101) != 0x0001)
 Validity check for PSM. More...
 
#define L2C_IS_VALID_PSM(psm)   (((psm) & 0x0101) == 0x0001)
 
#define MINIMIUM_DYNAMIC_LE_PSM   0x0080
 Validity check for LE_PSM. More...
 
#define MAXIMUM_LE_PSM   0x00FF
 
#define L2C_BLE_INVALID_PSM(le_psm)   (!(le_psm) || (le_psm) > MAX_LE_PSM)
 
#define L2C_BLE_IS_VALID_PSM(le_psm)   (((le_psm) != 0) && ((le_psm) <= MAX_LE_PSM))
 
#define L2CAP_FCR_BASIC_MODE   0x00
 
#define L2CAP_FCR_ERTM_MODE   0x03
 
#define L2CAP_FCR_STREAM_MODE   0x04
 
#define L2CAP_CH_CFG_MASK_MTU   0x0001
 
#define L2CAP_CH_CFG_MASK_QOS   0x0002
 
#define L2CAP_CH_CFG_MASK_FLUSH_TO   0x0004
 
#define L2CAP_CH_CFG_MASK_FCR   0x0008
 
#define L2CAP_CH_CFG_MASK_FCS   0x0010
 
#define L2CAP_CH_CFG_MASK_EXT_FLOW_SPEC   0x0020
 

Typedefs

typedef uint8_t wiced_bt_l2cap_chnl_priority_t
 
typedef uint8_t wiced_bt_l2cap_chnl_data_rate_t
 
typedef uint16_t wiced_bt_l2cap_ch_cfg_bits_t
 
typedef void( wiced_bt_l2cap_connected_cback_t )(void *context, 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 )(void *context, uint16_t local_cid, wiced_bool_t ack)
 Disconnect indication callback prototype. More...
 
typedef void( wiced_bt_l2cap_disconnect_confirm_cback_t )(void *context, uint16_t local_cid, uint16_t result)
 Disconnect confirm callback prototype. More...
 
typedef void( wiced_bt_l2cap_data_indication_cback_t )(void *context, uint16_t local_cid, uint8_t *p_buff, uint16_t buf_len)
 Data received indication callback prototype. More...
 
typedef void( wiced_bt_l2cap_congestion_status_cback_t )(void *context, uint16_t local_cid, wiced_bool_t congested)
 Congestion status callback protype. More...
 
typedef void( wiced_bt_l2cap_tx_complete_cback_t )(void *context, uint16_t local_cid, uint16_t num_sdu)
 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, tBT_TRANSPORT 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_buff, uint16_t buf_len)
 Signalling data received. More...
 
typedef void( wiced_bt_l2cap_fixed_congestion_status_cback_t )(wiced_bt_device_address_t bd_addr, wiced_bool_t congested)
 Congestion status callback protype. More...
 
typedef void( wiced_bt_l2cap_le_connect_indication_cback_t )(void *context, 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_le_connect_confirm_cback_t )(void *context, uint16_t local_cid, uint16_t result, uint16_t mtu_peer)
 LE Connection confirmation callback prototype. More...
 
typedef void( wiced_bt_l2cap_le_tx_complete_cback_t )(void *context, uint16_t local_cid, uint16_t buf_count)
 LE TX complete callback. More...
 
typedef void( wiced_bt_l2cap_le_conformance_test_cback_t )(uint16_t)
 

Functions

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)
 Function wiced_bt_l2cap_get_current_config. More...
 
uint16_t wiced_bt_l2cap_register (uint16_t psm, wiced_bt_l2cap_appl_information_t *p_cb_information, void *context)
 Function wiced_bt_l2cap_register. More...
 
void wiced_bt_l2cap_deregister (uint16_t psm)
 Function wiced_bt_l2cap_deregister. More...
 
uint16_t wiced_bt_l2cap_allocate_psm (void)
 Function wiced_bt_l2cap_allocate_psm. More...
 
uint16_t wiced_bt_l2cap_connect_req (uint16_t psm, wiced_bt_device_address_t p_bd_addr, wiced_bt_l2cap_ertm_information_t *p_ertm_information)
 Function wiced_bt_l2cap_connect_req. More...
 
void wiced_bt_l2cap_ertm_enable (void)
 Function wiced_bt_l2cap_ertm_enable. 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)
 Function wiced_bt_l2cap_ertm_connect_req. More...
 
wiced_bool_t wiced_bt_l2cap_disconnect_req (uint16_t cid)
 Function wiced_bt_l2cap_disconnect_req. More...
 
wiced_bool_t wiced_bt_l2cap_disconnect_rsp (uint16_t cid)
 Function wiced_bt_l2cap_disconnect_rsp. More...
 
uint8_t wiced_bt_l2cap_data_write (uint16_t cid, uint8_t *p_buf, uint16_t buf_len, uint16_t flags)
 Function wiced_bt_l2cap_data_write. More...
 
wiced_bool_t wiced_bt_l2cap_set_idle_timeout (uint16_t cid, uint16_t timeout, wiced_bool_t is_global)
 Function wiced_bt_l2cap_set_idle_timeout. More...
 
wiced_bool_t wiced_bt_l2cap_set_idle_timeout_by_bd_addr (wiced_bt_device_address_t bd_addr, uint16_t timeout, tBT_TRANSPORT transport)
 Function wiced_bt_l2cap_set_idle_timeout_by_bd_addr. More...
 
uint8_t wiced_bt_l2cap_set_trace_level (uint8_t trace_level)
 Function wiced_bt_l2cap_set_trace_level. More...
 
uint8_t wiced_bt_l2cap_set_desire_role (uint8_t new_role)
 Function wiced_bt_l2cap_set_desire_role. More...
 
uint16_t wiced_bt_l2cap_flush_channel (uint16_t lcid, uint16_t num_to_flush)
 Function wiced_bt_l2cap_flush_channel. More...
 
wiced_bool_t wiced_bt_l2cap_set_acl_priority (wiced_bt_device_address_t bd_addr, uint8_t priority)
 Function wiced_bt_l2cap_set_acl_priority. More...
 
wiced_bool_t wiced_bt_l2cap_set_acl_priority_ext (wiced_bt_device_address_t bd_addr, uint8_t priority, uint8_t direction)
 Function wiced_bt_l2cap_set_acl_priority_ext. More...
 
wiced_bool_t wiced_bt_l2cap_flow_control (uint16_t cid, wiced_bool_t data_enabled)
 Function wiced_bt_l2cap_flow_control. More...
 
wiced_bool_t wiced_bt_l2cap_set_tx_priority (uint16_t cid, wiced_bt_l2cap_chnl_priority_t priority)
 Function wiced_bt_l2cap_set_tx_priority. More...
 
wiced_bool_t wiced_bt_l2cap_set_flush_timeout (wiced_bt_device_address_t bd_addr, uint16_t flush_timeout)
 Function wiced_bt_l2cap_set_flush_timeout. More...
 
wiced_bool_t wiced_bt_l2cap_set_chnl_flushability (uint16_t cid, wiced_bool_t is_flushable)
 Function wiced_bt_l2cap_set_chnl_flushability. 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)
 Function wiced_bt_l2cap_get_peer_features. More...
 
wiced_bool_t wiced_bt_l2cap_get_bdaddrby_handle (uint16_t handle, wiced_bt_device_address_t bd_addr)
 Function wiced_bt_l2cap_get_bdaddrby_handle. More...
 
uint16_t wiced_bt_l2cap_get_handleby_bdaddr (BD_ADDR peer_bda)
 Function wiced_bt_l2cap_get_handleby_bdaddr. More...
 
uint8_t wiced_bt_l2cap_get_chnl_fcr_mode (uint16_t lcid)
 Function wiced_bt_l2cap_get_chnl_fcr_mode. More...
 
wiced_bool_t wiced_bt_l2cap_cancel_ble_connect_req (wiced_bt_device_address_t rem_bda)
 Function wiced_bt_l2cap_cancel_ble_connect_req. 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)
 Function wiced_bt_l2cap_update_ble_conn_params. More...
 
wiced_bool_t wiced_bt_l2cap_enable_update_ble_conn_params (wiced_bt_device_address_t rem_bda, wiced_bool_t enable)
 Function wiced_bt_l2cap_enable_update_ble_conn_params. More...
 
uint8_t wiced_bt_l2cap_get_ble_conn_role (wiced_bt_device_address_t bd_addr)
 Function wiced_bt_l2cap_get_ble_conn_role. More...
 
uint16_t wiced_bt_l2cap_get_disconnect_reason (wiced_bt_device_address_t remote_bda, tBT_TRANSPORT transport)
 Function wiced_bt_l2cap_get_disconnect_reason. More...
 
uint16_t wiced_bt_l2cap_le_register (uint16_t le_psm, wiced_bt_l2cap_le_appl_information_t *p_cb_information, void *context)
 Function wiced_bt_l2cap_le_register. More...
 
wiced_bool_t wiced_bt_l2cap_le_deregister (uint16_t le_psm)
 Function wiced_bt_l2cap_le_deregister. 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 rx_sdu_pool_id, uint8_t req_security, uint8_t req_encr_key_size)
 Function wiced_bt_l2cap_le_connect_req. 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, uint8_t rx_sdu_pool_id)
 Function wiced_bt_l2cap_le_connect_rsp. More...
 
wiced_bool_t wiced_bt_l2cap_le_disconnect_req (uint16_t lcid)
 Function wiced_bt_l2cap_le_disconnect_req. More...
 
wiced_bool_t wiced_bt_l2cap_le_disconnect_rsp (uint16_t lcid)
 Function wiced_bt_l2cap_le_disconnect_rsp. More...
 
uint8_t wiced_bt_l2cap_le_data_write (uint16_t cid, uint8_t *p_data, uint16_t buf_len, uint16_t flags)
 Function wiced_bt_l2cap_le_data_write. More...
 
wiced_bool_t wiced_bt_l2cap_le_set_user_congestion (uint16_t lcid, wiced_bool_t is_congested)
 Function wiced_bt_l2cap_le_set_user_congestion. More...
 
uint16_t wiced_bt_l2cap_le_get_peer_mtu (uint16_t lcid)
 Function wiced_bt_l2cap_le_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)
 Function wiced_bt_l2cap_le_determ_secur_rsp. More...
 

Detailed Description

Bluetooth L2CAP Application Programming Interface.

Logical Link Control and Adaptation Layer Protocol, referred to as L2CAP, provides connection oriented and connectionless data services to upper layer protocols with protocol multiplexing capability and segmentation and reassembly operation.

Typedef Documentation

typedef void( wiced_bt_l2cap_congestion_status_cback_t)(void *context, uint16_t local_cid, wiced_bool_t congested)

Congestion status callback protype.

This callback is optional. If an application tries to send data when the transmit queue is full, the data will anyways be dropped.

Parameters
context: Caller context provided with wiced_bt_l2cap_register()
local_cid: Local CID
congested: TRUE if congested, FALSE if uncongested
Returns
void
typedef void( wiced_bt_l2cap_connected_cback_t)(void *context, wiced_bt_device_address_t bd_addr, uint16_t local_cid, uint16_t peer_mtu)

Connection established callback prototype.

Parameters
context: Caller context provided with wiced_bt_l2cap_register()
bd_addr: BD Address of remote
local_cid: Local CID assigned to the connection
peer_mtu: Peer MTU
Returns
void
typedef void( wiced_bt_l2cap_data_indication_cback_t)(void *context, uint16_t local_cid, uint8_t *p_buff, uint16_t buf_len)

Data received indication callback prototype.

Parameters
context: Caller context provided with wiced_bt_l2cap_register()
local_cid: Local CID
p_addr_buff: Address of buffer
Returns
void
typedef void( wiced_bt_l2cap_disconnect_confirm_cback_t)(void *context, uint16_t local_cid, uint16_t result)

Disconnect confirm callback prototype.

Parameters
context: Caller context provided with wiced_bt_l2cap_register()
local_cid: Local CID
result: Result
Returns
void
typedef void( wiced_bt_l2cap_disconnect_indication_cback_t)(void *context, uint16_t local_cid, wiced_bool_t ack)

Disconnect indication callback prototype.

Parameters
context: Caller context provided with wiced_bt_l2cap_register()
local_cid: Local CID
ack: Boolean whether upper layer should ack this
Returns
void
typedef void( wiced_bt_l2cap_fixed_chnl_cback_t)(wiced_bt_device_address_t bd_addr, wiced_bool_t connected, uint16_t reason, tBT_TRANSPORT transport)

Fixed channel connected and disconnected.

Parameters
bd_addr: BD Address of remote
connected: TRUE if channel is connected, FALSE if disconnected
reason: Reason for connection failure
transport: Bluetooth Transport (BR/EDR or LE)
Returns
void
typedef void( wiced_bt_l2cap_fixed_congestion_status_cback_t)(wiced_bt_device_address_t bd_addr, wiced_bool_t congested)

Congestion status callback protype.

This callback is optional. If an application tries to send data when the transmit queue is full, the data will anyways be dropped.

Parameters
bd_addr: remote wiced_bt_device_address_t
congested: TRUE if congested, FALSE if uncongested
Returns
void
typedef void( wiced_bt_l2cap_fixed_data_cback_t)(wiced_bt_device_address_t bd_addr, uint8_t *p_buff, uint16_t buf_len)

Signalling data received.

Parameters
bd_addr: BD Address of remote
p_buff: Pointer to buffer with data
Returns
void
typedef void( wiced_bt_l2cap_le_conformance_test_cback_t)(uint16_t)
Returns
void
typedef void( wiced_bt_l2cap_le_connect_confirm_cback_t)(void *context, uint16_t local_cid, uint16_t result, uint16_t mtu_peer)

LE Connection confirmation callback prototype.

Parameters
context: Caller context provided with wiced_bt_l2cap_le_register()
local_cid: Local CID
result: Result - 0 = connected, non-zero means failure reason
mtu_peer: MTU of the peer
Returns
void
typedef void( wiced_bt_l2cap_le_connect_indication_cback_t)(void *context, 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.

Parameters
context: Caller context provided with wiced_bt_l2cap_le_register()
bd_addr: BD Address of remote
local_cid: Local CID assigned to the connection
psm: PSM that the remote wants to connect to
id: Identifier that the remote sent
mtu_peer: MTU of the peer
Returns
void
typedef void( wiced_bt_l2cap_le_tx_complete_cback_t)(void *context, uint16_t local_cid, uint16_t buf_count)

LE TX complete callback.

(Optional) Notification after wiced_bt_l2cap_le_data_write has sent buffer to transport layer

Parameters
context: Caller context provided with wiced_bt_l2cap_le_register()
local_cid: Local CID
buf_count: Number of buffers sent
Returns
void
typedef void( wiced_bt_l2cap_tx_complete_cback_t)(void *context, uint16_t local_cid, uint16_t num_sdu)

Transmit complete callback protype.

This callback is optional. If set, L2CAP will call it when packets are sent or flushed. If the count is 0xFFFF, it means all packets are sent for that CID (eRTM mode only).

Parameters
context: Caller context provided with wiced_bt_l2cap_register()
local_cid: Local CID
num_sdu: Number of SDUs sent or dropped
Returns
void