• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  /******************************************************************************
2   *
3   *  Copyright (C) 1999-2012 Broadcom Corporation
4   *
5   *  Licensed under the Apache License, Version 2.0 (the "License");
6   *  you may not use this file except in compliance with the License.
7   *  You may obtain a copy of the License at:
8   *
9   *  http://www.apache.org/licenses/LICENSE-2.0
10   *
11   *  Unless required by applicable law or agreed to in writing, software
12   *  distributed under the License is distributed on an "AS IS" BASIS,
13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   *  See the License for the specific language governing permissions and
15   *  limitations under the License.
16   *
17   ******************************************************************************/
18  
19  /******************************************************************************
20   *
21   *  this file contains the L2CAP API definitions
22   *
23   ******************************************************************************/
24  #ifndef L2C_API_H
25  #define L2C_API_H
26  
27  #include <stdbool.h>
28  
29  #include "bt_target.h"
30  #include "l2cdefs.h"
31  #include "hcidefs.h"
32  
33  /*****************************************************************************
34  **  Constants
35  *****************************************************************************/
36  
37  /* Define the minimum offset that L2CAP needs in a buffer. This is made up of
38  ** HCI type(1), len(2), handle(2), L2CAP len(2) and CID(2) => 9
39  */
40  #define L2CAP_MIN_OFFSET    13     /* plus control(2), SDU length(2) */
41  
42  #define L2CAP_LCC_SDU_LENGTH    2
43  #define L2CAP_LCC_OFFSET        (L2CAP_MIN_OFFSET + L2CAP_LCC_SDU_LENGTH)  /* plus SDU length(2) */
44  
45  /* ping result codes */
46  #define L2CAP_PING_RESULT_OK        0       /* Ping reply received OK     */
47  #define L2CAP_PING_RESULT_NO_LINK   1       /* Link could not be setup    */
48  #define L2CAP_PING_RESULT_NO_RESP   2       /* Remote L2CAP did not reply */
49  
50  /* result code for L2CA_DataWrite() */
51  #define L2CAP_DW_FAILED        FALSE
52  #define L2CAP_DW_SUCCESS       TRUE
53  #define L2CAP_DW_CONGESTED     2
54  
55  /* Values for priority parameter to L2CA_SetAclPriority */
56  #define L2CAP_PRIORITY_NORMAL       0
57  #define L2CAP_PRIORITY_HIGH         1
58  
59  /* Values for priority parameter to L2CA_SetTxPriority */
60  #define L2CAP_CHNL_PRIORITY_HIGH    0
61  #define L2CAP_CHNL_PRIORITY_MEDIUM  1
62  #define L2CAP_CHNL_PRIORITY_LOW     2
63  
64  typedef UINT8 tL2CAP_CHNL_PRIORITY;
65  
66  /* Values for Tx/Rx data rate parameter to L2CA_SetChnlDataRate */
67  #define L2CAP_CHNL_DATA_RATE_HIGH       3
68  #define L2CAP_CHNL_DATA_RATE_MEDIUM     2
69  #define L2CAP_CHNL_DATA_RATE_LOW        1
70  #define L2CAP_CHNL_DATA_RATE_NO_TRAFFIC 0
71  
72  typedef UINT8 tL2CAP_CHNL_DATA_RATE;
73  
74  /* Data Packet Flags  (bits 2-15 are reserved) */
75  /* layer specific 14-15 bits are used for FCR SAR */
76  #define L2CAP_FLUSHABLE_MASK        0x0003
77  #define L2CAP_FLUSHABLE_CH_BASED    0x0000
78  #define L2CAP_FLUSHABLE_PKT         0x0001
79  #define L2CAP_NON_FLUSHABLE_PKT     0x0002
80  
81  
82  /* L2CA_FlushChannel num_to_flush definitions */
83  #define L2CAP_FLUSH_CHANS_ALL       0xffff
84  #define L2CAP_FLUSH_CHANS_GET       0x0000
85  
86  
87  /* special CID for Multi-AV for reporting congestion */
88  #define L2CAP_MULTI_AV_CID          0
89  
90  /* length of the HCI header block */
91  /* HCI header(4) + SNK count(1) + FCR bits(1) + AV data length(2) */
92  #define L2CAP_MULTI_AV_HCI_HDR_LEN	8
93  
94  /* length of padding for 4 bytes align */
95  #define L2CAP_MULTI_AV_PADDING_LEN  2
96  
97  /* length of the HCI header block with padding for FCR */
98  /* HCI header(4) + SNK count(1) + FCR bits(1) + AV data length(2) + padding(2) */
99  #define L2CAP_MULTI_AV_HCI_HDR_LEN_WITH_PADDING	10
100  
101  /* length of the L2CAP header block */
102  /* HCI header(4) + L2CAP header(4) + padding(4) or control word(2) + FCS(2) */
103  #define L2CAP_MULTI_AV_L2C_HDR_LEN	12
104  
105  /* definition used for L2CA_SetDesireRole */
106  #define L2CAP_ROLE_SLAVE            HCI_ROLE_SLAVE
107  #define L2CAP_ROLE_MASTER           HCI_ROLE_MASTER
108  #define L2CAP_ROLE_ALLOW_SWITCH     0x80    /* set this bit to allow switch at create conn */
109  #define L2CAP_ROLE_DISALLOW_SWITCH  0x40    /* set this bit to disallow switch at create conn */
110  #define L2CAP_ROLE_CHECK_SWITCH     0xC0
111  
112  
113  /* Values for 'allowed_modes' field passed in structure tL2CAP_ERTM_INFO
114  */
115  #define L2CAP_FCR_CHAN_OPT_BASIC    (1 << L2CAP_FCR_BASIC_MODE)
116  #define L2CAP_FCR_CHAN_OPT_ERTM     (1 << L2CAP_FCR_ERTM_MODE)
117  #define L2CAP_FCR_CHAN_OPT_STREAM   (1 << L2CAP_FCR_STREAM_MODE)
118  
119  #define L2CAP_FCR_CHAN_OPT_ALL_MASK (L2CAP_FCR_CHAN_OPT_BASIC | L2CAP_FCR_CHAN_OPT_ERTM | L2CAP_FCR_CHAN_OPT_STREAM)
120  
121  /* Validity check for PSM.  PSM values must be odd.  Also, all PSM values must
122  ** be assigned such that the least significant bit of the most sigificant
123  ** octet equals zero.
124  */
125  #define L2C_INVALID_PSM(psm)       (((psm) & 0x0101) != 0x0001)
126  #define L2C_IS_VALID_PSM(psm)      (((psm) & 0x0101) == 0x0001)
127  #define L2C_IS_VALID_LE_PSM(psm)   (((psm) > 0x0000) && ((psm) < 0x0100))
128  
129  /*****************************************************************************
130  **  Type Definitions
131  *****************************************************************************/
132  
133  typedef struct
134  {
135  #define L2CAP_FCR_BASIC_MODE    0x00
136  #define L2CAP_FCR_ERTM_MODE     0x03
137  #define L2CAP_FCR_STREAM_MODE   0x04
138  #define L2CAP_FCR_LE_COC_MODE   0x05
139  
140      UINT8  mode;
141  
142      UINT8  tx_win_sz;
143      UINT8  max_transmit;
144      UINT16 rtrans_tout;
145      UINT16 mon_tout;
146      UINT16 mps;
147  } tL2CAP_FCR_OPTS;
148  
149  /* Define a structure to hold the configuration parameters. Since the
150  ** parameters are optional, for each parameter there is a boolean to
151  ** use to signify its presence or absence.
152  */
153  typedef struct
154  {
155      UINT16      result;                 /* Only used in confirm messages */
156      BOOLEAN     mtu_present;
157      UINT16      mtu;
158      BOOLEAN     qos_present;
159      FLOW_SPEC   qos;
160      BOOLEAN     flush_to_present;
161      UINT16      flush_to;
162      BOOLEAN     fcr_present;
163      tL2CAP_FCR_OPTS fcr;
164      BOOLEAN     fcs_present;            /* Optionally bypasses FCS checks */
165      UINT8       fcs;                    /* '0' if desire is to bypass FCS, otherwise '1' */
166      BOOLEAN               ext_flow_spec_present;
167      tHCI_EXT_FLOW_SPEC    ext_flow_spec;
168      UINT16      flags;                  /* bit 0: 0-no continuation, 1-continuation */
169  } tL2CAP_CFG_INFO;
170  
171  /* Define a structure to hold the configuration parameter for LE L2CAP connection
172  ** oriented channels.
173  */
174  typedef struct
175  {
176      UINT16  mtu;
177      UINT16  mps;
178      UINT16  credits;
179  } tL2CAP_LE_CFG_INFO;
180  
181  /* L2CAP channel configured field bitmap */
182  #define L2CAP_CH_CFG_MASK_MTU           0x0001
183  #define L2CAP_CH_CFG_MASK_QOS           0x0002
184  #define L2CAP_CH_CFG_MASK_FLUSH_TO      0x0004
185  #define L2CAP_CH_CFG_MASK_FCR           0x0008
186  #define L2CAP_CH_CFG_MASK_FCS           0x0010
187  #define L2CAP_CH_CFG_MASK_EXT_FLOW_SPEC 0x0020
188  
189  typedef UINT16 tL2CAP_CH_CFG_BITS;
190  
191  /*********************************
192  **  Callback Functions Prototypes
193  **********************************/
194  
195  /* Connection indication callback prototype. Parameters are
196  **              BD Address of remote
197  **              Local CID assigned to the connection
198  **              PSM that the remote wants to connect to
199  **              Identifier that the remote sent
200  */
201  typedef void (tL2CA_CONNECT_IND_CB) (BD_ADDR, UINT16, UINT16, UINT8);
202  
203  
204  /* Connection confirmation callback prototype. Parameters are
205  **              Local CID
206  **              Result - 0 = connected, non-zero means failure reason
207  */
208  typedef void (tL2CA_CONNECT_CFM_CB) (UINT16, UINT16);
209  
210  
211  /* Connection pending callback prototype. Parameters are
212  **              Local CID
213  */
214  typedef void (tL2CA_CONNECT_PND_CB) (UINT16);
215  
216  
217  /* Configuration indication callback prototype. Parameters are
218  **              Local CID assigned to the connection
219  **              Pointer to configuration info
220  */
221  typedef void (tL2CA_CONFIG_IND_CB) (UINT16, tL2CAP_CFG_INFO *);
222  
223  
224  /* Configuration confirm callback prototype. Parameters are
225  **              Local CID assigned to the connection
226  **              Pointer to configuration info
227  */
228  typedef void (tL2CA_CONFIG_CFM_CB) (UINT16, tL2CAP_CFG_INFO *);
229  
230  
231  /* Disconnect indication callback prototype. Parameters are
232  **              Local CID
233  **              Boolean whether upper layer should ack this
234  */
235  typedef void (tL2CA_DISCONNECT_IND_CB) (UINT16, BOOLEAN);
236  
237  
238  /* Disconnect confirm callback prototype. Parameters are
239  **              Local CID
240  **              Result
241  */
242  typedef void (tL2CA_DISCONNECT_CFM_CB) (UINT16, UINT16);
243  
244  
245  /* QOS Violation indication callback prototype. Parameters are
246  **              BD Address of violating device
247  */
248  typedef void (tL2CA_QOS_VIOLATION_IND_CB) (BD_ADDR);
249  
250  
251  /* Data received indication callback prototype. Parameters are
252  **              Local CID
253  **              Address of buffer
254  */
255  typedef void (tL2CA_DATA_IND_CB) (UINT16, BT_HDR *);
256  
257  
258  /* Echo response callback prototype. Note that this is not included in the
259  ** registration information, but is passed to L2CAP as part of the API to
260  ** actually send an echo request. Parameters are
261  **              Result
262  */
263  typedef void (tL2CA_ECHO_RSP_CB) (UINT16);
264  
265  
266  /* Callback function prototype to pass broadcom specific echo response  */
267  /* to the upper layer                                                   */
268  typedef void (tL2CA_ECHO_DATA_CB) (BD_ADDR, UINT16, UINT8 *);
269  
270  
271  /* Congestion status callback protype. This callback is optional. If
272  ** an application tries to send data when the transmit queue is full,
273  ** the data will anyways be dropped. The parameter is:
274  **              Local CID
275  **              TRUE if congested, FALSE if uncongested
276  */
277  typedef void (tL2CA_CONGESTION_STATUS_CB) (UINT16, BOOLEAN);
278  
279  /* Callback prototype for number of packets completed events.
280  ** This callback notifies the application when Number of Completed Packets
281  ** event has been received.
282  ** This callback is originally designed for 3DG devices.
283  ** The parameter is:
284  **          peer BD_ADDR
285  */
286  typedef void (tL2CA_NOCP_CB) (BD_ADDR);
287  
288  /* Transmit complete callback protype. This callback is optional. If
289  ** set, L2CAP will call it when packets are sent or flushed. If the
290  ** count is 0xFFFF, it means all packets are sent for that CID (eRTM
291  ** mode only). The parameters are:
292  **              Local CID
293  **              Number of SDUs sent or dropped
294  */
295  typedef void (tL2CA_TX_COMPLETE_CB) (UINT16, UINT16);
296  
297  /* Define the structure that applications use to register with
298  ** L2CAP. This structure includes callback functions. All functions
299  ** MUST be provided, with the exception of the "connect pending"
300  ** callback and "congestion status" callback.
301  */
302  typedef struct
303  {
304      tL2CA_CONNECT_IND_CB        *pL2CA_ConnectInd_Cb;
305      tL2CA_CONNECT_CFM_CB        *pL2CA_ConnectCfm_Cb;
306      tL2CA_CONNECT_PND_CB        *pL2CA_ConnectPnd_Cb;
307      tL2CA_CONFIG_IND_CB         *pL2CA_ConfigInd_Cb;
308      tL2CA_CONFIG_CFM_CB         *pL2CA_ConfigCfm_Cb;
309      tL2CA_DISCONNECT_IND_CB     *pL2CA_DisconnectInd_Cb;
310      tL2CA_DISCONNECT_CFM_CB     *pL2CA_DisconnectCfm_Cb;
311      tL2CA_QOS_VIOLATION_IND_CB  *pL2CA_QoSViolationInd_Cb;
312      tL2CA_DATA_IND_CB           *pL2CA_DataInd_Cb;
313      tL2CA_CONGESTION_STATUS_CB  *pL2CA_CongestionStatus_Cb;
314      tL2CA_TX_COMPLETE_CB        *pL2CA_TxComplete_Cb;
315  
316  } tL2CAP_APPL_INFO;
317  
318  /* Define the structure that applications use to create or accept
319  ** connections with enhanced retransmission mode.
320  */
321  typedef struct
322  {
323      UINT8       preferred_mode;
324      UINT8       allowed_modes;
325      UINT16      user_rx_buf_size;
326      UINT16      user_tx_buf_size;
327      UINT16      fcr_rx_buf_size;
328      UINT16      fcr_tx_buf_size;
329  
330  } tL2CAP_ERTM_INFO;
331  
332  #define L2CA_REGISTER(a,b,c)              L2CA_Register(a,(tL2CAP_APPL_INFO *)b)
333  #define L2CA_DEREGISTER(a)                L2CA_Deregister(a)
334  #define L2CA_CONNECT_REQ(a,b,c)           L2CA_ErtmConnectReq(a,b,c)
335  #define L2CA_CONNECT_RSP(a,b,c,d,e,f)     L2CA_ErtmConnectRsp(a,b,c,d,e,f)
336  #define L2CA_CONFIG_REQ(a,b)              L2CA_ConfigReq(a,b)
337  #define L2CA_CONFIG_RSP(a,b)              L2CA_ConfigRsp(a,b)
338  #define L2CA_DISCONNECT_REQ(a)            L2CA_DisconnectReq(a)
339  #define L2CA_DISCONNECT_RSP(a)            L2CA_DisconnectRsp(a)
340  #define L2CA_DATA_WRITE(a, b)             L2CA_DataWrite(a, b)
341  #define L2CA_REGISTER_COC(a,b,c)          L2CA_RegisterLECoc(a,(tL2CAP_APPL_INFO *)b)
342  #define L2CA_DEREGISTER_COC(a)            L2CA_DeregisterLECoc(a)
343  #define L2CA_CONNECT_COC_REQ(a,b,c)       L2CA_ConnectLECocReq(a,b,c)
344  #define L2CA_CONNECT_COC_RSP(a,b,c,d,e,f) L2CA_ConnectLECocRsp(a,b,c,d,e,f)
345  #define L2CA_GET_PEER_COC_CONFIG(a, b)    L2CA_GetPeerLECocConfig(a, b)
346  
347  /*****************************************************************************
348  **  External Function Declarations
349  *****************************************************************************/
350  #ifdef __cplusplus
351  extern "C"
352  {
353  #endif
354  
355  /*******************************************************************************
356  **
357  ** Function         L2CA_Register
358  **
359  ** Description      Other layers call this function to register for L2CAP
360  **                  services.
361  **
362  ** Returns          PSM to use or zero if error. Typically, the PSM returned
363  **                  is the same as was passed in, but for an outgoing-only
364  **                  connection to a dynamic PSM, a "virtual" PSM is returned
365  **                  and should be used in the calls to L2CA_ConnectReq() and
366  **                  BTM_SetSecurityLevel().
367  **
368  *******************************************************************************/
369  extern UINT16 L2CA_Register (UINT16 psm, tL2CAP_APPL_INFO *p_cb_info);
370  
371  /*******************************************************************************
372  **
373  ** Function         L2CA_Deregister
374  **
375  ** Description      Other layers call this function to deregister for L2CAP
376  **                  services.
377  **
378  ** Returns          void
379  **
380  *******************************************************************************/
381  extern void L2CA_Deregister (UINT16 psm);
382  
383  /*******************************************************************************
384  **
385  ** Function         L2CA_AllocatePSM
386  **
387  ** Description      Other layers call this function to find an unused PSM for L2CAP
388  **                  services.
389  **
390  ** Returns          PSM to use.
391  **
392  *******************************************************************************/
393  extern UINT16 L2CA_AllocatePSM(void);
394  
395  /*******************************************************************************
396  **
397  ** Function         L2CA_ConnectReq
398  **
399  ** Description      Higher layers call this function to create an L2CAP connection.
400  **                  Note that the connection is not established at this time, but
401  **                  connection establishment gets started. The callback function
402  **                  will be invoked when connection establishes or fails.
403  **
404  ** Returns          the CID of the connection, or 0 if it failed to start
405  **
406  *******************************************************************************/
407  extern UINT16 L2CA_ConnectReq (UINT16 psm, BD_ADDR p_bd_addr);
408  
409  /*******************************************************************************
410  **
411  ** Function         L2CA_ConnectRsp
412  **
413  ** Description      Higher layers call this function to accept an incoming
414  **                  L2CAP connection, for which they had gotten an connect
415  **                  indication callback.
416  **
417  ** Returns          TRUE for success, FALSE for failure
418  **
419  *******************************************************************************/
420  extern BOOLEAN L2CA_ConnectRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid,
421                                          UINT16 result, UINT16 status);
422  
423  /*******************************************************************************
424  **
425  ** Function         L2CA_ErtmConnectReq
426  **
427  ** Description      Higher layers call this function to create an L2CAP connection
428  **                  that needs to use Enhanced Retransmission Mode.
429  **                  Note that the connection is not established at this time, but
430  **                  connection establishment gets started. The callback function
431  **                  will be invoked when connection establishes or fails.
432  **
433  ** Returns          the CID of the connection, or 0 if it failed to start
434  **
435  *******************************************************************************/
436  extern UINT16 L2CA_ErtmConnectReq (UINT16 psm, BD_ADDR p_bd_addr,
437                                             tL2CAP_ERTM_INFO *p_ertm_info);
438  
439  /*******************************************************************************
440  **
441  ** Function         L2CA_RegisterLECoc
442  **
443  ** Description      Other layers call this function to register for L2CAP
444  **                  Connection Oriented Channel.
445  **
446  ** Returns          PSM to use or zero if error. Typically, the PSM returned
447  **                  is the same as was passed in, but for an outgoing-only
448  **                  connection to a dynamic PSM, a "virtual" PSM is returned
449  **                  and should be used in the calls to L2CA_ConnectLECocReq()
450  **                  and BTM_SetSecurityLevel().
451  **
452  *******************************************************************************/
453  extern UINT16 L2CA_RegisterLECoc (UINT16 psm, tL2CAP_APPL_INFO *p_cb_info);
454  
455  /*******************************************************************************
456  **
457  ** Function         L2CA_DeregisterLECoc
458  **
459  ** Description      Other layers call this function to deregister for L2CAP
460  **                  Connection Oriented Channel.
461  **
462  ** Returns          void
463  **
464  *******************************************************************************/
465  extern void L2CA_DeregisterLECoc (UINT16 psm);
466  
467  /*******************************************************************************
468  **
469  ** Function         L2CA_ConnectLECocReq
470  **
471  ** Description      Higher layers call this function to create an L2CAP LE COC.
472  **                  Note that the connection is not established at this time, but
473  **                  connection establishment gets started. The callback function
474  **                  will be invoked when connection establishes or fails.
475  **
476  ** Returns          the CID of the connection, or 0 if it failed to start
477  **
478  *******************************************************************************/
479  extern UINT16 L2CA_ConnectLECocReq (UINT16 psm, BD_ADDR p_bd_addr, tL2CAP_LE_CFG_INFO *p_cfg);
480  
481  /*******************************************************************************
482  **
483  ** Function         L2CA_ConnectLECocRsp
484  **
485  ** Description      Higher layers call this function to accept an incoming
486  **                  L2CAP LE COC connection, for which they had gotten an connect
487  **                  indication callback.
488  **
489  ** Returns          TRUE for success, FALSE for failure
490  **
491  *******************************************************************************/
492  extern BOOLEAN L2CA_ConnectLECocRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid, UINT16 result,
493                                           UINT16 status, tL2CAP_LE_CFG_INFO *p_cfg);
494  
495  /*******************************************************************************
496  **
497  **  Function         L2CA_GetPeerLECocConfig
498  **
499  **  Description      Get peers configuration for LE Connection Oriented Channel.
500  **
501  **  Return value:    TRUE if peer is connected
502  **
503  *******************************************************************************/
504  extern BOOLEAN L2CA_GetPeerLECocConfig (UINT16 lcid, tL2CAP_LE_CFG_INFO* peer_cfg);
505  
506  // This function sets the callback routines for the L2CAP connection referred to by
507  // |local_cid|. The callback routines can only be modified for outgoing connections
508  // established by |L2CA_ConnectReq| or accepted incoming connections. |callbacks|
509  // must not be NULL. This function returns true if the callbacks could be updated,
510  // false if not (e.g. |local_cid| was not found).
511  bool L2CA_SetConnectionCallbacks(uint16_t local_cid, const tL2CAP_APPL_INFO *callbacks);
512  
513  /*******************************************************************************
514  **
515  ** Function         L2CA_ErtmConnectRsp
516  **
517  ** Description      Higher layers call this function to accept an incoming
518  **                  L2CAP connection, for which they had gotten an connect
519  **                  indication callback, and for which the higher layer wants
520  **                  to use Enhanced Retransmission Mode.
521  **
522  ** Returns          TRUE for success, FALSE for failure
523  **
524  *******************************************************************************/
525  extern BOOLEAN  L2CA_ErtmConnectRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid,
526                                               UINT16 result, UINT16 status,
527                                               tL2CAP_ERTM_INFO *p_ertm_info);
528  
529  /*******************************************************************************
530  **
531  ** Function         L2CA_ConfigReq
532  **
533  ** Description      Higher layers call this function to send configuration.
534  **
535  ** Returns          TRUE if configuration sent, else FALSE
536  **
537  *******************************************************************************/
538  extern BOOLEAN L2CA_ConfigReq (UINT16 cid, tL2CAP_CFG_INFO *p_cfg);
539  
540  /*******************************************************************************
541  **
542  ** Function         L2CA_ConfigRsp
543  **
544  ** Description      Higher layers call this function to send a configuration
545  **                  response.
546  **
547  ** Returns          TRUE if configuration response sent, else FALSE
548  **
549  *******************************************************************************/
550  extern BOOLEAN L2CA_ConfigRsp (UINT16 cid, tL2CAP_CFG_INFO *p_cfg);
551  
552  /*******************************************************************************
553  **
554  ** Function         L2CA_DisconnectReq
555  **
556  ** Description      Higher layers call this function to disconnect a channel.
557  **
558  ** Returns          TRUE if disconnect sent, else FALSE
559  **
560  *******************************************************************************/
561  extern BOOLEAN L2CA_DisconnectReq (UINT16 cid);
562  
563  /*******************************************************************************
564  **
565  ** Function         L2CA_DisconnectRsp
566  **
567  ** Description      Higher layers call this function to acknowledge the
568  **                  disconnection of a channel.
569  **
570  ** Returns          void
571  **
572  *******************************************************************************/
573  extern BOOLEAN L2CA_DisconnectRsp (UINT16 cid);
574  
575  /*******************************************************************************
576  **
577  ** Function         L2CA_DataWrite
578  **
579  ** Description      Higher layers call this function to write data.
580  **
581  ** Returns          L2CAP_DW_SUCCESS, if data accepted, else FALSE
582  **                  L2CAP_DW_CONGESTED, if data accepted and the channel is congested
583  **                  L2CAP_DW_FAILED, if error
584  **
585  *******************************************************************************/
586  extern UINT8 L2CA_DataWrite (UINT16 cid, BT_HDR *p_data);
587  
588  /*******************************************************************************
589  **
590  ** Function         L2CA_Ping
591  **
592  ** Description      Higher layers call this function to send an echo request.
593  **
594  ** Returns          TRUE if echo request sent, else FALSE.
595  **
596  *******************************************************************************/
597  extern BOOLEAN L2CA_Ping (BD_ADDR p_bd_addr, tL2CA_ECHO_RSP_CB *p_cb);
598  
599  /*******************************************************************************
600  **
601  ** Function         L2CA_Echo
602  **
603  ** Description      Higher layers call this function to send an echo request
604  **                  with application-specific data.
605  **
606  ** Returns          TRUE if echo request sent, else FALSE.
607  **
608  *******************************************************************************/
609  extern BOOLEAN  L2CA_Echo (BD_ADDR p_bd_addr, BT_HDR *p_data, tL2CA_ECHO_DATA_CB *p_callback);
610  
611  // Given a local channel identifier, |lcid|, this function returns the bound remote
612  // channel identifier, |rcid|, and the ACL link handle, |handle|. If |lcid| is not
613  // known or is invalid, this function returns false and does not modify the values
614  // pointed at by |rcid| and |handle|. |rcid| and |handle| may be NULL.
615  bool L2CA_GetIdentifiers(uint16_t lcid, uint16_t *rcid, uint16_t *handle);
616  
617  /*******************************************************************************
618  **
619  ** Function         L2CA_SetIdleTimeout
620  **
621  ** Description      Higher layers call this function to set the idle timeout for
622  **                  a connection, or for all future connections. The "idle timeout"
623  **                  is the amount of time that a connection can remain up with
624  **                  no L2CAP channels on it. A timeout of zero means that the
625  **                  connection will be torn down immediately when the last channel
626  **                  is removed. A timeout of 0xFFFF means no timeout. Values are
627  **                  in seconds.
628  **
629  ** Returns          TRUE if command succeeded, FALSE if failed
630  **
631  *******************************************************************************/
632  extern BOOLEAN L2CA_SetIdleTimeout (UINT16 cid, UINT16 timeout,
633                                              BOOLEAN is_global);
634  
635  /*******************************************************************************
636  **
637  ** Function         L2CA_SetIdleTimeoutByBdAddr
638  **
639  ** Description      Higher layers call this function to set the idle timeout for
640  **                  a connection. The "idle timeout" is the amount of time that
641  **                  a connection can remain up with no L2CAP channels on it.
642  **                  A timeout of zero means that the connection will be torn
643  **                  down immediately when the last channel is removed.
644  **                  A timeout of 0xFFFF means no timeout. Values are in seconds.
645  **                  A bd_addr is the remote BD address. If bd_addr = BT_BD_ANY,
646  **                  then the idle timeouts for all active l2cap links will be
647  **                  changed.
648  **
649  ** Returns          TRUE if command succeeded, FALSE if failed
650  **
651  ** NOTE             This timeout applies to all logical channels active on the
652  **                  ACL link.
653  *******************************************************************************/
654  extern BOOLEAN L2CA_SetIdleTimeoutByBdAddr(BD_ADDR bd_addr, UINT16 timeout,
655                                             tBT_TRANSPORT transport);
656  
657  /*******************************************************************************
658  **
659  ** Function         L2CA_SetTraceLevel
660  **
661  ** Description      This function sets the trace level for L2CAP. If called with
662  **                  a value of 0xFF, it simply reads the current trace level.
663  **
664  ** Returns          the new (current) trace level
665  **
666  *******************************************************************************/
667  extern UINT8 L2CA_SetTraceLevel (UINT8 trace_level);
668  
669  /*******************************************************************************
670  **
671  ** Function     L2CA_SetDesireRole
672  **
673  ** Description  This function sets the desire role for L2CAP.
674  **              If the new role is L2CAP_ROLE_ALLOW_SWITCH, allow switch on
675  **              HciCreateConnection.
676  **              If the new role is L2CAP_ROLE_DISALLOW_SWITCH, do not allow switch on
677  **              HciCreateConnection.
678  **
679  **              If the new role is a valid role (HCI_ROLE_MASTER or HCI_ROLE_SLAVE),
680  **              the desire role is set to the new value. Otherwise, it is not changed.
681  **
682  ** Returns      the new (current) role
683  **
684  *******************************************************************************/
685  extern UINT8 L2CA_SetDesireRole (UINT8 new_role);
686  
687  /*******************************************************************************
688  **
689  ** Function     L2CA_LocalLoopbackReq
690  **
691  ** Description  This function sets up a CID for local loopback
692  **
693  ** Returns      CID of 0 if none.
694  **
695  *******************************************************************************/
696  extern UINT16 L2CA_LocalLoopbackReq (UINT16 psm, UINT16 handle, BD_ADDR p_bd_addr);
697  
698  /*******************************************************************************
699  **
700  ** Function     L2CA_FlushChannel
701  **
702  ** Description  This function flushes none, some or all buffers queued up
703  **              for xmission for a particular CID. If called with
704  **              L2CAP_FLUSH_CHANS_GET (0), it simply returns the number
705  **              of buffers queued for that CID L2CAP_FLUSH_CHANS_ALL (0xffff)
706  **              flushes all buffers.  All other values specifies the maximum
707  **              buffers to flush.
708  **
709  ** Returns      Number of buffers left queued for that CID
710  **
711  *******************************************************************************/
712  extern UINT16   L2CA_FlushChannel (UINT16 lcid, UINT16 num_to_flush);
713  
714  
715  /*******************************************************************************
716  **
717  ** Function         L2CA_SetAclPriority
718  **
719  ** Description      Sets the transmission priority for an ACL channel.
720  **                  (For initial implementation only two values are valid.
721  **                  L2CAP_PRIORITY_NORMAL and L2CAP_PRIORITY_HIGH).
722  **
723  ** Returns          TRUE if a valid channel, else FALSE
724  **
725  *******************************************************************************/
726  extern BOOLEAN L2CA_SetAclPriority (BD_ADDR bd_addr, UINT8 priority);
727  
728  /*******************************************************************************
729  **
730  ** Function         L2CA_FlowControl
731  **
732  ** Description      Higher layers call this function to flow control a channel.
733  **
734  **                  data_enabled - TRUE data flows, FALSE data is stopped
735  **
736  ** Returns          TRUE if valid channel, else FALSE
737  **
738  *******************************************************************************/
739  extern BOOLEAN L2CA_FlowControl (UINT16 cid, BOOLEAN data_enabled);
740  
741  /*******************************************************************************
742  **
743  ** Function         L2CA_SendTestSFrame
744  **
745  ** Description      Higher layers call this function to send a test S-frame.
746  **
747  ** Returns          TRUE if valid Channel, else FALSE
748  **
749  *******************************************************************************/
750  extern BOOLEAN L2CA_SendTestSFrame (UINT16 cid, UINT8 sup_type,
751                                              UINT8 back_track);
752  
753  /*******************************************************************************
754  **
755  ** Function         L2CA_SetTxPriority
756  **
757  ** Description      Sets the transmission priority for a channel. (FCR Mode)
758  **
759  ** Returns          TRUE if a valid channel, else FALSE
760  **
761  *******************************************************************************/
762  extern BOOLEAN L2CA_SetTxPriority (UINT16 cid, tL2CAP_CHNL_PRIORITY priority);
763  
764  /*******************************************************************************
765  **
766  ** Function         L2CA_RegForNoCPEvt
767  **
768  ** Description      Register callback for Number of Completed Packets event.
769  **
770  ** Input Param      p_cb - callback for Number of completed packets event
771  **                  p_bda - BT address of remote device
772  **
773  ** Returns
774  **
775  *******************************************************************************/
776  extern BOOLEAN L2CA_RegForNoCPEvt(tL2CA_NOCP_CB *p_cb, BD_ADDR p_bda);
777  
778  /*******************************************************************************
779  **
780  ** Function         L2CA_SetChnlDataRate
781  **
782  ** Description      Sets the tx/rx data rate for a channel.
783  **
784  ** Returns          TRUE if a valid channel, else FALSE
785  **
786  *******************************************************************************/
787  extern BOOLEAN L2CA_SetChnlDataRate (UINT16 cid, tL2CAP_CHNL_DATA_RATE tx, tL2CAP_CHNL_DATA_RATE rx);
788  
789  typedef void (tL2CA_RESERVE_CMPL_CBACK) (void);
790  
791  /*******************************************************************************
792  **
793  ** Function         L2CA_SetFlushTimeout
794  **
795  ** Description      This function set the automatic flush time out in Baseband
796  **                  for ACL-U packets.
797  **                  BdAddr : the remote BD address of ACL link. If it is BT_DB_ANY
798  **                           then the flush time out will be applied to all ACL link.
799  **                  FlushTimeout: flush time out in ms
800  **                           0x0000 : No automatic flush
801  **                           L2CAP_NO_RETRANSMISSION : No retransmission
802  **                           0x0002 - 0xFFFE : flush time out, if (flush_tout*8)+3/5)
803  **                                    <= HCI_MAX_AUTO_FLUSH_TOUT (in 625us slot).
804  **                                    Otherwise, return FALSE.
805  **                           L2CAP_NO_AUTOMATIC_FLUSH : No automatic flush
806  **
807  ** Returns          TRUE if command succeeded, FALSE if failed
808  **
809  ** NOTE             This flush timeout applies to all logical channels active on the
810  **                  ACL link.
811  *******************************************************************************/
812  extern BOOLEAN L2CA_SetFlushTimeout (BD_ADDR bd_addr, UINT16 flush_tout);
813  
814  /*******************************************************************************
815  **
816  ** Function         L2CA_DataWriteEx
817  **
818  ** Description      Higher layers call this function to write data with extended
819  **                  flags.
820  **                  flags : L2CAP_FLUSHABLE_CH_BASED
821  **                          L2CAP_FLUSHABLE_PKT
822  **                          L2CAP_NON_FLUSHABLE_PKT
823  **
824  ** Returns          L2CAP_DW_SUCCESS, if data accepted, else FALSE
825  **                  L2CAP_DW_CONGESTED, if data accepted and the channel is congested
826  **                  L2CAP_DW_FAILED, if error
827  **
828  *******************************************************************************/
829  extern UINT8 L2CA_DataWriteEx (UINT16 cid, BT_HDR *p_data, UINT16 flags);
830  
831  /*******************************************************************************
832  **
833  ** Function         L2CA_SetChnlFlushability
834  **
835  ** Description      Higher layers call this function to set a channels
836  **                  flushability flags
837  **
838  ** Returns          TRUE if CID found, else FALSE
839  **
840  *******************************************************************************/
841  extern BOOLEAN L2CA_SetChnlFlushability (UINT16 cid, BOOLEAN is_flushable);
842  
843  /*******************************************************************************
844  **
845  **  Function         L2CA_GetPeerFeatures
846  **
847  **  Description      Get a peers features and fixed channel map
848  **
849  **  Parameters:      BD address of the peer
850  **                   Pointers to features and channel mask storage area
851  **
852  **  Return value:    TRUE if peer is connected
853  **
854  *******************************************************************************/
855  extern BOOLEAN L2CA_GetPeerFeatures (BD_ADDR bd_addr, UINT32 *p_ext_feat, UINT8 *p_chnl_mask);
856  
857  /*******************************************************************************
858  **
859  **  Function         L2CA_GetBDAddrbyHandle
860  **
861  **  Description      Get BD address for the given HCI handle
862  **
863  **  Parameters:      HCI handle
864  **                   BD address of the peer
865  **
866  **  Return value:    TRUE if found lcb for the given handle, FALSE otherwise
867  **
868  *******************************************************************************/
869  extern BOOLEAN L2CA_GetBDAddrbyHandle (UINT16 handle, BD_ADDR bd_addr);
870  
871  /*******************************************************************************
872  **
873  **  Function         L2CA_GetChnlFcrMode
874  **
875  **  Description      Get the channel FCR mode
876  **
877  **  Parameters:      Local CID
878  **
879  **  Return value:    Channel mode
880  **
881  *******************************************************************************/
882  extern UINT8 L2CA_GetChnlFcrMode (UINT16 lcid);
883  
884  
885  /*******************************************************************************
886  **
887  **                      UCD callback prototypes
888  **
889  *******************************************************************************/
890  
891  /* UCD discovery. Parameters are
892  **      BD Address of remote
893  **      Data Type
894  **      Data
895  */
896  #define L2CAP_UCD_INFO_TYPE_RECEPTION   0x01
897  #define L2CAP_UCD_INFO_TYPE_MTU         0x02
898  
899  typedef void (tL2CA_UCD_DISCOVER_CB) (BD_ADDR, UINT8, UINT32);
900  
901  /* UCD data received. Parameters are
902  **      BD Address of remote
903  **      Pointer to buffer with data
904  */
905  typedef void (tL2CA_UCD_DATA_CB) (BD_ADDR, BT_HDR *);
906  
907  /* Congestion status callback protype. This callback is optional. If
908  ** an application tries to send data when the transmit queue is full,
909  ** the data will anyways be dropped. The parameter is:
910  **              remote BD_ADDR
911  **              TRUE if congested, FALSE if uncongested
912  */
913  typedef void (tL2CA_UCD_CONGESTION_STATUS_CB) (BD_ADDR, BOOLEAN);
914  
915  /* UCD registration info (the callback addresses and PSM)
916  */
917  typedef struct
918  {
919      tL2CA_UCD_DISCOVER_CB           *pL2CA_UCD_Discover_Cb;
920      tL2CA_UCD_DATA_CB               *pL2CA_UCD_Data_Cb;
921      tL2CA_UCD_CONGESTION_STATUS_CB  *pL2CA_UCD_Congestion_Status_Cb;
922  } tL2CAP_UCD_CB_INFO;
923  
924  /*******************************************************************************
925  **
926  **  Function        L2CA_UcdRegister
927  **
928  **  Description     Register PSM on UCD.
929  **
930  **  Parameters:     tL2CAP_UCD_CB_INFO
931  **
932  **  Return value:   TRUE if successs
933  **
934  *******************************************************************************/
935  extern BOOLEAN L2CA_UcdRegister ( UINT16 psm, tL2CAP_UCD_CB_INFO *p_cb_info );
936  
937  /*******************************************************************************
938  **
939  **  Function        L2CA_UcdDeregister
940  **
941  **  Description     Deregister PSM on UCD.
942  **
943  **  Parameters:     PSM
944  **
945  **  Return value:   TRUE if successs
946  **
947  *******************************************************************************/
948  extern BOOLEAN L2CA_UcdDeregister ( UINT16 psm );
949  
950  /*******************************************************************************
951  **
952  **  Function        L2CA_UcdDiscover
953  **
954  **  Description     Discover UCD of remote device.
955  **
956  **  Parameters:     PSM
957  **                  BD_ADDR of remote device
958  **                  info_type : L2CAP_UCD_INFO_TYPE_RECEPTION
959  **                              L2CAP_UCD_INFO_TYPE_MTU
960  **
961  **
962  **  Return value:   TRUE if successs
963  **
964  *******************************************************************************/
965  extern BOOLEAN L2CA_UcdDiscover ( UINT16 psm, BD_ADDR rem_bda, UINT8 info_type );
966  
967  /*******************************************************************************
968  **
969  **  Function        L2CA_UcdDataWrite
970  **
971  **  Description     Send UCD to remote device
972  **
973  **  Parameters:     PSM
974  **                  BD Address of remote
975  **                  Pointer to buffer of type BT_HDR
976  **                  flags : L2CAP_FLUSHABLE_CH_BASED
977  **                          L2CAP_FLUSHABLE_PKT
978  **                          L2CAP_NON_FLUSHABLE_PKT
979  **
980  ** Return value     L2CAP_DW_SUCCESS, if data accepted
981  **                  L2CAP_DW_FAILED,  if error
982  **
983  *******************************************************************************/
984  extern UINT16 L2CA_UcdDataWrite (UINT16 psm, BD_ADDR rem_bda, BT_HDR *p_buf, UINT16 flags);
985  
986  /*******************************************************************************
987  **
988  **  Function        L2CA_UcdSetIdleTimeout
989  **
990  **  Description     Set UCD Idle timeout.
991  **
992  **  Parameters:     BD Addr
993  **                  Timeout in second
994  **
995  **  Return value:   TRUE if successs
996  **
997  *******************************************************************************/
998  extern BOOLEAN L2CA_UcdSetIdleTimeout ( BD_ADDR rem_bda, UINT16 timeout );
999  
1000  /*******************************************************************************
1001  **
1002  ** Function         L2CA_UCDSetTxPriority
1003  **
1004  ** Description      Sets the transmission priority for a connectionless channel.
1005  **
1006  ** Returns          TRUE if a valid channel, else FALSE
1007  **
1008  *******************************************************************************/
1009  extern BOOLEAN L2CA_UCDSetTxPriority ( BD_ADDR rem_bda, tL2CAP_CHNL_PRIORITY priority );
1010  
1011  
1012  /*******************************************************************************
1013  **
1014  **                      Fixed Channel callback prototypes
1015  **
1016  *******************************************************************************/
1017  
1018  /* Fixed channel connected and disconnected. Parameters are
1019  **      channel
1020  **      BD Address of remote
1021  **      TRUE if channel is connected, FALSE if disconnected
1022  **      Reason for connection failure
1023  **      transport : physical transport, BR/EDR or LE
1024  */
1025  typedef void (tL2CA_FIXED_CHNL_CB) (UINT16, BD_ADDR, BOOLEAN, UINT16, tBT_TRANSPORT);
1026  
1027  /* Signalling data received. Parameters are
1028  **      channel
1029  **      BD Address of remote
1030  **      Pointer to buffer with data
1031  */
1032  typedef void (tL2CA_FIXED_DATA_CB) (UINT16, BD_ADDR, BT_HDR *);
1033  
1034  /* Congestion status callback protype. This callback is optional. If
1035  ** an application tries to send data when the transmit queue is full,
1036  ** the data will anyways be dropped. The parameter is:
1037  **      remote BD_ADDR
1038  **      TRUE if congested, FALSE if uncongested
1039  */
1040  typedef void (tL2CA_FIXED_CONGESTION_STATUS_CB) (BD_ADDR, BOOLEAN);
1041  
1042  /* Fixed channel registration info (the callback addresses and channel config)
1043  */
1044  typedef struct
1045  {
1046      tL2CA_FIXED_CHNL_CB    *pL2CA_FixedConn_Cb;
1047      tL2CA_FIXED_DATA_CB    *pL2CA_FixedData_Cb;
1048      tL2CA_FIXED_CONGESTION_STATUS_CB *pL2CA_FixedCong_Cb;
1049      tL2CAP_FCR_OPTS         fixed_chnl_opts;
1050  
1051      UINT16                  default_idle_tout;
1052      tL2CA_TX_COMPLETE_CB    *pL2CA_FixedTxComplete_Cb; /* fixed channel tx complete callback */
1053  } tL2CAP_FIXED_CHNL_REG;
1054  
1055  
1056  #if (L2CAP_NUM_FIXED_CHNLS > 0)
1057  /*******************************************************************************
1058  **
1059  **  Function        L2CA_RegisterFixedChannel
1060  **
1061  **  Description     Register a fixed channel.
1062  **
1063  **  Parameters:     Fixed Channel #
1064  **                  Channel Callbacks and config
1065  **
1066  **  Return value:   TRUE if registered OK
1067  **
1068  *******************************************************************************/
1069  extern BOOLEAN  L2CA_RegisterFixedChannel (UINT16 fixed_cid, tL2CAP_FIXED_CHNL_REG *p_freg);
1070  
1071  /*******************************************************************************
1072  **
1073  **  Function        L2CA_ConnectFixedChnl
1074  **
1075  **  Description     Connect an fixed signalling channel to a remote device.
1076  **
1077  **  Parameters:     Fixed CID
1078  **                  BD Address of remote
1079  **
1080  **  Return value:   TRUE if connection started
1081  **
1082  *******************************************************************************/
1083  extern BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR bd_addr);
1084  
1085  /*******************************************************************************
1086  **
1087  **  Function        L2CA_SendFixedChnlData
1088  **
1089  **  Description     Write data on a fixed signalling channel.
1090  **
1091  **  Parameters:     Fixed CID
1092  **                  BD Address of remote
1093  **                  Pointer to buffer of type BT_HDR
1094  **
1095  ** Return value     L2CAP_DW_SUCCESS, if data accepted
1096  **                  L2CAP_DW_FAILED,  if error
1097  **
1098  *******************************************************************************/
1099  extern UINT16 L2CA_SendFixedChnlData (UINT16 fixed_cid, BD_ADDR rem_bda, BT_HDR *p_buf);
1100  
1101  /*******************************************************************************
1102  **
1103  **  Function        L2CA_RemoveFixedChnl
1104  **
1105  **  Description     Remove a fixed channel to a remote device.
1106  **
1107  **  Parameters:     Fixed CID
1108  **                  BD Address of remote
1109  **                  Idle timeout to use (or 0xFFFF if don't care)
1110  **
1111  **  Return value:   TRUE if channel removed
1112  **
1113  *******************************************************************************/
1114  extern BOOLEAN L2CA_RemoveFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda);
1115  
1116  /*******************************************************************************
1117  **
1118  ** Function         L2CA_SetFixedChannelTout
1119  **
1120  ** Description      Higher layers call this function to set the idle timeout for
1121  **                  a fixed channel. The "idle timeout" is the amount of time that
1122  **                  a connection can remain up with no L2CAP channels on it.
1123  **                  A timeout of zero means that the connection will be torn
1124  **                  down immediately when the last channel is removed.
1125  **                  A timeout of 0xFFFF means no timeout. Values are in seconds.
1126  **                  A bd_addr is the remote BD address. If bd_addr = BT_BD_ANY,
1127  **                  then the idle timeouts for all active l2cap links will be
1128  **                  changed.
1129  **
1130  ** Returns          TRUE if command succeeded, FALSE if failed
1131  **
1132  *******************************************************************************/
1133  extern BOOLEAN L2CA_SetFixedChannelTout (BD_ADDR rem_bda, UINT16 fixed_cid, UINT16 idle_tout);
1134  
1135  #endif /* (L2CAP_NUM_FIXED_CHNLS > 0) */
1136  
1137  /*******************************************************************************
1138  **
1139  ** Function     L2CA_GetCurrentConfig
1140  **
1141  ** Description  This function returns configurations of L2CAP channel
1142  **              pp_our_cfg : pointer of our saved configuration options
1143  **              p_our_cfg_bits : valid config in bitmap
1144  **              pp_peer_cfg: pointer of peer's saved configuration options
1145  **              p_peer_cfg_bits : valid config in bitmap
1146  **
1147  ** Returns      TRUE if successful
1148  **
1149  *******************************************************************************/
1150  extern BOOLEAN L2CA_GetCurrentConfig (UINT16 lcid,
1151                                        tL2CAP_CFG_INFO **pp_our_cfg,  tL2CAP_CH_CFG_BITS *p_our_cfg_bits,
1152                                        tL2CAP_CFG_INFO **pp_peer_cfg, tL2CAP_CH_CFG_BITS *p_peer_cfg_bits);
1153  
1154  /*******************************************************************************
1155  **
1156  ** Function     L2CA_GetConnectionConfig
1157  **
1158  ** Description  This function polulates the mtu, remote cid & lm_handle for
1159  **              a given local L2CAP channel
1160  **
1161  ** Returns      TRUE if successful
1162  **
1163  *******************************************************************************/
1164  extern BOOLEAN L2CA_GetConnectionConfig(UINT16 lcid, UINT16 *mtu, UINT16 *rcid, UINT16 *handle);
1165  
1166  #if (BLE_INCLUDED == TRUE)
1167  /*******************************************************************************
1168  **
1169  **  Function        L2CA_CancelBleConnectReq
1170  **
1171  **  Description     Cancel a pending connection attempt to a BLE device.
1172  **
1173  **  Parameters:     BD Address of remote
1174  **
1175  **  Return value:   TRUE if connection was cancelled
1176  **
1177  *******************************************************************************/
1178  extern BOOLEAN L2CA_CancelBleConnectReq (BD_ADDR rem_bda);
1179  
1180  /*******************************************************************************
1181  **
1182  **  Function        L2CA_UpdateBleConnParams
1183  **
1184  **  Description     Update BLE connection parameters.
1185  **
1186  **  Parameters:     BD Address of remote
1187  **
1188  **  Return value:   TRUE if update started
1189  **
1190  *******************************************************************************/
1191  extern BOOLEAN L2CA_UpdateBleConnParams (BD_ADDR rem_bdRa, UINT16 min_int,
1192                                           UINT16 max_int, UINT16 latency, UINT16 timeout);
1193  
1194  /*******************************************************************************
1195  **
1196  **  Function        L2CA_EnableUpdateBleConnParams
1197  **
1198  **  Description     Update BLE connection parameters.
1199  **
1200  **  Parameters:     BD Address of remote
1201  **                  enable flag
1202  **
1203  **  Return value:   TRUE if update started
1204  **
1205  *******************************************************************************/
1206  extern BOOLEAN L2CA_EnableUpdateBleConnParams (BD_ADDR rem_bda, BOOLEAN enable);
1207  
1208  /*******************************************************************************
1209  **
1210  ** Function         L2CA_GetBleConnRole
1211  **
1212  ** Description      This function returns the connection role.
1213  **
1214  ** Returns          link role.
1215  **
1216  *******************************************************************************/
1217  extern UINT8 L2CA_GetBleConnRole (BD_ADDR bd_addr);
1218  
1219  /*******************************************************************************
1220  **
1221  ** Function         L2CA_GetDisconnectReason
1222  **
1223  ** Description      This function returns the disconnect reason code.
1224  **
1225  **  Parameters:     BD Address of remote
1226  **                         Physical transport for the L2CAP connection (BR/EDR or LE)
1227  **
1228  ** Returns          disconnect reason
1229  **
1230  *******************************************************************************/
1231  extern UINT16 L2CA_GetDisconnectReason (BD_ADDR remote_bda, tBT_TRANSPORT transport);
1232  
1233  #endif /* (BLE_INCLUDED == TRUE) */
1234  
1235  #ifdef __cplusplus
1236  }
1237  #endif
1238  
1239  #endif  /* L2C_API_H */
1240