gatttest.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. /**************************************************************************************************
  11. **************************************************************************************************/
  12. #ifndef GATTTEST_H
  13. #define GATTTEST_H
  14. #ifdef __cplusplus
  15. extern "C"
  16. {
  17. #endif
  18. /*********************************************************************
  19. * INCLUDES
  20. */
  21. #include "bcomdef.h"
  22. #include "OSAL.h"
  23. /*********************************************************************
  24. * CONSTANTS
  25. */
  26. // Length of attribute
  27. #define GATT_TEST_ATTR_LEN 20
  28. // Length of long attribute
  29. #define GATT_TEST_LONG_ATTR_LEN 50
  30. // GATT Test Services bit fields
  31. #define GATT_TEST_SERVICE 0x00000001 // GATT Test
  32. #define GATT_BATT_STATE_SERVICE 0x00000002 // Battery State
  33. #define GATT_THERMO_HUMID_SERVICE 0x00000004 // Thermometer Humidity
  34. #define GATT_WEIGHT_SERVICE 0x00000008 // Weight
  35. #define GATT_POSITION_SERVICE 0x00000010 // Position
  36. #define GATT_ALERT_SERVICE 0x00000020 // Alert
  37. #define GATT_MANUFACT_SENSOR_SERVICE 0x00000040 // Sensor Manufacturer
  38. #define GATT_MANUFACT_SCALES_SERVICE 0x00000080 // Scales Manufacturer
  39. #define GATT_ADDRESS_SERVICE 0x00000100 // Address
  40. #define GATT_128BIT_UUID1_SERVICE 0x00000200 // 128-bit UUID 1
  41. #define GATT_128BIT_UUID2_SERVICE 0x00000400 // 128-bit UUID 2
  42. #define GATT_128BIT_UUID3_SERVICE 0x00000800 // 128-bit UUID 3
  43. /*********************************************************************
  44. * VARIABLES
  45. */
  46. /*********************************************************************
  47. * MACROS
  48. */
  49. /*********************************************************************
  50. * TYPEDEFS
  51. */
  52. /*********************************************************************
  53. * VARIABLES
  54. */
  55. /*********************************************************************
  56. * FUNCTIONS
  57. */
  58. /**
  59. * @brief Add function for the GATT Test Services.
  60. *
  61. * @param services - services to add. This is a bit map and can
  62. * contain more than one service.
  63. *
  64. * @return SUCCESS: Service added successfully.
  65. * INVALIDPARAMETER: Invalid service field.
  66. * FAILURE: Not enough attribute handles available.
  67. * bleMemAllocError: Memory allocation error occurred.
  68. */
  69. extern bStatus_t GATTTest_AddService( uint32 services );
  70. /**
  71. * @brief Delete function for the GATT Test Services.
  72. *
  73. * @param services - services to delete. This is a bit map and can
  74. * contain more than one service.
  75. *
  76. * @return SUCCESS: Service deleted successfully.
  77. * FAILURE: Service not found.
  78. */
  79. extern bStatus_t GATTTest_DelService( uint32 services );
  80. /*-------------------------------------------------------------------
  81. * TASK API - These functions must only be called by OSAL.
  82. */
  83. /**
  84. * @internal
  85. *
  86. * @brief Initialize the GATT Test Application.
  87. *
  88. * @param taskId - Task identifier for the desired task
  89. *
  90. * @return void
  91. *
  92. */
  93. extern void GATTTest_Init( uint8 taskId );
  94. /**
  95. * @internal
  96. *
  97. * @brief GATT Test Application Task event processor. This function
  98. * is called to process all events for the task. Events include
  99. * timers, messages and any other user defined events.
  100. *
  101. * @param task_id - The OSAL assigned task ID.
  102. * @param events - events to process. This is a bit map and can
  103. * contain more than one event.
  104. *
  105. * @return none
  106. */
  107. extern uint16 GATTTest_ProcessEvent( uint8 task_id, uint16 events );
  108. /**
  109. * @brief Add function for the GATT Qualification Services.
  110. *
  111. * @param services - services to add. This is a bit map and can
  112. * contain more than one service.
  113. *
  114. * @return SUCCESS: Service added successfully.
  115. * INVALIDPARAMETER: Invalid service field.
  116. * FAILURE: Not enough attribute handles available.
  117. * bleMemAllocError: Memory allocation error occurred.
  118. */
  119. extern bStatus_t GATTQual_AddService( uint32 services );
  120. /**
  121. * @brief Delete function for the GATT Qualification Services.
  122. *
  123. * @param services - services to delete. This is a bit map and can
  124. * contain more than one service.
  125. *
  126. * @return SUCCESS: Service deleted successfully.
  127. * FAILURE: Service not found.
  128. */
  129. extern bStatus_t GATTQual_DelService( uint32 services );
  130. /*********************************************************************
  131. *********************************************************************/
  132. #ifdef __cplusplus
  133. }
  134. #endif
  135. #endif /* GATTTEST_H */