simpleGATTprofile.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /**************************************************************************************************
  2. Filename: simpleGATTprofile.h
  3. Revised: $Date: 2010-08-06 08:56:11 -0700 (Fri, 06 Aug 2010) $
  4. Revision: $Revision: 23333 $
  5. Description: This file contains the Simple GATT profile definitions and
  6. prototypes.
  7. Copyright 2010 - 2013 Texas Instruments Incorporated. All rights reserved.
  8. IMPORTANT: Your use of this Software is limited to those specific rights
  9. granted under the terms of a software license agreement between the user
  10. who downloaded the software, his/her employer (which must be your employer)
  11. and Texas Instruments Incorporated (the "License"). You may not use this
  12. Software unless you agree to abide by the terms of the License. The License
  13. limits your use, and you acknowledge, that the Software may not be modified,
  14. copied or distributed unless embedded on a Texas Instruments microcontroller
  15. or used solely and exclusively in conjunction with a Texas Instruments radio
  16. frequency transceiver, which is integrated into your product. Other than for
  17. the foregoing purpose, you may not use, reproduce, copy, prepare derivative
  18. works of, modify, distribute, perform, display or sell this Software and/or
  19. its documentation for any purpose.
  20. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  21. PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  22. INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  23. NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  24. TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
  25. NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  26. LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  27. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  28. OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  29. OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  30. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
  31. Should you have any questions regarding your right to use this Software,
  32. contact Texas Instruments Incorporated at www.TI.com.
  33. **************************************************************************************************/
  34. #ifndef SIMPLEGATTPROFILE_H
  35. #define SIMPLEGATTPROFILE_H
  36. #ifdef __cplusplus
  37. extern "C"
  38. {
  39. #endif
  40. /*********************************************************************
  41. * INCLUDES
  42. */
  43. /*********************************************************************
  44. * CONSTANTS
  45. */
  46. // Profile Parameters
  47. #define SIMPLEPROFILE_CHAR1 0 // RW uint8 - Profile Characteristic 1 value
  48. #define SIMPLEPROFILE_CHAR2 1 // RW uint8 - Profile Characteristic 2 value
  49. #define SIMPLEPROFILE_CHAR3 2 // RW uint8 - Profile Characteristic 3 value
  50. #define SIMPLEPROFILE_CHAR4 3 // RW uint8 - Profile Characteristic 4 value
  51. #define SIMPLEPROFILE_CHAR5 4 // RW uint8 - Profile Characteristic 4 value
  52. // Simple Profile Service UUID
  53. #define SIMPLEPROFILE_SERV_UUID 0xFFF0
  54. // Key Pressed UUID
  55. #define SIMPLEPROFILE_CHAR1_UUID 0xFFF1
  56. #define SIMPLEPROFILE_CHAR2_UUID 0xFFF2
  57. #define SIMPLEPROFILE_CHAR3_UUID 0xFFF3
  58. #define SIMPLEPROFILE_CHAR4_UUID 0xFFF4
  59. #define SIMPLEPROFILE_CHAR5_UUID 0xFFF5
  60. // Simple Keys Profile Services bit fields
  61. #define SIMPLEPROFILE_SERVICE 0x00000001
  62. // Length of Characteristic 5 in bytes
  63. #define SIMPLEPROFILE_CHAR5_LEN 5
  64. #define IBEACON_UUID_LEN 16
  65. /*********************************************************************
  66. * TYPEDEFS
  67. */
  68. /*********************************************************************
  69. * MACROS
  70. */
  71. /*********************************************************************
  72. * Profile Callbacks
  73. */
  74. // Callback when a characteristic value has changed
  75. typedef void (*simpleProfileChange_t)( uint8 paramID );
  76. typedef struct
  77. {
  78. simpleProfileChange_t pfnSimpleProfileChange; // Called when characteristic value changes
  79. } simpleProfileCBs_t;
  80. /*********************************************************************
  81. * API FUNCTIONS
  82. */
  83. /*
  84. * SimpleProfile_AddService- Initializes the Simple GATT Profile service by registering
  85. * GATT attributes with the GATT server.
  86. *
  87. * @param services - services to add. This is a bit map and can
  88. * contain more than one service.
  89. */
  90. extern bStatus_t SimpleProfile_AddService( uint32 services );
  91. /*
  92. * SimpleProfile_RegisterAppCBs - Registers the application callback function.
  93. * Only call this function once.
  94. *
  95. * appCallbacks - pointer to application callbacks.
  96. */
  97. extern bStatus_t SimpleProfile_RegisterAppCBs( simpleProfileCBs_t *appCallbacks );
  98. /*
  99. * SimpleProfile_SetParameter - Set a Simple GATT Profile parameter.
  100. *
  101. * param - Profile parameter ID
  102. * len - length of data to right
  103. * value - pointer to data to write. This is dependent on
  104. * the parameter ID and WILL be cast to the appropriate
  105. * data type (example: data type of uint16 will be cast to
  106. * uint16 pointer).
  107. */
  108. extern bStatus_t SimpleProfile_SetParameter( uint8 param, uint8 len, void *value );
  109. /*
  110. * SimpleProfile_GetParameter - Get a Simple GATT Profile parameter.
  111. *
  112. * param - Profile parameter ID
  113. * value - pointer to data to write. This is dependent on
  114. * the parameter ID and WILL be cast to the appropriate
  115. * data type (example: data type of uint16 will be cast to
  116. * uint16 pointer).
  117. */
  118. extern bStatus_t SimpleProfile_GetParameter( uint8 param, void *value );
  119. /*********************************************************************
  120. *********************************************************************/
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124. #endif /* SIMPLEGATTPROFILE_H */