BLE-Stack APIs  3.00.01
l2cap.h
Go to the documentation of this file.
1 /******************************************************************************
2 
3  Group: WCS, BTS
4  $Target Device: DEVICES $
5 
6  ******************************************************************************
7  $License: TISD 2009 $
8  ******************************************************************************
9  $Release Name: PACKAGE NAME $
10  $Release Date: PACKAGE RELEASE DATE $
11  *****************************************************************************/
12 
21 #ifndef L2CAP_H
22 #define L2CAP_H
23 
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28 
29 /*********************************************************************
30  * INCLUDES
31  */
32 #include "bcomdef.h"
33 #include "osal.h"
34 
35 /*********************************************************************
36  * CONSTANTS
37  */
38 
43 #define L2CAP_MTU_SIZE 23
44 
45 #define L2CAP_SDU_SIZE 512
46 
47 #define L2CAP_NUM_PSM_DEFAULT 3
48 
49 #define L2CAP_NUM_CO_CHANNELS_DEFAULT 3
50 
51 #define L2CAP_SIG_MTU_SIZE 23
52 
53 #define L2CAP_HDR_SIZE 4
54 
55 
61 #define L2CAP_PDU_SIZE ( L2CAP_HDR_SIZE + L2CAP_MTU_SIZE )
62 
63 #define L2CAP_LEN_FIELD_SIZE 2
64 
65 
72 #define L2CAP_INVALID_PSM 0x0000
73 
74 #define L2CAP_FIXED_PSM_MIN 0x0001
75 #define L2CAP_FIXED_PSM_MAX 0x007F
76 
77 #define L2CAP_DYNAMIC_PSM_MIN 0x0080
78 #define L2CAP_DYNAMIC_PSM_MAX 0x00FF
79 
80 
88 #define L2CAP_CID_NULL 0x0000
89 
90 #define L2CAP_CID_ATT 0x0004
91 #define L2CAP_CID_SIG 0x0005
92 #define L2CAP_CID_SMP 0x0006
93 #define L2CAP_CID_GENERIC 0x0007
94 
95 #define L2CAP_DYNAMIC_CID_MIN 0x0040
96 #define L2CAP_DYNAMIC_CID_MAX 0x007F
97 
98 #define L2CAP_NUM_FIXED_CHANNELS 4
99 
100 #define L2CAP_NUM_SIG_COMMANDS 1
101 
102 
112 #define L2CAP_RTX_TIMEOUT 30
113 
117 #define L2CAP_CMD_REJECT 0x01
118 #define L2CAP_DISCONNECT_REQ 0x06
119 #define L2CAP_DISCONNECT_RSP 0x07
120 #define L2CAP_INFO_REQ 0x0a
121 #define L2CAP_INFO_RSP 0x0b
122 #define L2CAP_PARAM_UPDATE_REQ 0x12
123 #define L2CAP_PARAM_UPDATE_RSP 0x13
124 #define L2CAP_CONNECT_REQ 0x14
125 #define L2CAP_CONNECT_RSP 0x15
126 #define L2CAP_FLOW_CTRL_CREDIT 0x16
127 
128 
134 #define L2CAP_CHANNEL_ESTABLISHED_EVT 0x60
135 #define L2CAP_CHANNEL_TERMINATED_EVT 0x61
136 #define L2CAP_OUT_OF_CREDIT_EVT 0x62
137 #define L2CAP_PEER_CREDIT_THRESHOLD_EVT 0x63
138 #define L2CAP_SEND_SDU_DONE_EVT 0x64
139 #define L2CAP_NUM_CTRL_DATA_PKT_EVT 0x65
140 
141 
147 #define L2CAP_REJECT_CMD_NOT_UNDERSTOOD 0x0000
148 #define L2CAP_REJECT_SIGNAL_MTU_EXCEED 0x0001
149 #define L2CAP_REJECT_INVALID_CID 0x0002
150 
151 
157 #define L2CAP_CONN_SUCCESS 0x0000
158 #define L2CAP_CONN_PSM_NOT_SUPPORTED 0x0002
159 #define L2CAP_CONN_NO_RESOURCES 0x0004
160 #define L2CAP_CONN_INSUFFICIENT_AUTHEN 0x0005
161 #define L2CAP_CONN_INSUFFICIENT_AUTHOR 0x0006
162 #define L2CAP_CONN_INSUFFICIENT_KEY_SIZE 0x0007
163 #define L2CAP_CONN_INSUFFICIENT_ENCRYPT 0x0008
164 
165 #define L2CAP_CONN_PENDING_SEC_VERIFY 0xFFFF
166 
167 
173 #define L2CAP_CONN_PARAMS_ACCEPTED 0x0000
174 #define L2CAP_CONN_PARAMS_REJECTED 0x0001
175 
176 
182 #define L2CAP_TERM_LINK_DOWN 0x0000
183 #define L2CAP_TERM_BY_PSM 0x0001
184 #define L2CAP_TERM_BY_PEER_PSM 0x0002
185 #define L2CAP_TERM_MAX_CREDIT_EXCEED 0x0003
186 #define L2CAP_TERM_SDU_LEN_EXCEED 0x0004
187 #define L2CAP_TERM_PSM_MTU_EXCEED 0x0005
188 #define L2CAP_TERM_RX_PKT_NO_CREDIT 0x0006
189 #define L2CAP_TERM_RX_ERROR 0x0007
190 #define L2CAP_TERM_TX_ERROR 0x0008
191 #define L2CAP_TERM_MEM_ALLOC_ERROR 0x0009
192 
193 
199 #define L2CAP_CLOSED 0x00
200 #define L2CAP_OPEN 0x01
201 #define L2CAP_PENDING_CONN_RSP 0x02
202 #define L2CAP_PENDING_DISCONN_RSP 0x03
203 #define L2CAP_PENDING_PARAM_UPDATE_RSP 0x04
204 #define L2CAP_PENDING_INFO_RSP 0x05
205 #define L2CAP_PENDING_SEC_VERIFY 0x06
206 
207 
213 #define L2CAP_INFO_CONNLESS_MTU 0x0001
214 #define L2CAP_INFO_EXTENDED_FEATURES 0x0002
215 #define L2CAP_INFO_FIXED_CHANNELS 0x0003
216 
217 
219 /*********************************************************************
220  * Information Response: Extended Features Mask Values
221  */
222 #define L2CAP_FIXED_CHANNELS 0x00000080
223 
224 #define L2CAP_EXTENDED_FEATURES_SIZE 4
225 
226 /*********************************************************************
227  * Information Response: Fixed Channels Mask Values
228  */
229 #define L2CAP_FIXED_CHANNELS_ATT 0x10
230 
231 #define L2CAP_FIXED_CHANNELS_SIG 0x20
232 
233 #define L2CAP_FIXED_CHANNELS_SMP 0x40
234 
235 #define L2CAP_FIXED_CHANNELS_SIZE 8
236 
237 /*********************************************************************
238  * Information Response: Result Values
239  */
240 #define L2CAP_INFO_SUCCESS 0x0000
241 
242 #define L2CAP_INFO_NOT_SUPPORTED 0x0001
243 
244 
246 /*********************************************************************
247  * L2CAP Test Modes: Test code values
248  */
249 #if defined ( TESTMODES )
250  // Test modes 0 through 10 are reserved for L2CAP Connection Request.
251  #define L2CAP_TESTMODE_OFF 0
252  #define L2CAP_TESTMODE_PSM_NOT_SUPPORTED 2
253  #define L2CAP_TESTMODE_NO_RESOURCES 4
254  #define L2CAP_TESTMODE_INSUFF_AUTHEN 5
255  #define L2CAP_TESTMODE_INSUFF_AUTHOR 6
256  #define L2CAP_TESTMODE_INSUFF_KEY_SIZE 7
257  #define L2CAP_TESTMODE_INSUFF_ENCRYPT 8
258  #define L2CAP_TESTMODE_INVALID_SRC_CID 9
259  #define L2CAP_TESTMODE_SRC_CID_ALREADY_ALLOC 10
260  #define L2CAP_TESTMODE_OUT_OF_RANGE_CREDITS 11
261  #define L2CAP_TESTMODE_SDU_LEN_EXCEED 12
262  #define L2CAP_TESTMODE_TX_PKT_NO_CREDIT 13
263  #define L2CAP_TESTMODE_BLOCK_DATA_TX 14
264 #endif
265 
267 
270 /*********************************************************************
271  * MACROS
272  */
273 
274 /*********************************************************************
275  * TYPEDEFS
276  */
277 
282 typedef struct
284 {
285  uint8 maxNumPSM;
288 
290 typedef struct
291 {
292  uint16 localCID;
293  uint16 remoteCID;
295 
297 typedef union
298 {
299  uint16 signalMTU;
302 
304 typedef struct
305 {
306  uint16 reason;
308 
309  // Shorthand access for union members
310  #define maxSignalMTU reasonData.signalMTU
311  #define invalidLocalCID reasonData.invalidCID.localCID
312  #define invalidRemoteCID reasonData.invalidCID.remoteCID
313 } l2capCmdReject_t;
314 
316 typedef struct
317 {
318  uint16 intervalMin;
319  uint16 intervalMax;
320  uint16 slaveLatency;
323 
325 typedef struct
326 {
327  uint16 result;
329 
331 typedef struct
332 {
333  uint16 infoType;
335 
337 typedef union
338 {
341  uint8 fixedChannels[L2CAP_FIXED_CHANNELS_SIZE];
342 } l2capInfo_t;
343 
345 typedef struct
346 {
347  uint16 result;
348  uint16 infoType;
351 
353 typedef struct
354 {
355  uint16 psm;
356  uint16 srcCID;
357  uint16 mtu;
358  uint16 mps;
359  uint16 initCredits;
361 
363 typedef struct
364 {
365  uint16 dstCID;
366  uint16 mtu;
367  uint16 mps;
368  uint16 initCredits;
369  uint16 result;
371 
373 typedef struct
374 {
375  uint16 dstCID;
376  uint16 srcCID;
378 
380 typedef struct
381 {
382  uint16 dstCID;
383  uint16 srcCID;
385 
387 typedef struct
388 {
389  uint16 CID;
390  uint16 credits;
392 
394 typedef struct
395 {
396  uint16 mtu;
397  uint16 mps;
403 
405 typedef struct
406 {
407  uint16 psm;
408  uint16 mtu;
409  uint16 mps;
410  uint16 credits;
411  uint16 peerCID;
412  uint16 peerMtu;
413  uint16 peerMps;
414  uint16 peerCredits;
417 
419 typedef struct
420 {
421  uint8 state;
424 
437 typedef struct
438 {
439  uint16 result;
440  uint16 CID;
443 
450 typedef struct
451 {
452  uint16 CID;
453  uint16 peerCID;
454  uint16 reason;
456 
463 typedef struct
464 {
465  uint16 CID;
466  uint16 peerCID;
467  uint16 credits;
470 
477 typedef struct
478 {
479  uint16 CID;
480  uint16 credits;
481  uint16 peerCID;
482  uint16 peerCredits;
483  uint16 totalLen;
484  uint16 txLen;
486 
493 typedef struct
494 {
495  uint8 numDataPkt;
497 
499 typedef union
500 {
501  // Requests
507 
508  // Responses
514 
515  // Proprietary local events
522 
529 typedef struct
530 {
532  uint16 connHandle;
533  uint8 id;
534  uint8 opcode;
537 
539 typedef struct
540 {
541  uint16 CID;
542  uint8 *pPayload;
543  uint16 len;
546 } l2capPacket_t;
547 
558 typedef struct
559 {
561  uint16 connHandle;
564 
586 typedef uint16 (*pfnVerifySecCB_t)( uint16 connHandle, uint8 id, l2capConnectReq_t *pReq );
587 
595 typedef struct
597 {
598  uint16 psm;
599  uint16 mtu;
603  uint8 taskId;
605 } l2capPsm_t;
606  // end of L2CAP_Structs
608 
609 /*********************************************************************
610  * GLOBAL VARIABLES
611  */
612 
613 /*********************************************************************
614  * FUNCTIONS
615  */
616 
626 extern bStatus_t L2CAP_RegisterApp( uint8 taskId, uint16 CID );
627 
634 extern void L2CAP_RegisterFlowCtrlTask( uint8 taskId );
635 
654 extern bStatus_t L2CAP_SendData( uint16 connHandle, l2capPacket_t *pPkt );
655 
668 extern bStatus_t L2CAP_RegisterPsm( l2capPsm_t *pPsm );
669 
680 extern bStatus_t L2CAP_DeregisterPsm( uint8 taskId, uint16 psm );
681 
691 extern bStatus_t L2CAP_PsmInfo( uint16 psm, l2capPsmInfo_t *pInfo );
692 
703 extern bStatus_t L2CAP_PsmChannels( uint16 psm, uint8 numCIDs, uint16 *pCIDs );
704 
714 extern bStatus_t L2CAP_ChannelInfo( uint16 CID, l2capChannelInfo_t *pInfo );
715 
731 extern bStatus_t L2CAP_ConnectReq( uint16 connHandle, uint16 psm, uint16 peerPsm );
732 
746 extern bStatus_t L2CAP_ConnectRsp( uint16 connHandle, uint8 id, uint16 result );
747 
760 extern bStatus_t L2CAP_DisconnectReq( uint16 CID );
761 
775 extern bStatus_t L2CAP_FlowCtrlCredit( uint16 CID, uint16 peerCredits );
776 
792 extern bStatus_t L2CAP_SendSDU( l2capPacket_t *pPkt );
793 
807 extern bStatus_t L2CAP_CmdReject( uint16 connHandle, uint8 id, l2capCmdReject_t *pCmdReject );
808 
823 extern bStatus_t L2CAP_InfoReq( uint16 connHandle, l2capInfoReq_t *pInfoReq, uint8 taskId );
824 
840 extern bStatus_t L2CAP_ConnParamUpdateReq( uint16 connHandle, l2capParamUpdateReq_t *pUpdateReq, uint8 taskId );
841 
855 extern bStatus_t L2CAP_ConnParamUpdateRsp( uint16 connHandle, uint8 id, l2capParamUpdateRsp_t *pUpdateRsp );
856 
865 extern void L2CAP_SetUserConfig( l2capUserCfg_t *pUserCfg );
866 
875 extern void L2CAP_SetBufSize( uint16 dataPktLen, uint8 numDataPkts );
876 
882 extern uint16 L2CAP_GetMTU( void );
883 
896 extern void *L2CAP_bm_alloc( uint16 size );
897 
906 extern uint16 L2CAP_BuildConnectReq( uint8 *pBuf, uint8 *pData );
907 
918 extern bStatus_t L2CAP_ParseConnectReq( l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len );
919 
930 extern bStatus_t L2CAP_ParseFlowCtrlCredit( l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len );
931 
940 extern uint16 L2CAP_BuildCmdReject( uint8 *pBuf, uint8 *pCmd );
941 
952 extern bStatus_t L2CAP_ParseInfoReq( l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len );
953 
964 extern bStatus_t L2CAP_ParseParamUpdateReq( l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len );
965 
974 extern uint16 L2CAP_BuildParamUpdateRsp( uint8 *pBuf, uint8 *pData );
975 
984 extern uint16 L2CAP_BuildInfoRsp( uint8 *pBuf, uint8 *pData );
985 
993 extern void L2CAP_SetControllerToHostFlowCtrl( uint16 hostBuffSize, uint8 flowCtrlMode );
994 
1005 extern void L2CAP_HostNumCompletedPkts( uint16 connHandle, uint16 numCompletedPkts );
1006 
1014 extern void L2CAP_SetParamValue( uint16 value );
1015 
1021 extern uint16 L2CAP_GetParamValue( void );
1022 
1023 /*-------------------------------------------------------------------
1024  * TASK API - These functions must only be called by OSAL.
1025  */
1026 
1028 
1036 extern void L2CAP_Init( uint8 taskId );
1037 
1047 extern uint16 L2CAP_ProcessEvent( uint8 taskId, uint16 events );
1048 
1050 
1051 /*********************************************************************
1052 *********************************************************************/
1053 
1054 #ifdef __cplusplus
1055 }
1056 #endif
1057 
1058 #endif /* L2CAP_H */
1059 
uint8 numActiveChannels
Number of active CO Channels.
Definition: l2cap.h:401
uint16 remoteCID
Source CID from the rejected command.
Definition: l2cap.h:293
Local channel information format.
Definition: l2cap.h:419
uint16 peerCreditThreshold
Low threshold for number of peer credits.
Definition: l2cap.h:399
This API allows the software components in the Z-Stack to be written independently of the specifics o...
osal_event_hdr_t hdr
L2CAP_DATA_EVENT and status.
Definition: l2cap.h:560
l2capConnectRsp_t connectRsp
LE Credit Based Connection Response.
Definition: l2cap.h:512
uint16 intervalMin
Minimum Interval.
Definition: l2cap.h:318
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:586
Command Reject format.
Definition: l2cap.h:304
bStatus_t L2CAP_ConnParamUpdateRsp(uint16 connHandle, uint8 id, l2capParamUpdateRsp_t *pUpdateRsp)
Send Connection Parameter Update Response.
uint16 CID
Local channel id.
Definition: l2cap.h:479
uint16 CID
local channel id
Definition: l2cap.h:541
uint16 initCredits
Indicates number of LE-frames that peer device can send.
Definition: l2cap.h:368
Command Reject Reason Data format.
Definition: l2cap.h:297
l2capParamUpdateReq_t updateReq
Connection Parameter Update Request.
Definition: l2cap.h:502
uint8 maxNumCoChannels
Max number of Connection Oriented Channels: L2CAP_NUM_CO_CHANNELS_DEFAULT.
Definition: l2cap.h:286
Information Response Data field.
Definition: l2cap.h:337
uint16 totalLen
Total length of SDU being transmitted.
Definition: l2cap.h:483
uint16 localCID
Destination CID from the rejected command.
Definition: l2cap.h:292
bStatus_t L2CAP_RegisterPsm(l2capPsm_t *pPsm)
Register a Protocol/Service Multiplexer (PSM) with L2CAP.
uint16 mps
Specifies maximum payload size that can be received on this channel.
Definition: l2cap.h:358
uint16 L2CAP_GetMTU(void)
Get the maximum payload size that L2CAP is capable of receiving.
#define L2CAP_FIXED_CHANNELS_SIZE
Length of Fixed Channels bit mask.
Definition: l2cap.h:235
uint16 initPeerCredits
Number of LE-frames that peer device can send.
Definition: l2cap.h:398
Connection oriented channel information format.
Definition: l2cap.h:405
uint16 result
Result.
Definition: l2cap.h:347
uint16 result
Indicates outcome of connection request: L2CAP Connection Response Result Values. ...
Definition: l2cap.h:369
Disconnection Response format (src/dst CIDs are relative to sender of request).
Definition: l2cap.h:380
uint16 mtu
Maximum SDU size that can be received by local device.
Definition: l2cap.h:599
void L2CAP_RegisterFlowCtrlTask(uint8 taskId)
Register task to recevie L2CAP Flow Control events when there are data buffers available for sending ...
uint16 peerCreditThreshold
Low threshold for peer credit count.
Definition: l2cap.h:415
uint16 peerMps
Maximum payload size that can be received by peer device.
Definition: l2cap.h:413
Disconnection Request format (src/dst CIDs are relative to sender of request).
Definition: l2cap.h:373
l2capNumCtrlDataPktEvt_t numCtrlDataPktEvt
Number of Available Ctrl Data Packets Event.
Definition: l2cap.h:520
bStatus_t L2CAP_RegisterApp(uint8 taskId, uint16 CID)
Register a protocol/application with an L2CAP fixed channel.
uint16 dstCID
Identifies CID on device sending response.
Definition: l2cap.h:382
l2capInfoRsp_t infoRsp
Information Response - not supported.
Definition: l2cap.h:510
bStatus_t L2CAP_ConnectRsp(uint16 connHandle, uint8 id, uint16 result)
Send Connection Response.
uint16 infoType
Information type: L2CAP Information Request/Response Info Types.
Definition: l2cap.h:333
uint16 connectionlessMTU
Connectionless MTU.
Definition: l2cap.h:339
uint16 L2CAP_BuildConnectReq(uint8 *pBuf, uint8 *pData)
Build Connection Request.
uint16 psm
LE PSM.
Definition: l2cap.h:355
uint16 peerCID
Remote channel id.
Definition: l2cap.h:411
osal_event_hdr_t hdr
L2CAP_SIGNAL_EVENT and status.
Definition: l2cap.h:531
l2capReasonData_t reasonData
Reason Data.
Definition: l2cap.h:307
void L2CAP_SetUserConfig(l2capUserCfg_t *pUserCfg)
Set the user configurable variables for the L2CAP layer.
uint16 CID
Local channel id.
Definition: l2cap.h:452
bStatus_t L2CAP_PsmChannels(uint16 psm, uint8 numCIDs, uint16 *pCIDs)
Get all active channels for a given registered PSM.
uint16 srcCID
Specifies CID to be disconnected on device sending request.
Definition: l2cap.h:376
uint16 CID
Represents Source CID of device sending credit packet.
Definition: l2cap.h:389
uint8 maxNumPSM
Max number of Protocol/Service Multiplexers (PSM): L2CAP_NUM_PSM_DEFAULT.
Definition: l2cap.h:285
uint16 peerCID
Peer channel id.
Definition: l2cap.h:481
uint16 mtu
Specifies maximum SDU size that can be received on this channel.
Definition: l2cap.h:366
uint8 * pPayload
Definition: l2cap.h:542
uint8 state
Channel connection state: L2CAP Channel States.
Definition: l2cap.h:421
uint16 txLen
Total number of octets transmitted.
Definition: l2cap.h:484
uint16 reason
Indicates reason for termination: L2CAP Channel Terminated Event Reason Values.
Definition: l2cap.h:454
uint8 taskId
Task registered with PSM.
Definition: l2cap.h:603
L2CAP PSM structure. Allocated one for each registered PSM.
Definition: l2cap.h:596
l2capInfo_t info
Content of Info field depends on infoType.
Definition: l2cap.h:349
uint16 L2CAP_BuildInfoRsp(uint8 *pBuf, uint8 *pData)
Build Information Response.
bStatus_t L2CAP_InfoReq(uint16 connHandle, l2capInfoReq_t *pInfoReq, uint8 taskId)
Send Information Request.
bStatus_t L2CAP_DisconnectReq(uint16 CID)
Send Disconnection Request.
uint8 id
identifier to match responses with requests
Definition: l2cap.h:533
void L2CAP_HostNumCompletedPkts(uint16 connHandle, uint16 numCompletedPkts)
Host Number of Completed Packets.
L2CAP_CHANNEL_TERMINATED_EVT message format.
Definition: l2cap.h:450
uint16 mps
Maximum payload size that can be received by local device.
Definition: l2cap.h:397
PSM information format.
Definition: l2cap.h:394
uint16 result
Result: L2CAP Connection Parameter Update Response Result Values.
Definition: l2cap.h:327
Union of all L2CAP Signaling commands.
Definition: l2cap.h:499
uint8 numDataPkt
Number of Data Packets Available.
Definition: l2cap.h:495
uint16 srcCID
Represents CID on device sending request and receiving response.
Definition: l2cap.h:356
l2capDisconnectReq_t disconnectReq
Disconnection Request.
Definition: l2cap.h:505
uint16 peerCreditThreshold
Low threshold for peer credit count.
Definition: l2cap.h:601
Connection Request format.
Definition: l2cap.h:353
uint16 signalMTU
Maximum Signaling MTU.
Definition: l2cap.h:299
uint16 peerCredits
Peer credits.
Definition: l2cap.h:482
L2CAP_OUT_OF_CREDIT_EVT or L2CAP_PEER_CREDIT_THRESHOLD_EVT message format.
Definition: l2cap.h:463
uint16 initCredits
Indicates number of LE-frames that peer device can send.
Definition: l2cap.h:359
Invalid CID in Request format.
Definition: l2cap.h:290
uint8 maxNumChannels
Maximum number of CO Channels supported by PSM.
Definition: l2cap.h:400
pfnVerifySecCB_t pfnVerifySecCB
PSM security verification callback (can be NULL)
Definition: l2cap.h:604
bStatus_t L2CAP_ConnectReq(uint16 connHandle, uint16 psm, uint16 peerPsm)
Send Connection Request.
bStatus_t L2CAP_ParseConnectReq(l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len)
Parse Connection Request message.
uint16 peerCredits
Number of LE-frames that peer device can send.
Definition: l2cap.h:414
uint16 connHandle
connection packet was received on
Definition: l2cap.h:561
uint32 extendedFeatures
Extended features supported.
Definition: l2cap.h:340
uint16 peerMtu
Maximum SDU size that can be received by peer device.
Definition: l2cap.h:412
l2capSignalCmd_t cmd
command data
Definition: l2cap.h:535
l2capParamUpdateRsp_t updateRsp
Connection Parameter Update Response.
Definition: l2cap.h:509
L2CAP_CHANNEL_ESTABLISHED_EVT message format.
Definition: l2cap.h:437
l2capSendSduDoneEvt_t sendSduDoneEvt
Send SDU Done Event.
Definition: l2cap.h:519
bStatus_t L2CAP_FlowCtrlCredit(uint16 CID, uint16 peerCredits)
Send Flow Control Credit.
l2capInvalidCID_t invalidCID
Invalid CID in Request.
Definition: l2cap.h:300
bStatus_t L2CAP_SendSDU(l2capPacket_t *pPkt)
Send data packet over an L2CAP connection oriented channel established over a physical connection...
uint8 opcode
type of command: L2CAP Signaling Codes (type of commands)
Definition: l2cap.h:534
L2CAP_NUM_CTRL_DATA_PKT_EVT message format.
Definition: l2cap.h:493
uint16 credits
Definition: l2cap.h:467
Information Response format.
Definition: l2cap.h:345
bStatus_t L2CAP_ParseFlowCtrlCredit(l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len)
Parse Flow Control Credit message.
User configurable variables format.
Definition: l2cap.h:283
Type definitions and macros for BLE stack.
uint16 L2CAP_BuildCmdReject(uint8 *pBuf, uint8 *pCmd)
Build Command Reject.
uint16 dstCID
Represents CID on device receiving request and sending response.
Definition: l2cap.h:365
uint16 mps
Specifies maximum payload size that can be received on this channel.
Definition: l2cap.h:367
Information Request format.
Definition: l2cap.h:331
bStatus_t L2CAP_CmdReject(uint16 connHandle, uint8 id, l2capCmdReject_t *pCmdReject)
Send Command Reject.
uint16 intervalMax
Maximum Interval.
Definition: l2cap.h:319
OSAL Event Header.
Definition: osal.h:92
l2capInfoReq_t infoReq
Information Request - not supported.
Definition: l2cap.h:503
bStatus_t L2CAP_PsmInfo(uint16 psm, l2capPsmInfo_t *pInfo)
Get information about a given registered PSM.
l2capCreditEvt_t creditEvt
Out Of Credit Event or Peer Credit Threshold Event.
Definition: l2cap.h:518
bStatus_t L2CAP_ParseInfoReq(l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len)
Parse Information Request message.
l2capDisconnectRsp_t disconnectRsp
Disconnection Response.
Definition: l2cap.h:513
l2capChannelEstEvt_t channelEstEvt
Channel Established Event.
Definition: l2cap.h:516
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 initPeerCredits
Number of LE-frames that peer device can send.
Definition: l2cap.h:600
uint16 slaveLatency
Slave Latency.
Definition: l2cap.h:320
uint16 connHandle
connection message was received on
Definition: l2cap.h:532
L2CAP packet structure.
Definition: l2cap.h:539
OSAL L2CAP_SIGNAL_EVENT message format.
Definition: l2cap.h:529
l2capPacket_t pkt
received packet
Definition: l2cap.h:562
bStatus_t L2CAP_DeregisterPsm(uint8 taskId, uint16 psm)
Deregister a Protocol/Service Multiplexer with L2CAP.
uint16 mtu
Maximum SDU size that can be received by local device.
Definition: l2cap.h:396
uint16 peerCID
Peer channel id.
Definition: l2cap.h:453
uint16 mtu
Maximum SDU size that can be received by local device.
Definition: l2cap.h:408
bStatus_t L2CAP_ConnParamUpdateReq(uint16 connHandle, l2capParamUpdateReq_t *pUpdateReq, uint8 taskId)
Send Connection Parameter Update Request.
uint16 psm
PSM that channel belongs to.
Definition: l2cap.h:407
l2capFlowCtrlCredit_t credit
LE Flow Control Credit.
Definition: l2cap.h:506
uint16 mps
Maximum payload size that can be received by local device.
Definition: l2cap.h:409
uint16 reason
Reason: L2CAP Command Reject Reason Codes.
Definition: l2cap.h:306
Flow Control Credit format.
Definition: l2cap.h:387
uint16 dstCID
Specifies CID to be disconnected on device receiving request.
Definition: l2cap.h:375
l2capCoCInfo_t info
Channel info.
Definition: l2cap.h:422
uint16 credits
Number of LE-frames that local device can send.
Definition: l2cap.h:410
uint16 infoType
Information type: L2CAP Information Request/Response Info Types.
Definition: l2cap.h:348
uint16 credits
Number of LE-frames that can be sent to local device.
Definition: l2cap.h:390
l2capCoCInfo_t info
Channel info.
Definition: l2cap.h:441
uint16 L2CAP_GetParamValue(void)
Get the L2CAP parameter value.
L2CAP_SEND_SDU_DONE_EVT message format.
Definition: l2cap.h:477
void L2CAP_SetControllerToHostFlowCtrl(uint16 hostBuffSize, uint8 flowCtrlMode)
Turn flow control on or off for data packets sent from the Controller to the Host.
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:224
uint16 timeoutMultiplier
Timeout Multiplier.
Definition: l2cap.h:321
void L2CAP_SetParamValue(uint16 value)
Set the L2CAP parameter value.
uint16 CID
Local channel id.
Definition: l2cap.h:465
uint16 CID
Local channel id.
Definition: l2cap.h:440
Connection Response format.
Definition: l2cap.h:363
uint16 srcCID
Identifies CID on device receiving response.
Definition: l2cap.h:383
bStatus_t L2CAP_ChannelInfo(uint16 CID, l2capChannelInfo_t *pInfo)
Get information about a given active Connection Oriented Channel.
uint16 L2CAP_BuildParamUpdateRsp(uint8 *pBuf, uint8 *pData)
Build Connection Parameter Update Response.
uint16 psm
Registered PSM.
Definition: l2cap.h:598
l2capChannelTermEvt_t channelTermEvt
Channel Terminated Event.
Definition: l2cap.h:517
void * L2CAP_bm_alloc(uint16 size)
L2CAP implementation of the allocator functionality.
Connection Parameter Update Response format.
Definition: l2cap.h:325
uint16 peerCID
Peer channel id.
Definition: l2cap.h:466
Connection Parameter Update Request format.
Definition: l2cap.h:316
bStatus_t L2CAP_ParseParamUpdateReq(l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len)
Parse Connection Parameter Update Request.
l2capConnectReq_t connectReq
LE Credit Based Connection Request.
Definition: l2cap.h:504
uint16 mtu
Specifies maximum SDU size that can be received on this channel.
Definition: l2cap.h:357
OSAL L2CAP_DATA_EVENT message format.
Definition: l2cap.h:558
uint8 maxNumChannels
Maximum number of CO Channels supported by PSM.
Definition: l2cap.h:602
uint16 result
Indicates outcome of connection request: L2CAP Connection Response Result Values. ...
Definition: l2cap.h:439
l2capCmdReject_t cmdReject
Command Reject.
Definition: l2cap.h:511
bStatus_t L2CAP_SendData(uint16 connHandle, l2capPacket_t *pPkt)
Send data packet over an L2CAP fixed channel established over a physical connection.
uint16 credits
Local credits.
Definition: l2cap.h:480
Copyright 2017, Texas Instruments Incorporated