hal_ble_host.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef __hal_BLE_Host__
  2. #define __hal_BLE_Host__
  3. #include <stdbool.h>
  4. #include <stdint.h>
  5. #include <string.h>
  6. #include "sdk_common.h"
  7. #include "SEGGER_RTT.h"
  8. #include "usr_config.h"
  9. #include "hal_ble_common.h"
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. #ifdef __cplusplus
  14. }
  15. #endif
  16. typedef void (*BLE_Host_Callback)(void*);
  17. typedef void (*BLE_Host_Callback_cb)(uint8_t*pdat ,uint8_t len);
  18. typedef struct _BLE_Host_Rx{
  19. uint8_t cmd;
  20. uint8_t* pDat;
  21. uint8_t datLen;
  22. BLE_Host_Callback cb;
  23. }BLE_Host_Rx_t;
  24. typedef struct _BLE_Host_Tx{
  25. uint8_t n;
  26. uint32_t t;
  27. uint8_t ncnt;
  28. uint32_t tcnt;
  29. BLE_CMD_n cmd;
  30. uint8_t* pDat;
  31. uint8_t datLen;
  32. uint8_t holdon;
  33. BLE_Host_Callback cb;
  34. struct _BLE_Host_Tx *next; //µ¥ÏòÁ´±í
  35. }BLE_Host_Tx_t;
  36. void BLE_Host_Initialize(void);
  37. void BLE_Host_Send(BLE_CMD_n cmd,unsigned char *pDat,unsigned char datLen);
  38. int BLE_Host_Rx_Regist(BLE_CMD_n cmd,BLE_Host_Callback cb);
  39. void BLE_Host_Tx_Send(BLE_Host_Tx_t* handle,BLE_CMD_n cmd,unsigned char *pDat,unsigned char datLen);
  40. void BLE_Host_Tx_Clear(BLE_Host_Tx_t* handle);
  41. void BLE_Host_Push(unsigned char* p,int len);
  42. int BLE_Host_Rx_Regist_Game(BLE_Host_Callback_cb cb);
  43. #endif