scanparamservice.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /**
  2. * @file
  3. * @author chipsea
  4. * @brief
  5. * @version 0.1
  6. * @date 2020-11-30
  7. * @copyright Copyright (c) 2020, CHIPSEA Co., Ltd.
  8. * @note
  9. */
  10. #ifndef SCANPARAMSERVICE_H
  11. #define SCANPARAMSERVICE_H
  12. #ifdef __cplusplus
  13. extern "C"
  14. {
  15. #endif
  16. /*********************************************************************
  17. * INCLUDES
  18. */
  19. /*********************************************************************
  20. * CONSTANTS
  21. */
  22. // Scan Characteristic Lengths
  23. #define SCAN_INTERVAL_WINDOW_CHAR_LEN 4
  24. #define SCAN_PARAM_REFRESH_LEN 1
  25. // Scan Parameter Refresh Values
  26. #define SCAN_PARAM_REFRESH_REQ 0x00
  27. // Callback events
  28. #define SCAN_INTERVAL_WINDOW_SET 1
  29. // Get/Set parameters
  30. #define SCAN_PARAM_PARAM_INTERVAL 0
  31. #define SCAN_PARAM_PARAM_WINDOW 1
  32. /*********************************************************************
  33. * TYPEDEFS
  34. */
  35. /*********************************************************************
  36. * MACROS
  37. */
  38. /*********************************************************************
  39. * Profile Callbacks
  40. */
  41. // Scan Parameters Service callback function
  42. typedef void (*scanParamServiceCB_t)( uint8 event );
  43. /*********************************************************************
  44. * API FUNCTIONS
  45. */
  46. /*********************************************************************
  47. * @fn ScanParam_AddService
  48. *
  49. * @brief Initializes the Service by registering
  50. * GATT attributes with the GATT server.
  51. *
  52. * @return Success or Failure
  53. */
  54. extern bStatus_t ScanParam_AddService( void );
  55. /*********************************************************************
  56. * @fn ScanParam_Register
  57. *
  58. * @brief Register a callback function with the Scan Parameters Service.
  59. *
  60. * @param pfnServiceCB - Callback function.
  61. *
  62. * @return None.
  63. */
  64. extern void ScanParam_Register( scanParamServiceCB_t pfnServiceCB );
  65. /*********************************************************************
  66. * @fn ScanParam_SetParameter
  67. *
  68. * @brief Set a Scan Parameters Service parameter.
  69. *
  70. * @param param - Profile parameter ID
  71. * @param len - length of data to right
  72. * @param value - pointer to data to write. This is dependent on
  73. * the parameter ID and WILL be cast to the appropriate
  74. * data type (example: data type of uint16 will be cast to
  75. * uint16 pointer).
  76. *
  77. * @return bStatus_t
  78. */
  79. extern bStatus_t ScanParam_SetParameter( uint8 param, uint8 len, void *value );
  80. /*********************************************************************
  81. * @fn ScanParam_GetParameter
  82. *
  83. * @brief Get a Scan Parameters Service parameter.
  84. *
  85. * @param param - Profile parameter ID
  86. * @param value - pointer to data to get. This is dependent on
  87. * the parameter ID and WILL be cast to the appropriate
  88. * data type (example: data type of uint16 will be cast to
  89. * uint16 pointer).
  90. *
  91. * @return bStatus_t
  92. */
  93. extern bStatus_t ScanParam_GetParameter( uint8 param, void *value );
  94. /*********************************************************************
  95. * @fn ScanParam_RefreshNotify
  96. *
  97. * @brief Notify the peer to refresh the scan parameters.
  98. *
  99. * @param connHandle - connection handle
  100. *
  101. * @return None
  102. */
  103. extern void ScanParam_RefreshNotify( uint16 connHandle );
  104. /*********************************************************************
  105. * @fn ScanParam_HandleConnStatusCB
  106. *
  107. * @brief Service link status change handler function.
  108. *
  109. * @param connHandle - connection handle
  110. * @param changeType - type of change
  111. *
  112. * @return none
  113. */
  114. void ScanParam_HandleConnStatusCB( uint16 connHandle, uint8 changeType );
  115. /*********************************************************************
  116. *********************************************************************/
  117. #ifdef __cplusplus
  118. }
  119. #endif
  120. #endif /* SCANPARAMSERVICE_H */