gatt_internal.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. **************************************************************************************************/
  30. #ifndef GATT_INTERNAL_H
  31. #define GATT_INTERNAL_H
  32. #ifdef __cplusplus
  33. extern "C"
  34. {
  35. #endif
  36. /*********************************************************************
  37. * INCLUDES
  38. */
  39. #include "osal_cbTimer.h"
  40. #include "att.h"
  41. #include "gatt.h"
  42. /*********************************************************************
  43. * MACROS
  44. */
  45. #define TIMER_VALID( id ) ( ( (id) != INVALID_TIMER_ID ) && \
  46. ( (id) != TIMEOUT_TIMER_ID ) )
  47. #define TIMER_STATUS( id ) ( (id) == TIMEOUT_TIMER_ID ? bleTimeout : \
  48. (id) == INVALID_TIMER_ID ? SUCCESS : blePending )
  49. /*********************************************************************
  50. * CONSTANTS
  51. */
  52. /*********************************************************************
  53. * TYPEDEFS
  54. */
  55. // Srtucture for Attribute Version Information attribute
  56. typedef struct
  57. {
  58. uint8 attVersion; // Attribute Protocol Version
  59. uint8 gattVersion; // Generic Attribute Profile Version
  60. uint16 manufacturerName; // Manufacturer Name
  61. } gattVersionInfo_t;
  62. // Function prototype to parse an attribute protocol request message
  63. typedef bStatus_t (*gattParseReq_t)( uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg );
  64. // Function prototype to parse an attribute protocol response message
  65. typedef bStatus_t (*gattParseRsp_t)( uint8 *pParams, uint16 len, attMsg_t *pMsg );
  66. // Function prototype to process an attribute protocol message
  67. typedef bStatus_t (*gattProcessMsg_t)( uint16 connHandle, attPacket_t *pPkt );
  68. // Function prototype to process an attribute protocol request message
  69. typedef bStatus_t (*gattProcessReq_t)( uint16 connHandle, attMsg_t *pMsg );
  70. /*********************************************************************
  71. * VARIABLES
  72. */
  73. extern uint8 gattTaskID;
  74. /*********************************************************************
  75. * FUNCTIONS
  76. */
  77. extern void gattRegisterServer( gattProcessMsg_t pfnProcessMsg );
  78. extern void gattRegisterClient( gattProcessMsg_t pfnProcessMsg );
  79. extern bStatus_t gattNotifyEvent( uint8 taskId, uint16 connHandle, uint8 status,
  80. uint8 method, gattMsg_t *pMsg );
  81. extern void gattStartTimer( pfnCbTimer_t pfnCbTimer, uint8 *pData,
  82. uint16 timeout, uint8 *pTimerId );
  83. extern void gattStopTimer( uint8 *pTimerId );
  84. /*********************************************************************
  85. *********************************************************************/
  86. #ifdef __cplusplus
  87. }
  88. #endif
  89. #endif /* GATT_INTERNAL_H */