nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Logical Link Control and Adaptation Protocol (L2CAP)

Definitions and prototypes for the L2CAP interface. More...

Modules

 Defines
 

Data Structures

struct  ble_l2cap_header_t
 Packet header format for L2CAP transmission. More...
 
struct  ble_l2cap_evt_rx_t
 L2CAP Received packet event report. More...
 
struct  ble_l2cap_evt_t
 L2CAP event callback event structure. More...
 

Enumerations

enum  BLE_L2CAP_SVCS {
  SD_BLE_L2CAP_CID_REGISTER = 0xB0, SD_BLE_L2CAP_CID_UNREGISTER, SD_BLE_L2CAP_TX, SD_BLE_L2CAP_CID_REGISTER = 0xB0,
  SD_BLE_L2CAP_CID_UNREGISTER, SD_BLE_L2CAP_TX, SD_BLE_L2CAP_CID_REGISTER = 0xB0, SD_BLE_L2CAP_CID_UNREGISTER,
  SD_BLE_L2CAP_TX
}
 L2CAP API SVC numbers. More...
 
enum  BLE_L2CAP_EVTS { BLE_L2CAP_EVT_RX = 0x70, BLE_L2CAP_EVT_RX = 0x70, BLE_L2CAP_EVT_RX = 0x70 }
 L2CAP Event IDs. More...
 

Functions

uint32_t sd_ble_l2cap_cid_register (uint16_t cid)
 Register a CID with L2CAP. More...
 
uint32_t sd_ble_l2cap_cid_unregister (uint16_t cid)
 Unregister a CID with L2CAP. More...
 
uint32_t sd_ble_l2cap_tx (uint16_t conn_handle, ble_l2cap_header_t const *const p_header, uint8_t const *const p_data)
 Transmit an L2CAP packet. More...
 

Detailed Description

Definitions and prototypes for the L2CAP interface.

Enumeration Type Documentation

L2CAP Event IDs.

Enumerator
BLE_L2CAP_EVT_RX 

L2CAP packet received.

BLE_L2CAP_EVT_RX 

L2CAP BLE Event base. L2CAP packet received.

BLE_L2CAP_EVT_RX 

L2CAP packet received.

L2CAP API SVC numbers.

Enumerator
SD_BLE_L2CAP_CID_REGISTER 

Register a CID.

SD_BLE_L2CAP_CID_UNREGISTER 

Unregister a CID.

SD_BLE_L2CAP_TX 

Transmit a packet.

SD_BLE_L2CAP_CID_REGISTER 

L2CAP BLE SVC base. Register a CID.

SD_BLE_L2CAP_CID_UNREGISTER 

Unregister a CID.

SD_BLE_L2CAP_TX 

Transmit a packet.

SD_BLE_L2CAP_CID_REGISTER 

Register a CID.

SD_BLE_L2CAP_CID_UNREGISTER 

Unregister a CID.

SD_BLE_L2CAP_TX 

Transmit a packet.

Function Documentation

uint32_t sd_ble_l2cap_cid_register ( uint16_t  cid)

Register a CID with L2CAP.

This registers a higher protocol layer with the L2CAP multiplexer, and is requried prior to all operations on the CID.

Parameters
[in]cidL2CAP CID.
Returns
NRF_SUCCESS Successfully registered a CID with the L2CAP layer.
NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, CID must be above BLE_L2CAP_CID_DYN_BASE.
BLE_ERROR_L2CAP_CID_IN_USE L2CAP CID already in use.
NRF_ERROR_NO_MEM Not enough memory to complete operation.
uint32_t sd_ble_l2cap_cid_unregister ( uint16_t  cid)

Unregister a CID with L2CAP.

This unregisters a previously registerd higher protocol layer with the L2CAP multiplexer.

Parameters
[in]cidL2CAP CID.
Returns
NRF_SUCCESS Successfully unregistered the CID.
NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
NRF_ERROR_NOT_FOUND CID not previously registered.
uint32_t sd_ble_l2cap_tx ( uint16_t  conn_handle,
ble_l2cap_header_t const *const  p_header,
uint8_t const *const  p_data 
)

Transmit an L2CAP packet.

Note
It is important to note that a call to this function will consume an application buffer, and will therefore generate a BLE_EVT_TX_COMPLETE event when the packet has been transmitted. Please see the documentation of sd_ble_tx_buffer_count_get for more details.
Parameters
[in]conn_handleConnection Handle.
[in]p_headerPointer to a packet header containing length and CID.
[in]p_dataPointer to the data to be transmitted.
Returns
NRF_SUCCESS Successfully queued an L2CAP packet for transmission.
NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, CIDs must be registered beforehand with sd_ble_l2cap_cid_register.
NRF_ERROR_NOT_FOUND CID not found.
NRF_ERROR_NO_MEM Not enough memory to complete operation.
BLE_ERROR_NO_TX_BUFFERS Not enough application buffers available.
NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, see BLE_L2CAP_MTU_DEF.