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