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