bt_app_core.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. This example code is in the Public Domain (or CC0 licensed, at your option.)
  3. Unless required by applicable law or agreed to in writing, this
  4. software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  5. CONDITIONS OF ANY KIND, either express or implied.
  6. */
  7. #ifndef __BT_APP_CORE_H__
  8. #define __BT_APP_CORE_H__
  9. #include "Status.pb.h"
  10. #include "esp_log.h"
  11. #include "time.h"
  12. #include <stdbool.h>
  13. #include <stdint.h>
  14. #include <stdio.h>
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #define BT_APP_CORE_TAG "BT_APP_CORE"
  19. #define BT_APP_SIG_WORK_DISPATCH (0x01)
  20. enum {
  21. BT_APP_EVT_STACK_UP = 0,
  22. };
  23. extern sys_status_av_states bt_app_source_get_a2d_state();
  24. extern sys_status_media_states bt_app_source_get_media_state();
  25. /**
  26. * @brief handler for the dispatched work
  27. */
  28. typedef void (*bt_app_cb_t)(uint16_t event, void* param);
  29. /* message to be sent */
  30. typedef struct {
  31. uint16_t sig; /*!< signal to bt_app_task */
  32. uint16_t event; /*!< message event id */
  33. bt_app_cb_t cb; /*!< context switch callback */
  34. void* param; /*!< parameter area needs to be last */
  35. } bt_app_msg_t;
  36. /**
  37. * @brief parameter deep-copy function to be customized
  38. */
  39. typedef void (*bt_app_copy_cb_t)(bt_app_msg_t* msg, void* p_dest, void* p_src);
  40. /**
  41. * @brief callback for startup event
  42. */
  43. typedef void bt_av_hdl_stack_evt_t(uint16_t event, void* p_param);
  44. /**
  45. * @brief work dispatcher for the application task
  46. */
  47. bool bt_app_work_dispatch(bt_app_cb_t p_cback, uint16_t event, void* p_params, int param_len,
  48. bt_app_copy_cb_t p_copy_cback);
  49. void bt_app_task_start_up(bt_av_hdl_stack_evt_t* handler);
  50. void bt_app_task_shut_down(void);
  51. #endif /* __BT_APP_CORE_H__ */
  52. #ifdef __cplusplus
  53. }
  54. #endif