AudioGATTprofile.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. Filename: AudioGATTprofile.h
  12. Revised:
  13. Revision:
  14. Description: This file contains the Simple GATT profile definitions and
  15. prototypes.
  16. **************************************************************************************************/
  17. #ifndef AUDIOGATTPROFILE_H
  18. #define AUDIOGATTPROFILE_H
  19. #ifdef __cplusplus
  20. extern "C"
  21. {
  22. #endif
  23. /*********************************************************************
  24. * INCLUDES
  25. */
  26. /*********************************************************************
  27. * CONSTANTS
  28. */
  29. // Profile Parameters
  30. #define AUDIOPROFILE_CHAR1 0 // RW uint8 - Profile Characteristic 1 value
  31. #define AUDIOPROFILE_CHAR2 1 // RW uint8 - Profile Characteristic 2 value
  32. //product id
  33. #define PRODUCT_ID 0x0046
  34. // AUDIO Profile Service UUID
  35. #define AUDIOPROFILE_SERV_UUID 0xB000
  36. // Key Pressed UUID
  37. #define AUDIOPROFILE_CHAR1_UUID 0xB001
  38. #define AUDIOPROFILE_CHAR2_UUID 0xB002
  39. // AUDIO Keys Profile Services bit fields
  40. #define AUDIOPROFILE_SERVICE 0x00000001
  41. #define AUDIOPROFILE_CHAR1_LEN 20
  42. #define AUDIOPROFILE_CHAR2_LEN 20
  43. // Length of Characteristic 5 in bytes
  44. #define AUDIOPROFILE_CHAR5_LEN 5
  45. /*********************************************************************
  46. * TYPEDEFS
  47. */
  48. /*********************************************************************
  49. * MACROS
  50. */
  51. /*********************************************************************
  52. * Profile Callbacks
  53. */
  54. // Callback when a characteristic value has changed
  55. typedef void (*AudioProfileChange_t)( uint8 paramID );
  56. typedef struct
  57. {
  58. AudioProfileChange_t pfnAudioProfileChange; // Called when characteristic value changes
  59. } AudioProfileCBs_t;
  60. /*********************************************************************
  61. * API FUNCTIONS
  62. */
  63. /*
  64. * AudioProfile_AddService- Initializes the Audio GATT Profile service by registering
  65. * GATT attributes with the GATT server.
  66. *
  67. * @param services - services to add. This is a bit map and can
  68. * contain more than one service.
  69. */
  70. extern bStatus_t AudioProfile_AddService( uint32 services );
  71. /*
  72. * AudioProfile_RegisterAppCBs - Registers the application callback function.
  73. * Only call this function once.
  74. *
  75. * appCallbacks - pointer to application callbacks.
  76. */
  77. extern bStatus_t AudioProfile_RegisterAppCBs( AudioProfileCBs_t *appCallbacks );
  78. /*
  79. * AudioProfile_SetParameter - Set a Audio GATT Profile parameter.
  80. *
  81. * param - Profile parameter ID
  82. * len - length of data to right
  83. * value - pointer to data to write. This is dependent on
  84. * the parameter ID and WILL be cast to the appropriate
  85. * data type (example: data type of uint16 will be cast to
  86. * uint16 pointer).
  87. */
  88. extern bStatus_t AudioProfile_SetParameter( uint8 param, uint8 len, void *value );
  89. /*
  90. * AudioProfile_GetParameter - Get a Audio GATT Profile parameter.
  91. *
  92. * param - Profile parameter ID
  93. * value - pointer to data to write. This is dependent on
  94. * the parameter ID and WILL be cast to the appropriate
  95. * data type (example: data type of uint16 will be cast to
  96. * uint16 pointer).
  97. */
  98. extern bStatus_t AudioProfile_GetParameter( uint8 param, void *value );
  99. extern bStatus_t AudioProfile_Notify( uint8 param, uint8 len, void *value );
  100. extern bStatus_t AudioProfile_Read( uint16 connHandle, gattAttribute_t *pAttr,
  101. uint8 *pValue, uint16 *pLen, uint16 offset, uint8 maxLen );
  102. extern bStatus_t AudioProfile_Write( uint16 connHandle, gattAttribute_t *pAttr,
  103. uint8 *pValue, uint8 len, uint16 offset );
  104. /*********************************************************************
  105. *********************************************************************/
  106. #ifdef __cplusplus
  107. }
  108. #endif
  109. #endif /* SIMPLEGATTPROFILE_H */