AudioGATTprofile.h 6.0 KB

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