1 // Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef __ESP_GATT_COMMON_API_H__ 16 #define __ESP_GATT_COMMON_API_H__ 17 18 #include <stdint.h> 19 #include <stdbool.h> 20 21 #include "esp_err.h" 22 #include "esp_bt_defs.h" 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 // Maximum Transmission Unit used in GATT 29 #define ESP_GATT_DEF_BLE_MTU_SIZE 23 /* relate to GATT_DEF_BLE_MTU_SIZE in stack/gatt_api.h */ 30 31 // Maximum Transmission Unit allowed in GATT 32 #define ESP_GATT_MAX_MTU_SIZE 517 /* relate to GATT_MAX_MTU_SIZE in stack/gatt_api.h */ 33 34 /** 35 * @brief This function is called to set local MTU, 36 * the function is called before BLE connection. 37 * 38 * @param[in] mtu: the size of MTU. 39 * 40 * @return 41 * - ESP_OK: success 42 * - other: failed 43 * 44 */ 45 extern esp_err_t esp_ble_gatt_set_local_mtu (uint16_t mtu); 46 47 #if (BLE_INCLUDED == TRUE) 48 extern uint16_t esp_ble_get_sendable_packets_num (void); 49 extern uint16_t esp_ble_get_cur_sendable_packets_num (uint16_t connid); 50 #endif 51 52 #ifdef __cplusplus 53 } 54 #endif 55 56 #endif /* __ESP_GATT_COMMON_API_H__ */ 57