ppsp_serv.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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_SERV_CFGS_CHAR_FED4_DLEN 256
  38. #define PPSP_SERV_CFGS_CHAR_FED5_DLEN 256
  39. #define PPSP_SERV_CFGS_CHAR_FED6_DLEN 256
  40. #define PPSP_SERV_CFGS_CHAR_FED7_DLEN 256
  41. #define PPSP_SERV_CFGS_CHAR_FED8_DLEN 256
  42. /*********************************************************************
  43. * TYPEDEFS
  44. */
  45. #include "bcomdef.h"
  46. /*********************************************************************
  47. * MACROS
  48. */
  49. /*********************************************************************
  50. * Profile Callbacks
  51. */
  52. // Callback when a characteristic value has changed
  53. typedef void (*ppsp_serv_hdlr_char_upda_t)( uint8 para, uint8 coun );
  54. typedef struct {
  55. ppsp_serv_hdlr_char_upda_t char_upda; // Called when characteristic value changes
  56. } ppsp_serv_appl_CBs_t;
  57. /*********************************************************************
  58. * API FUNCTIONS
  59. */
  60. /*
  61. * SimpleProfile_AddService- Initializes the Simple GATT Profile service by registering
  62. * GATT attributes with the GATT server.
  63. *
  64. * @param services - services to add. This is a bit map and can
  65. * contain more than one service.
  66. */
  67. extern bStatus_t ppsp_serv_add_serv(uint32 serv);
  68. /*
  69. * SimpleProfile_RegisterAppCBs - Registers the application callback function.
  70. * Only call this function once.
  71. *
  72. * appCallbacks - pointer to application callbacks.
  73. */
  74. extern bStatus_t ppsp_serv_reg_appl( ppsp_serv_appl_CBs_t *appl_hdlr );
  75. /*
  76. * SimpleProfile_SetParameter - Set a Simple GATT Profile parameter.
  77. *
  78. * param - Profile parameter ID
  79. * len - length of data to right
  80. * value - pointer to data to write. This is dependent on
  81. * the parameter ID and WILL be cast to the appropriate
  82. * data type (example: data type of uint16 will be cast to
  83. * uint16 pointer).
  84. */
  85. extern bStatus_t ppsp_serv_set_para( uint8 para, uint8 leng, void *valu );
  86. /*
  87. * SimpleProfile_GetParameter - Get a Simple GATT Profile parameter.
  88. *
  89. * param - Profile parameter ID
  90. * value - pointer to data to write. This is dependent on
  91. * the parameter ID and WILL be cast to the appropriate
  92. * data type (example: data type of uint16 will be cast to
  93. * uint16 pointer).
  94. */
  95. extern bStatus_t ppsp_serv_get_para( uint8 para, void *valu, uint8 leng );
  96. // extern bStatus_t simpleProfile_Notify( uint8 param, uint8 len, void *value );
  97. /*********************************************************************
  98. *********************************************************************/
  99. #ifdef __cplusplus
  100. }
  101. #endif
  102. #endif /* SIMPLEGATTPROFILE_H */