ble_l2cap.h
Go to the documentation of this file.
1 /**
2  ****************************************************************************************
3  *
4  * @file ble_l2cap.h
5  *
6  * @brief BLE L2CAP API
7  *
8  ****************************************************************************************
9  * @attention
10  #####Copyright (c) 2019 GOODIX
11  All rights reserved.
12 
13  Redistribution and use in source and binary forms, with or without
14  modification, are permitted provided that the following conditions are met:
15  * Redistributions of source code must retain the above copyright
16  notice, this list of conditions and the following disclaimer.
17  * Redistributions in binary form must reproduce the above copyright
18  notice, this list of conditions and the following disclaimer in the
19  documentation and/or other materials provided with the distribution.
20  * Neither the name of GOODIX nor the names of its contributors may be used
21  to endorse or promote products derived from this software without
22  specific prior written permission.
23 
24  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  POSSIBILITY OF SUCH DAMAGE.
35  *****************************************************************************************
36  */
37 
38  /**
39  * @addtogroup BLE
40  * @{
41  */
42 
43  /**
44  @addtogroup BLE_L2CAP Logical Link Control and Adaptation Protocol (L2CAP)
45  @{
46  @brief Definitions and prototypes for the L2CAP interface.
47  */
48 
49 #ifndef __BLE_L2CAP_H__
50 #define __BLE_L2CAP_H__
51 
52 #include "ble_error.h"
53 #include "gr55xx_sys_cfg.h"
54 #include <stdint.h>
55 #include <stdbool.h>
56 
57 /**@addtogroup BLE_L2CAP_ENUMERATIONS Enumerations
58  * @{ */
59 
60 /**@brief LE credit based disconnection reasons. */
61 typedef enum
62 {
63  BLE_L2CAP_REMOTE_USER_TERM_CON = 0x00, /**< Remote user terminates the connection. */
64  BLE_L2CAP_LOCAL_USER_TERM_CON = 0x01, /**< Local user terminates the connection. */
66 
67 /** @} */
68 
69 /** @addtogroup BLE_L2CAP_STRUCTURES Structures
70  * @{ */
71 /** @brief The parameter of LE credit based connection request packet sending.
72  * @note The le_psm should be registered by the peer device, otherwise the peer device will reject this request with result of LE_PSM not supported.
73  * @note The local_cid should be 0x0040-0x007F. If the local_cid is set to 0, the stack will assign it dynamically.
74  * @note The local_credit is required to be sure that at least one SDU can be received, otherwise the stack will use the default value: (MTU + MPS + 1) /MPS + 1.
75  * @note The MTU range is [23~max_mtu].
76  * @note The MPS range is [23~max_mps].
77  * @note About max_mtu and max_mps config, please see @ref ble_gap_l2cap_params_set.
78 */
79 typedef struct
80 {
81  uint16_t le_psm; /**< The le_psm number. */
82  uint16_t local_cid; /**< The local CID. */
83  uint16_t local_credits; /**< The local credits indicate the number of LE-frames that the peer device can send to the L2CAP layer entity sending the LE Credit Based Connection Request. */
84  uint16_t mtu; /**< The MTU field specifies the maximum SDU size (in octets) that the L2CAP layer entity sending the LE Credit Based Connection Request can receive on this channel. */
85  uint16_t mps; /**< The MPS field specifies the maximum payload size (in octets) that the L2CAP layer entity sending the LE Credit Based Connection Request is capable of receiving on this channel. */
87 
88 /** @brief LE credit based connection confirm parameter.
89  * @note The accept flag indicates whether the App accepts the LE Credit Based connection request.
90  * @note The peer_cid represents the channel endpoint on the peer device.
91  * @note The local_cid should be 0x0040-0x007F. If the local_cid is set to 0, the stack will assign it dynamically.
92  * @note The local_credits required to be sure that at least one SDU can be received, otherwise the stack will use the default value: (MTU + MPS + 1) /MPS + 1.
93  * @note The MTU range is [23~max_mtu].
94  * @note The MPS range is [23~max_mps].
95  * @note About the max_mtu and max_mps config, please see @ref ble_gap_l2cap_params_set.
96 */
97 typedef struct
98 {
99  bool accept; /**< Whether to accept the connection request. */
100  uint16_t peer_cid; /**< It represents the channel endpoint on the device sending the request and receiving the response. */
101  uint16_t local_cid; /**< Local CID. */
102  uint16_t local_credits; /**< It indicates the number of LE-frames that the peer device can send to the L2CAP layer entity sending the LE Credit Based Connection Respone. */
103  uint16_t mtu; /**< The MTU field specifies the maximum SDU size (in octets) that the L2CAP layer entity sending
104  the LE Credit Based Connection Request can receive on this channel. */
105  uint16_t mps; /**< The MPS field specifies the maximum payload size (in octets) that the L2CAP layer entity sending
106  the LE Credit Based Connection Request is capable of receiving on this channel. */
108 
109 /** @brief LE flow control credit packet parameter. */
110 typedef struct
111 {
112  uint16_t local_cid; /**< The local source channel ID. */
113  uint16_t credits; /**< Number of credits that the receiving device can increment. */
115 
116 /** @brief SDU packet parameter.
117  * @note The length should be less than peer_mtu when sending sdu packet.
118  * @note The credits is 0 if this packet is being sent, or it represents the number of credits consumed by this sdu if this packet is received.
119  * @note When the application receives a sdu, it should firstly copy this sdu packet before handling it, because the stack will free it after invoking the callback function.
120  * @note Similarly, the application should free the packet if it is malloced after invoking the function to send sdu packet.
121 */
122 typedef struct
123 {
124  uint16_t cid; /**< The local source channel. */
125  uint16_t credits; /**< The credits is 0 if this packet is being sent, otherwise it represents the number of credits consumed by the sdu. */
126  uint16_t length; /**< The lenght of data. */
127  uint8_t *data; /**< The data of this sdu packet. */
129 
130 /** @brief L2cap Connect Request event for @ref BLE_L2CAP_EVT_CONN_REQ. */
131 typedef struct
132 {
133  uint16_t le_psm; /**< Le_psm number that should be registered by local device. */
134  uint16_t peer_cid; /**< It represents the channel endpoint on the device sending the request and receiving the response. */
135  uint16_t peer_mtu; /**< It indicates the maximum SDU size (in octets) that the L2CAP layer entity sending the LE Credit
136  Based Connection Request can receive on this channel. */
137  uint16_t peer_mps; /**< It indicates the maximum payload size (in octets) that the L2CAP layer entity sending the LE Credit
138  Based Connection Request is capable of receiving on this channe. */
140 
141 /** @brief L2cap Connected Indicate event for @ref BLE_L2CAP_EVT_CONN_IND. */
142 typedef struct
143 {
144  uint16_t le_psm; /**< Le_psm number. */
145  uint16_t local_cid; /**< The local source channel ID. */
146  uint16_t local_credits; /**< It indicates the number of LE-frames that the local device can receive. */
147  uint16_t peer_credits; /**< It indicates the number of LE-frames that the peer device can receive. */
148  uint16_t peer_mtu; /**< It indicates the maximum SDU size (in octets) that the L2CAP layer entity sending the LE Credit
149  Based Connection Request can receive on this channel. */
150  uint16_t peer_mps; /**< It indicates the maximum payload size (in octets) that the L2CAP layer entity sending the LE Credit
151  Based Connection Request is capable of receiving on this channe. */
153 
154 /** @brief L2cap Credits Add Indicate event for @ref BLE_L2CAP_EVT_ADD_CREDITS_IND. */
155 typedef struct
156 {
157  uint16_t local_cid; /**< The local source channel ID. */
158  uint16_t peer_added_credits; /**< Represent number of credits the receiving device can increment. */
160 
161 /** @brief L2cap disconnect event for @ref BLE_L2CAP_EVT_DISCONNECTED. */
162 typedef struct
163 {
164  uint16_t local_cid; /**< The local source channel ID. */
165  ble_l2cap_lecb_disconn_reason_t reason; /**< The reason for disconnection, see @ref ble_l2cap_lecb_disconn_reason_t . */
167 
168 /**@brief L2cap SDU Receive event for @ref BLE_L2CAP_EVT_SDU_RECV. */
169 typedef struct
170 {
171  uint16_t cid; /**< The local source channel. */
172  uint16_t credits; /**< The credits is 0 if this packet is being sent, otherwise it represents the number of credits consumed by the sdu. */
173  uint16_t length; /**< The lenght of data. */
174  uint8_t *data; /**< The data of this sdu packet. */
176 
177 /**@brief L2cap SDU Send event for @ref BLE_L2CAP_EVT_SDU_SEND. */
178 typedef struct
179 {
180  uint16_t cid; /**< Channel ID that is the local CID. */
181  uint16_t credits; /**< Number of peer credit used. */
183 
184 /**@brief L2cap Credits Add Completed event for @ref BLE_GATTC_EVT_NTF_IND. */
185 typedef struct
186 {
187  uint16_t local_cid; /**< Channel ID that is the local CID. */
189 
190 /**@brief BLE L2cap event structure. */
191 typedef struct
192 {
193  uint8_t index; /**< Index of connection or advertising. */
194  union
195  {
196  ble_l2cap_evt_conn_req_t conn_req; /**< L2cap Connect Request event. */
197  ble_l2cap_evt_conn_ind_t conn_ind; /**< L2cap Connected Indicate event. */
198  ble_l2cap_evt_add_credits_ind_t add_credits_ind; /**< L2cap Credits Add Indicate event. */
199  ble_l2cap_evt_disconnect_t disconnected; /**< L2cap Disconnected event. */
200  ble_l2cap_evt_sdu_recv_t sdu_recv; /**< L2cap SDU Receive event. */
201  ble_l2cap_evt_sdu_send_t sdu_send; /**< L2cap SDU Send event. */
202  ble_l2cap_evt_add_credits_cplt_t add_credits_cplt; /**< L2cap Credits Add Completed event. */
203  } params; /**< Event Parameters. */
205 /** @} */
206 
207 /** @addtogroup BLE_L2CAP_FUNCTIONS Functions
208  * @{ */
209 /**
210  ****************************************************************************************
211  * @brief Create the LE credit based connection.
212  *
213  * @param[in] conn_idx: ACL connection index. The first ACL connection index is 0, and the index will be increased one by one.
214  * @param[in] p_conn_req: Pointer to the LE Credit Based Connection Request structure.
215  *
216  * @retval ::SDK_SUCCESS: The LE Credit Based connection request is successfully set to the BLE stack.
217  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
218  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
219  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
220  ****************************************************************************************
221  */
222 uint16_t ble_l2cap_lecb_conn_create(uint8_t conn_idx, const ble_l2cap_lecb_conn_req_t *p_conn_req);
223 
224 /**
225  ****************************************************************************************
226  * @brief Confirm the LE credit based connection after receiving the connection request packet from the peer device.
227  *
228  * @param[in] conn_idx: ACL connection index. The first ACL connection index is 0 and the index will be increased one by one.
229  * @param[in] p_cfm_conn: Pointer to the LE Credit Based Connection Confirm structure.
230  *
231  * @retval ::SDK_SUCCESS: The LE Credit Based connection confirmation is successfully set to the BLE stack.
232  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
233  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
234  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
235  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
236  ****************************************************************************************
237  */
238 uint16_t ble_l2cap_lecb_conn_cfm(uint8_t conn_idx, const ble_l2cap_lecb_cfm_conn_t *p_cfm_conn);
239 
240 /**
241  ****************************************************************************************
242  * @brief Disconnect the LE credit based connection.
243  *
244  * @param[in] conn_idx: ACL connection index. The first ACL connection index is 0 and the index will be increased one by one.
245  * @param[in] local_cid: The local source channel ID.
246  *
247  * @retval ::SDK_SUCCESS: LE Credit Based disconnection request is successfully set to the BLE stack.
248  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
249  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
250  ****************************************************************************************
251  */
252 uint16_t ble_l2cap_lecb_disconnect(uint8_t conn_idx, uint16_t local_cid);
253 
254 /**
255  ****************************************************************************************
256  * @brief Send a LE Flow Control Credit packet when the device is capable of receiving additional LE-frames (for example after the device has processed the sdu).
257  *
258  * @param[in] conn_idx: ACL connection index, the first ACL connection index is 0, and increased one by one.
259  * @param[in] p_add_credits: Pointer to the LE Flow Control Credit structure.
260  *
261  * @retval ::SDK_SUCCESS: LE Flow Control Credit packet is successfully set to the BLE stack.
262  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
263  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
264  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
265  ****************************************************************************************
266  */
267 uint16_t ble_l2cap_lecb_credits_add(uint8_t conn_idx, const ble_l2cap_lecb_add_credits_t *p_add_credits);
268 
269 /**
270  ****************************************************************************************
271  * @brief Send an SDU packet to the peer device.
272  *
273  * @param[in] conn_idx: ACL connection index. The first ACL connection index is 0 and the index will be increased one by one.
274  * @param[in] p_sdu: Pointer to the sdu packet structure.
275  *
276  * @retval ::SDK_SUCCESS: The sdu packet is successfully set to the BLE stack.
277  * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied.
278  * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied.
279  * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources.
280  ****************************************************************************************
281  */
282 uint16_t ble_l2cap_lecb_sdu_send(uint8_t conn_idx, const ble_l2cap_lecb_sdu_t *p_sdu);
283 
284 /**
285  ****************************************************************************************
286  * @brief Register PSM.
287  *
288  * @param[in] le_psm: The le_psm number.
289  *
290  * @retval ::SDK_SUCCESS: The callback is successfully registered to the BLE stack.
291  * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied.
292  * @retval ::SDK_ERR_INVALID_PSM_EXCEEDED_MAX_PSM_NUM: The maximum PSM number limit is exceeded.
293  ****************************************************************************************
294  */
295 uint16_t ble_l2cap_lecb_psm_register(uint16_t le_psm);
296 /** @} */
297 
298 #endif
299 
300 /**
301  @}
302 */
303 /** @} */
ble_l2cap_evt_conn_req_t::peer_cid
uint16_t peer_cid
It represents the channel endpoint on the device sending the request and receiving the response.
Definition: ble_l2cap.h:134
ble_l2cap_evt_conn_req_t::peer_mtu
uint16_t peer_mtu
It indicates the maximum SDU size (in octets) that the L2CAP layer entity sending the LE Credit Based...
Definition: ble_l2cap.h:135
ble_l2cap_evt_add_credits_ind_t::peer_added_credits
uint16_t peer_added_credits
Represent number of credits the receiving device can increment.
Definition: ble_l2cap.h:158
ble_l2cap_evt_t::index
uint8_t index
Index of connection or advertising.
Definition: ble_l2cap.h:193
ble_l2cap_lecb_cfm_conn_t::mtu
uint16_t mtu
The MTU field specifies the maximum SDU size (in octets) that the L2CAP layer entity sending the LE C...
Definition: ble_l2cap.h:103
ble_l2cap_lecb_conn_req_t
The parameter of LE credit based connection request packet sending.
Definition: ble_l2cap.h:80
ble_l2cap_evt_conn_req_t
L2cap Connect Request event for BLE_L2CAP_EVT_CONN_REQ.
Definition: ble_l2cap.h:132
ble_l2cap_evt_conn_ind_t::peer_mtu
uint16_t peer_mtu
It indicates the maximum SDU size (in octets) that the L2CAP layer entity sending the LE Credit Based...
Definition: ble_l2cap.h:148
ble_l2cap_lecb_conn_req_t::le_psm
uint16_t le_psm
The le_psm number.
Definition: ble_l2cap.h:81
ble_l2cap_lecb_add_credits_t
LE flow control credit packet parameter.
Definition: ble_l2cap.h:111
ble_l2cap_evt_add_credits_cplt_t
L2cap Credits Add Completed event for BLE_GATTC_EVT_NTF_IND.
Definition: ble_l2cap.h:186
ble_l2cap_lecb_cfm_conn_t::local_cid
uint16_t local_cid
Local CID.
Definition: ble_l2cap.h:101
ble_l2cap_evt_conn_ind_t::local_credits
uint16_t local_credits
It indicates the number of LE-frames that the local device can receive.
Definition: ble_l2cap.h:146
BLE_L2CAP_REMOTE_USER_TERM_CON
@ BLE_L2CAP_REMOTE_USER_TERM_CON
Remote user terminates the connection.
Definition: ble_l2cap.h:63
ble_l2cap_lecb_sdu_t::cid
uint16_t cid
The local source channel.
Definition: ble_l2cap.h:124
ble_l2cap_evt_sdu_recv_t::length
uint16_t length
The lenght of data.
Definition: ble_l2cap.h:173
ble_l2cap_lecb_psm_register
uint16_t ble_l2cap_lecb_psm_register(uint16_t le_psm)
Register PSM.
ble_l2cap_evt_conn_req_t::le_psm
uint16_t le_psm
Le_psm number that should be registered by local device.
Definition: ble_l2cap.h:133
ble_l2cap_evt_conn_ind_t::peer_credits
uint16_t peer_credits
It indicates the number of LE-frames that the peer device can receive.
Definition: ble_l2cap.h:147
ble_l2cap_evt_t::disconnected
ble_l2cap_evt_disconnect_t disconnected
L2cap Disconnected event.
Definition: ble_l2cap.h:199
ble_l2cap_evt_t
BLE L2cap event structure.
Definition: ble_l2cap.h:192
ble_l2cap_evt_add_credits_ind_t::local_cid
uint16_t local_cid
The local source channel ID.
Definition: ble_l2cap.h:157
ble_l2cap_lecb_sdu_t::length
uint16_t length
The lenght of data.
Definition: ble_l2cap.h:126
ble_l2cap_lecb_sdu_send
uint16_t ble_l2cap_lecb_sdu_send(uint8_t conn_idx, const ble_l2cap_lecb_sdu_t *p_sdu)
Send an SDU packet to the peer device.
ble_l2cap_lecb_disconnect
uint16_t ble_l2cap_lecb_disconnect(uint8_t conn_idx, uint16_t local_cid)
Disconnect the LE credit based connection.
ble_l2cap_evt_sdu_recv_t::credits
uint16_t credits
The credits is 0 if this packet is being sent, otherwise it represents the number of credits consumed...
Definition: ble_l2cap.h:172
ble_l2cap_evt_conn_ind_t::le_psm
uint16_t le_psm
Le_psm number.
Definition: ble_l2cap.h:144
ble_l2cap_lecb_conn_req_t::local_cid
uint16_t local_cid
The local CID.
Definition: ble_l2cap.h:82
gr55xx_sys_cfg.h
Define the chip configuration.
ble_l2cap_lecb_add_credits_t::local_cid
uint16_t local_cid
The local source channel ID.
Definition: ble_l2cap.h:112
ble_l2cap_evt_t::sdu_send
ble_l2cap_evt_sdu_send_t sdu_send
L2cap SDU Send event.
Definition: ble_l2cap.h:201
BLE_L2CAP_LOCAL_USER_TERM_CON
@ BLE_L2CAP_LOCAL_USER_TERM_CON
Local user terminates the connection.
Definition: ble_l2cap.h:64
ble_l2cap_lecb_conn_create
uint16_t ble_l2cap_lecb_conn_create(uint8_t conn_idx, const ble_l2cap_lecb_conn_req_t *p_conn_req)
Create the LE credit based connection.
ble_l2cap_evt_conn_ind_t::local_cid
uint16_t local_cid
The local source channel ID.
Definition: ble_l2cap.h:145
ble_l2cap_evt_t::add_credits_cplt
ble_l2cap_evt_add_credits_cplt_t add_credits_cplt
L2cap Credits Add Completed event.
Definition: ble_l2cap.h:202
ble_l2cap_evt_t::sdu_recv
ble_l2cap_evt_sdu_recv_t sdu_recv
L2cap SDU Receive event.
Definition: ble_l2cap.h:200
ble_error.h
File that contains error codes.
ble_l2cap_evt_sdu_send_t
L2cap SDU Send event for BLE_L2CAP_EVT_SDU_SEND.
Definition: ble_l2cap.h:179
ble_l2cap_lecb_add_credits_t::credits
uint16_t credits
Number of credits that the receiving device can increment.
Definition: ble_l2cap.h:113
ble_l2cap_evt_sdu_recv_t::cid
uint16_t cid
The local source channel.
Definition: ble_l2cap.h:171
ble_l2cap_lecb_disconn_reason_t
ble_l2cap_lecb_disconn_reason_t
LE credit based disconnection reasons.
Definition: ble_l2cap.h:62
ble_l2cap_lecb_cfm_conn_t::accept
bool accept
Whether to accept the connection request.
Definition: ble_l2cap.h:99
ble_l2cap_evt_add_credits_ind_t
L2cap Credits Add Indicate event for BLE_L2CAP_EVT_ADD_CREDITS_IND.
Definition: ble_l2cap.h:156
ble_l2cap_lecb_conn_cfm
uint16_t ble_l2cap_lecb_conn_cfm(uint8_t conn_idx, const ble_l2cap_lecb_cfm_conn_t *p_cfm_conn)
Confirm the LE credit based connection after receiving the connection request packet from the peer de...
ble_l2cap_evt_t::add_credits_ind
ble_l2cap_evt_add_credits_ind_t add_credits_ind
L2cap Credits Add Indicate event.
Definition: ble_l2cap.h:198
ble_l2cap_evt_add_credits_cplt_t::local_cid
uint16_t local_cid
Channel ID that is the local CID.
Definition: ble_l2cap.h:187
ble_l2cap_lecb_cfm_conn_t::peer_cid
uint16_t peer_cid
It represents the channel endpoint on the device sending the request and receiving the response.
Definition: ble_l2cap.h:100
ble_l2cap_evt_sdu_recv_t::data
uint8_t * data
The data of this sdu packet.
Definition: ble_l2cap.h:174
ble_l2cap_evt_conn_ind_t
L2cap Connected Indicate event for BLE_L2CAP_EVT_CONN_IND.
Definition: ble_l2cap.h:143
ble_l2cap_lecb_sdu_t
SDU packet parameter.
Definition: ble_l2cap.h:123
ble_l2cap_evt_t::conn_req
ble_l2cap_evt_conn_req_t conn_req
L2cap Connect Request event.
Definition: ble_l2cap.h:196
ble_l2cap_evt_t::conn_ind
ble_l2cap_evt_conn_ind_t conn_ind
L2cap Connected Indicate event.
Definition: ble_l2cap.h:197
ble_l2cap_lecb_credits_add
uint16_t ble_l2cap_lecb_credits_add(uint8_t conn_idx, const ble_l2cap_lecb_add_credits_t *p_add_credits)
Send a LE Flow Control Credit packet when the device is capable of receiving additional LE-frames (fo...
ble_l2cap_lecb_cfm_conn_t::local_credits
uint16_t local_credits
It indicates the number of LE-frames that the peer device can send to the L2CAP layer entity sending ...
Definition: ble_l2cap.h:102
ble_l2cap_lecb_sdu_t::credits
uint16_t credits
The credits is 0 if this packet is being sent, otherwise it represents the number of credits consumed...
Definition: ble_l2cap.h:125
ble_l2cap_lecb_conn_req_t::local_credits
uint16_t local_credits
The local credits indicate the number of LE-frames that the peer device can send to the L2CAP layer e...
Definition: ble_l2cap.h:83
ble_l2cap_lecb_cfm_conn_t::mps
uint16_t mps
The MPS field specifies the maximum payload size (in octets) that the L2CAP layer entity sending the ...
Definition: ble_l2cap.h:105
ble_l2cap_evt_sdu_recv_t
L2cap SDU Receive event for BLE_L2CAP_EVT_SDU_RECV.
Definition: ble_l2cap.h:170
ble_l2cap_lecb_cfm_conn_t
LE credit based connection confirm parameter.
Definition: ble_l2cap.h:98
ble_l2cap_lecb_conn_req_t::mtu
uint16_t mtu
The MTU field specifies the maximum SDU size (in octets) that the L2CAP layer entity sending the LE C...
Definition: ble_l2cap.h:84
ble_l2cap_evt_disconnect_t
L2cap disconnect event for BLE_L2CAP_EVT_DISCONNECTED.
Definition: ble_l2cap.h:163
ble_l2cap_lecb_conn_req_t::mps
uint16_t mps
The MPS field specifies the maximum payload size (in octets) that the L2CAP layer entity sending the ...
Definition: ble_l2cap.h:85
ble_l2cap_evt_conn_ind_t::peer_mps
uint16_t peer_mps
It indicates the maximum payload size (in octets) that the L2CAP layer entity sending the LE Credit B...
Definition: ble_l2cap.h:150
ble_l2cap_evt_disconnect_t::reason
ble_l2cap_lecb_disconn_reason_t reason
The reason for disconnection, see ble_l2cap_lecb_disconn_reason_t .
Definition: ble_l2cap.h:165
ble_l2cap_evt_disconnect_t::local_cid
uint16_t local_cid
The local source channel ID.
Definition: ble_l2cap.h:164
ble_l2cap_evt_sdu_send_t::cid
uint16_t cid
Channel ID that is the local CID.
Definition: ble_l2cap.h:180
ble_l2cap_evt_sdu_send_t::credits
uint16_t credits
Number of peer credit used.
Definition: ble_l2cap.h:181
ble_l2cap_lecb_sdu_t::data
uint8_t * data
The data of this sdu packet.
Definition: ble_l2cap.h:127
ble_l2cap_evt_conn_req_t::peer_mps
uint16_t peer_mps
It indicates the maximum payload size (in octets) that the L2CAP layer entity sending the LE Credit B...
Definition: ble_l2cap.h:137