RA Flexible Software Package Documentation
Release v5.6.0
|
|
Functions | |
ble_status_t | R_BLE_L2CAP_RegisterCfPsm (ble_l2cap_cf_app_cb_t cb, uint16_t psm, uint16_t lwm) |
This function registers PSM that uses L2CAP CBFC Channel and a callback for L2CAP event. More... | |
ble_status_t | R_BLE_L2CAP_DeregisterCfPsm (uint16_t psm) |
This function stops the use of the L2CAP CBFC Channel specified by the psm parameter and deregisters the callback function for L2CAP event. More... | |
ble_status_t | R_BLE_L2CAP_ReqCfConn (uint16_t conn_hdl, st_ble_l2cap_conn_req_param_t *p_conn_req_param) |
This function sends a connection request for L2CAP CBFC Channel. More... | |
ble_status_t | R_BLE_L2CAP_RspCfConn (st_ble_l2cap_conn_rsp_param_t *p_conn_rsp_param) |
This function replies to the connection request for L2CAP CBFC Channel from the remote device. More... | |
ble_status_t | R_BLE_L2CAP_DisconnectCf (uint16_t lcid) |
This function sends a disconnection request for L2CAP CBFC Channel. More... | |
ble_status_t | R_BLE_L2CAP_SendCfCredit (uint16_t lcid, uint16_t credit) |
This function sends credit to a remote device. More... | |
ble_status_t | R_BLE_L2CAP_SendCfData (uint16_t conn_hdl, uint16_t lcid, uint16_t data_len, uint8_t *p_sdu) |
This function sends the data to a remote device via L2CAP CBFC Channel. More... | |
Data Structures | |
struct | st_ble_l2cap_conn_req_param_t |
L2CAP CBFC Channel connection request parameters. More... | |
struct | st_ble_l2cap_conn_rsp_param_t |
L2CAP CBFC Channel connection response parameters. More... | |
struct | st_ble_l2cap_cf_conn_evt_t |
L2CAP CBFC Channel connection parameters. More... | |
struct | st_ble_l2cap_cf_data_evt_t |
Sent/Received Data parameters. More... | |
struct | st_ble_l2cap_cf_credit_evt_t |
Credit parameters of local or remote device. More... | |
struct | st_ble_l2cap_cf_disconn_evt_t |
Disconnection parameters. More... | |
struct | st_ble_l2cap_rej_evt_t |
Command Reject parameters. More... | |
struct | st_ble_l2cap_cf_evt_data_t |
st_ble_l2cap_cf_evt_data_t is the type of the data notified in a L2CAP Event. More... | |
Macros | |
#define | BLE_L2CAP_MAX_CBFC_PSM |
The maximum number of callbacks that host stack can register. | |
#define | BLE_L2CAP_CF_RSP_SUCCESS |
Notify the remote device that the connection can be established. | |
#define | BLE_L2CAP_CF_RSP_RFSD_INSF_AUTH |
Notify the remote device that the connection can not be established because of insufficient authentication. | |
#define | BLE_L2CAP_CF_RSP_RFSD_INSF_AUTRZ |
Notify the remote device that the connection can not be established because of insufficient Authorization. | |
#define | BLE_L2CAP_CF_RSP_RFSD_INSF_ENC_KEY |
Notify the remote device that the connection can not be established because of Encryption Key Size. | |
#define | BLE_L2CAP_CF_RSP_RFSD_INSF_ENC |
Notify the remote device that the connection can not be established because of Encryption. | |
#define | BLE_L2CAP_CF_RSP_RFSD_UNAC_PARAM |
Notify the remote device that the connection can not be established because the parameters is unacceptable to local device. | |
Typedefs | |
typedef void(* | ble_l2cap_cf_app_cb_t) (uint16_t event_type, ble_status_t event_result, st_ble_l2cap_cf_evt_data_t *p_event_data) |
ble_l2cap_cf_app_cb_t is the L2CAP Event callback function type. More... | |
Enumerations | |
enum | e_r_ble_l2cap_cf_evt_t |
L2CAP Event Identifier. More... | |
struct st_ble_l2cap_conn_req_param_t |
L2CAP CBFC Channel connection request parameters.
struct st_ble_l2cap_conn_rsp_param_t |
L2CAP CBFC Channel connection response parameters.
Data Fields | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
uint16_t | lcid | CID identifying the L2CAP CBFC Channel on local device. The valid range is 0x40-0x40 + BLE_L2CAP_MAX_CBFC_PSM - 1. | ||||||||||||||
uint16_t | response |
The response to the connection request. Select one of the following.
| ||||||||||||||
uint16_t | mtu | MTU(byte) of packet that L2CAP CBFC Channel on local device can receive. | ||||||||||||||
uint16_t | mps | MPS(byte) of packet that L2CAP CBFC Channel on local device can receive. | ||||||||||||||
uint16_t | credit | The number of LE-Frame that L2CAP CBFC Channel on local device can receive. |
struct st_ble_l2cap_cf_conn_evt_t |
L2CAP CBFC Channel connection parameters.
Data Fields | ||
---|---|---|
uint16_t | cid | CID identifying the L2CAP CBFC Channel. |
uint16_t | psm | PSM allocated by the cid field. |
uint16_t | mtu | MTU of local (specified in BLE_L2CAP_EVENT_CF_CONN_IND) / remote (notified in BLE_L2CAP_EVENT_CF_CONN_CNF) device. |
uint16_t | mps | MPS of local (specified in BLE_L2CAP_EVENT_CF_CONN_IND) / remote (notified in BLE_L2CAP_EVENT_CF_CONN_CNF) device. |
uint16_t | credit | Credit of local (specified in BLE_L2CAP_EVENT_CF_CONN_IND) / remote (notified in BLE_L2CAP_EVENT_CF_CONN_CNF) device. |
struct st_ble_l2cap_cf_data_evt_t |
struct st_ble_l2cap_cf_credit_evt_t |
struct st_ble_l2cap_cf_disconn_evt_t |
struct st_ble_l2cap_rej_evt_t |
Command Reject parameters.
struct st_ble_l2cap_cf_evt_data_t |
st_ble_l2cap_cf_evt_data_t is the type of the data notified in a L2CAP Event.
ble_l2cap_cf_app_cb_t |
ble_l2cap_cf_app_cb_t is the L2CAP Event callback function type.
[in] | event_type | The type of L2CAP Event. |
[in] | event_result | The result of L2CAP Event |
[in] | p_event_data | Data notified by L2CAP Event. |
L2CAP Event Identifier.
Enumerator | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
BLE_L2CAP_EVENT_CF_CONN_CNF | After the connection request for L2CAP CBFC Channel has been sent with R_BLE_L2CAP_ReqCfConn(), when the L2CAP CBFC Channel connection response has been received, BLE_L2CAP_EVENT_CF_CONN_CNF event occurs. Event Code: 0x5001result:
Event Data: | ||||||||||||||||||||||
BLE_L2CAP_EVENT_CF_CONN_IND | When a connection request for L2CPA CBFC Channel has been received from a remote device, BLE_L2CAP_EVENT_CF_CONN_IND event occurs. Event Code: 0x5002result:
Event Data: | ||||||||||||||||||||||
BLE_L2CAP_EVENT_CF_DISCONN_CNF | After local device has sent a disconnection request for L2CAP CBFC Channel by R_BLE_L2CAP_DisconnectCf(), when the local device has received the response, BLE_L2CAP_EVENT_CF_DISCONN_CNF event occurs. Event Code: 0x5003result:
Event Data: | ||||||||||||||||||||||
BLE_L2CAP_EVENT_CF_DISCONN_IND | When local device has received a disconnection request for L2CAP CBFC Channel from the remote device, BLE_L2CAP_EVENT_CF_DISCONN_IND event occurs. Event Code: 0x5004result:
Event Data: | ||||||||||||||||||||||
BLE_L2CAP_EVENT_CF_RX_DATA_IND | When local device has received data on L2CAP CBFC Channel, BLE_L2CAP_EVENT_CF_RX_DATA_IND event occurs. Event Code: 0x5005result:
Event Data: | ||||||||||||||||||||||
BLE_L2CAP_EVENT_CF_LOW_RX_CRD_IND | When the credit of the L2CAP CBFC Channel has reached the Low Water Mark, BLE_L2CAP_EVENT_CF_LOW_RX_CRD_IND event occurs. Event Code: 0x5006result:
Event Data: | ||||||||||||||||||||||
BLE_L2CAP_EVENT_CF_TX_CRD_IND | When local device has received credit from a remote device, BLE_L2CAP_EVENT_CF_TX_CRD_IND event occurs. Event Code: 0x5007result:
Event Data: | ||||||||||||||||||||||
BLE_L2CAP_EVENT_CF_TX_DATA_CNF | When the data transmission has been completed from host stack to Controller, BLE_L2CAP_EVENT_CF_TX_DATA_CNF event occurs. Event Code: 0x5008result:
Event Data: | ||||||||||||||||||||||
BLE_L2CAP_EVENT_CMD_REJ | When local device has received Command Reject PDU, BLE_L2CAP_EVENT_CMD_REJ event occurs. Event Code: 0x5009result:
Event Data: |
ble_status_t R_BLE_L2CAP_RegisterCfPsm | ( | ble_l2cap_cf_app_cb_t | cb, |
uint16_t | psm, | ||
uint16_t | lwm | ||
) |
This function registers PSM that uses L2CAP CBFC Channel and a callback for L2CAP event.
Only one callback is available per PSM. Configure in each PSM the Low Water Mark of the LE-Frames that the local device can receive.
When the number of the credit reaches the Low Water Mark, BLE_L2CAP_EVENT_CF_LOW_RX_CRD_IND event is notified to the application layer.
The number of PSM is defined as BLE_L2CAP_MAX_CBFC_PSM.
The result of this API call is returned by a return value.
[in] | cb | Callback function for L2CAP event. | |||||||||
[in] | psm | Identifier indicating the protocol/profile that uses L2CAP CBFC Channel.
| |||||||||
[in] | lwm | Low Water Mark that indicates the LE-Frame numbers that the local device can receive. |
BLE_SUCCESS(0x0000) | Success |
BLE_ERR_INVALID_PTR(0x0001) | The cb parameter is specified as NULL. |
BLE_ERR_INVALID_ARG(0x0003) | The psm parameter is out of range. |
BLE_ERR_CONTEXT_FULL(0x000B) | More than BLE_L2CAP_MAX_CBFC_PSM+1 PSMs, callbacks has been registered. |
ble_status_t R_BLE_L2CAP_DeregisterCfPsm | ( | uint16_t | psm | ) |
This function stops the use of the L2CAP CBFC Channel specified by the psm parameter and deregisters the callback function for L2CAP event.
The result of this API call is returned by a return value.
[in] | psm | PSM that is to be stopped to use the L2CAP CBFC Channel. Set the PSM registered by R_BLE_L2CAP_RegisterCfPsm(). |
BLE_SUCCESS(0x0000) | Success |
BLE_ERR_NOT_FOUND(0x000D) | The callback function allocated by the psm parameter is not found. |
ble_status_t R_BLE_L2CAP_ReqCfConn | ( | uint16_t | conn_hdl, |
st_ble_l2cap_conn_req_param_t * | p_conn_req_param | ||
) |
This function sends a connection request for L2CAP CBFC Channel.
The connection response is notified by BLE_L2CAP_EVENT_CF_CONN_CNF event.
The result of this API call is returned by a return value.
[in] | conn_hdl | Connection handle identifying the remote device that the connection request is sent to. |
[in] | p_conn_req_param | Connection request parameters. |
BLE_SUCCESS(0x0000) | Success |
BLE_ERR_INVALID_PTR(0x0001) | The p_conn_req_param parameter is specified as NULL. |
BLE_ERR_INVALID_ARG(0x0003) | The mtu parameter or the mps parameter is out of range. |
BLE_ERR_INVALID_STATE(0x0008) | CF Channel connection has not been established. |
BLE_ERR_CONTEXT_FULL(0x000B) | New CF Channel can not be registered or other L2CAP Command is processing. |
BLE_ERR_MEM_ALLOC_FAILED(0x000C) | Insufficient memory is needed to generate this function. |
BLE_ERR_INVALID_HDL(0x000E) | The remote device specified by conn_hdl is not found. |
BLE_ERR_NOT_YET_READY(0x0012) | The psm parameter is not registered. |
ble_status_t R_BLE_L2CAP_RspCfConn | ( | st_ble_l2cap_conn_rsp_param_t * | p_conn_rsp_param | ) |
This function replies to the connection request for L2CAP CBFC Channel from the remote device.
The connection request is notified by BLE_L2CAP_EVENT_CF_CONN_IND event. The result of this API call is returned by a return value.
[in] | p_conn_rsp_param | Connection response parameters. |
BLE_SUCCESS(0x0000) | Success |
BLE_ERR_INVALID_PTR(0x0001) | The p_conn_rsp_param parameter is specified as NULL. |
BLE_ERR_NOT_FOUND(0x000D) | A connection request for L2CAP CBFC Channel has not been received, or CID specified by the lcid field in the p_conn_rsp_param parameter is not found. |
ble_status_t R_BLE_L2CAP_DisconnectCf | ( | uint16_t | lcid | ) |
This function sends a disconnection request for L2CAP CBFC Channel.
When L2CAP CBFC Channel has been disconnected, BLE_L2CAP_EVENT_CF_DISCONN_CNF event is notified to the application layer.
[in] | lcid | CID identifying the L2CAP CBFC Channel that has been disconnected. The valid range is 0x40 - (0x40 + BLE_L2CAP_MAX_CBFC_PSM - 1). |
BLE_SUCCESS(0x0000) | Success |
BLE_ERR_INVALID_OPERATION(0x0009) | CF Channel connection has not been established. |
BLE_ERR_CONTEXT_FULL(0x000B) | This function was called while processing other L2CAP command. |
BLE_ERR_MEM_ALLOC_FAILED(0x000C) | There are no memories for L2CAP Command. |
BLE_ERR_NOT_FOUND(0x000D) | CID specified the lcid parameter is not found. |
ble_status_t R_BLE_L2CAP_SendCfCredit | ( | uint16_t | lcid, |
uint16_t | credit | ||
) |
This function sends credit to a remote device.
In L2CAP CBFC communication, if credit is 0, the remote device stops data transmission.
Therefore when processing the received data has been completed and local device affords to receive data, the remote device is notified of the number of LE-Frame that local device can receive by this function and local device can continue to receive data from the remote device.
The result of this API call is returned by a return value.
[in] | lcid | CID identifying the L2CAP CBFC Channel on local device that sends credit. |
[in] | credit | Credit to be sent to the remote device. |
BLE_SUCCESS(0x0000) | Success |
BLE_ERR_INVALID_ARG(0x0003) | The credit parameter is set to 0. |
BLE_ERR_CONTEXT_FULL(0x000B) | This function was called while processing other L2CAP command. |
BLE_ERR_MEM_ALLOC_FAILED(0x000C) | There are no memories for L2CAP Command. |
ble_status_t R_BLE_L2CAP_SendCfData | ( | uint16_t | conn_hdl, |
uint16_t | lcid, | ||
uint16_t | data_len, | ||
uint8_t * | p_sdu | ||
) |
This function sends the data to a remote device via L2CAP CBFC Channel.
When the data transmission to Controller has been completed, BLE_L2CAP_EVENT_CF_TX_DATA_CNF event is notified to the application layer.
[in] | conn_hdl | Connection handle identifying the remote device to be sent the data. |
[in] | lcid | CID identifying the L2CAP CBFC Channel on local device used in the data transmission. |
[in] | data_len | Length of the data. |
[in] | p_sdu | Service Data Unit. Input the data length specified by the data_len parameter to the first 2 bytes (Little Endian). |
BLE_SUCCESS(0x0000) | Success |
BLE_ERR_INVALID_PTR(0x0001) | The p_data parameter is specified as NULL. |
BLE_ERR_INVALID_ARG(0x0003) | The length parameter is out of range. |
BLE_ERR_INVALID_STATE(0x0008) | CF Channel connection has not been established or the data whose length exceeds the MTU has been sent. |
BLE_ERR_ALREADY_IN_PROGRESS(0x000A) | Data transmission has been already started. |
BLE_ERR_CONTEXT_FULL(0x000B) | L2CAP task queue is full. |
BLE_ERR_MEM_ALLOC_FAILED(0x000C) | There are no memories for L2CAP Command. |
BLE_ERR_NOT_FOUND(0x000D) | CID specified the lcid parameter is not found. |
BLE_ERR_INVALID_HDL(0x000E) | The remote device specified by the conn_hdl parameter is not found. |