BLE-Stack APIs  3.00.00
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
l2cap.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /*!*****************************************************************************
33  * @defgroup L2CAP L2CAP
34  * @brief This module implements the Logical Link Control and Adaption Protocol
35  * @{
36  * @file l2cap.h
37  * @brief L2CAP layer interface
38  */
39 
40 #ifndef L2CAP_H
41 #define L2CAP_H
42 
43 #ifdef __cplusplus
44 extern "C"
45 {
46 #endif
47 
48 /*********************************************************************
49  * INCLUDES
50  */
51 #include "bcomdef.h"
52 #include "osal.h"
53 
54 /*********************************************************************
55  * CONSTANTS
56  */
57 
62 #define L2CAP_MTU_SIZE 23
63 
64 #define L2CAP_SDU_SIZE 512
65 
66 #define L2CAP_NUM_PSM_DEFAULT 3
67 
68 #define L2CAP_NUM_CO_CHANNELS_DEFAULT 3
69 
70 #define L2CAP_SIG_MTU_SIZE 23
71 
72 #define L2CAP_HDR_SIZE 4
73 
74 
80 #define L2CAP_PDU_SIZE ( L2CAP_HDR_SIZE + L2CAP_MTU_SIZE )
81 
82 #define L2CAP_LEN_FIELD_SIZE 2
83 
84 
91 #define L2CAP_INVALID_PSM 0x0000
92 
93 #define L2CAP_FIXED_PSM_MIN 0x0001
94 #define L2CAP_FIXED_PSM_MAX 0x007F
95 
96 #define L2CAP_DYNAMIC_PSM_MIN 0x0080
97 #define L2CAP_DYNAMIC_PSM_MAX 0x00FF
98 
99 
107 #define L2CAP_CID_NULL 0x0000
108 
109 #define L2CAP_CID_ATT 0x0004
110 #define L2CAP_CID_SIG 0x0005
111 #define L2CAP_CID_SMP 0x0006
112 #define L2CAP_CID_GENERIC 0x0007
113 
114 #define L2CAP_DYNAMIC_CID_MIN 0x0040 // Dynamic Channel Identifier Min
115 #define L2CAP_DYNAMIC_CID_MAX 0x007F // Dynamic Channel Identifier Max
116 
117 #define L2CAP_NUM_FIXED_CHANNELS 4
118 
119 #define L2CAP_NUM_SIG_COMMANDS 1
120 
121 
131 #define L2CAP_RTX_TIMEOUT 30
132 
136 #define L2CAP_CMD_REJECT 0x01
137 #define L2CAP_DISCONNECT_REQ 0x06
138 #define L2CAP_DISCONNECT_RSP 0x07
139 #define L2CAP_INFO_REQ 0x0a
140 #define L2CAP_INFO_RSP 0x0b
141 #define L2CAP_PARAM_UPDATE_REQ 0x12
142 #define L2CAP_PARAM_UPDATE_RSP 0x13
143 #define L2CAP_CONNECT_REQ 0x14
144 #define L2CAP_CONNECT_RSP 0x15
145 #define L2CAP_FLOW_CTRL_CREDIT 0x16
146 
147 
153 #define L2CAP_CHANNEL_ESTABLISHED_EVT 0x60
154 #define L2CAP_CHANNEL_TERMINATED_EVT 0x61
155 #define L2CAP_OUT_OF_CREDIT_EVT 0x62
156 #define L2CAP_PEER_CREDIT_THRESHOLD_EVT 0x63
157 #define L2CAP_SEND_SDU_DONE_EVT 0x64
158 #define L2CAP_NUM_CTRL_DATA_PKT_EVT 0x65
159 
160 
166 #define L2CAP_REJECT_CMD_NOT_UNDERSTOOD 0x0000
167 #define L2CAP_REJECT_SIGNAL_MTU_EXCEED 0x0001
168 #define L2CAP_REJECT_INVALID_CID 0x0002
169 
170 
176 #define L2CAP_CONN_SUCCESS 0x0000
177 #define L2CAP_CONN_PSM_NOT_SUPPORTED 0x0002
178 #define L2CAP_CONN_NO_RESOURCES 0x0004
179 #define L2CAP_CONN_INSUFFICIENT_AUTHEN 0x0005
180 #define L2CAP_CONN_INSUFFICIENT_AUTHOR 0x0006
181 #define L2CAP_CONN_INSUFFICIENT_KEY_SIZE 0x0007
182 #define L2CAP_CONN_INSUFFICIENT_ENCRYPT 0x0008
183 
184 #define L2CAP_CONN_PENDING_SEC_VERIFY 0xFFFF
185 
186 
192 #define L2CAP_CONN_PARAMS_ACCEPTED 0x0000
193 #define L2CAP_CONN_PARAMS_REJECTED 0x0001
194 
195 
201 #define L2CAP_TERM_LINK_DOWN 0x0000
202 #define L2CAP_TERM_BY_PSM 0x0001
203 #define L2CAP_TERM_BY_PEER_PSM 0x0002
204 #define L2CAP_TERM_MAX_CREDIT_EXCEED 0x0003
205 #define L2CAP_TERM_SDU_LEN_EXCEED 0x0004
206 #define L2CAP_TERM_PSM_MTU_EXCEED 0x0005
207 #define L2CAP_TERM_RX_PKT_NO_CREDIT 0x0006
208 #define L2CAP_TERM_RX_ERROR 0x0007
209 #define L2CAP_TERM_TX_ERROR 0x0008
210 #define L2CAP_TERM_MEM_ALLOC_ERROR 0x0009
211 
212 
218 #define L2CAP_CLOSED 0x00
219 #define L2CAP_OPEN 0x01
220 #define L2CAP_PENDING_CONN_RSP 0x02
221 #define L2CAP_PENDING_DISCONN_RSP 0x03
222 #define L2CAP_PENDING_PARAM_UPDATE_RSP 0x04
223 #define L2CAP_PENDING_INFO_RSP 0x05
224 #define L2CAP_PENDING_SEC_VERIFY 0x06
225 
226 
232 #define L2CAP_INFO_CONNLESS_MTU 0x0001
233 #define L2CAP_INFO_EXTENDED_FEATURES 0x0002
234 #define L2CAP_INFO_FIXED_CHANNELS 0x0003
235 
236 
238 /*********************************************************************
239  * Information Response: Extended Features Mask Values
240  */
241 #define L2CAP_FIXED_CHANNELS 0x00000080
242 
243 #define L2CAP_EXTENDED_FEATURES_SIZE 4
244 
245 /*********************************************************************
246  * Information Response: Fixed Channels Mask Values
247  */
248 #define L2CAP_FIXED_CHANNELS_ATT 0x10
249 
250 #define L2CAP_FIXED_CHANNELS_SIG 0x20
251 
252 #define L2CAP_FIXED_CHANNELS_SMP 0x40
253 
254 #define L2CAP_FIXED_CHANNELS_SIZE 8
255 
256 /*********************************************************************
257  * Information Response: Result Values
258  */
259 #define L2CAP_INFO_SUCCESS 0x0000
260 
261 #define L2CAP_INFO_NOT_SUPPORTED 0x0001
262 
263 
265 /*********************************************************************
266  * L2CAP Test Modes: Test code values
267  */
268 #if defined ( TESTMODES )
269  // Test modes 0 through 8 are reserved for L2CAP Connection Request.
270  #define L2CAP_TESTMODE_OFF 0 // Test mode off
271  #define L2CAP_TESTMODE_PSM_NOT_SUPPORTED 2 // Refuse connection - LE_PSM not supported
272  #define L2CAP_TESTMODE_NO_RESOURCES 4 // Refuse connection - no resources available
273  #define L2CAP_TESTMODE_INSUFF_AUTHEN 5 // Refuse connection - insufficient authentication
274  #define L2CAP_TESTMODE_INSUFF_AUTHOR 6 // Refuse connection - insufficient authorization
275  #define L2CAP_TESTMODE_INSUFF_KEY_SIZE 7 // Refuse connection - insufficient encryption key size
276  #define L2CAP_TESTMODE_INSUFF_ENCRYPT 8 // Refuse connection - insufficient encryption
277  #define L2CAP_TESTMODE_OUT_OF_RANGE_CREDITS 9 // Allow out of range credits to be sent (0 or exceeding 65535)
278  #define L2CAP_TESTMODE_SDU_LEN_EXCEED 10 // Send SDU larger than SDU length specified in first LE-frame of SDU
279  #define L2CAP_TESTMODE_TX_PKT_NO_CREDIT 11 // Send LE-frame when local device has a credit count of zero
280  #define L2CAP_TESTMODE_BLOCK_DATA_TX 12 // Block data packet transmission
281 #endif
282 
284 
287 /*********************************************************************
288  * MACROS
289  */
290 
291 /*********************************************************************
292  * TYPEDEFS
293  */
294 
299 typedef struct
301 {
302  uint8 maxNumPSM;
305 
307 typedef struct
308 {
309  uint16 localCID;
310  uint16 remoteCID;
312 
314 typedef union
315 {
316  uint16 signalMTU;
319 
321 typedef struct
322 {
323  uint16 reason;
325 
326  // Shorthand access for union members
327  #define maxSignalMTU reasonData.signalMTU
328  #define invalidLocalCID reasonData.invalidCID.localCID
329  #define invalidRemoteCID reasonData.invalidCID.remoteCID
331 
333 typedef struct
334 {
335  uint16 intervalMin;
336  uint16 intervalMax;
337  uint16 slaveLatency;
340 
342 typedef struct
343 {
344  uint16 result;
346 
348 typedef struct
349 {
350  uint16 infoType;
352 
354 typedef union
355 {
358  uint8 fixedChannels[L2CAP_FIXED_CHANNELS_SIZE];
359 } l2capInfo_t;
360 
362 typedef struct
363 {
364  uint16 result;
365  uint16 infoType;
368 
370 typedef struct
371 {
372  uint16 psm;
373  uint16 srcCID;
374  uint16 mtu;
375  uint16 mps;
376  uint16 initCredits;
378 
380 typedef struct
381 {
382  uint16 dstCID;
383  uint16 mtu;
384  uint16 mps;
385  uint16 initCredits;
386  uint16 result;
388 
390 typedef struct
391 {
392  uint16 dstCID;
393  uint16 srcCID;
395 
397 typedef struct
398 {
399  uint16 dstCID;
400  uint16 srcCID;
402 
404 typedef struct
405 {
406  uint16 CID;
407  uint16 credits;
409 
411 typedef struct
412 {
413  uint16 mtu;
414  uint16 mps;
420 
422 typedef struct
423 {
424  uint16 psm;
425  uint16 mtu;
426  uint16 mps;
427  uint16 credits;
428  uint16 peerCID;
429  uint16 peerMtu;
430  uint16 peerMps;
431  uint16 peerCredits;
434 
436 typedef struct
437 {
438  uint8 state;
441 
454 typedef struct
455 {
456  uint16 result;
457  uint16 CID;
460 
467 typedef struct
468 {
469  uint16 CID;
470  uint16 peerCID;
471  uint16 reason;
473 
480 typedef struct
481 {
482  uint16 CID;
483  uint16 peerCID;
484  uint16 credits;
487 
494 typedef struct
495 {
496  uint16 CID;
497  uint16 credits;
498  uint16 peerCID;
499  uint16 peerCredits;
500  uint16 totalLen;
501  uint16 txLen;
503 
510 typedef struct
511 {
512  uint8 numDataPkt;
514 
516 typedef union
517 {
518  // Requests
524 
525  // Responses
531 
532  // Proprietary local events
539 
546 typedef struct
547 {
549  uint16 connHandle;
550  uint8 id;
551  uint8 opcode;
554 
556 typedef struct
557 {
558  uint16 CID;
559  uint8 *pPayload;
560  uint16 len;
563 } l2capPacket_t;
564 
575 typedef struct
576 {
578  uint16 connHandle;
581 
603 typedef uint16 (*pfnVerifySecCB_t)( uint16 connHandle, uint8 id, l2capConnectReq_t *pReq );
604 
612 typedef struct
614 {
615  uint16 psm;
616  uint16 mtu;
620  uint8 taskId;
622 } l2capPsm_t;
623  // end of L2CAP_Structs
625 
626 /*********************************************************************
627  * GLOBAL VARIABLES
628  */
629 
630 /*********************************************************************
631  * FUNCTIONS
632  */
633 
643 extern bStatus_t L2CAP_RegisterApp( uint8 taskId, uint16 CID );
644 
651 extern void L2CAP_RegisterFlowCtrlTask( uint8 taskId );
652 
671 extern bStatus_t L2CAP_SendData( uint16 connHandle, l2capPacket_t *pPkt );
672 
685 extern bStatus_t L2CAP_RegisterPsm( l2capPsm_t *pPsm );
686 
697 extern bStatus_t L2CAP_DeregisterPsm( uint8 taskId, uint16 psm );
698 
708 extern bStatus_t L2CAP_PsmInfo( uint16 psm, l2capPsmInfo_t *pInfo );
709 
720 extern bStatus_t L2CAP_PsmChannels( uint16 psm, uint8 numCIDs, uint16 *pCIDs );
721 
731 extern bStatus_t L2CAP_ChannelInfo( uint16 CID, l2capChannelInfo_t *pInfo );
732 
748 extern bStatus_t L2CAP_ConnectReq( uint16 connHandle, uint16 psm, uint16 peerPsm );
749 
763 extern bStatus_t L2CAP_ConnectRsp( uint16 connHandle, uint8 id, uint16 result );
764 
777 extern bStatus_t L2CAP_DisconnectReq( uint16 CID );
778 
792 extern bStatus_t L2CAP_FlowCtrlCredit( uint16 CID, uint16 peerCredits );
793 
809 extern bStatus_t L2CAP_SendSDU( l2capPacket_t *pPkt );
810 
824 extern bStatus_t L2CAP_CmdReject( uint16 connHandle, uint8 id, l2capCmdReject_t *pCmdReject );
825 
840 extern bStatus_t L2CAP_InfoReq( uint16 connHandle, l2capInfoReq_t *pInfoReq, uint8 taskId );
841 
857 extern bStatus_t L2CAP_ConnParamUpdateReq( uint16 connHandle, l2capParamUpdateReq_t *pUpdateReq, uint8 taskId );
858 
872 extern bStatus_t L2CAP_ConnParamUpdateRsp( uint16 connHandle, uint8 id, l2capParamUpdateRsp_t *pUpdateRsp );
873 
882 extern void L2CAP_SetUserConfig( l2capUserCfg_t *pUserCfg );
883 
892 extern void L2CAP_SetBufSize( uint16 dataPktLen, uint8 numDataPkts );
893 
899 extern uint16 L2CAP_GetMTU( void );
900 
913 extern void *L2CAP_bm_alloc( uint16 size );
914 
923 extern uint16 L2CAP_BuildConnectReq( uint8 *pBuf, uint8 *pData );
924 
935 extern bStatus_t L2CAP_ParseConnectReq( l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len );
936 
947 extern bStatus_t L2CAP_ParseFlowCtrlCredit( l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len );
948 
957 extern uint16 L2CAP_BuildCmdReject( uint8 *pBuf, uint8 *pCmd );
958 
969 extern bStatus_t L2CAP_ParseInfoReq( l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len );
970 
981 extern bStatus_t L2CAP_ParseParamUpdateReq( l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len );
982 
991 extern uint16 L2CAP_BuildParamUpdateRsp( uint8 *pBuf, uint8 *pData );
992 
1001 extern uint16 L2CAP_BuildInfoRsp( uint8 *pBuf, uint8 *pData );
1002 
1010 extern void L2CAP_SetControllerToHostFlowCtrl( uint16 hostBuffSize, uint8 flowCtrlMode );
1011 
1022 extern void L2CAP_HostNumCompletedPkts( uint16 connHandle, uint16 numCompletedPkts );
1023 
1031 extern void L2CAP_SetParamValue( uint16 value );
1032 
1038 extern uint16 L2CAP_GetParamValue( void );
1039 
1040 /*-------------------------------------------------------------------
1041  * TASK API - These functions must only be called by OSAL.
1042  */
1043 
1045 
1053 extern void L2CAP_Init( uint8 taskId );
1054 
1064 extern uint16 L2CAP_ProcessEvent( uint8 taskId, uint16 events );
1065 
1067 
1068 /*********************************************************************
1069 *********************************************************************/
1070 
1071 #ifdef __cplusplus
1072 }
1073 #endif
1074 
1075 #endif /* L2CAP_H */
1076 
uint8 numActiveChannels
Number of active CO Channels.
Definition: l2cap.h:418
uint16 remoteCID
Source CID from the rejected command.
Definition: l2cap.h:310
Local channel information format.
Definition: l2cap.h:436
uint16 peerCreditThreshold
Low threshold for number of peer credits.
Definition: l2cap.h:416
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:577
l2capConnectRsp_t connectRsp
LE Credit Based Connection Response.
Definition: l2cap.h:529
uint16 intervalMin
Minimum Interval.
Definition: l2cap.h:335
Command Reject format.
Definition: l2cap.h:321
bStatus_t L2CAP_ConnParamUpdateRsp(uint16 connHandle, uint8 id, l2capParamUpdateRsp_t *pUpdateRsp)
Send Connection Parameter Update Response.
uint16 CID
Local channel id.
Definition: l2cap.h:496
uint16 CID
local channel id
Definition: l2cap.h:558
uint16 initCredits
Indicates number of LE-frames that peer device can send.
Definition: l2cap.h:385
Command Reject Reason Data format.
Definition: l2cap.h:314
l2capParamUpdateReq_t updateReq
Connection Parameter Update Request.
Definition: l2cap.h:519
uint8 maxNumCoChannels
Max number of Connection Oriented Channels: L2CAP_NUM_CO_CHANNELS_DEFAULT.
Definition: l2cap.h:303
Information Response Data field.
Definition: l2cap.h:354
uint16 totalLen
Total length of SDU being transmitted.
Definition: l2cap.h:500
uint16 localCID
Destination CID from the rejected command.
Definition: l2cap.h:309
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:375
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:254
uint16 initPeerCredits
Number of LE-frames that peer device can send.
Definition: l2cap.h:415
Connection oriented channel information format.
Definition: l2cap.h:422
uint16 result
Result.
Definition: l2cap.h:364
uint16 result
Indicates outcome of connection request: L2CAP Connection Response Result Values. ...
Definition: l2cap.h:386
Disconnection Response format (src/dst CIDs are relative to sender of request).
Definition: l2cap.h:397
uint16 mtu
Maximum SDU size that can be received by local device.
Definition: l2cap.h:616
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:432
uint16 peerMps
Maximum payload size that can be received by peer device.
Definition: l2cap.h:430
Disconnection Request format (src/dst CIDs are relative to sender of request).
Definition: l2cap.h:390
l2capNumCtrlDataPktEvt_t numCtrlDataPktEvt
Number of Available Ctrl Data Packets Event.
Definition: l2cap.h:537
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:399
l2capInfoRsp_t infoRsp
Information Response - not supported.
Definition: l2cap.h:527
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:350
uint16 connectionlessMTU
Connectionless MTU.
Definition: l2cap.h:356
uint16 L2CAP_BuildConnectReq(uint8 *pBuf, uint8 *pData)
Build Connection Request.
uint16 psm
LE PSM.
Definition: l2cap.h:372
uint16 peerCID
Remote channel id.
Definition: l2cap.h:428
osal_event_hdr_t hdr
L2CAP_SIGNAL_EVENT and status.
Definition: l2cap.h:548
l2capReasonData_t reasonData
Reason Data.
Definition: l2cap.h:324
void L2CAP_SetUserConfig(l2capUserCfg_t *pUserCfg)
Set the user configurable variables for the L2CAP layer.
uint16 CID
Local channel id.
Definition: l2cap.h:469
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:393
uint16 CID
Represents Source CID of device sending credit packet.
Definition: l2cap.h:406
uint8 maxNumPSM
Max number of Protocol/Service Multiplexers (PSM): L2CAP_NUM_PSM_DEFAULT.
Definition: l2cap.h:302
uint16 peerCID
Peer channel id.
Definition: l2cap.h:498
uint16 mtu
Specifies maximum SDU size that can be received on this channel.
Definition: l2cap.h:383
uint8 * pPayload
Definition: l2cap.h:559
uint8 state
Channel connection state: L2CAP Channel States.
Definition: l2cap.h:438
uint16 txLen
Total number of octets transmitted.
Definition: l2cap.h:501
uint16 reason
Indicates reason for termination: L2CAP Channel Terminated Event Reason Values.
Definition: l2cap.h:471
uint8 taskId
Task registered with PSM.
Definition: l2cap.h:620
L2CAP PSM structure. Allocated one for each registered PSM.
Definition: l2cap.h:613
l2capInfo_t info
Content of Info field depends on infoType.
Definition: l2cap.h:366
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:550
void L2CAP_HostNumCompletedPkts(uint16 connHandle, uint16 numCompletedPkts)
Host Number of Completed Packets.
L2CAP_CHANNEL_TERMINATED_EVT message format.
Definition: l2cap.h:467
uint16 mps
Maximum payload size that can be received by local device.
Definition: l2cap.h:414
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:603
PSM information format.
Definition: l2cap.h:411
uint16 result
Result: L2CAP Connection Parameter Update Response Result Values.
Definition: l2cap.h:344
Union of all L2CAP Signaling commands.
Definition: l2cap.h:516
uint8 numDataPkt
Number of Data Packets Available.
Definition: l2cap.h:512
uint16 srcCID
Represents CID on device sending request and receiving response.
Definition: l2cap.h:373
l2capDisconnectReq_t disconnectReq
Disconnection Request.
Definition: l2cap.h:522
uint16 peerCreditThreshold
Low threshold for peer credit count.
Definition: l2cap.h:618
Connection Request format.
Definition: l2cap.h:370
uint16 signalMTU
Maximum Signaling MTU.
Definition: l2cap.h:316
uint16 peerCredits
Peer credits.
Definition: l2cap.h:499
L2CAP_OUT_OF_CREDIT_EVT or L2CAP_PEER_CREDIT_THRESHOLD_EVT message format.
Definition: l2cap.h:480
uint16 initCredits
Indicates number of LE-frames that peer device can send.
Definition: l2cap.h:376
Invalid CID in Request format.
Definition: l2cap.h:307
uint8 maxNumChannels
Maximum number of CO Channels supported by PSM.
Definition: l2cap.h:417
pfnVerifySecCB_t pfnVerifySecCB
PSM security verification callback (can be NULL)
Definition: l2cap.h:621
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:431
uint16 connHandle
connection packet was received on
Definition: l2cap.h:578
uint32 extendedFeatures
Extended features supported.
Definition: l2cap.h:357
uint16 peerMtu
Maximum SDU size that can be received by peer device.
Definition: l2cap.h:429
l2capSignalCmd_t cmd
command data
Definition: l2cap.h:552
l2capParamUpdateRsp_t updateRsp
Connection Parameter Update Response.
Definition: l2cap.h:526
L2CAP_CHANNEL_ESTABLISHED_EVT message format.
Definition: l2cap.h:454
l2capSendSduDoneEvt_t sendSduDoneEvt
Send SDU Done Event.
Definition: l2cap.h:536
bStatus_t L2CAP_FlowCtrlCredit(uint16 CID, uint16 peerCredits)
Send Flow Control Credit.
l2capInvalidCID_t invalidCID
Invalid CID in Request.
Definition: l2cap.h:317
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:551
L2CAP_NUM_CTRL_DATA_PKT_EVT message format.
Definition: l2cap.h:510
uint16 credits
Definition: l2cap.h:484
Information Response format.
Definition: l2cap.h:362
bStatus_t L2CAP_ParseFlowCtrlCredit(l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len)
Parse Flow Control Credit message.
User configurable variables format.
Definition: l2cap.h:300
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:382
uint16 mps
Specifies maximum payload size that can be received on this channel.
Definition: l2cap.h:384
Information Request format.
Definition: l2cap.h:348
bStatus_t L2CAP_CmdReject(uint16 connHandle, uint8 id, l2capCmdReject_t *pCmdReject)
Send Command Reject.
uint16 intervalMax
Maximum Interval.
Definition: l2cap.h:336
OSAL Event Header.
Definition: osal.h:110
l2capInfoReq_t infoReq
Information Request - not supported.
Definition: l2cap.h:520
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:535
bStatus_t L2CAP_ParseInfoReq(l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len)
Parse Information Request message.
l2capDisconnectRsp_t disconnectRsp
Disconnection Response.
Definition: l2cap.h:530
l2capChannelEstEvt_t channelEstEvt
Channel Established Event.
Definition: l2cap.h:533
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:617
uint16 slaveLatency
Slave Latency.
Definition: l2cap.h:337
uint16 connHandle
connection message was received on
Definition: l2cap.h:549
L2CAP packet structure.
Definition: l2cap.h:556
OSAL L2CAP_SIGNAL_EVENT message format.
Definition: l2cap.h:546
l2capPacket_t pkt
received packet
Definition: l2cap.h:579
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:413
uint16 peerCID
Peer channel id.
Definition: l2cap.h:470
uint16 mtu
Maximum SDU size that can be received by local device.
Definition: l2cap.h:425
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:424
l2capFlowCtrlCredit_t credit
LE Flow Control Credit.
Definition: l2cap.h:523
uint16 mps
Maximum payload size that can be received by local device.
Definition: l2cap.h:426
uint16 reason
Reason: L2CAP Command Reject Reason Codes.
Definition: l2cap.h:323
Flow Control Credit format.
Definition: l2cap.h:404
uint16 dstCID
Specifies CID to be disconnected on device receiving request.
Definition: l2cap.h:392
l2capCoCInfo_t info
Channel info.
Definition: l2cap.h:439
uint16 credits
Number of LE-frames that local device can send.
Definition: l2cap.h:427
uint16 infoType
Information type: L2CAP Information Request/Response Info Types.
Definition: l2cap.h:365
uint16 credits
Number of LE-frames that can be sent to local device.
Definition: l2cap.h:407
l2capCoCInfo_t info
Channel info.
Definition: l2cap.h:458
uint16 L2CAP_GetParamValue(void)
Get the L2CAP parameter value.
L2CAP_SEND_SDU_DONE_EVT message format.
Definition: l2cap.h:494
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:243
uint16 timeoutMultiplier
Timeout Multiplier.
Definition: l2cap.h:338
void L2CAP_SetParamValue(uint16 value)
Set the L2CAP parameter value.
uint16 CID
Local channel id.
Definition: l2cap.h:482
uint16 CID
Local channel id.
Definition: l2cap.h:457
Connection Response format.
Definition: l2cap.h:380
uint16 srcCID
Identifies CID on device receiving response.
Definition: l2cap.h:400
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:615
l2capChannelTermEvt_t channelTermEvt
Channel Terminated Event.
Definition: l2cap.h:534
void * L2CAP_bm_alloc(uint16 size)
L2CAP implementation of the allocator functionality.
Connection Parameter Update Response format.
Definition: l2cap.h:342
uint16 peerCID
Peer channel id.
Definition: l2cap.h:483
Connection Parameter Update Request format.
Definition: l2cap.h:333
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:521
uint16 mtu
Specifies maximum SDU size that can be received on this channel.
Definition: l2cap.h:374
OSAL L2CAP_DATA_EVENT message format.
Definition: l2cap.h:575
uint8 maxNumChannels
Maximum number of CO Channels supported by PSM.
Definition: l2cap.h:619
uint16 result
Indicates outcome of connection request: L2CAP Connection Response Result Values. ...
Definition: l2cap.h:456
l2capCmdReject_t cmdReject
Command Reject.
Definition: l2cap.h:528
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:497
Copyright 2016, Texas Instruments Incorporated