Bluetooth Host Stack Library
All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
Logical Link Control and Adaptation Protocol (L2CAP)

General Description

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.

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_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...
 
struct  wiced_bt_l2cap_ecrb_cb_ptrs_t
 Structure containing application ECRB callbacks. More...
 

Macros

#define L2CAP_ECRB_MIN_MTU   64
 ECRB Min MTU. More...
 
#define L2CAP_ECRB_MIN_MPS   64
 ECRB Min MPS.
 
#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.
 

Typedefs

typedef uint16_t wiced_bt_l2cap_ch_cfg_bits_t
 Channel configuration fields in bit map. 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...
 
typedef void() wiced_bt_l2cap_ecrb_connect_ind(wiced_bt_device_address_t peer_addr, wiced_bt_transport_t transport, uint16_t psm, wiced_bt_ecrb_cid_list_t lcids, uint8_t id, uint16_t peer_mtu)
 ECRB Application callback for incoming connection requests.
 
typedef void() wiced_bt_l2cap_ecrb_confirm_cb(uint16_t lcid, uint16_t result, uint16_t peer_mtu)
 ECRB Application callback for outging connection confirms.
 
typedef void() wiced_bt_l2cap_ecrb_mtu_changed_cb(uint16_t lcid, uint16_t new_mtu, uint16_t new_mps)
 ECRB Application callback for channel MTU size change.
 

L2CAP connection result codes

L2CAP connection result codes.

#define L2CAP_CONN_OK   0
 Connection OK.
 
#define L2CAP_CONN_PENDING   1
 Connection Pending.
 
#define L2CAP_CONN_NO_PSM   2
 Connection NO PSM.
 
#define L2CAP_CONN_SECURITY_BLOCK   3
 Connection Security Block.
 
#define L2CAP_CONN_NO_RESOURCES   4
 Connection NO Resource.
 
#define L2CAP_CONN_BAD_CTLR_ID   5
 Bad Controller ID.
 
#define L2CAP_BLE_CONN_BAD_AUTHENT   5
 LE Connection Bad Authentication. More...
 
#define L2CAP_BLE_CONN_BAD_AUTHORIZ   6
 LE Connection Bad Autherization.
 
#define L2CAP_BLE_CONN_BAD_KEY_SIZE   7
 LE Connection Bad key size.
 
#define L2CAP_BLE_CONN_BAD_ENCRYPT   8
 LE Connection Bad Encryption.
 
#define L2CAP_BLE_CONN_INVALID_CID   9
 Invalid Source CID.
 
#define L2CAP_BLE_CONN_CID_ALREADY_USED   10
 Source CID already allocated.
 
#define L2CAP_BLE_CONN_BAD_PARAMS   11
 Bad parameters.
 

L2CAP ECRB Result Code

L2CAP ECRB Result Code

#define L2CAP_ECRB_ALL_CONNS_SUCCESSFUL   0x0000
 All Connections Successful.
 
#define L2CAP_ECRB_ALL_CONNS_REFUSED   0x0002
 All Connections Refused.
 
#define L2CAP_ECRB_SOME_CONNS_REFUSED   0x0004
 Some Connections Refused.
 
#define L2CAP_ECRB_INSUFF_AUTHENTICATION   0x0005
 Insufficient Authentication.
 
#define L2CAP_ECRB_INSUFF_AUTHORIZATION   0x0006
 Insufficient Autherization.
 
#define L2CAP_ECRB_INSUFF_KEY_SIZE   0x0007
 Insufficient Key size.
 
#define L2CAP_ECRB_INSUFF_ENCRYPTION   0x0008
 Insufficient Encryption.
 
#define L2CAP_ECRB_INVALID_SOURCE_CID   0x0009
 Invalid Source CID.
 
#define L2CAP_ECRB_SOURCE_CID_IN_USE   0x000A
 Source CID in Used.
 
#define L2CAP_ECRB_UNACCEPTABLE_PARAMS   0x000B
 Unacceptable Params.
 
#define L2CAP_ECRB_INVALID_PARAMS   0x000C
 Invalid Params.
 
#define L2CAP_ECRB_RECONFIG_SUCCESSFUL   0x0000
 Reconfiguration Successful.
 
#define L2CAP_ECRB_RECONFIG_FAIL_BAD_MTU   0x0001
 Reconfiguration fail : Bad MTU.
 
#define L2CAP_ECRB_RECONFIG_FAIL_BAD_MPS   0x0002
 Reconfiguration fail : Bad MPS.
 
#define L2CAP_ECRB_RECONFIG_FAIL_BAD_DCID   0x0003
 Reconfiguration fail : Bad DCID.
 
#define L2CAP_ECRB_RECONFIG_FAIL_OTHER   0x0004
 Reconfiguration fail : Other Reason.
 
#define L2CAP_ECRB_NOT_SUPPORTED_BY_PEER   0xF000
 Not Supported by Peer.
 

L2CAP ping result

Ping result codes.

#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

Validity check for PSM. PSM values must be odd. Also, all PSM values must be assigned such that the least significant bit of the most sigificant octet equals zero.

#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 LE PSM

Validity check for LE_PSM. Fixed LE_PSMs are in the range 0x0001 - 0x007F. Dynamic LE_PSM are in the range 0x0080 - 0x00FF. The values 0x0000 and 0x0100 - 0xFFFF are reserved.

#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.
 
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_deregister_fixed_channel (uint16_t fixed_cid)
 De-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_ecrb_register (uint16_t psm, wiced_bt_l2cap_ecrb_cb_ptrs_t *p_ecrb_callbacks)
 Application calls this function to register support for enhanced credit-based channels. More...
 
wiced_bool_t wiced_bt_l2cap_ecrb_deregister (uint16_t psm)
 Application calls this function to deregister support for enhanced credit-based channels. More...
 
int wiced_bt_l2cap_ecrb_connect_req (uint16_t psm, wiced_bt_transport_t transport, wiced_bt_device_address_t bd_addr, wiced_bt_ble_address_type_t bd_addr_type, wiced_bt_ble_conn_mode_t conn_mode, uint16_t our_rx_mtu, uint16_t our_rx_mps, int num_channels, tDRB **p_rx_drb_list, wiced_bt_ecrb_cid_list_t lcid_list)
 Higher layers call this function to create up to 5 credit-based L2CAP connections on the same PSM. More...
 
void wiced_bt_l2cap_ecrb_ConnectRsp (uint16_t result, uint8_t trans_id, int16_t our_rx_mtu, uint16_t our_rx_mps, wiced_bt_ecrb_cid_list_t lcid_list, tDRB **p_rx_drb_list)
 Higher layers call this function to accept incoming Enhanced Credit-based L2CAP channel establishment, for which they had gotten a connect indication callback. More...
 
wiced_bool_t wiced_bt_l2cap_ecrb_reconfigure (uint16_t new_rx_mtu, int16_t new_rx_mps, int num_channels, wiced_bt_ecrb_cid_list_t lcid_list, tDRB **p_rx_drb_list)
 Higher layers call this function to reconfigure the MTU and or MPS of Enhanced Credit-based L2CAP channels. 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...
 
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, wiced_bt_ble_pref_conn_params_t *p_conn_params)
 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)
 Application requests to disable or enable parameters update. 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 flow_off_peer)
 App can call this function to flow control data reception from the peer (flow controlled channels only, viz LE COC, ECRB channels) To stop sending credits/flow off the remote peer set flow_off_peer to WICED_TRUE To resume sending credits/flow on set flow_off_peer to WICED_FALSE. 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...
 

Macro Definition Documentation

◆ L2CAP_BLE_CONN_BAD_AUTHENT

#define L2CAP_BLE_CONN_BAD_AUTHENT   5

LE Connection Bad Authentication.

Note
AMP related

◆ L2CAP_ECRB_MIN_MTU

#define L2CAP_ECRB_MIN_MTU   64

ECRB Min MTU.

Note
LE COC related

◆ L2CAP_MINIMUM_OFFSET

#define L2CAP_MINIMUM_OFFSET   13

Minimum offset that L2CAP needs in a buffer.

This is made up of HCI type(1), len(2), handle(2), L2CAP len(2), CID(2), control(2) and SDU length(2)

Typedef Documentation

◆ wiced_bt_l2cap_ch_cfg_bits_t

Channel configuration fields in bit map.

Refer L2CAP channel configuration

◆ wiced_bt_l2cap_connected_cback_t

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.

Parameters
bd_addr: BD Address of remote
local_cid: Local CID assigned to the connection
peer_mtu: Peer MTU
Returns
void

◆ wiced_bt_l2cap_disconnect_indication_cback_t

typedef void() wiced_bt_l2cap_disconnect_indication_cback_t(uint16_t local_cid, uint16_t reason, wiced_bool_t ack)

Disconnect indication callback prototype.

Parameters
local_cid: Local CID
ack: Boolean whether upper layer should ack this
Returns
void

◆ wiced_bt_l2cap_disconnect_confirm_cback_t

typedef void() wiced_bt_l2cap_disconnect_confirm_cback_t(uint16_t local_cid, uint16_t result)

Disconnect confirm callback prototype.

Parameters
local_cid: Local CID
result: Result
Returns
void

◆ wiced_bt_l2cap_data_indication_cback_t

typedef void() wiced_bt_l2cap_data_indication_cback_t(uint16_t local_cid, tDRB *p_drb)

Data received indication callback prototype.

Parameters
local_cid: Local CID
p_drb: Pointer to the data received buffer, check tDRB
Note
: Application is expected to use the data in the callback. Applications should not attempt to free/release the p_drb pointer in this callback, since the buffer will be reused to receive the next incoming packet
Returns
void

◆ wiced_bt_l2cap_tx_complete_cback_t

typedef void() wiced_bt_l2cap_tx_complete_cback_t(uint16_t local_cid, void *p_data)

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
local_cid: Local CID
p_buff: Pointer to the data that was sent
Returns
void

◆ wiced_bt_l2cap_fixed_chnl_cback_t

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.

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

◆ wiced_bt_l2cap_fixed_data_cback_t

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.

Parameters
bd_addr: BD Address of remote
p_buff: Pointer to data
data_len: Data length
Returns
void

◆ wiced_bt_l2cap_le_connect_indication_cback_t

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.

Parameters
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

◆ wiced_bt_l2cap_drb_release_cb

typedef void() wiced_bt_l2cap_drb_release_cb(tDRB *p_drb)

User DRB may be released callback prototype.

This function address is passed in when the user provides a DRB for an eRTM or LE-COC channel. It is called when the DRB can be released, i.e. at the end of the connection.

Parameters
p_drb: Address of the DRB that can be released
Returns
void

◆ wiced_bt_l2cap_le_connect_confirm_cback_t

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.

Parameters
local_cid: Local CID
result: Result - 0 = connected, non-zero means failure reason
mtu_peer: MTU of the peer
Returns
void

Function Documentation

◆ wiced_bt_l2cap_register_fixed_channel()

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.

Parameters
[in]fixed_cid: Fixed Channel #
[in]p_freg: Channel Callbacks and config
Returns
TRUE if registered OK

◆ wiced_bt_l2cap_deregister_fixed_channel()

wiced_bool_t wiced_bt_l2cap_deregister_fixed_channel ( uint16_t  fixed_cid)

De-register a fixed channel.

Parameters
[in]fixed_cid: Fixed Channel #
Returns
TRUE if registered OK

◆ wiced_bt_l2cap_connect_fixed_chnl()

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.

Parameters
[in]fixed_cid: Fixed CID
[in]bd_addr: BD Address of remote
[in]ble_addr_type: Address type
Returns
TRUE if connection started

◆ wiced_bt_l2cap_send_fixed_chnl_data()

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.

Parameters
[in]fixed_cid: Fixed CID
[in]rem_bda: BD Address of remote
[in]p_data: Pointer to data to send
[in]data_len: Length of data to send
Returns
L2CAP_DATAWRITE_SUCCESS, if data accepted L2CAP_DATAWRITE_FAILED, if error

◆ wiced_bt_l2cap_remove_fixed_chnl()

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.

Parameters
[in]fixed_cid: Fixed CID
[in]rem_bda: BD Address of remote Idle timeout to use (or 0xFFFF if don't care)
Returns
TRUE if channel removed

◆ wiced_bt_l2cap_set_fixed_channel_timeout()

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.

The "idle timeout" is the amount of time that a connection can remain up with no L2CAP channels on it. A timeout of zero means that the connection will be torn down immediately when the last channel is removed. A timeout of 0xFFFF means no timeout. Values are in seconds. A bd_addr is the remote BD address. If bd_addr = BT_BD_ANY, then the idle timeouts for all active l2cap links will be changed.

Parameters
[in]rem_bda: Remote BD address
[in]fixed_cid: Fixed CID
[in]idle_timeout: Idle timeout
Returns
TRUE if command succeeded, FALSE if failed

◆ wiced_bt_l2cap_ecrb_register()

wiced_bool_t wiced_bt_l2cap_ecrb_register ( uint16_t  psm,
wiced_bt_l2cap_ecrb_cb_ptrs_t p_ecrb_callbacks 
)

Application calls this function to register support for enhanced credit-based channels.

The PSM must have been previously registered for BR and/or LE.

Parameters
[in]psm: PSM value
[in]p_ecrb_callbacks: callbacks for the credit based channel connections
Returns
WICED_TRUE if all ok

◆ wiced_bt_l2cap_ecrb_deregister()

wiced_bool_t wiced_bt_l2cap_ecrb_deregister ( uint16_t  psm)

Application calls this function to deregister support for enhanced credit-based channels.

The PSM must have been previously registered.

Parameters
[in]psmPSM value
Returns
WICED_TRUE if all OK.

◆ wiced_bt_l2cap_ecrb_connect_req()

int wiced_bt_l2cap_ecrb_connect_req ( uint16_t  psm,
wiced_bt_transport_t  transport,
wiced_bt_device_address_t  bd_addr,
wiced_bt_ble_address_type_t  bd_addr_type,
wiced_bt_ble_conn_mode_t  conn_mode,
uint16_t  our_rx_mtu,
uint16_t  our_rx_mps,
int  num_channels,
tDRB **  p_rx_drb_list,
wiced_bt_ecrb_cid_list_t  lcid_list 
)

Higher layers call this function to create up to 5 credit-based L2CAP connections on the same PSM.

Note
The connection is not established at this time, but connection establishment gets started. The callback function will be invoked when connection establishes or fails.
Parameters
[in]psmPSM Value
[in]transportBluetooth transport for the connection
[in]bd_addr: Bluetooth device address to connect
[in]bd_addr_typeBLE_ADDR_PUBLIC or BLE_ADDR_RANDOM
[in]conn_mode: LE connection mode
[in]our_rx_mtuOur RX MTU to be used for the channels
[in]our_rx_mpsOur RX MPS to be used for the channels
Note
our_rx_mps must be less then wiced_bt_cfg_ble_t::ble_max_rx_pdu_size or wiced_bt_cfg_br_t::br_max_rx_pdu_size for LE and BR/EDR transports respectively
Parameters
[in]num_channels: Number of channels to be created
[in]p_rx_drb_listlist of the allocated tDRB 's, one for each num_channels
Note
: the size of DRB allocated must be >= our_rx_mtu
Parameters
[out]lcid_listlist of cids (channel ids) which will be started
Returns
number of channels which will be started

◆ wiced_bt_l2cap_ecrb_ConnectRsp()

void wiced_bt_l2cap_ecrb_ConnectRsp ( uint16_t  result,
uint8_t  trans_id,
int16_t  our_rx_mtu,
uint16_t  our_rx_mps,
wiced_bt_ecrb_cid_list_t  lcid_list,
tDRB **  p_rx_drb_list 
)

Higher layers call this function to accept incoming Enhanced Credit-based L2CAP channel establishment, for which they had gotten a connect indication callback.

Parameters
[in]result: Result of the connection set by the application. L2CAP result codes (L2CAP_CONN_RESULT)
[in]trans_id: trans_id received in the wiced_bt_l2cap_ecrb_connect_ind
[in]our_rx_mtuOur RX MTU to be used for the channels
[in]our_rx_mpsOur RX MPS to be used for the channels
Note
our_rx_mps must be less then wiced_bt_cfg_ble_t::ble_max_rx_pdu_size or wiced_bt_cfg_br_t::br_max_rx_pdu_size for LE and BR/EDR transports respectively
Parameters
[out]lcid_listlist of cids (channel ids) which will be started as received in wiced_bt_l2cap_ecrb_connect_ind
Note
The CID list in lcid_list must match the CID list returned in the callback. The DRB pointer list must contain a valid DRB pointer for each non-zero CID in the list that the application accepts.
Parameters
[in]p_rx_drb_list: list of the allocated tDRB 's, one for each num_channels
Note
: the size of DRB allocated must be >= our_rx_mtu
Returns
void

◆ wiced_bt_l2cap_ecrb_reconfigure()

wiced_bool_t wiced_bt_l2cap_ecrb_reconfigure ( uint16_t  new_rx_mtu,
int16_t  new_rx_mps,
int  num_channels,
wiced_bt_ecrb_cid_list_t  lcid_list,
tDRB **  p_rx_drb_list 
)

Higher layers call this function to reconfigure the MTU and or MPS of Enhanced Credit-based L2CAP channels.

Parameters
[in]new_rx_mtuOur new RX MTU to be used for the channels
Note
If new_rx_mtu is zero, no change to MTU is requested. Otherwise new_rx_mtu must be larger than the old MTU for all channels.
Parameters
[in]new_rx_mpsOur new RX MPS to be used for the channels
Note
If new_rx_mts is zero, no change to MPS is requested. Otherwise new_rx_mps must be larger than the old MPS for all channels.
new_rx_mps must be less then wiced_bt_cfg_ble_t::ble_max_rx_pdu_size or wiced_bt_cfg_br_t::br_max_rx_pdu_size for LE and BR/EDR transports respectively
Parameters
[in]num_channels: Number of channels to be created
[in]lcid_list: list of channels to be reconfigured
[in]p_rx_drb_list: list of the allocated tDRB 's, one for each num_channels
Note
: the size of DRB allocated must be >= new_rx_mtu
Returns
WICED_TRUE if reconfigure sent OK

◆ wiced_bt_l2cap_get_current_config()

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.

Parameters
[in]lcid: Local CID
[in]pp_our_cfg: pointer of our saved configuration options
[in]p_our_cfg_bits: valid config in bitmap
[in]pp_peer_cfg: pointer of peer's saved configuration options
[in]p_peer_cfg_bits: valid config in bitmap
Returns
TRUE if successful

◆ wiced_bt_l2cap_register()

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.

Parameters
[in]psm: PSM value
[in]p_cb_information: L2CAP cb info
Returns
PSM to use or zero if error. Typically, the PSM returned is the same as was passed in, but for an outgoing-only connection to a dynamic PSM, a "virtual" PSM is returned and should be used in the calls to wiced_bt_l2cap_connect_req().

◆ wiced_bt_l2cap_deregister()

void wiced_bt_l2cap_deregister ( uint16_t  psm)

Other layers call this function to deregister for L2CAP services.

Parameters
[in]psm: PSM value
Returns
void

◆ wiced_bt_l2cap_allocate_psm()

uint16_t wiced_bt_l2cap_allocate_psm ( void  )

Other layers call this function to find an unused PSM for L2CAP services.

Returns
PSM to use.

◆ wiced_bt_l2cap_disconnect_req()

wiced_bool_t wiced_bt_l2cap_disconnect_req ( uint16_t  cid)

Higher layers call this function to disconnect a channel.

Parameters
[in]cid: CID value
Returns
TRUE if disconnect sent, else FALSE

◆ wiced_bt_l2cap_disconnect_rsp()

wiced_bool_t wiced_bt_l2cap_disconnect_rsp ( uint16_t  cid)

Higher layers call this function to acknowledge the disconnection of a channel.

Parameters
[in]cid: CID value
Returns
void

◆ wiced_bt_l2cap_data_write()

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.

Parameters
[in]cid: CID value
[in]p_buf: Input buffer
[in]buf_len: p_buf buffer size
[in]flags: refer L2CAP data write flags
Returns
refer L2CAP data write result

◆ wiced_bt_l2cap_set_idle_timeout()

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.

The "idle timeout" is the amount of time that a connection can remain up with no L2CAP channels on it. A timeout of zero means that the connection will be torn down immediately when the last channel is removed. A timeout of 0xFFFF means no timeout. Values are in seconds.

Parameters
[in]cid: CID value
[in]timeout: Timeout value
[in]is_global: TRUE, if global
Returns
TRUE if command succeeded, FALSE if failed

◆ wiced_bt_l2cap_set_idle_timeout_by_bd_addr()

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.

The "idle timeout" is the amount of time that a connection can remain up with no L2CAP channels on it. A timeout of zero means that the connection will be torn down immediately when the last channel is removed. A timeout of 0xFFFF means no timeout. Values are in seconds. A bd_addr is the remote BD address. If bd_addr = BT_BD_ANY, then the idle timeouts for all active l2cap links will be changed.

Parameters
[in]bd_addr: BD Address
[in]timeout: Timeout value
[in]transport: Transport (BR-EDR or LE)
Returns
TRUE if command succeeded, FALSE if failed
Note
This timeout applies to all logical channels active on the ACL link.

◆ wiced_bt_l2cap_get_bdaddrby_handle()

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.

Parameters
[in]handle: HCI handle
[in]bd_addr: Peer Bd Address
Returns
: TRUE if found lcb for the given handle, FALSE otherwise

◆ wiced_bt_l2cap_cancel_ble_connect_req()

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.

Parameters
[in]rem_bda: BD Address of remote
Returns
: TRUE if connection was cancelled

◆ wiced_bt_l2cap_update_ble_conn_params()

wiced_bool_t wiced_bt_l2cap_update_ble_conn_params ( wiced_bt_device_address_t  rem_bdRa,
wiced_bt_ble_pref_conn_params_t p_conn_params 
)

Update LE connection parameters.

Parameters
[in]rem_bdRa: Remote BD Address
[in]p_conn_params: Preferred connection parameters
Returns
: TRUE if update started

◆ wiced_bt_l2cap_enable_update_ble_conn_params()

wiced_bool_t wiced_bt_l2cap_enable_update_ble_conn_params ( wiced_bt_device_address_t  rem_bda,
wiced_bool_t  enable 
)

Application requests to disable or enable parameters update.

Note
By default parameter updates are allowed on connection complete This API is typically used to pause parameter updates.
Parameters
[in]rem_bdaRemote Bd Address
[in]enableTRUE to enable,FALSE to disable. If enable = FALSE, and if parameters are already updated, this API resets them to what was requested during connection establishement If enable = TRUE, then any pending request sent through wiced_bt_l2cap_update_ble_conn_params is processed
Returns
: TRUE if update started

◆ wiced_bt_l2cap_get_ble_conn_role()

uint8_t wiced_bt_l2cap_get_ble_conn_role ( wiced_bt_device_address_t  bd_addr)

This function returns the connection role.

Parameters
[in]bd_addrBD Address
Returns
link role.( 0 => HCI_ROLE_CENTRAL and 1 => HCI_ROLE_PERIPHERAL)

◆ wiced_bt_l2cap_le_register()

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.

Parameters
[in]le_psm: LE PSM value
[in]p_cb_information: L2CAP cb info
Returns
LE_PSM to use or zero if error. Typically the LE_PSM returned is the same as was passed in, but for an outgoing-only connection a "virtual" LE_PSM is returned and should be used in the calls to wiced_bt_l2cap_le_connect_req() and wiced_bt_l2cap_le_deregister().

◆ wiced_bt_l2cap_le_deregister()

wiced_bool_t wiced_bt_l2cap_le_deregister ( uint16_t  le_psm)

Other layers call this function to deregister L2CAP services for LE_PSM.

Parameters
[in]le_psmLE PSM value
Returns
TRUE for success, FALSE for failure

◆ wiced_bt_l2cap_le_connect_req()

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.

Note that the connection is not established at this time, but connection establishment gets started. The callback function will be invoked when connection establishes or fails.

Parameters
[in]le_psm: LE PSM value
[in]p_bd_addr: BD Address
[in]bd_addr_type: BLE_ADDR_PUBLIC or BLE_ADDR_RANDOM
[in]conn_mode: BLE_CONN_MODE_HIGH_DUTY or BLE_CONN_MODE_LOW_DUTY
[in]rx_mtu: Rx MTU value
Note
rx_mtu must be less then wiced_bt_cfg_ble_t::ble_max_rx_pdu_size
Parameters
[in]req_security: Security required
[in]req_encr_key_size: key size
[in]p_rx_drb: DRB to receive peer's data. MUST be large enough to hold RX MTU data, check tDRB
Note
p_rx_drb can be released by the application on receiving a callback with the wiced_bt_l2cap_le_appl_information_t::le_release_drb_cb of the p_cb_information member of wiced_bt_l2cap_le_register
Returns
the CID of the connection, or 0 if it failed to start

◆ wiced_bt_l2cap_le_connect_rsp()

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.

Parameters
[in]p_bd_addr: BD Address
[in]id: ID received from wiced_bt_l2cap_le_connect_indication_cback_t callback.
[in]lcid: Local CID
[in]result: L2CAP result codes (L2CAP_CONN_RESULT)
[in]rx_mtu: Rx MTU value (must be <= ACL_POOL_SIZE)
[in]p_rx_drb: DRB to receive peer's data. MUST be large enough to hold RX MTU data, check tDRB
Note
p_rx_drb can be released by the application on receiving a callback with the wiced_bt_l2cap_le_appl_information_t::le_release_drb_cb of the p_cb_information member of wiced_bt_l2cap_le_register
Returns
TRUE for success, FALSE for failure

◆ wiced_bt_l2cap_le_disconnect_req()

wiced_bool_t wiced_bt_l2cap_le_disconnect_req ( uint16_t  lcid)

Higher layers call this function to disconnect a LE COC channel.

Parameters
[in]lcidLocal CID value
Returns
TRUE if disconnect sent, else FALSE

◆ wiced_bt_l2cap_le_disconnect_rsp()

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.

Parameters
[in]lcidLocal CID value
Returns
void

◆ wiced_bt_l2cap_le_data_write()

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.

Parameters
[in]cid: CID value
[in]p_data: Input buffer
[in]buf_len: p_data buffer size
Returns
L2CAP_DATAWRITE_SUCCESS, if data accepted, else FALSE L2CAP_DATAWRITE_CONGESTED, if data accepted and the channel is congested L2CAP_DATAWRITE_FAILED, if error

◆ wiced_bt_l2cap_le_set_user_congestion()

wiced_bool_t wiced_bt_l2cap_le_set_user_congestion ( uint16_t  lcid,
wiced_bool_t  flow_off_peer 
)

App can call this function to flow control data reception from the peer (flow controlled channels only, viz LE COC, ECRB channels) To stop sending credits/flow off the remote peer set flow_off_peer to WICED_TRUE To resume sending credits/flow on set flow_off_peer to WICED_FALSE.

Note
: This API is typically invoked by applications that buffer incoming data for further processing/forwarding. On invoking the API further issuance of L2CAP credits is stopped, however, the remote will continue to send data till it runs out of credits. The maximum amount of data size expected to be received is 2 * Receive MTU which could be split over a max of (Receive MTU + 2(Sdu header size))/(Receive MPS) number of packets
Parameters
[in]lcid: Local CID value
[in]flow_off_peer: to flow off peer set to WICED_TRUE, to flow on peer set to WICED_FALSE
Returns
TRUE if command processed OK

◆ wiced_bt_l2cap_le_get_peer_mtu()

uint16_t wiced_bt_l2cap_le_get_peer_mtu ( uint16_t  lcid)

Higher layers call this function to get peer MTU.

Parameters
[in]lcid: Local CID value
Returns
Peer MTU or 0.

◆ wiced_bt_l2cap_le_determ_secur_rsp()

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.

It is called by call acceptor on reception of LE Credit Based Connection Request.

Parameters
[in]bd_addr: BD Address
[in]req_secur: Security required
[in]req_encr_key_size: Key size
Returns
L2CAP_CONN_OK/L2CAP_BLE_CONN_BAD_AUTHENT/ L2CAP_BLE_CONN_BAD_KEY_SIZE/L2CAP_BLE_CONN_BAD_ENCRYPT/ L2CAP_CONN_NO_RESOURCES.