scanparamservice.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /**************************************************************************************************
  2. Phyplus Microelectronics Limited confidential and proprietary.
  3. All rights reserved.
  4. IMPORTANT: All rights of this software belong to Phyplus Microelectronics
  5. Limited ("Phyplus"). Your use of this Software is limited to those
  6. specific rights granted under the terms of the business contract, the
  7. confidential agreement, the non-disclosure agreement and any other forms
  8. of agreements as a customer or a partner of Phyplus. You may not use this
  9. Software unless you agree to abide by the terms of these agreements.
  10. You acknowledge that the Software may not be modified, copied,
  11. distributed or disclosed unless embedded on a Phyplus Bluetooth Low Energy
  12. (BLE) integrated circuit, either as a product or is integrated into your
  13. products. Other than for the aforementioned purposes, you may not use,
  14. reproduce, copy, prepare derivative works of, modify, distribute, perform,
  15. display or sell this Software and/or its documentation for any purposes.
  16. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  17. PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  18. INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  19. NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  20. PHYPLUS OR ITS SUBSIDIARIES BE LIABLE OR OBLIGATED UNDER CONTRACT,
  21. NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  22. LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  23. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  24. OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  25. OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  26. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
  27. **************************************************************************************************/
  28. #ifndef SCANPARAMSERVICE_H
  29. #define SCANPARAMSERVICE_H
  30. #ifdef __cplusplus
  31. extern "C"
  32. {
  33. #endif
  34. /*********************************************************************
  35. * INCLUDES
  36. */
  37. /*********************************************************************
  38. * CONSTANTS
  39. */
  40. // Scan Characteristic Lengths
  41. #define SCAN_INTERVAL_WINDOW_CHAR_LEN 4
  42. #define SCAN_PARAM_REFRESH_LEN 1
  43. // Scan Parameter Refresh Values
  44. #define SCAN_PARAM_REFRESH_REQ 0x00
  45. // Callback events
  46. #define SCAN_INTERVAL_WINDOW_SET 1
  47. // Get/Set parameters
  48. #define SCAN_PARAM_PARAM_INTERVAL 0
  49. #define SCAN_PARAM_PARAM_WINDOW 1
  50. /*********************************************************************
  51. * TYPEDEFS
  52. */
  53. /*********************************************************************
  54. * MACROS
  55. */
  56. /*********************************************************************
  57. * Profile Callbacks
  58. */
  59. // Scan Parameters Service callback function
  60. typedef void (*scanParamServiceCB_t)( uint8 event );
  61. /*********************************************************************
  62. * API FUNCTIONS
  63. */
  64. /*********************************************************************
  65. * @fn ScanParam_AddService
  66. *
  67. * @brief Initializes the Service by registering
  68. * GATT attributes with the GATT server.
  69. *
  70. * @return Success or Failure
  71. */
  72. extern bStatus_t ScanParam_AddService( void );
  73. /*********************************************************************
  74. * @fn ScanParam_Register
  75. *
  76. * @brief Register a callback function with the Scan Parameters Service.
  77. *
  78. * @param pfnServiceCB - Callback function.
  79. *
  80. * @return None.
  81. */
  82. extern void ScanParam_Register( scanParamServiceCB_t pfnServiceCB );
  83. /*********************************************************************
  84. * @fn ScanParam_SetParameter
  85. *
  86. * @brief Set a Scan Parameters Service parameter.
  87. *
  88. * @param param - Profile parameter ID
  89. * @param len - length of data to right
  90. * @param value - pointer to data to write. This is dependent on
  91. * the parameter ID and WILL be cast to the appropriate
  92. * data type (example: data type of uint16 will be cast to
  93. * uint16 pointer).
  94. *
  95. * @return bStatus_t
  96. */
  97. extern bStatus_t ScanParam_SetParameter( uint8 param, uint8 len, void *value );
  98. /*********************************************************************
  99. * @fn ScanParam_GetParameter
  100. *
  101. * @brief Get a Scan Parameters Service parameter.
  102. *
  103. * @param param - Profile parameter ID
  104. * @param value - pointer to data to get. This is dependent on
  105. * the parameter ID and WILL be cast to the appropriate
  106. * data type (example: data type of uint16 will be cast to
  107. * uint16 pointer).
  108. *
  109. * @return bStatus_t
  110. */
  111. extern bStatus_t ScanParam_GetParameter( uint8 param, void *value );
  112. /*********************************************************************
  113. * @fn ScanParam_RefreshNotify
  114. *
  115. * @brief Notify the peer to refresh the scan parameters.
  116. *
  117. * @param connHandle - connection handle
  118. *
  119. * @return None
  120. */
  121. extern void ScanParam_RefreshNotify( uint16 connHandle );
  122. /*********************************************************************
  123. * @fn ScanParam_HandleConnStatusCB
  124. *
  125. * @brief Service link status change handler function.
  126. *
  127. * @param connHandle - connection handle
  128. * @param changeType - type of change
  129. *
  130. * @return none
  131. */
  132. void ScanParam_HandleConnStatusCB( uint16 connHandle, uint8 changeType );
  133. /*********************************************************************
  134. *********************************************************************/
  135. #ifdef __cplusplus
  136. }
  137. #endif
  138. #endif /* SCANPARAMSERVICE_H */