bt.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 __BT_H__
  14. #define __BT_H__
  15. #include <stdint.h>
  16. #include <stdbool.h>
  17. #include "esp_err.h"
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. /**
  22. * @brief Initialize BT controller
  23. *
  24. * This function should be called only once, before any other BT functions are called.
  25. */
  26. void bt_controller_init(void);
  27. /** @brief vhci_host_callback
  28. * used for vhci call host function to notify what host need to do
  29. */
  30. typedef struct vhci_host_callback {
  31. void (*notify_host_send_available)(void); /*!< callback used to notify that the host can send packet to controller */
  32. int (*notify_host_recv)(uint8_t *data, uint16_t len); /*!< callback used to notify that the controller has a packet to send to the host*/
  33. } vhci_host_callback_t;
  34. /** @brief API_vhci_host_check_send_available
  35. * used for check actively if the host can send packet to controller or not.
  36. * @return true for ready to send, false means cannot send packet
  37. */
  38. bool API_vhci_host_check_send_available(void);
  39. /** @brief API_vhci_host_send_packet
  40. * host send packet to controller
  41. * @param data the packet point
  42. *,@param len the packet length
  43. */
  44. void API_vhci_host_send_packet(uint8_t *data, uint16_t len);
  45. /** @brief API_vhci_host_register_callback
  46. * register the vhci referece callback, the call back
  47. * struct defined by vhci_host_callback structure.
  48. * @param callback vhci_host_callback type variable
  49. */
  50. void API_vhci_host_register_callback(const vhci_host_callback_t *callback);
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif /* __BT_H__ */