TI BLE Stack API Documentation  2.03.09
l2cap.h
1 /******************************************************************************
2 
3  @file l2cap.h
4 
5  @brief This file contains the Logical Link Control and Adaptation
6  Layer (L2CAP) definitions and prototypes.
7 
8  <BR><BR> \image html
9  HighLevelL2CAP.PNG
10 
11  <BR> <h2>Functional
12  Description</h2> <p>The
13  Logical Link Control and Adaptation Layer (L2CAP) protocol provides
14  connection-oriented and connectionless data services to upper layer
15  protocols with protocol multiplexing capability and segmentation and
16  reassembly operation. The L2CAP protocol is packet-based but follows a
17  communication model based on channels. A channel represents a data flow
18  between L2CAP entities in remote devices.</p>
19 
20  <BR> <h2>L2CAP
21  Services</h2> <p>The
22  L2CAP layer provides the following services to upper level protocols
23  and applications:</p> <ul <ul <ul <ul <ul <ul <ul <ul <ul <ul <ul <ul
24  <ul> <li>Fixed and connection-oriented channels with protocol
25  multiplexing capability:</li> <ul <ul <ul <ul <ul <ul <ul <ul <ul <ul
26  <ul> <li>Attribute
27  Protocol (ATT) channel (0x0004).</li> <li>Signaling channel
28  (0x0005).</li> <li>Security
29  Management Protocol (SMP) channel (0x0006).</li>
30  <li>Connection-oriented channels (0x0040-0x007F).</li> </ul </ul </ul
31  </ul> <li>Data transport services allowing upper level protocols and
32  applications to transmit and receive upper layer
33  Service Data Units (SDUs) up to:</li> <ul <ul <ul <ul <ul <ul <ul <ul
34  <ul> <li>23 octets in length over a fixed channel. With
35  HCI fragmentation and recombination operation enabled, applications can
36  transmit and receive larger
37  SDUs.</li> <li>512 octets in length over a connection-oriented channel
38  with segmentation and reassembly operation.</li operation.</li
39  operation.</li> </ul </ul </ul </ul </ul </ul </ul </ul </ul </ul </ul
40  </ul> </ul </ul </ul </ul </ul </ul </ul </ul </ul </ul </ul </ul </ul
41  </ul>
42 
43  <BR><BR><BR><BR>
44 
45  Group: WCS, BTS
46  $Target Device: DEVICES $
47 
48  ******************************************************************************
49  $License: TISD 2009 $
50  ******************************************************************************
51  $Release Name: PACKAGE NAME $
52  $Release Date: PACKAGE RELEASE DATE $
53  *****************************************************************************/
54 
55 #ifndef L2CAP_H
56 #define L2CAP_H
57 
58 #ifdef __cplusplus
59 extern "C"
60 {
61 #endif
62 
63 /*********************************************************************
64  * INCLUDES
65  */
66 #include "bcomdef.h"
67 #include "osal.h"
68 
69 /*********************************************************************
70  * CONSTANTS
71  */
72 
77 #define L2CAP_MTU_SIZE 23
78 
79 
85 #define L2CAP_SDU_SIZE 512
86 
87 
93 #define L2CAP_NUM_PSM_DEFAULT 3
94 
95 
101 #define L2CAP_NUM_CO_CHANNELS_DEFAULT 3
102 
103 
105 // Minimum supported information payload for the Control frame (C-frame)
106 #define L2CAP_SIG_MTU_SIZE 23
107 
108 // Basic L2CAP header: Length (2 bytes) + Channel ID (2 bytes)
109 #define L2CAP_HDR_SIZE 4
110 
111 // Minimum size of PDU received from lower layer protocol (incoming
112 // packet), or delivered to lower layer protocol (outgoing packet).
113 #define L2CAP_PDU_SIZE ( L2CAP_HDR_SIZE + L2CAP_MTU_SIZE )
114 
115 // SDU Length field size
116 #define L2CAP_LEN_FIELD_SIZE 2
117 
118 // LE Protocol/Service Multiplexer values. LE PSM values are separated into
119 // two ranges. Values in the first range are assigned by the Bluetooth SIG
120 // and indicate protocols. Values in the second range are dynamically
121 // allocated and used in conjunction with services defined in the GATT server.
122 #define L2CAP_INVALID_PSM 0x0000
123 
124 // Fixed LE PSM values (assigned by Bluetooth SIG and indicate protocols)
125 #define L2CAP_FIXED_PSM_MIN 0x0001
126 #define L2CAP_FIXED_PSM_MAX 0x007F
127 
128 // Dynamic LE PSM values (dynamically allocated and used in conjunction with GATT services)
129 #define L2CAP_DYNAMIC_PSM_MIN 0x0080
130 #define L2CAP_DYNAMIC_PSM_MAX 0x00FF
131 
132 // L2CAP Channel Identifiers. Identifiers from 0x0001 to 0x003F are
133 // reserved for specific L2CAP functions. Identifiers 0x0001-0x0003
134 // are reserved by BR/EDR.
135 #define L2CAP_CID_NULL 0x0000 // Illegal Identifier
136 
137 // L2CAP Fixed Channel Identifiers
138 #define L2CAP_CID_ATT 0x0004 // Attribute Protocol
139 #define L2CAP_CID_SIG 0x0005 // L2CAP Signaling
140 #define L2CAP_CID_SMP 0x0006 // Security Management Protocol
141 #define L2CAP_CID_GENERIC 0x0007 // Generic (proprietary channel)
142 
143 // L2CAP Dynamic Channel Identifiers
144 #define L2CAP_DYNAMIC_CID_MIN 0x0040
145 #define L2CAP_DYNAMIC_CID_MAX 0x007F
146 
147 // Number of Fixed channels: one for each of ATT, Signaling, SMP and Generic channels
148 #define L2CAP_NUM_FIXED_CHANNELS 4
149 
150 // Number of Signaling Commands: one for Connection Parameter Update Request
151 #define L2CAP_NUM_SIG_COMMANDS 1
152 
153 // L2CAP Response Timeout expired (RTX) value for Signaling commands (in seconds).
154 // The RTX timer is used for response timeout or to terminate a dynamic channel
155 // when the remote device is unresponsive to signaling requests. Its value may
156 // range from 1 to 60 seconds.
157 #define L2CAP_RTX_TIMEOUT 30
158 
163 #define L2CAP_CMD_REJECT 0x01
164 #define L2CAP_DISCONNECT_REQ 0x06
165 #define L2CAP_DISCONNECT_RSP 0x07
166 #define L2CAP_INFO_REQ 0x0a
167 #define L2CAP_INFO_RSP 0x0b
168 #define L2CAP_PARAM_UPDATE_REQ 0x12
169 #define L2CAP_PARAM_UPDATE_RSP 0x13
170 #define L2CAP_CONNECT_REQ 0x14
171 #define L2CAP_CONNECT_RSP 0x15
172 #define L2CAP_FLOW_CTRL_CREDIT 0x16
173 
174 
180 #define L2CAP_CHANNEL_ESTABLISHED_EVT 0x60
181 #define L2CAP_CHANNEL_TERMINATED_EVT 0x61
182 #define L2CAP_OUT_OF_CREDIT_EVT 0x62
183 #define L2CAP_PEER_CREDIT_THRESHOLD_EVT 0x63
184 #define L2CAP_SEND_SDU_DONE_EVT 0x64
185 #define L2CAP_NUM_CTRL_DATA_PKT_EVT 0x65
186 
187 
193 #define L2CAP_REJECT_CMD_NOT_UNDERSTOOD 0x0000
194 #define L2CAP_REJECT_SIGNAL_MTU_EXCEED 0x0001
195 #define L2CAP_REJECT_INVALID_CID 0x0002
196 
197 
203 #define L2CAP_CONN_SUCCESS 0x0000
204 #define L2CAP_CONN_PSM_NOT_SUPPORTED 0x0002
205 #define L2CAP_CONN_NO_RESOURCES 0x0004
206 #define L2CAP_CONN_INSUFFICIENT_AUTHEN 0x0005
207 #define L2CAP_CONN_INSUFFICIENT_AUTHOR 0x0006
208 #define L2CAP_CONN_INSUFFICIENT_KEY_SIZE 0x0007
209 #define L2CAP_CONN_INSUFFICIENT_ENCRYPT 0x0008
210 #define L2CAP_CONN_INVALID_SRC_CID 0x0009
211 #define L2CAP_CONN_SRC_CID_ALREADY_ALLOC 0x000A
212 #define L2CAP_CONN_UNACCEPTABLE_PARAMS 0x000B
213 
214 #define L2CAP_CONN_PENDING_SEC_VERIFY 0xFFFF
215 
216 
222 #define L2CAP_CONN_PARAMS_ACCEPTED 0x0000
223 #define L2CAP_CONN_PARAMS_REJECTED 0x0001
224 
225 
231 #define L2CAP_TERM_LINK_DOWN 0x0000
232 #define L2CAP_TERM_BY_PSM 0x0001
233 #define L2CAP_TERM_BY_PEER_PSM 0x0002
234 #define L2CAP_TERM_MAX_CREDIT_EXCEED 0x0003
235 #define L2CAP_TERM_SDU_LEN_EXCEED 0x0004
236 #define L2CAP_TERM_PSM_MTU_EXCEED 0x0005
237 #define L2CAP_TERM_RX_PKT_NO_CREDIT 0x0006
238 #define L2CAP_TERM_RX_ERROR 0x0007
239 #define L2CAP_TERM_TX_ERROR 0x0008
240 #define L2CAP_TERM_MEM_ALLOC_ERROR 0x0009
241 
242 
248 #define L2CAP_CLOSED 0x00
249 #define L2CAP_OPEN 0x01
250 #define L2CAP_PENDING_CONN_RSP 0x02
251 #define L2CAP_PENDING_DISCONN_RSP 0x03
252 #define L2CAP_PENDING_PARAM_UPDATE_RSP 0x04
253 #define L2CAP_PENDING_INFO_RSP 0x05
254 #define L2CAP_PENDING_SEC_VERIFY 0x06
255 
256 
262 #define L2CAP_INFO_CONNLESS_MTU 0x0001
263 #define L2CAP_INFO_EXTENDED_FEATURES 0x0002
264 #define L2CAP_INFO_FIXED_CHANNELS 0x0003
265 
266 
268 /*********************************************************************
269  * Information Response: Extended Features Mask Values
270  */
271  // Fixed channels are supported
272 #define L2CAP_FIXED_CHANNELS 0x00000080
273 
274  // Length of Extended Features bit mask
275 #define L2CAP_EXTENDED_FEATURES_SIZE 4
276 
277 /*********************************************************************
278  * Information Response: Fixed Channels Mask Values
279  */
280  // Fixed Channel ATT is supported
281 #define L2CAP_FIXED_CHANNELS_ATT 0x10
282 
283  // Fixed Channel L2CAP Signaling is supported
284 #define L2CAP_FIXED_CHANNELS_SIG 0x20
285 
286  // Fixed Channel SMP is supported
287 #define L2CAP_FIXED_CHANNELS_SMP 0x40
288 
289  // Length of Fixed Channels bit mask
290 #define L2CAP_FIXED_CHANNELS_SIZE 8
291 
292 /*********************************************************************
293  * Information Response: Result Values
294  */
295  // Success
296 #define L2CAP_INFO_SUCCESS 0x0000
297 
298  // Not supported
299 #define L2CAP_INFO_NOT_SUPPORTED 0x0001
300 
301 /*********************************************************************
302  * L2CAP Test Modes: Test code values
303  */
304 #if defined ( TESTMODES )
305  // Test modes 0 through 8 are reserved for L2CAP Connection Request.
306  #define L2CAP_TESTMODE_OFF 0 // Test mode off
307  #define L2CAP_TESTMODE_PSM_NOT_SUPPORTED 2 // Refuse connection - LE_PSM not supported
308  #define L2CAP_TESTMODE_NO_RESOURCES 4 // Refuse connection - no resources available
309  #define L2CAP_TESTMODE_INSUFF_AUTHEN 5 // Refuse connection - insufficient authentication
310  #define L2CAP_TESTMODE_INSUFF_AUTHOR 6 // Refuse connection - insufficient authorization
311  #define L2CAP_TESTMODE_INSUFF_KEY_SIZE 7 // Refuse connection - insufficient encryption key size
312  #define L2CAP_TESTMODE_INSUFF_ENCRYPT 8 // Refuse connection - insufficient encryption
313  #define L2CAP_TESTMODE_INVALID_SRC_CID 9
314  #define L2CAP_TESTMODE_SRC_CID_ALREADY_ALLOC 10
315  #define L2CAP_TESTMODE_OUT_OF_RANGE_CREDITS 11
316  #define L2CAP_TESTMODE_SDU_LEN_EXCEED 12
317  #define L2CAP_TESTMODE_TX_PKT_NO_CREDIT 13
318  #define L2CAP_TESTMODE_BLOCK_DATA_TX 14
319 #endif
320 
321 /*********************************************************************
322  * MACROS
323  */
324 
325 /*********************************************************************
326  * TYPEDEFS
327  */
328 
332 typedef struct
333 {
334  uint8 maxNumPSM;
337 
341 typedef struct
342 {
343  uint16 localCID;
344  uint16 remoteCID;
346 
350 typedef union
351 {
352  uint16 signalMTU;
355 
359 typedef struct
360 {
361  uint16 reason;
363 
364  // Shorthand access for union members
365  #define maxSignalMTU reasonData.signalMTU
366  #define invalidLocalCID reasonData.invalidCID.localCID
367  #define invalidRemoteCID reasonData.invalidCID.remoteCID
369 
373 typedef struct
374 {
375  uint16 intervalMin;
376  uint16 intervalMax;
377  uint16 slaveLatency;
380 
384 typedef struct
385 {
386  uint16 result;
388 
392 typedef struct
393 {
394  uint16 infoType;
396 
400 typedef union
401 {
404  uint8 fixedChannels[L2CAP_FIXED_CHANNELS_SIZE];
405 } l2capInfo_t;
406 
410 typedef struct
411 {
412  uint16 result;
413  uint16 infoType;
416 
420 typedef struct
421 {
422  uint16 psm;
423  uint16 srcCID;
424  uint16 mtu;
425  uint16 mps;
426  uint16 initCredits;
428 
432 typedef struct
433 {
434  uint16 dstCID;
435  uint16 mtu;
436  uint16 mps;
437  uint16 initCredits;
438  uint16 result;
440 
444 typedef struct
445 {
446  uint16 dstCID;
447  uint16 srcCID;
449 
453 typedef struct
454 {
455  uint16 dstCID;
456  uint16 srcCID;
458 
462 typedef struct
463 {
464  uint16 CID;
465  uint16 credits;
467 
471 typedef struct
472 {
473  uint16 mtu;
474  uint16 mps;
480 
484 typedef struct
485 {
486  uint16 psm;
487  uint16 mtu;
488  uint16 mps;
489  uint16 credits;
490  uint16 peerCID;
491  uint16 peerMtu;
492  uint16 peerMps;
493  uint16 peerCredits;
496 
500 typedef struct
501 {
502  uint8 state;
505 
510 typedef struct
511 {
512  uint16 result;
513  uint16 CID;
516 
521 typedef struct
522 {
523  uint16 CID;
524  uint16 peerCID;
525  uint16 reason;
527 
533 typedef struct
534 {
535  uint16 CID;
536  uint16 peerCID;
537  uint16 credits;
540 
545 typedef struct
546 {
547  uint16 CID;
548  uint16 credits;
549  uint16 peerCID;
550  uint16 peerCredits;
551  uint16 totalLen;
552  uint16 txLen;
554 
559 typedef struct
560 {
561  uint8 numDataPkt;
563 
567 typedef union
568 {
569  // Requests
575 
576  // Responses
582 
583  // Proprietary local events
590 
595 typedef struct
596 {
598  uint16 connHandle;
599  uint8 id;
600  uint8 opcode;
603 
607 typedef struct
608 {
609  uint16 CID;
610  uint8 *pPayload;
611  uint16 len;
614 } l2capPacket_t;
615 
623 typedef struct
624 {
626  uint16 connHandle;
629 
649 typedef uint16 (*pfnVerifySecCB_t)( uint16 connHandle, uint8 id, l2capConnectReq_t *pReq );
650 
656 typedef struct
657 {
658  uint16 psm;
659  uint16 mtu;
663  uint8 taskId;
665 } l2capPsm_t;
666 
667 /*********************************************************************
668  * GLOBAL VARIABLES
669  */
670 
671 /*********************************************************************
672  * FUNCTIONS
673  */
674 
690 extern bStatus_t L2CAP_RegisterApp( uint8 taskId, uint16 CID );
691 
700 extern void L2CAP_RegisterFlowCtrlTask( uint8 taskId );
701 
719 extern bStatus_t L2CAP_SendData( uint16 connHandle, l2capPacket_t *pPkt );
720 
733 extern bStatus_t L2CAP_RegisterPsm( l2capPsm_t *pPsm );
734 
745 extern bStatus_t L2CAP_DeregisterPsm( uint8 taskId, uint16 psm );
746 
756 extern bStatus_t L2CAP_PsmInfo( uint16 psm, l2capPsmInfo_t *pInfo );
757 
768 extern bStatus_t L2CAP_PsmChannels( uint16 psm, uint8 numCIDs, uint16 *pCIDs );
769 
779 extern bStatus_t L2CAP_ChannelInfo( uint16 CID, l2capChannelInfo_t *pInfo );
780 
796 extern bStatus_t L2CAP_ConnectReq( uint16 connHandle, uint16 psm, uint16 peerPsm );
797 
811 extern bStatus_t L2CAP_ConnectRsp( uint16 connHandle, uint8 id, uint16 result );
812 
825 extern bStatus_t L2CAP_DisconnectReq( uint16 CID );
826 
840 extern bStatus_t L2CAP_FlowCtrlCredit( uint16 CID, uint16 peerCredits );
841 
857 extern bStatus_t L2CAP_SendSDU( l2capPacket_t *pPkt );
858 
872 extern bStatus_t L2CAP_CmdReject( uint16 connHandle, uint8 id, l2capCmdReject_t *pCmdReject );
873 
888 extern bStatus_t L2CAP_InfoReq( uint16 connHandle, l2capInfoReq_t *pInfoReq, uint8 taskId );
889 
905 extern bStatus_t L2CAP_ConnParamUpdateReq( uint16 connHandle, l2capParamUpdateReq_t *pUpdateReq, uint8 taskId );
906 
920 extern bStatus_t L2CAP_ConnParamUpdateRsp( uint16 connHandle, uint8 id, l2capParamUpdateRsp_t *pUpdateRsp );
921 
931 extern void L2CAP_SetUserConfig( l2capUserCfg_t *pUserCfg );
932 
943 extern void L2CAP_SetBufSize( uint16 dataPktLen, uint8 numDataPkts );
944 
950 extern uint16 L2CAP_GetMTU( void );
951 
962 extern void *L2CAP_bm_alloc( uint16 size );
963 
982 extern uint16 L2CAP_BuildConnectReq( uint8 *pBuf, uint8 *pData );
983 
994 extern bStatus_t L2CAP_ParseConnectReq( l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len );
995 
1006 extern bStatus_t L2CAP_ParseFlowCtrlCredit( l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len );
1007 
1016 extern uint16 L2CAP_BuildCmdReject( uint8 *pBuf, uint8 *pCmd );
1017 
1028 extern bStatus_t L2CAP_ParseInfoReq( l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len );
1029 
1040 extern bStatus_t L2CAP_ParseParamUpdateReq( l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len );
1041 
1050 extern uint16 L2CAP_BuildParamUpdateRsp( uint8 *pBuf, uint8 *pData );
1051 
1064 extern uint16 L2CAP_BuildInfoRsp( uint8 *pBuf, uint8 *pData );
1065 
1075 extern void L2CAP_SetControllerToHostFlowCtrl( uint16 hostBuffSize, uint8 flowCtrlMode );
1076 
1087 extern void L2CAP_HostNumCompletedPkts( uint16 connHandle, uint16 numCompletedPkts );
1088 
1097 extern void L2CAP_SetParamValue( uint16 value );
1098 
1106 extern uint16 L2CAP_GetParamValue( void );
1107 
1108 /*-------------------------------------------------------------------
1109  * TASK API - These functions must only be called by OSAL.
1110  */
1111 
1121 extern void L2CAP_Init( uint8 taskId );
1122 
1134 extern uint16 L2CAP_ProcessEvent( uint8 taskId, uint16 events );
1135 
1136 
1137 /*********************************************************************
1138 *********************************************************************/
1139 
1140 #ifdef __cplusplus
1141 }
1142 #endif
1143 
1144 #endif /* L2CAP_H */
Definition: l2cap.h:462
bStatus_t L2CAP_ParseConnectReq(l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len)
Parse Connection Request message.
bStatus_t L2CAP_ParseParamUpdateReq(l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len)
Parse Connection Parameter Update Request.
l2capParamUpdateRsp_t updateRsp
Connection Parameter Update Response.
Definition: l2cap.h:577
uint16 initCredits
Indicates number of LE-frames that peer device can send.
Definition: l2cap.h:437
bStatus_t L2CAP_FlowCtrlCredit(uint16 CID, uint16 peerCredits)
Send Flow Control Credit.
uint8 state
Channel connection state: L2CAP Channel States.
Definition: l2cap.h:502
uint16 peerCID
Peer channel id.
Definition: l2cap.h:549
uint16 mtu
Maximum SDU size that can be received by local device.
Definition: l2cap.h:659
Definition: l2cap.h:559
void L2CAP_SetUserConfig(l2capUserCfg_t *pUserCfg)
Set the user configurable variables for the L2CAP layer.
Definition: l2cap.h:350
uint16(* pfnVerifySecCB_t)(uint16 connHandle, uint8 id, l2capConnectReq_t *pReq)
Callback function prototype to verify security when a Connection Request is received.
Definition: l2cap.h:649
void L2CAP_RegisterFlowCtrlTask(uint8 taskId)
Register task to recevie L2CAP Flow Control events when there are data buffers available for sending ...
uint16 mps
Maximum payload size that can be received by local device.
Definition: l2cap.h:474
bStatus_t L2CAP_PsmChannels(uint16 psm, uint8 numCIDs, uint16 *pCIDs)
Get all active channels for a given registered PSM.
uint8 numDataPkt
Number of Data Packets Available.
Definition: l2cap.h:561
uint16 txLen
Total number of octets transmitted.
Definition: l2cap.h:552
uint8 maxNumPSM
Max number of Protocol/Service Multiplexers (PSM): L2CAP Number of PSMs.
Definition: l2cap.h:334
uint16 mps
Specifies maximum payload size that can be received on this channel.
Definition: l2cap.h:436
Definition: l2cap.h:521
l2capCmdReject_t cmdReject
Command Reject.
Definition: l2cap.h:579
Definition: l2cap.h:359
Definition: l2cap.h:420
uint16 mtu
Specifies maximum SDU size that can be received on this channel.
Definition: l2cap.h:424
bStatus_t L2CAP_PsmInfo(uint16 psm, l2capPsmInfo_t *pInfo)
Get information about a given registered PSM.
Definition: l2cap.h:595
uint16 srcCID
Identifies CID on device receiving response.
Definition: l2cap.h:456
l2capCreditEvt_t creditEvt
Out Of Credit Event or Peer Credit Threshold Event.
Definition: l2cap.h:586
Definition: l2cap.h:373
uint16 psm
PSM that channel belongs to.
Definition: l2cap.h:486
uint16 initPeerCredits
Number of LE-frames that peer device can send.
Definition: l2cap.h:660
uint16 mtu
Maximum SDU size that can be received by local device.
Definition: l2cap.h:487
uint16 connHandle
connection packet was received on
Definition: l2cap.h:626
l2capNumCtrlDataPktEvt_t numCtrlDataPktEvt
Number of Available Ctrl Data Packets Event.
Definition: l2cap.h:588
uint16 CID
Represents Source CID of device sending credit packet.
Definition: l2cap.h:464
uint16 psm
LE PSM.
Definition: l2cap.h:422
uint16 peerMps
Maximum payload size that can be received by peer device.
Definition: l2cap.h:492
uint16 connectionlessMTU
Connectionless MTU.
Definition: l2cap.h:402
uint16 intervalMin
Minimum Interval.
Definition: l2cap.h:375
l2capInfoRsp_t infoRsp
Information Response - not supported.
Definition: l2cap.h:578
l2capCoCInfo_t info
Channel info.
Definition: l2cap.h:503
uint16 dstCID
Identifies CID on device sending response.
Definition: l2cap.h:455
uint16 credits
Local credits.
Definition: l2cap.h:548
Definition: l2cap.h:510
bStatus_t L2CAP_DeregisterPsm(uint8 taskId, uint16 psm)
Deregister a Protocol/Service Multiplexer with L2CAP.
uint16 peerCreditThreshold
Low threshold for peer credit count.
Definition: l2cap.h:494
uint16 dstCID
Represents CID on device receiving request and sending response.
Definition: l2cap.h:434
Definition: l2cap.h:384
uint16 initPeerCredits
Number of LE-frames that peer device can send.
Definition: l2cap.h:475
uint16 psm
Registered PSM.
Definition: l2cap.h:658
uint16 srcCID
Represents CID on device sending request and receiving response.
Definition: l2cap.h:423
Definition: l2cap.h:471
uint8 * pPayload
Definition: l2cap.h:610
bStatus_t L2CAP_RegisterApp(uint8 taskId, uint16 CID)
Register a protocol/application with an L2CAP fixed channel.
uint16 peerCreditThreshold
Low threshold for peer credit count.
Definition: l2cap.h:661
Definition: l2cap.h:410
Definition: l2cap.h:533
uint16 L2CAP_BuildParamUpdateRsp(uint8 *pBuf, uint8 *pData)
Build Connection Parameter Update Response.
Definition: l2cap.h:400
bStatus_t L2CAP_SendSDU(l2capPacket_t *pPkt)
Send data packet over an L2CAP connection oriented channel established over a physical connection...
bStatus_t L2CAP_ChannelInfo(uint16 CID, l2capChannelInfo_t *pInfo)
Get information about a given active Connection Oriented Channel.
bStatus_t L2CAP_ConnectRsp(uint16 connHandle, uint8 id, uint16 result)
Send Connection Response.
uint16 initCredits
Indicates number of LE-frames that peer device can send.
Definition: l2cap.h:426
l2capCoCInfo_t info
Channel info.
Definition: l2cap.h:514
l2capPacket_t pkt
received packet
Definition: l2cap.h:627
uint16 infoType
Information type: L2CAP Information Request/Response Info Types.
Definition: l2cap.h:394
uint16 result
Indicates outcome of connection request: L2CAP Connection Response Result Values. ...
Definition: l2cap.h:512
uint16 peerCredits
Peer credits.
Definition: l2cap.h:550
bStatus_t L2CAP_ConnParamUpdateRsp(uint16 connHandle, uint8 id, l2capParamUpdateRsp_t *pUpdateRsp)
Send Connection Parameter Update Response.
uint8 maxNumChannels
Maximum number of CO Channels supported by PSM.
Definition: l2cap.h:662
l2capFlowCtrlCredit_t credit
LE Flow Control Credit.
Definition: l2cap.h:574
void L2CAP_SetBufSize(uint16 dataPktLen, uint8 numDataPkts)
This API is used by the upper layer to set the maximum data packet size and the number of data packet...
uint16 remoteCID
Source CID from the rejected command.
Definition: l2cap.h:344
uint16 peerCredits
Number of LE-frames that peer device can send.
Definition: l2cap.h:493
uint16 signalMTU
Maximum Signaling MTU.
Definition: l2cap.h:352
Definition: l2cap.h:432
l2capInvalidCID_t invalidCID
Invalid CID in Request.
Definition: l2cap.h:353
Definition: l2cap.h:656
bStatus_t L2CAP_ParseInfoReq(l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len)
Parse Information Request message.
uint16 result
Result.
Definition: l2cap.h:412
uint16 result
Indicates outcome of connection request: L2CAP Connection Response Result Values. ...
Definition: l2cap.h:438
osal_event_hdr_t hdr
L2CAP_SIGNAL_EVENT and status.
Definition: l2cap.h:597
uint16 L2CAP_BuildCmdReject(uint8 *pBuf, uint8 *pCmd)
Build Command Reject.
uint16 CID
Local channel id.
Definition: l2cap.h:523
uint8 id
identifier to match responses with requests
Definition: l2cap.h:599
l2capInfo_t info
Content of Info field depends on infoType.
Definition: l2cap.h:414
uint16 peerCID
Peer channel id.
Definition: l2cap.h:524
uint16 result
Result: L2CAP Connection Parameter Update Response Result Values.
Definition: l2cap.h:386
Status_t bStatus_t
BLE Generic Status return: BLE Default BLE Status Values.
Definition: bcomdef.h:244
uint16 intervalMax
Maximum Interval.
Definition: l2cap.h:376
uint16 infoType
Information type: L2CAP Information Request/Response Info Types.
Definition: l2cap.h:413
uint16 mtu
Specifies maximum SDU size that can be received on this channel.
Definition: l2cap.h:435
Definition: l2cap.h:392
uint16 peerCID
Remote channel id.
Definition: l2cap.h:490
uint16 dstCID
Specifies CID to be disconnected on device receiving request.
Definition: l2cap.h:446
uint16 mps
Specifies maximum payload size that can be received on this channel.
Definition: l2cap.h:425
uint16 connHandle
connection message was received on
Definition: l2cap.h:598
uint16 localCID
Destination CID from the rejected command.
Definition: l2cap.h:343
uint16 totalLen
Total length of SDU being transmitted.
Definition: l2cap.h:551
uint16 L2CAP_BuildConnectReq(uint8 *pBuf, uint8 *pData)
Build Connection Request.
bStatus_t L2CAP_ConnectReq(uint16 connHandle, uint16 psm, uint16 peerPsm)
Send Connection Request.
uint16 L2CAP_GetMTU(void)
Get the maximum payload size that L2CAP is capable of receiving.
pfnVerifySecCB_t pfnVerifySecCB
PSM security verification callback (can be NULL)
Definition: l2cap.h:664
l2capReasonData_t reasonData
Reason Data.
Definition: l2cap.h:362
uint16 CID
Local channel id.
Definition: l2cap.h:547
uint16 mtu
Maximum SDU size that can be received by local device.
Definition: l2cap.h:473
bStatus_t L2CAP_RegisterPsm(l2capPsm_t *pPsm)
Register a Protocol/Service Multiplexer (PSM) with L2CAP.
uint16 peerCID
Peer channel id.
Definition: l2cap.h:536
uint16 mps
Maximum payload size that can be received by local device.
Definition: l2cap.h:488
l2capChannelEstEvt_t channelEstEvt
Channel Established Event.
Definition: l2cap.h:584
Definition: osal.h:89
uint16 CID
local channel id
Definition: l2cap.h:609
bStatus_t L2CAP_ParseFlowCtrlCredit(l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len)
Parse Flow Control Credit message.
osal_event_hdr_t hdr
L2CAP_DATA_EVENT and status.
Definition: l2cap.h:625
Definition: l2cap.h:453
Definition: l2cap.h:484
l2capConnectRsp_t connectRsp
LE Credit Based Connection Response.
Definition: l2cap.h:580
l2capInfoReq_t infoReq
Information Request - not supported.
Definition: l2cap.h:571
Definition: l2cap.h:444
uint16 peerCreditThreshold
Low threshold for number of peer credits.
Definition: l2cap.h:476
bStatus_t L2CAP_SendData(uint16 connHandle, l2capPacket_t *pPkt)
Send data packet over an L2CAP fixed channel established over a physical connection.
uint8 taskId
Task registered with PSM.
Definition: l2cap.h:663
uint16 credits
Number of LE-frames that can be sent to local device.
Definition: l2cap.h:465
Definition: l2cap.h:332
l2capDisconnectRsp_t disconnectRsp
Disconnection Response.
Definition: l2cap.h:581
l2capConnectReq_t connectReq
LE Credit Based Connection Request.
Definition: l2cap.h:572
uint16 CID
Local channel id.
Definition: l2cap.h:513
l2capDisconnectReq_t disconnectReq
Disconnection Request.
Definition: l2cap.h:573
bStatus_t L2CAP_DisconnectReq(uint16 CID)
Send Disconnection Request.
uint16 srcCID
Specifies CID to be disconnected on device sending request.
Definition: l2cap.h:447
uint16 reason
Reason: L2CAP Command Reject Reason Codes.
Definition: l2cap.h:361
Definition: l2cap.h:545
Definition: l2cap.h:567
Definition: l2cap.h:607
uint16 credits
Definition: l2cap.h:537
uint8 numActiveChannels
Number of active CO Channels.
Definition: l2cap.h:478
Definition: l2cap.h:341
uint16 slaveLatency
Slave Latency.
Definition: l2cap.h:377
l2capParamUpdateReq_t updateReq
Connection Parameter Update Request.
Definition: l2cap.h:570
bStatus_t L2CAP_InfoReq(uint16 connHandle, l2capInfoReq_t *pInfoReq, uint8 taskId)
Send Information Request.
bStatus_t L2CAP_ConnParamUpdateReq(uint16 connHandle, l2capParamUpdateReq_t *pUpdateReq, uint8 taskId)
Send Connection Parameter Update Request.
void * L2CAP_bm_alloc(uint16 size)
L2CAP implementation of the allocator functionality.
Definition: l2cap.h:623
Definition: l2cap.h:500
uint16 peerMtu
Maximum SDU size that can be received by peer device.
Definition: l2cap.h:491
uint16 CID
Local channel id.
Definition: l2cap.h:535
uint16 credits
Number of LE-frames that local device can send.
Definition: l2cap.h:489
uint8 opcode
type of command: L2CAP Signaling Codes (type of commands)
Definition: l2cap.h:600
uint32 extendedFeatures
Extended features supported.
Definition: l2cap.h:403
bStatus_t L2CAP_CmdReject(uint16 connHandle, uint8 id, l2capCmdReject_t *pCmdReject)
Send Command Reject.
l2capChannelTermEvt_t channelTermEvt
Channel Terminated Event.
Definition: l2cap.h:585
l2capSendSduDoneEvt_t sendSduDoneEvt
Send SDU Done Event.
Definition: l2cap.h:587
l2capSignalCmd_t cmd
command data
Definition: l2cap.h:601
uint16 timeoutMultiplier
Timeout Multiplier.
Definition: l2cap.h:378
uint8 maxNumChannels
Maximum number of CO Channels supported by PSM.
Definition: l2cap.h:477
uint16 reason
Indicates reason for termination: L2CAP Channel Terminated Event Reason Values.
Definition: l2cap.h:525
uint8 maxNumCoChannels
Max number of Connection Oriented Channels: L2CAP Number of CO Channels.
Definition: l2cap.h:335