1 // Copyright 2015-2016 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_BT_MAIN_H__ 16 #define __ESP_BT_MAIN_H__ 17 18 #include "esp_err.h" 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 /** 25 * @brief Bluetooth stack status type, to indicate whether the bluetooth stack is ready. 26 */ 27 typedef enum { 28 ESP_BLUEDROID_STATUS_UNINITIALIZED = 0, /*!< Bluetooth not initialized */ 29 ESP_BLUEDROID_STATUS_INITIALIZED, /*!< Bluetooth initialized but not enabled */ 30 ESP_BLUEDROID_STATUS_ENABLED /*!< Bluetooth initialized and enabled */ 31 } esp_bluedroid_status_t; 32 33 /** 34 * @brief Get bluetooth stack status 35 * 36 * @return Bluetooth stack status 37 * 38 */ 39 esp_bluedroid_status_t esp_bluedroid_get_status(void); 40 41 /** 42 * @brief Enable bluetooth, must after esp_bluedroid_init(). 43 * 44 * @return 45 * - ESP_OK : Succeed 46 * - Other : Failed 47 */ 48 esp_err_t esp_bluedroid_enable(void); 49 50 /** 51 * @brief Disable bluetooth, must prior to esp_bluedroid_deinit(). 52 * 53 * @return 54 * - ESP_OK : Succeed 55 * - Other : Failed 56 */ 57 esp_err_t esp_bluedroid_disable(void); 58 59 /** 60 * @brief Init and alloc the resource for bluetooth, must be prior to every bluetooth stuff. 61 * 62 * @return 63 * - ESP_OK : Succeed 64 * - Other : Failed 65 */ 66 esp_err_t esp_bluedroid_init(void); 67 68 /** 69 * @brief Deinit and free the resource for bluetooth, must be after every bluetooth stuff. 70 * 71 * @return 72 * - ESP_OK : Succeed 73 * - Other : Failed 74 */ 75 esp_err_t esp_bluedroid_deinit(void); 76 77 #ifdef __cplusplus 78 } 79 #endif 80 81 #endif /* __ESP_BT_MAIN_H__ */ 82