1 #ifndef GATTM_H_ 2 #define GATTM_H_ 3 4 5 6 /** 7 **************************************************************************************** 8 * @addtogroup GATTM Generic Attribute Profile Manager 9 * @ingroup GATT 10 * @brief Generic Attribute Profile. 11 * 12 * The GATT manager module is responsible for providing an API for all action operations 13 * not related to a connection. It's responsible to managing internal database. 14 * 15 * @{ 16 **************************************************************************************** 17 */ 18 19 /* 20 * INCLUDE FILES 21 **************************************************************************************** 22 */ 23 /* kernel task */ 24 #include "rwip_config.h" 25 26 #if (BLE_CENTRAL || BLE_PERIPHERAL) 27 #include <stdint.h> 28 #include <stdbool.h> 29 30 /* 31 * DEFINES 32 **************************************************************************************** 33 */ 34 35 36 /* 37 * FUNCTION DECLARATIONS 38 **************************************************************************************** 39 */ 40 41 /** 42 **************************************************************************************** 43 * @brief Initialization of the GATT manager module. 44 * This function performs all the initialization steps of the GATT module. 45 * 46 * @param[in] reset true if it's requested by a reset; false if it's boot initialization 47 * 48 **************************************************************************************** 49 */ 50 void gattm_init(bool reset); 51 52 53 /** 54 **************************************************************************************** 55 * @brief Initialize GATT attribute database 56 * 57 * @param[in] start_hdl Service Start Handle 58 * @param[in] svc_chg_en Service Change feature enabled 59 * 60 * @return status code of attribute database initialization 61 * Command status code: 62 * - @ref ATT_ERR_NO_ERROR: If database creation succeeds. 63 * - @ref ATT_ERR_INVALID_HANDLE: If start_hdl given in parameter + nb of attribute override 64 * some existing services handles. 65 * - @ref ATT_ERR_INSUFF_RESOURCE: There is not enough memory to allocate service buffer. 66 * or of new attribute cannot be added because all expected 67 * attributes already add 68 **************************************************************************************** 69 */ 70 uint8_t gattm_init_attr(uint16_t start_hdl, bool svc_chg_en); 71 72 /** 73 **************************************************************************************** 74 * @brief Initialize GATT resources for connection. 75 * 76 * @param[in] conidx connection record index 77 * @param[in] role device role after connection establishment 78 * 79 **************************************************************************************** 80 */ 81 void gattm_create(uint8_t conidx); 82 /** 83 **************************************************************************************** 84 * @brief Cleanup GATT resources for connection 85 * 86 * @param[in] conidx connection record index 87 * 88 **************************************************************************************** 89 */ 90 void gattm_cleanup(uint8_t conidx); 91 92 93 #if (BLE_ATTS) 94 /** 95 **************************************************************************************** 96 * @brief Return the start handle of the GATT service in the database * 97 **************************************************************************************** 98 */ 99 uint16_t gattm_svc_get_start_hdl(void); 100 #endif //(BLE_ATTS) 101 #endif /* (BLE_CENTRAL || BLE_PERIPHERAL) */ 102 103 /// @} GATTM 104 #endif // GATTM_H_ 105