ble_user.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef BLE_USER_H__
  2. #define BLE_USER_H__
  3. #include <stdint.h>
  4. #include "_string.h"
  5. #include "nordic_common.h"
  6. #include "nrf.h"
  7. #include "ble_advdata.h"
  8. #include "ble_advertising.h"
  9. #include "ble_conn_params.h"
  10. #include "nrf_sdh.h"
  11. #include "nrf_sdh_soc.h"
  12. #include "nrf_sdh_ble.h"
  13. #include "nrf_ble_gatt.h"
  14. #include "nrf_ble_qwr.h"
  15. #include "app_timer.h"
  16. #include "app_error.h"
  17. #include "ble.h"
  18. #include "ble_err.h"
  19. #include "ble_hci.h"
  20. #include "ble_srv_common.h"
  21. #include "define.h"
  22. #include "app_button.h"
  23. #include "nrf_pwr_mgmt.h"
  24. #include "nrf_log.h"
  25. #include "nrf_log_ctrl.h"
  26. #include "nrf_log_default_backends.h"
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. typedef enum{
  31. BLE_STAT_CONNECTED,
  32. BLE_STAT_DISCONNECTED,
  33. BLE_STAT_DATA_OK,
  34. BLE_STAT_DATA_NOK
  35. }ble_stat_e;
  36. typedef bool (*ble_recieve_data_func)(uint8_t *data,uint8_t len);
  37. typedef void (*ble_dfu_act_func)(void);
  38. typedef void (*ble_stat_func)(ble_stat_e stat);
  39. typedef void (*ble_disconnect_func)(void);
  40. typedef struct{
  41. ble_recieve_data_func recieve_data;
  42. ble_dfu_act_func dfu_act;
  43. ble_stat_func ble_stat;
  44. ble_disconnect_func ble_disconnect;
  45. }ble_user_func_s;
  46. void Ble_User_Init(void);
  47. void ble_timers_init(void);
  48. void ble_owned_data_send(uint8_t *data,uint16_t len);
  49. bool get_m_owned_conn_stat(void);
  50. void return_dfu_act(bool stat);
  51. void set_ble_recieve_data_evtfunc(ble_recieve_data_func func);
  52. void set_ble_dfu_act_evtfunc(ble_dfu_act_func func);
  53. void set_ble_stat_evtfunc(ble_stat_func func);
  54. void set_ble_disconnect_evtfunc(ble_disconnect_func func);
  55. extern uint8_t m_addl_adv_manuf_data[];
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif // BSP_H__
  60. /** @} */