Drv_bt.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #ifndef _DRV_IPC_H_
  2. #define _DRV_IPC_H_
  3. #include <stdio.h>
  4. #include "btreg.h"
  5. #include "type.h"
  6. #define LE_ADV_DATA_MAX_LENGTH 31
  7. #define LE_SCAN_RSP_MAX_LENGTH 31
  8. #define Adv_Type_Flags 0x01
  9. #define Adv_Type_CompleteLocalName 0x09
  10. typedef enum
  11. {
  12. BR_STATE_INVALID,
  13. BR_IDLE,
  14. BR_CONNECTABLE,
  15. BR_DISCOVERABLE,
  16. BR_CONNECTABLE_DISCOVERABLE,
  17. BR_CONNECTING,
  18. BR_CONNECTED,
  19. BR_HFP_INCOMMING,
  20. BR_HFP_OUTGOING,
  21. BR_HFP_CALLACTIVE,
  22. BR_HFP_CALLACTIVE_WITHOUT_SCO,
  23. BR_HFP_CALLIMG,
  24. BR_HFP_CALLOGG,
  25. BR_HFP_CALMULTY,
  26. BR_STATE_NUM,
  27. }BR_STATE_TYPE;
  28. typedef enum{
  29. NONE_FILTER,
  30. WHITE_LIST_SCAN_FILTER,
  31. WHITE_LIST_CONNECT_FILTER,
  32. WHITE_LIST_FILTER,
  33. WHITE_LIST_CONN_SCAN_FILTER,
  34. }LE_WHITE_POLICY;
  35. typedef struct
  36. {
  37. uint8_t topState;
  38. uint8_t secondState;
  39. uint8_t thirdlyState;
  40. }BR_STATE;
  41. typedef enum
  42. {
  43. BLE_STATE_INVALID,
  44. BLE_IDLE,
  45. BLE_ADV,
  46. BLE_CONNECTING,
  47. BLE_CONNECTED,
  48. BLE_PAIRED,
  49. BLE_FAST_PAIRED,
  50. BLE_DIRECT_ADV,
  51. }BLE_STATE_TYPE;
  52. typedef enum {
  53. ADV_TYPE_NOMAL,
  54. ADV_TYPE_DIRECT,
  55. ADV_TYPE_NOCONNECT,
  56. SCAN_REQ,
  57. SCAN_RSP,
  58. CONNECT_REQ,
  59. ADV_TYPE_SCAN,
  60. }advType;
  61. typedef enum
  62. {
  63. ADV_DISABLE=0x00,
  64. ADV_ENABLE=0x01,
  65. }ADV_STATE;
  66. typedef enum {
  67. SCAN_TYPE_PASSIVE,
  68. SCAN_TYPE_ACTIVE,
  69. }scanType;
  70. typedef struct
  71. {
  72. uint8_t topState;
  73. uint8_t secondState;
  74. }BLE_STATE;
  75. typedef struct
  76. {
  77. uint16_t min_interval;
  78. uint16_t max_interval;
  79. uint16_t latency;
  80. uint16_t timeout;
  81. }BLE_Conn_param;
  82. void Ble_SendBleData(uint16_t BLE_WRITE_HANDLE,uint8_t* data, uint16_t len);
  83. void Bt_SetBleAddr(unsigned char* pAddr);
  84. void Bt_SetSppAddr(unsigned char* pAddr);
  85. void Bt_SetSppName(unsigned char* Name,int Len);
  86. void Bt_Re_BleAdvName(uint8_t *name,uint8_t len);
  87. void Bt_Re_BleDeivcename(uint8_t *name,uint8_t len);
  88. void Bt_Renew_Adv_Data(uint8_t *data,uint8_t len);
  89. void Bt_Renew_Scan_Rsp(uint8_t *data,uint8_t len);
  90. void Bt_SetAdvType(advType Type);
  91. void Bt_SetScanRspType(scanType Type);
  92. void Update_connection_param(BLE_Conn_param* param);
  93. void Bt_SetAdvInterval(uint16_t gap);
  94. void Bt_StartAdv(int time_10ms,uint16_t gap);
  95. void Bt_StartDirectAdv(int time_10ms, uint16_t gap);
  96. void Bt_send_stop_direct_adv(int params);
  97. void Bt_stop_adv(int params);
  98. void Bt_setBLEState(uint8_t inState);
  99. void Bt_EvtCallBack(uint8_t len,uint8_t *dataPtr);
  100. void Bt_BleCallBack(uint8_t len,uint8_t *dataPtr);
  101. uint8_t Bt_checkBleIsConnected();
  102. uint8_t Bt_checkBleIsAdvStart();
  103. void Bt_Reset();
  104. BLE_STATE_TYPE Bt_getBLEState();
  105. #endif //_DRV_IPC_H_