1 /* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the copyright holders nor the names of 14 * contributors may be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * 4. Any redistribution, use, or modification is done solely for 17 * personal benefit and not for any commercial purpose or for 18 * monetary gain. 19 * 20 * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 24 * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * Please inquire about commercial licensing options at 34 * [email protected] 35 * 36 */ 37 38 /* 39 * l2cap.h 40 * 41 * Logical Link Control and Adaption Protocol (L2CAP) 42 * 43 * Created by Matthias Ringwald on 5/16/09. 44 */ 45 46 #ifndef __L2CAP_H 47 #define __L2CAP_H 48 49 #include "hci.h" 50 #include "l2cap_signaling.h" 51 #include "btstack_util.h" 52 #include "bluetooth.h" 53 54 #if defined __cplusplus 55 extern "C" { 56 #endif 57 58 // check L2CAP MTU 59 #ifdef ENABLE_CLASSIC 60 #if (L2CAP_HEADER_SIZE + L2CAP_MINIMAL_MTU) > HCI_ACL_PAYLOAD_SIZE 61 #error "HCI_ACL_PAYLOAD_SIZE too small for minimal L2CAP MTU of 48 bytes" 62 #endif 63 #endif 64 #ifdef ENABLE_BLE 65 #if (L2CAP_HEADER_SIZE + L2CAP_LE_DEFAULT_MTU) > HCI_ACL_PAYLOAD_SIZE 66 #error "HCI_ACL_PAYLOAD_SIZE too small for minimal L2CAP LE MTU of 23 bytes" 67 #endif 68 #endif 69 70 #define L2CAP_LE_AUTOMATIC_CREDITS 0xffff 71 72 // private structs 73 typedef enum { 74 L2CAP_STATE_CLOSED = 1, // no baseband 75 L2CAP_STATE_WILL_SEND_CREATE_CONNECTION, 76 L2CAP_STATE_WAIT_CONNECTION_COMPLETE, 77 L2CAP_STATE_WAIT_REMOTE_SUPPORTED_FEATURES, 78 L2CAP_STATE_WAIT_INCOMING_SECURITY_LEVEL_UPDATE, 79 L2CAP_STATE_WAIT_OUTGOING_SECURITY_LEVEL_UPDATE, 80 L2CAP_STATE_WAIT_INCOMING_EXTENDED_FEATURES, // only for Enhanced Retransmission Mode 81 L2CAP_STATE_WAIT_OUTGOING_EXTENDED_FEATURES, // only for Enhanced Retransmission Mode 82 L2CAP_STATE_WAIT_CLIENT_ACCEPT_OR_REJECT, 83 L2CAP_STATE_WAIT_CONNECT_RSP, // from peer 84 L2CAP_STATE_CONFIG, 85 L2CAP_STATE_OPEN, 86 L2CAP_STATE_WAIT_DISCONNECT, // from application 87 L2CAP_STATE_WILL_SEND_CONNECTION_REQUEST, 88 L2CAP_STATE_WILL_SEND_CONNECTION_RESPONSE_INSUFFICIENT_SECURITY, 89 L2CAP_STATE_WILL_SEND_CONNECTION_RESPONSE_DECLINE, 90 L2CAP_STATE_WILL_SEND_CONNECTION_RESPONSE_ACCEPT, 91 L2CAP_STATE_WILL_SEND_DISCONNECT_REQUEST, 92 L2CAP_STATE_WILL_SEND_DISCONNECT_RESPONSE, 93 L2CAP_STATE_WILL_SEND_LE_CONNECTION_REQUEST, 94 L2CAP_STATE_WILL_SEND_LE_CONNECTION_RESPONSE_DECLINE, 95 L2CAP_STATE_WILL_SEND_LE_CONNECTION_RESPONSE_ACCEPT, 96 L2CAP_STATE_WAIT_LE_CONNECTION_RESPONSE, 97 L2CAP_STATE_INVALID, 98 } L2CAP_STATE; 99 100 typedef enum { 101 L2CAP_CHANNEL_STATE_VAR_NONE = 0, 102 L2CAP_CHANNEL_STATE_VAR_RCVD_CONF_REQ = 1 << 0, 103 L2CAP_CHANNEL_STATE_VAR_RCVD_CONF_RSP = 1 << 1, 104 L2CAP_CHANNEL_STATE_VAR_SEND_CONF_REQ = 1 << 2, 105 L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP = 1 << 3, 106 L2CAP_CHANNEL_STATE_VAR_SENT_CONF_REQ = 1 << 4, 107 L2CAP_CHANNEL_STATE_VAR_SENT_CONF_RSP = 1 << 5, 108 L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_MTU = 1 << 6, // in CONF RSP, add MTU field 109 L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_CONT = 1 << 7, // in CONF RSP, set CONTINUE flag 110 L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_INVALID = 1 << 8, // in CONF RSP, send UNKNOWN OPTIONS 111 L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_REJECTED = 1 << 9, // in CONF RSP, send Unacceptable Parameters (ERTM) 112 L2CAP_CHANNEL_STATE_VAR_BASIC_FALLBACK_TRIED = 1 << 10, // set when ERTM was requested but we want only Basic mode (ERM) 113 L2CAP_CHANNEL_STATE_VAR_SEND_CMD_REJ_UNKNOWN = 1 << 11, // send CMD_REJ with reason unknown 114 L2CAP_CHANNEL_STATE_VAR_SEND_CONN_RESP_PEND = 1 << 12, // send Connection Respond with pending 115 L2CAP_CHANNEL_STATE_VAR_INCOMING = 1 << 15, // channel is incoming 116 } L2CAP_CHANNEL_STATE_VAR; 117 118 typedef struct { 119 l2cap_segmentation_and_reassembly_t sar; 120 uint16_t len; 121 uint8_t valid; 122 } l2cap_ertm_rx_packet_state_t; 123 124 typedef struct { 125 l2cap_segmentation_and_reassembly_t sar; 126 uint16_t len; 127 uint8_t tx_seq; 128 uint8_t retry_count; 129 uint8_t retransmission_requested; 130 } l2cap_ertm_tx_packet_state_t; 131 132 typedef struct { 133 // If not mandatory, the use of ERTM can be decided by the remote 134 uint8_t ertm_mandatory; 135 136 // Number of retransmissions that L2CAP is allowed to try before accepting that a packet and the channel is lost. 137 uint8_t max_transmit; 138 139 // time before retransmission of i-frame / Recommended : 2000 ms (ACL Flush timeout not used) 140 uint16_t retransmission_timeout_ms; 141 142 // time after withc s-frames are sent / Recommended: 12000 ms (ACL Flush timeout not used) 143 uint16_t monitor_timeout_ms; 144 145 // MTU for incoming SDUs 146 uint16_t local_mtu; 147 148 // Number of buffers for outgoing data 149 uint8_t num_tx_buffers; 150 151 // Number of packets that can be received out of order (-> our tx_window size) 152 uint8_t num_rx_buffers; 153 154 } l2cap_ertm_config_t; 155 156 // info regarding an actual connection 157 typedef struct { 158 // linked list - assert: first field 159 btstack_linked_item_t item; 160 161 // packet handler 162 btstack_packet_handler_t packet_handler; 163 164 // timer 165 btstack_timer_source_t rtx; // also used for ertx 166 167 L2CAP_STATE state; 168 L2CAP_CHANNEL_STATE_VAR state_var; 169 170 // info 171 hci_con_handle_t con_handle; 172 173 bd_addr_t address; 174 bd_addr_type_t address_type; 175 176 uint8_t remote_sig_id; // used by other side, needed for delayed response 177 uint8_t local_sig_id; // own signaling identifier 178 179 uint16_t local_cid; 180 uint16_t remote_cid; 181 182 uint16_t local_mtu; 183 uint16_t remote_mtu; 184 185 uint16_t flush_timeout; // default 0xffff 186 187 uint16_t psm; 188 189 gap_security_level_t required_security_level; 190 191 uint8_t reason; // used in decline internal 192 uint8_t waiting_for_can_send_now; 193 194 // LE Data Channels 195 196 // incoming SDU 197 uint8_t * receive_sdu_buffer; 198 uint16_t receive_sdu_len; 199 uint16_t receive_sdu_pos; 200 201 // outgoing SDU 202 uint8_t * send_sdu_buffer; 203 uint16_t send_sdu_len; 204 uint16_t send_sdu_pos; 205 206 // max PDU size 207 uint16_t remote_mps; 208 209 // credits for outgoing traffic 210 uint16_t credits_outgoing; 211 212 // number of packets remote will be granted 213 uint16_t new_credits_incoming; 214 215 // credits for incoming traffic 216 uint16_t credits_incoming; 217 218 // automatic credits incoming 219 uint16_t automatic_credits; 220 221 #ifdef ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE 222 223 // l2cap channel mode: basic or enhanced retransmission mode 224 l2cap_channel_mode_t mode; 225 226 // local mps = size of rx/tx buffers 227 uint16_t local_mps; 228 229 // retransmission timer 230 btstack_timer_source_t retransmission_timer; 231 232 // monitor timer 233 btstack_timer_source_t monitor_timer; 234 235 // local/remote config options 236 uint16_t local_retransmission_timeout_ms; 237 uint16_t local_monitor_timeout_ms; 238 239 uint16_t remote_retransmission_timeout_ms; 240 uint16_t remote_monitor_timeout_ms; 241 242 uint8_t remote_tx_window_size; 243 244 uint8_t local_max_transmit; 245 uint8_t remote_max_transmit; 246 247 // if ertm is not mandatory, allow fallback to L2CAP Basic Mode - flag 248 uint8_t ertm_mandatory; 249 250 // sender: max num of stored outgoing frames 251 uint8_t num_tx_buffers; 252 253 // sender: number of unacknowledeged I-Frames - frames have been sent, but not acknowledged yet 254 uint8_t unacked_frames; 255 256 // sender: buffer index of oldest packet 257 uint8_t tx_read_index; 258 259 // sender: buffer index to store next tx packet 260 uint8_t tx_write_index; 261 262 // sender: buffer index of packet to send next 263 uint8_t tx_send_index; 264 265 // sender: next seq nr used for sending 266 uint8_t next_tx_seq; 267 268 // sender: selective retransmission requested 269 uint8_t srej_active; 270 271 272 // receiver: max num out-of-order packets // tx_window 273 uint8_t num_rx_buffers; 274 275 // receiver: buffer index of to store packet with delta = 1 276 uint8_t rx_store_index; 277 278 // receiver: value of tx_seq in next expected i-frame 279 uint8_t expected_tx_seq; 280 281 // receiver: request transmission with tx_seq = req_seq and ack up to and including req_seq 282 uint8_t req_seq; 283 284 // receiver: local busy condition 285 uint8_t local_busy; 286 287 // receiver: send RR frame with optional final flag set - flag 288 uint8_t send_supervisor_frame_receiver_ready; 289 290 // receiver: send RR frame with poll bit set 291 uint8_t send_supervisor_frame_receiver_ready_poll; 292 293 // receiver: send RNR frame - flag 294 uint8_t send_supervisor_frame_receiver_not_ready; 295 296 // receiver: send REJ frame - flag 297 uint8_t send_supervisor_frame_reject; 298 299 // receiver: send SREJ frame - flag 300 uint8_t send_supervisor_frame_selective_reject; 301 302 // set final bit after poll packet with poll bit was received 303 uint8_t set_final_bit_after_packet_with_poll_bit_set; 304 305 // receiver: meta data for out-of-order frames 306 l2cap_ertm_rx_packet_state_t * rx_packets_state; 307 308 // sender: retransmission state 309 l2cap_ertm_tx_packet_state_t * tx_packets_state; 310 311 // receiver: reassemly pos 312 uint16_t reassembly_pos; 313 314 // receiver: reassemly sdu length 315 uint16_t reassembly_sdu_length; 316 317 // receiver: eassembly buffer 318 uint8_t * reassembly_buffer; 319 320 // receiver: num_rx_buffers of size local_mps 321 uint8_t * rx_packets_data; 322 323 // sender: num_tx_buffers of size local_mps 324 uint8_t * tx_packets_data; 325 326 #endif 327 } l2cap_channel_t; 328 329 // info regarding potential connections 330 typedef struct { 331 // linked list - assert: first field 332 btstack_linked_item_t item; 333 334 // service id 335 uint16_t psm; 336 337 // incoming MTU 338 uint16_t mtu; 339 340 // internal connection 341 btstack_packet_handler_t packet_handler; 342 343 // required security level 344 gap_security_level_t required_security_level; 345 346 } l2cap_service_t; 347 348 349 typedef struct l2cap_signaling_response { 350 hci_con_handle_t handle; 351 uint8_t sig_id; 352 uint8_t code; 353 uint16_t cid; // source cid for CONNECTION REQUEST 354 uint16_t data; // infoType for INFORMATION REQUEST, result for CONNECTION REQUEST and COMMAND UNKNOWN 355 } l2cap_signaling_response_t; 356 357 358 void l2cap_register_fixed_channel(btstack_packet_handler_t packet_handler, uint16_t channel_id); 359 int l2cap_can_send_fixed_channel_packet_now(hci_con_handle_t con_handle, uint16_t channel_id); 360 void l2cap_request_can_send_fix_channel_now_event(hci_con_handle_t con_handle, uint16_t channel_id); 361 int l2cap_send_connectionless(hci_con_handle_t con_handle, uint16_t cid, uint8_t *data, uint16_t len); 362 int l2cap_send_prepared_connectionless(hci_con_handle_t con_handle, uint16_t cid, uint16_t len); 363 364 // PTS Testing 365 int l2cap_send_echo_request(hci_con_handle_t con_handle, uint8_t *data, uint16_t len); 366 void l2cap_require_security_level_2_for_outgoing_sdp(void); 367 368 // Used by RFCOMM - similar to l2cap_can-send_packet_now but does not check if outgoing buffer is reserved 369 int l2cap_can_send_prepared_packet_now(uint16_t local_cid); 370 371 /* API_START */ 372 373 /** 374 * @brief Set up L2CAP and register L2CAP with HCI layer. 375 */ 376 void l2cap_init(void); 377 378 /** 379 * @brief Registers packet handler for LE Connection Parameter Update events 380 */ 381 void l2cap_register_packet_handler(void (*handler)(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size)); 382 383 /** 384 * @brief Get max MTU for Classic connections based on btstack configuration 385 */ 386 uint16_t l2cap_max_mtu(void); 387 388 /** 389 * @brief Get max MTU for LE connections based on btstack configuration 390 */ 391 uint16_t l2cap_max_le_mtu(void); 392 393 /** 394 * @brief Creates L2CAP channel to the PSM of a remote device with baseband address. A new baseband connection will be initiated if necessary. 395 * @param packet_handler 396 * @param address 397 * @param psm 398 * @param mtu 399 * @param local_cid 400 * @return status 401 */ 402 uint8_t l2cap_create_channel(btstack_packet_handler_t packet_handler, bd_addr_t address, uint16_t psm, uint16_t mtu, uint16_t * out_local_cid); 403 404 /** 405 * @brief Creates L2CAP channel to the PSM of a remote device with baseband address using Enhanced Retransmission Mode. 406 * A new baseband connection will be initiated if necessary. 407 * @param packet_handler 408 * @param address 409 * @param psm 410 * @param ertm_config 411 * @param buffer to store reassembled rx packet, out-of-order packets and unacknowledged outgoing packets with their tretransmission timers 412 * @param size of buffer 413 * @param local_cid 414 * @return status 415 */ 416 uint8_t l2cap_create_ertm_channel(btstack_packet_handler_t packet_handler, bd_addr_t address, uint16_t psm, 417 l2cap_ertm_config_t * ertm_contig, uint8_t * buffer, uint32_t size, uint16_t * out_local_cid); 418 419 /** 420 * @brief Disconnects L2CAP channel with given identifier. 421 */ 422 void l2cap_disconnect(uint16_t local_cid, uint8_t reason); 423 424 /** 425 * @brief Queries the maximal transfer unit (MTU) for L2CAP channel with given identifier. 426 */ 427 uint16_t l2cap_get_remote_mtu_for_local_cid(uint16_t local_cid); 428 429 /** 430 * @brief Sends L2CAP data packet to the channel with given identifier. 431 */ 432 int l2cap_send(uint16_t local_cid, uint8_t *data, uint16_t len); 433 434 /** 435 * @brief Registers L2CAP service with given PSM and MTU, and assigns a packet handler. 436 */ 437 uint8_t l2cap_register_service(btstack_packet_handler_t packet_handler, uint16_t psm, uint16_t mtu, gap_security_level_t security_level); 438 439 /** 440 * @brief Unregisters L2CAP service with given PSM. 441 */ 442 uint8_t l2cap_unregister_service(uint16_t psm); 443 444 /** 445 * @brief Accepts incoming L2CAP connection. 446 */ 447 void l2cap_accept_connection(uint16_t local_cid); 448 449 /** 450 * @brief Accepts incoming L2CAP connection for Enhanced Retransmission Mode 451 * @param local_cid 452 * @param ertm_config 453 * @param buffer to store reassembled rx packet, out-of-order packets and unacknowledged outgoing packets with their tretransmission timers 454 * @param size of buffer 455 * @return status 456 */ 457 uint8_t l2cap_accept_ertm_connection(uint16_t local_cid, l2cap_ertm_config_t * ertm_contig, uint8_t * buffer, uint32_t size); 458 459 /** 460 * @brief Deny incoming L2CAP connection. 461 */ 462 void l2cap_decline_connection(uint16_t local_cid); 463 464 /** 465 * @brief Check if outgoing buffer is available and that there's space on the Bluetooth module 466 */ 467 int l2cap_can_send_packet_now(uint16_t local_cid); 468 469 /** 470 * @brief Request emission of L2CAP_EVENT_CAN_SEND_NOW as soon as possible 471 * @note L2CAP_EVENT_CAN_SEND_NOW might be emitted during call to this function 472 * so packet handler should be ready to handle it 473 * @param local_cid 474 */ 475 void l2cap_request_can_send_now_event(uint16_t local_cid); 476 477 /** 478 * @brief Reserve outgoing buffer 479 */ 480 int l2cap_reserve_packet_buffer(void); 481 482 /** 483 * @brief Get outgoing buffer and prepare data. 484 */ 485 uint8_t *l2cap_get_outgoing_buffer(void); 486 487 /** 488 * @brief Send L2CAP packet prepared in outgoing buffer to channel 489 */ 490 int l2cap_send_prepared(uint16_t local_cid, uint16_t len); 491 492 /** 493 * @brief Release outgoing buffer (only needed if l2cap_send_prepared is not called) 494 */ 495 void l2cap_release_packet_buffer(void); 496 497 498 // 499 // LE Connection Oriented Channels feature with the LE Credit Based Flow Control Mode == LE Data Channel 500 // 501 502 503 /** 504 * @brief Register L2CAP LE Data Channel service 505 * @note MTU and initial credits are specified in l2cap_le_accept_connection(..) call 506 * @param packet_handler 507 * @param psm 508 * @param security_level 509 */ 510 uint8_t l2cap_le_register_service(btstack_packet_handler_t packet_handler, uint16_t psm, gap_security_level_t security_level); 511 512 /** 513 * @brief Unregister L2CAP LE Data Channel service 514 * @param psm 515 */ 516 517 uint8_t l2cap_le_unregister_service(uint16_t psm); 518 519 /* 520 * @brief Accept incoming LE Data Channel connection 521 * @param local_cid L2CAP LE Data Channel Identifier 522 * @param receive_buffer buffer used for reassembly of L2CAP LE Information Frames into service data unit (SDU) with given MTU 523 * @param receive_buffer_size buffer size equals MTU 524 * @param initial_credits Number of initial credits provided to peer or L2CAP_LE_AUTOMATIC_CREDITS to enable automatic credits 525 */ 526 527 uint8_t l2cap_le_accept_connection(uint16_t local_cid, uint8_t * receive_sdu_buffer, uint16_t mtu, uint16_t initial_credits); 528 529 /** 530 * @brief Deny incoming LE Data Channel connection due to resource constraints 531 * @param local_cid L2CAP LE Data Channel Identifier 532 */ 533 534 uint8_t l2cap_le_decline_connection(uint16_t local_cid); 535 536 /** 537 * @brief Create LE Data Channel 538 * @param packet_handler Packet handler for this connection 539 * @param con_handle ACL-LE HCI Connction Handle 540 * @param psm Service PSM to connect to 541 * @param receive_buffer buffer used for reassembly of L2CAP LE Information Frames into service data unit (SDU) with given MTU 542 * @param receive_buffer_size buffer size equals MTU 543 * @param initial_credits Number of initial credits provided to peer or L2CAP_LE_AUTOMATIC_CREDITS to enable automatic credits 544 * @param security_level Minimum required security level 545 * @param out_local_cid L2CAP LE Channel Identifier is stored here 546 */ 547 uint8_t l2cap_le_create_channel(btstack_packet_handler_t packet_handler, hci_con_handle_t con_handle, 548 uint16_t psm, uint8_t * receive_sdu_buffer, uint16_t mtu, uint16_t initial_credits, gap_security_level_t security_level, 549 uint16_t * out_local_cid); 550 551 /** 552 * @brief Provide credtis for LE Data Channel 553 * @param local_cid L2CAP LE Data Channel Identifier 554 * @param credits Number additional credits for peer 555 */ 556 uint8_t l2cap_le_provide_credits(uint16_t cid, uint16_t credits); 557 558 /** 559 * @brief Check if packet can be scheduled for transmission 560 * @param local_cid L2CAP LE Data Channel Identifier 561 */ 562 int l2cap_le_can_send_now(uint16_t cid); 563 564 /** 565 * @brief Request emission of L2CAP_EVENT_LE_CAN_SEND_NOW as soon as possible 566 * @note L2CAP_EVENT_CAN_SEND_NOW might be emitted during call to this function 567 * so packet handler should be ready to handle it 568 * @param local_cid L2CAP LE Data Channel Identifier 569 */ 570 uint8_t l2cap_le_request_can_send_now_event(uint16_t cid); 571 572 /** 573 * @brief Send data via LE Data Channel 574 * @note Since data larger then the maximum PDU needs to be segmented into multiple PDUs, data needs to stay valid until ... event 575 * @param local_cid L2CAP LE Data Channel Identifier 576 * @param data data to send 577 * @param size data size 578 */ 579 uint8_t l2cap_le_send_data(uint16_t cid, uint8_t * data, uint16_t size); 580 581 /** 582 * @brief Disconnect from LE Data Channel 583 * @param local_cid L2CAP LE Data Channel Identifier 584 */ 585 uint8_t l2cap_le_disconnect(uint16_t cid); 586 587 /* API_END */ 588 589 /** 590 * @brief ERTM Set channel as busy. 591 * @note Can be cleared by l2cap_ertm_set_ready 592 * @param local_cid 593 */ 594 uint8_t l2cap_ertm_set_busy(uint16_t local_cid); 595 596 /** 597 * @brief ERTM Set channel as ready 598 * @note Used after l2cap_ertm_set_busy 599 * @param local_cid 600 */ 601 uint8_t l2cap_ertm_set_ready(uint16_t local_cid); 602 603 #if defined __cplusplus 604 } 605 #endif 606 607 #endif // __L2CAP_H 608