esp_bt_main.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #ifndef __ESP_BT_MAIN_H__
  14. #define __ESP_BT_MAIN_H__
  15. #include "esp_err.h"
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /**
  20. * @brief Bluetooth stack status type, to indicate whether the bluetooth stack is ready
  21. */
  22. typedef enum {
  23. ESP_BLUEDROID_STATUS_UNINITIALIZED = 0, /*!< Bluetooth not initialized */
  24. ESP_BLUEDROID_STATUS_INITIALIZED, /*!< Bluetooth initialized but not enabled */
  25. ESP_BLUEDROID_STATUS_ENABLED /*!< Bluetooth initialized and enabled */
  26. } esp_bluedroid_status_t;
  27. /**
  28. * @brief Get bluetooth stack status
  29. *
  30. * @return Bluetooth stack status
  31. *
  32. */
  33. esp_bluedroid_status_t esp_bluedroid_get_status(void);
  34. /**
  35. * @brief Enable bluetooth, must after esp_bluedroid_init()
  36. *
  37. * @return
  38. * - ESP_OK : Succeed
  39. * - Other : Failed
  40. */
  41. esp_err_t esp_bluedroid_enable(void);
  42. /**
  43. * @brief Disable bluetooth, must prior to esp_bluedroid_deinit()
  44. *
  45. * @return
  46. * - ESP_OK : Succeed
  47. * - Other : Failed
  48. */
  49. esp_err_t esp_bluedroid_disable(void);
  50. /**
  51. * @brief Init and alloc the resource for bluetooth, must be prior to every bluetooth stuff
  52. *
  53. * @return
  54. * - ESP_OK : Succeed
  55. * - Other : Failed
  56. */
  57. esp_err_t esp_bluedroid_init(void);
  58. /**
  59. * @brief Deinit and free the resource for bluetooth, must be after every bluetooth stuff
  60. *
  61. * @return
  62. * - ESP_OK : Succeed
  63. * - Other : Failed
  64. */
  65. esp_err_t esp_bluedroid_deinit(void);
  66. #ifdef __cplusplus
  67. }
  68. #endif
  69. #endif /* __ESP_BT_MAIN_H__ */