L2CAP transfer#
The L2CAP data channel component is used to transfer data through the link layer. The component serves as an API to access the L2CAP data transfer functionalites.
Modules#
sl_bt_l2cap_transfer_transfer_s
Enumerations#
Define sender and receiver sides.
Typedefs#
Forward declaration.
Callback functions used by the transfer object.
Transfer structure that is used for the L2CAP data channels.
Functions#
Macros#
Channel parameter limit definitions.
Enumeration Documentation#
sl_bt_l2cap_transfer_transfer_mode_t#
sl_bt_l2cap_transfer_transfer_mode_t
Define sender and receiver sides.
Enumerator | |
---|---|
SL_BT_L2CAP_TRANSFER_MODE_RECEIVE | Transfer side is responding to data receive events. |
SL_BT_L2CAP_TRANSFER_MODE_TRANSMIT | Transfer side is initiating data transfer. |
SL_BT_L2CAP_TRANSFER_MODE_INACTIVE | Transfer side is inactive - closing. |
61
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h
Typedef Documentation#
sl_bt_l2cap_transfer_transfer_handle_t#
typedef struct sl_bt_l2cap_transfer_transfer_s* sl_bt_l2cap_transfer_transfer_handle_t
Forward declaration.
68
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h
sl_bt_l2cap_transfer_data_received_cb_t#
typedef uint16_t(* sl_bt_l2cap_transfer_data_received_cb_t) (sl_bt_l2cap_transfer_transfer_handle_t transfer_object, uint32_t offset, uint16_t size, uint8_t *data) )(sl_bt_l2cap_transfer_transfer_handle_t transfer_object, uint32_t offset, uint16_t size, uint8_t *data)
[in] | transfer_object | Active transfer |
[in] | offset | Current data offset |
[in] | size | Size of the incoming data |
[in] | data | Incoming data |
Callback is invoked when data on L2CAP channel is received.
Returns
credit Requested credit that should be sent to the other side
83
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h
sl_bt_l2cap_transfer_transfer_finished_cb_t#
typedef void(* sl_bt_l2cap_transfer_transfer_finished_cb_t) (sl_bt_l2cap_transfer_transfer_handle_t transfer_object, sl_status_t error_code) )(sl_bt_l2cap_transfer_transfer_handle_t transfer_object, sl_status_t error_code)
[in] | transfer_object | Active transfer |
[in] | error_code | SL_STATUS type error code |
Callback is invoked when data transfer on L2CAP channel is finished.
94
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h
sl_bt_l2cap_transfer_data_transmit_cb_t#
typedef void(* sl_bt_l2cap_transfer_data_transmit_cb_t) (sl_bt_l2cap_transfer_transfer_handle_t transfer_object, uint32_t offset, uint32_t size, uint8_t **data, uint32_t *data_size) )(sl_bt_l2cap_transfer_transfer_handle_t transfer_object, uint32_t offset, uint32_t size, uint8_t **data, uint32_t *data_size)
[in] | transfer_object | Active transfer |
[in] | offset | Current offset of requested data |
[in] | size | Maximum size of requested data |
[out] | data | Pointer of pointer to data |
[out] | data_size | Size of the provided data |
Callback for data transmission on L2CAP channel. Called when data is about to transmit on the channel to provide the next data packet.
107
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h
sl_bt_l2cap_transfer_channel_opened_cb_t#
typedef void(* sl_bt_l2cap_transfer_channel_opened_cb_t) (sl_bt_l2cap_transfer_transfer_handle_t transfer_object) )(sl_bt_l2cap_transfer_transfer_handle_t transfer_object)
[in] | transfer_object | Active transfer |
Callback is invoked when a channel is opened.
118
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h
sl_bt_l2cap_transfer_callbacks_t#
typedef struct callbacks_s sl_bt_l2cap_transfer_callbacks_t
Callback functions used by the transfer object.
126
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h
sl_bt_l2cap_transfer_transfer_t#
typedef struct sl_bt_l2cap_transfer_transfer_s sl_bt_l2cap_transfer_transfer_t
Transfer structure that is used for the L2CAP data channels.
145
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h
Function Documentation#
sl_bt_l2cap_transfer_start_data_transfer#
sl_status_t sl_bt_l2cap_transfer_start_data_transfer (sl_bt_l2cap_transfer_transfer_t * transfer, bool open_channel)
[in] | transfer | Active transfer object. Mandatory settings are:
|
[in] | open_channel | If true - this transfer will initiate the L2CAP channel opening |
Start data transfer process. Both sides should call this function and decide which side will send the open request.
It is important that the transfer object shall be well configured to create a valid open request.
195
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h
sl_bt_l2cap_transfer_increase_credit#
sl_status_t sl_bt_l2cap_transfer_increase_credit (sl_bt_l2cap_transfer_transfer_t * transfer, uint16_t credit)
[in] | transfer | Targeted transfer object - name of the transfer |
[in] | credit | The credit value, i.e., the additional number of PDUs the peer channel endpoint can send. Range: 1 to 65535. |
API call to send credit to the initiator.
Returns
SL_STATUS_OK if successful. Error code otherwise
207
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h
sl_bt_l2cap_transfer_abort_transfer#
sl_status_t sl_bt_l2cap_transfer_abort_transfer (sl_bt_l2cap_transfer_transfer_t * transfer)
[in] | transfer | Targeted transfer object - name of the transfer |
API call to abort L2CAP data transfer - will invoke a close channel event
Returns
SL_STATUS_OK if successful. Error code otherwise
217
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h
sl_bt_l2cap_transfer_check_progress#
sl_status_t sl_bt_l2cap_transfer_check_progress (sl_bt_l2cap_transfer_transfer_t * transfer)
[in] | transfer | Targeted transfer object - name of the transfer |
Check if a transfer is in progress
228
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h
sl_bt_l2cap_transfer_open_prior_channel#
sl_status_t sl_bt_l2cap_transfer_open_prior_channel (sl_bt_l2cap_transfer_transfer_t * transfer)
[in] | transfer | Targeted transfer object |
Open prior channel
Returns
status of the operation
237
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h
Macro Definition Documentation#
SL_BT_L2CAP_TRANSFER_CONFIG_ACCEPT_PRIOR_CHANNELS#
#define SL_BT_L2CAP_TRANSFER_CONFIG_ACCEPT_PRIOR_CHANNELSValue:
1
45
of file common/l2cap_transfer/config/sl_bt_l2cap_transfer_config.h
SL_BT_L2CAP_TRANSFER_CONFIG_PRIOR_CHANNEL_COUNT#
#define SL_BT_L2CAP_TRANSFER_CONFIG_PRIOR_CHANNEL_COUNTValue:
SL_BT_CONFIG_MAX_CONNECTIONS
49
of file common/l2cap_transfer/config/sl_bt_l2cap_transfer_config.h
SL_BT_L2CAP_TRANSFER_MIN_SDU#
#define SL_BT_L2CAP_TRANSFER_MIN_SDUValue:
23
Channel parameter limit definitions.
51
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h
SL_BT_L2CAP_TRANSFER_MAX_SDU#
#define SL_BT_L2CAP_TRANSFER_MAX_SDUValue:
65533
52
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h
SL_BT_L2CAP_TRANSFER_MIN_PDU#
#define SL_BT_L2CAP_TRANSFER_MIN_PDUValue:
23
53
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h
SL_BT_L2CAP_TRANSFER_MAX_PDU#
#define SL_BT_L2CAP_TRANSFER_MAX_PDUValue:
252
54
of file common/l2cap_transfer/inc/sl_bt_l2cap_transfer.h