simpleGATTprofile_ota.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. Filename: simpleGATTprofile.h
  30. Revised:
  31. Revision:
  32. Description: This file contains the Simple GATT profile definitions and
  33. prototypes.
  34. **************************************************************************************************/
  35. #ifndef SIMPLEGATTPROFILE_OTA_H
  36. #define SIMPLEGATTPROFILE_OTA_H
  37. #ifdef __cplusplus
  38. extern "C"
  39. {
  40. #endif
  41. /*********************************************************************
  42. * INCLUDES
  43. */
  44. /*********************************************************************
  45. * CONSTANTS
  46. */
  47. // Profile Parameters
  48. #define SIMPLEPROFILE_CHAR1 0 // RW uint8 - Profile Characteristic 1 value
  49. #define SIMPLEPROFILE_CHAR2 1 // RW uint8 - Profile Characteristic 2 value
  50. #define SIMPLEPROFILE_CHAR3 2 // RW uint8 - Profile Characteristic 3 value
  51. #define SIMPLEPROFILE_CHAR4 3 // RW uint8 - Profile Characteristic 4 value
  52. #define SIMPLEPROFILE_CHAR5 4 // RW uint8 - Profile Characteristic 4 value
  53. #define SIMPLEPROFILE_CHAR6 5 // RW uint8 - Profile Characteristic 4 value
  54. // Simple Profile Service UUID
  55. #define SIMPLEPROFILE_SERV_UUID 0xFFF0
  56. // Key Pressed UUID
  57. #define SIMPLEPROFILE_CHAR1_UUID 0xFFF1
  58. #define SIMPLEPROFILE_CHAR2_UUID 0xFFF2
  59. #define SIMPLEPROFILE_CHAR3_UUID 0xFFF3
  60. #define SIMPLEPROFILE_CHAR4_UUID 0xFFF4
  61. #define SIMPLEPROFILE_CHAR5_UUID 0xFFF5
  62. #define SIMPLEPROFILE_CHAR6_UUID 0xFFF6
  63. // Simple Keys Profile Services bit fields
  64. #define SIMPLEPROFILE_SERVICE 0x00000001
  65. // Length of Characteristic 5 in bytes
  66. //#define SIMPLEPROFILE_CHAR5_LEN 5
  67. #define IBEACON_UUID_LEN 16
  68. /*********************************************************************
  69. * TYPEDEFS
  70. */
  71. /*********************************************************************
  72. * MACROS
  73. */
  74. /*********************************************************************
  75. * Profile Callbacks
  76. */
  77. // Callback when a characteristic value has changed
  78. typedef void (*simpleProfileChange_t)( uint8 paramID );
  79. typedef struct
  80. {
  81. simpleProfileChange_t pfnSimpleProfileChange; // Called when characteristic value changes
  82. } simpleProfileCBs_t;
  83. /*********************************************************************
  84. * API FUNCTIONS
  85. */
  86. /*
  87. * SimpleProfile_AddService- Initializes the Simple GATT Profile service by registering
  88. * GATT attributes with the GATT server.
  89. *
  90. * @param services - services to add. This is a bit map and can
  91. * contain more than one service.
  92. */
  93. extern bStatus_t SimpleProfile_AddService( uint32 services );
  94. /*
  95. * SimpleProfile_RegisterAppCBs - Registers the application callback function.
  96. * Only call this function once.
  97. *
  98. * appCallbacks - pointer to application callbacks.
  99. */
  100. extern bStatus_t SimpleProfile_RegisterAppCBs( simpleProfileCBs_t *appCallbacks );
  101. /*
  102. * SimpleProfile_SetParameter - Set a Simple GATT Profile parameter.
  103. *
  104. * param - Profile parameter ID
  105. * len - length of data to right
  106. * value - pointer to data to write. This is dependent on
  107. * the parameter ID and WILL be cast to the appropriate
  108. * data type (example: data type of uint16 will be cast to
  109. * uint16 pointer).
  110. */
  111. extern bStatus_t SimpleProfile_SetParameter( uint8 param, uint8 len, void *value );
  112. /*
  113. * SimpleProfile_GetParameter - Get a Simple GATT Profile parameter.
  114. *
  115. * param - Profile parameter ID
  116. * value - pointer to data to write. This is dependent on
  117. * the parameter ID and WILL be cast to the appropriate
  118. * data type (example: data type of uint16 will be cast to
  119. * uint16 pointer).
  120. */
  121. extern bStatus_t SimpleProfile_GetParameter( uint8 param, void *value );
  122. extern bStatus_t simpleProfile_Notify( uint8 param, uint8 len, void *value );
  123. /*********************************************************************
  124. *********************************************************************/
  125. #ifdef __cplusplus
  126. }
  127. #endif
  128. #endif /* SIMPLEGATTPROFILE_H */