BR/EDR

group l2cap_br_edr_api_functions

API’s used for BR/EDR L2CAP.

Functions

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.

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
  • psm[in] : PSM value

  • p_bd_addr[in] : BD Address

Returns

the CID of the connection, or 0 if it failed to start

void wiced_bt_l2cap_ertm_enable(void)

Enable ERTM.

             Calling this function will cause the linker to include
             ERTM related functions.

Returns

void

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.

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
  • psm[in] : PSM value

  • p_bd_addr[in] : BD Address

  • p_ertm_information[in] : ERTM info

Returns

the CID of the connection, or 0 if it failed to start

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.

Parameters
  • lcid[in] : Local CID value

  • p_drb[in] : Address of the DRB

  • drb_max_payload_len[in] : DRB Size. It should greater than or equal to to MTU.

  • p_unreg_cb[in] : wiced_bt_l2cap_drb_release_cb.

Returns

TRUE if disconnect sent, else FALSE

uint8_t wiced_bt_l2cap_set_desire_role(uint8_t new_role)

This function sets the desire role for L2CAP.

If the new role is L2CAP_ROLE_ALLOW_SWITCH, allow switch on HciCreateConnection. If the new role is L2CAP_ROLE_DISALLOW_SWITCH, do not allow switch on HciCreateConnection.

If the new role is a valid role (HCI_ROLE_CENTRAL or HCI_ROLE_PERIPHERAL), the desire role is set to the new value. Otherwise, it is not changed.

Parameters

new_role[in] : New role value. Refer L2CAP role

Returns

the new (current) role. Refer L2CAP role

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.

If called with L2CAP_FLUSH_CHANNELS_GET (0), it simply returns the number of buffers queued for that CID L2CAP_FLUSH_CHANNELS_ALL (0xffff) flushes all buffers. All other values specifies the maximum buffers to flush.

Parameters
  • lcid[in] : Local CID value

  • num_to_flush[in] : Number of items for flushing, Refer L2CAP flush channels

Returns

Number of buffers left queued for that CID

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.

Parameters
Returns

TRUE if a valid channel, else FALSE

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.

Parameters
Returns

TRUE if a valid channel, else FALSE

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.

            data_enabled - TRUE data flows, FALSE data is stopped

Parameters
  • cid[in] : CID value

  • data_enabled[in] : data enabled

Returns

TRUE if valid channel, else FALSE

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.

(FCR Mode)

Parameters
Returns

TRUE if a valid channel, else FALSE

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.

note

This flush timeout applies to all logical channels active on the ACL link.

Parameters
  • bd_addr[in] : The remote BD address of ACL link. If it is BT_DB_ANY then the flush time out will be applied to all ACL link.

  • flush_timeout[in] : flush time out in ms 0x0000 : No automatic flush L2CAP_NO_RETRANSMISSION : No retransmission 0x0002 - 0xFFFE : flush time out, if (flush_timeout*8)+3/5) <= HCI_MAX_AUTO_FLUSH_TOUT (in 625us slot). Otherwise, return FALSE. L2CAP_NO_AUTOMATIC_FLUSH : No automatic flush

Returns

TRUE if command succeeded, FALSE if failed

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.

Parameters
  • bd_addr[in] : Peer Bd Address

  • p_ext_feat[in] : features

  • p_chnl_mask[in] : mask storage area

Returns

: TRUE if peer is connected

uint8_t wiced_bt_l2cap_get_chnl_fcr_mode(uint16_t lcid)

Get the channel FCR mode.

Parameters

lcid[in] Local CID

Returns

Channel mode Refer L2CAP_FCR_MODE