hidkbdservice.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. #ifndef HIDKBDSERVICE_H
  29. #define HIDKBDSERVICE_H
  30. #ifdef __cplusplus
  31. extern "C"
  32. {
  33. #endif
  34. /*********************************************************************
  35. * INCLUDES
  36. */
  37. /*********************************************************************
  38. * CONSTANTS
  39. */
  40. // Number of HID reports defined in the service
  41. #define HID_NUM_REPORTS 7
  42. // HID Report IDs for the service
  43. #define HID_RPT_ID_KEY_IN 0 // Keyboard input report ID
  44. #define HID_RPT_ID_MOUSE_IN 1 // Mouse input report ID
  45. #define HID_RPT_ID_LED_OUT 0 // LED output report ID
  46. #define HID_RPT_ID_FEATURE 0 // Feature report ID
  47. // HID feature flags
  48. #define HID_KBD_FLAGS HID_FLAGS_REMOTE_WAKE
  49. /*********************************************************************
  50. * TYPEDEFS
  51. */
  52. /*********************************************************************
  53. * MACROS
  54. */
  55. /*********************************************************************
  56. * Profile Callbacks
  57. */
  58. /*********************************************************************
  59. * API FUNCTIONS
  60. */
  61. /*********************************************************************
  62. * @fn HidKbd_AddService
  63. *
  64. * @brief Initializes the HID service for keyboard by registering
  65. * GATT attributes with the GATT server.
  66. *
  67. * @param none
  68. *
  69. * @return Success or Failure
  70. */
  71. extern bStatus_t HidKbd_AddService(void);
  72. /*********************************************************************
  73. * @fn HidKbd_SetParameter
  74. *
  75. * @brief Set a HID Kbd parameter.
  76. *
  77. * @param id - HID report ID.
  78. * @param type - HID report type.
  79. * @param uuid - attribute uuid.
  80. * @param len - length of data to right.
  81. * @param pValue - pointer to data to write. This is dependent on
  82. * the input parameters and WILL be cast to the appropriate
  83. * data type (example: data type of uint16 will be cast to
  84. * uint16 pointer).
  85. *
  86. * @return GATT status code.
  87. */
  88. extern uint8 HidKbd_SetParameter( uint8 id, uint8 type, uint16 uuid, uint8 len, void *pValue );
  89. /*********************************************************************
  90. * @fn HidKbd_GetParameter
  91. *
  92. * @brief Get a HID Kbd parameter.
  93. *
  94. * @param id - HID report ID.
  95. * @param type - HID report type.
  96. * @param uuid - attribute uuid.
  97. * @param pLen - length of data to be read.
  98. * @param pValue - pointer to data to get. This is dependent on
  99. * the input parameters and WILL be cast to the appropriate
  100. * data type (example: data type of uint16 will be cast to
  101. * uint16 pointer).
  102. *
  103. * @return GATT status code.
  104. */
  105. extern uint8 HidKbd_GetParameter( uint8 id, uint8 type, uint16 uuid, uint8 *pLen, void *pValue );
  106. /*********************************************************************
  107. *********************************************************************/
  108. #ifdef __cplusplus
  109. }
  110. #endif
  111. #endif /* HIDKBDSERVICE_H */