bt.h 2.1 KB

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