gatttest.h 6.5 KB

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