ppsp_serv.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /**************************************************************************************************
  2. Filename: ppsp_serv.h
  3. Revised:
  4. Revision:
  5. Description: This file contains the Simple GATT profile definitions and
  6. prototypes.
  7. **************************************************************************************************/
  8. #ifndef PPSP_SERV_H
  9. #define PPSP_SERV_H
  10. #ifdef __cplusplus
  11. extern "C"
  12. {
  13. #endif
  14. /*********************************************************************
  15. * INCLUDES
  16. */
  17. /*********************************************************************
  18. * CONSTANTS
  19. */
  20. // Profile Parameters
  21. #define PPSP_SERV_CFGS_CHAR_FFD4_INDX 0 // RW uint8 - Profile Characteristic 1 value
  22. #define PPSP_SERV_CFGS_CHAR_FFD5_INDX 1 // RW uint8 - Profile Characteristic 2 value
  23. #define PPSP_SERV_CFGS_CHAR_FFD6_INDX 2 // RW uint8 - Profile Characteristic 3 value
  24. #define PPSP_SERV_CFGS_CHAR_FFD7_INDX 3 // RW uint8 - Profile Characteristic 4 value
  25. #define PPSP_SERV_CFGS_CHAR_FFD8_INDX 4 // RW uint8 - Profile Characteristic 5 value
  26. // Simple Profile Service UUID
  27. #define PPSP_SERV_CFGS_SERV_FEB3_UUID 0xFEB3
  28. // Key Pressed UUID
  29. #define PPSP_SERV_CFGS_CHAR_FED4_UUID 0xFED4
  30. #define PPSP_SERV_CFGS_CHAR_FED5_UUID 0xFED5
  31. #define PPSP_SERV_CFGS_CHAR_FED6_UUID 0xFED6
  32. #define PPSP_SERV_CFGS_CHAR_FED7_UUID 0xFED7
  33. #define PPSP_SERV_CFGS_CHAR_FED8_UUID 0xFED8
  34. // Simple Keys Profile Services bit fields
  35. #define PPSP_SERV_CFGS_SERV_FEB3_MASK 0x00000001
  36. // Data Length of Characteristic 5 in bytes
  37. #define PPSP_DATA_LEN 520
  38. #define PPSP_SERV_CFGS_CHAR_FED4_DLEN 520
  39. #define PPSP_SERV_CFGS_CHAR_FED5_DLEN 520
  40. #define PPSP_SERV_CFGS_CHAR_FED6_DLEN 520
  41. #define PPSP_SERV_CFGS_CHAR_FED7_DLEN 520
  42. #define PPSP_SERV_CFGS_CHAR_FED8_DLEN 520
  43. /*********************************************************************
  44. * TYPEDEFS
  45. */
  46. #include "bcomdef.h"
  47. /*********************************************************************
  48. * MACROS
  49. */
  50. /*********************************************************************
  51. * Profile Callbacks
  52. */
  53. // Callback when a characteristic value has changed
  54. typedef void (*ppsp_serv_hdlr_char_upda_t)( uint8 para, uint16 coun );
  55. typedef struct {
  56. ppsp_serv_hdlr_char_upda_t char_upda; // Called when characteristic value changes
  57. } ppsp_serv_appl_CBs_t;
  58. /*********************************************************************
  59. * API FUNCTIONS
  60. */
  61. /*
  62. * SimpleProfile_AddService- Initializes the Simple GATT Profile service by registering
  63. * GATT attributes with the GATT server.
  64. *
  65. * @param services - services to add. This is a bit map and can
  66. * contain more than one service.
  67. */
  68. extern bStatus_t ppsp_serv_add_serv(uint32 serv);
  69. /*
  70. * SimpleProfile_RegisterAppCBs - Registers the application callback function.
  71. * Only call this function once.
  72. *
  73. * appCallbacks - pointer to application callbacks.
  74. */
  75. extern bStatus_t ppsp_serv_reg_appl( ppsp_serv_appl_CBs_t *appl_hdlr );
  76. /*
  77. * SimpleProfile_SetParameter - Set a Simple GATT Profile parameter.
  78. *
  79. * param - Profile parameter ID
  80. * len - length of data to right
  81. * value - pointer to data to write. This is dependent on
  82. * the parameter ID and WILL be cast to the appropriate
  83. * data type (example: data type of uint16 will be cast to
  84. * uint16 pointer).
  85. */
  86. extern bStatus_t ppsp_serv_set_para( uint8 para, uint8 leng, void *valu );
  87. /*
  88. * SimpleProfile_GetParameter - Get a Simple GATT Profile parameter.
  89. *
  90. * param - Profile parameter ID
  91. * value - pointer to data to write. This is dependent on
  92. * the parameter ID and WILL be cast to the appropriate
  93. * data type (example: data type of uint16 will be cast to
  94. * uint16 pointer).
  95. */
  96. extern bStatus_t ppsp_serv_get_para( uint8 para, void *valu, uint16 leng );
  97. // extern bStatus_t simpleProfile_Notify( uint8 param, uint8 len, void *value );
  98. /*********************************************************************
  99. *********************************************************************/
  100. #ifdef __cplusplus
  101. }
  102. #endif
  103. #endif /* SIMPLEGATTPROFILE_H */