@@ -573,14 +573,14 @@ void bt_gatt_cb_register(struct bt_gatt_cb *cb);
573573 *
574574 * @param cb Callback struct.
575575 *
576- * @return Zero on success or negative error code otherwise
576+ * @return Zero on success or negative error code otherwise.
577577 */
578578int bt_gatt_authorization_cb_register (const struct bt_gatt_authorization_cb * cb );
579579
580580/** @brief Register GATT service.
581581 *
582- * Register GATT service. Applications can make use of
583- * macros such as ``BT_GATT_PRIMARY_SERVICE``, ``BT_GATT_CHARACTERISTIC``,
582+ * To register a GATT service, applications can make use of macros such as
583+ * ``BT_GATT_PRIMARY_SERVICE``, ``BT_GATT_CHARACTERISTIC``,
584584 * ``BT_GATT_DESCRIPTOR``, etc.
585585 *
586586 * When using @kconfig{CONFIG_BT_SETTINGS} then all services that should have
@@ -621,6 +621,9 @@ int bt_gatt_service_unregister(struct bt_gatt_service *svc);
621621 */
622622bool bt_gatt_service_is_registered (const struct bt_gatt_service * svc );
623623
624+ /** @brief to be used as return values for @ref bt_gatt_attr_func_t and @ref bt_gatt_read_func_t
625+ * type callbacks.
626+ */
624627enum {
625628 BT_GATT_ITER_STOP = 0 ,
626629 BT_GATT_ITER_CONTINUE ,
@@ -645,7 +648,8 @@ typedef uint8_t (*bt_gatt_attr_func_t)(const struct bt_gatt_attr *attr,
645648 * Iterate attributes in the given range matching given UUID and/or data.
646649 *
647650 * @param start_handle Start handle.
648- * @param end_handle End handle.
651+ * @param end_handle End handle. Often set to start_handle + attr_count or
652+ * BT_ATT_LAST_ATTRIBUTE_HANDLE.
649653 * @param uuid UUID to match, passing NULL skips UUID matching.
650654 * @param attr_data Attribute data to match, passing NULL skips data matching.
651655 * @param num_matches Number matches, passing 0 makes it unlimited.
@@ -893,6 +897,16 @@ ssize_t bt_gatt_attr_read_chrc(struct bt_conn *conn,
893897 const struct bt_gatt_attr * attr , void * buf ,
894898 uint16_t len , uint16_t offset );
895899
900+ /** @brief Gatt Characterisitc Initialization Macro.
901+ *
902+ * Helper macro used within the @ref BT_GATT_CHARACTERISTIC macro in the GATT attribute declaration
903+ * to set the attribute user data.
904+ *
905+ * @param _uuid Characteristic attribute uuid.
906+ * @param _handle Characcteristic attribute handle at init.
907+ * @param _props Characteristic attribute properties,
908+ * a bitmap of ``BT_GATT_CHRC_*`` macros.
909+ */
896910#define BT_GATT_CHRC_INIT (_uuid , _handle , _props ) \
897911{ \
898912 .uuid = _uuid, \
@@ -925,6 +939,17 @@ ssize_t bt_gatt_attr_read_chrc(struct bt_conn *conn,
925939 })), \
926940 BT_GATT_ATTRIBUTE(_uuid, _perm, _read, _write, _user_data)
927941
942+ /**
943+ * @brief BT_GATT_CCC_MAX is defined depending on whether
944+ * @kconfig{CONFIG_BT_SETTINGS_CCC_LAZY_LOADING} or @kconfig{CONFIG_BT_CONN} is set.
945+ *
946+ * @kconfig{CONFIG_BT_SETTINGS_CCC_LAZY_LOADING} will set BT_GATT_CCC_MAX to
947+ * @kconfig{CONFIG_BT_MAX_CONN}
948+ * @kconfig{CONFIG_BT_CONN} will set BT_GATT_CCC_MAX to @kconfig{CONFIG_BT_MAX_PAIRED} +
949+ * @kconfig{CONFIG_BT_MAX_CONN}
950+ * If neither are set, BT_GATT_CCC_MAX is 0.
951+ *
952+ */
928953#if defined(CONFIG_BT_SETTINGS_CCC_LAZY_LOADING )
929954 #define BT_GATT_CCC_MAX (CONFIG_BT_MAX_CONN)
930955#elif defined(CONFIG_BT_CONN )
@@ -933,13 +958,21 @@ ssize_t bt_gatt_attr_read_chrc(struct bt_conn *conn,
933958 #define BT_GATT_CCC_MAX 0
934959#endif
935960
936- /** @brief GATT CCC configuration entry. */
961+ /** @brief GATT CCC configuration entry.
962+ *
963+ * bt_gatt_ccc_cfg is used within @ref bt_gatt_attr_read_ccc and @ref bt_gatt_attr_write_ccc to
964+ * read and write the ccc configurations respectively.
965+ *
966+ */
937967struct bt_gatt_ccc_cfg {
938968 /** Local identity, BT_ID_DEFAULT in most cases. */
939969 uint8_t id ;
940970 /** Remote peer address. */
941971 bt_addr_le_t peer ;
942- /** Configuration value. */
972+ /** @brief Configuration value
973+ * Value used to enable or disable notifications or indications for a specific
974+ * characteristic.
975+ */
943976 uint16_t value ;
944977};
945978
@@ -990,8 +1023,6 @@ struct _bt_gatt_ccc {
9901023 * Read CCC attribute value from local database storing the result into buffer
9911024 * after encoding it.
9921025 *
993- * @note Only use this with attributes which user_data is a _bt_gatt_ccc.
994- *
9951026 * @param conn Connection object.
9961027 * @param attr Attribute to read.
9971028 * @param buf Buffer to store the value read.
@@ -1001,6 +1032,11 @@ struct _bt_gatt_ccc {
10011032 * @return number of bytes read in case of success or negative values in
10021033 * case of error.
10031034 */
1035+ /** @cond INTERNAL_HIDDEN
1036+ * @note Only use this with attributes which user_data is a _bt_gatt_ccc.
1037+ * _bt_gatt_ccc being the internal representation of CCC value.
1038+ */
1039+ /** @endcond */
10041040ssize_t bt_gatt_attr_read_ccc (struct bt_conn * conn ,
10051041 const struct bt_gatt_attr * attr , void * buf ,
10061042 uint16_t len , uint16_t offset );
@@ -1009,8 +1045,6 @@ ssize_t bt_gatt_attr_read_ccc(struct bt_conn *conn,
10091045 *
10101046 * Write value in the buffer into CCC attribute.
10111047 *
1012- * @note Only use this with attributes which user_data is a _bt_gatt_ccc.
1013- *
10141048 * @param conn Connection object.
10151049 * @param attr Attribute to read.
10161050 * @param buf Buffer to store the value read.
@@ -1021,6 +1055,11 @@ ssize_t bt_gatt_attr_read_ccc(struct bt_conn *conn,
10211055 * @return number of bytes written in case of success or negative values in
10221056 * case of error.
10231057 */
1058+ /** @cond INTERNAL_HIDDEN
1059+ * @note Only use this with attributes which user_data is a _bt_gatt_ccc.
1060+ * _bt_gatt_ccc being the internal representation of CCC value.
1061+ */
1062+ /** @endcond */
10241063ssize_t bt_gatt_attr_write_ccc (struct bt_conn * conn ,
10251064 const struct bt_gatt_attr * attr , const void * buf ,
10261065 uint16_t len , uint16_t offset , uint8_t flags );
@@ -1140,7 +1179,7 @@ ssize_t bt_gatt_attr_read_cud(struct bt_conn *conn,
11401179 * Read CPF attribute value from local database storing the result into buffer
11411180 * after encoding it.
11421181 *
1143- * @note Only use this with attributes which user_data is a bt_gatt_pf .
1182+ * @note Only use this with attributes which user_data is a @ref bt_gatt_cpf .
11441183 *
11451184 * @param conn Connection object
11461185 * @param attr Attribute to read
@@ -1212,6 +1251,10 @@ ssize_t bt_gatt_attr_read_cpf(struct bt_conn *conn,
12121251 */
12131252typedef void (* bt_gatt_complete_func_t ) (struct bt_conn * conn , void * user_data );
12141253
1254+ /** @brief GATT notification parameters
1255+ *
1256+ * See also @ref bt_gatt_notify_cb and @ref bt_gatt_notify_multiple, using this parameter.
1257+ */
12151258struct bt_gatt_notify_params {
12161259 /** @brief Notification Attribute UUID type
12171260 *
@@ -1233,7 +1276,8 @@ struct bt_gatt_notify_params {
12331276 bt_gatt_complete_func_t func ;
12341277 /** Notification Value callback user data */
12351278 void * user_data ;
1236- #if defined(CONFIG_BT_EATT )
1279+ #if defined(CONFIG_BT_EATT ) || defined(__DOXYGEN__ )
1280+ /** Att channel options. */
12371281 enum bt_att_chan_opt chan_opt ;
12381282#endif /* CONFIG_BT_EATT */
12391283};
@@ -1407,10 +1451,22 @@ typedef void (*bt_gatt_indicate_func_t)(struct bt_conn *conn,
14071451 struct bt_gatt_indicate_params * params ,
14081452 uint8_t err );
14091453
1454+ /** @typedef bt_gatt_indicate_params_destroy_t
1455+ * @brief Callback to destroy or clean up the GATT Indicate Value parameters.
1456+ *
1457+ * This callback function is invoked to clean up any resources associated with the
1458+ * `bt_gatt_indicate_params` structure once the GATT indication operation is completed.
1459+ *
1460+ * @param params Pointer to the GATT Indicate parameters structure to be cleaned up.
1461+ */
14101462typedef void (* bt_gatt_indicate_params_destroy_t )(
14111463 struct bt_gatt_indicate_params * params );
14121464
1413- /** @brief GATT Indicate Value parameters */
1465+ /** @brief GATT Indicate Value parameters
1466+ *
1467+ * See also @ref bt_gatt_indicate, using this parameter.
1468+ *
1469+ */
14141470struct bt_gatt_indicate_params {
14151471 /** @brief Indicate Attribute UUID type
14161472 *
@@ -1434,7 +1490,8 @@ struct bt_gatt_indicate_params {
14341490 uint16_t len ;
14351491 /** Private reference counter */
14361492 uint8_t _ref ;
1437- #if defined(CONFIG_BT_EATT )
1493+ #if defined(CONFIG_BT_EATT ) || defined(__DOXYGEN__ )
1494+ /** Att channel options. */
14381495 enum bt_att_chan_opt chan_opt ;
14391496#endif /* CONFIG_BT_EATT */
14401497};
@@ -1467,10 +1524,9 @@ struct bt_gatt_indicate_params {
14671524int bt_gatt_indicate (struct bt_conn * conn ,
14681525 struct bt_gatt_indicate_params * params );
14691526
1470-
14711527/** @brief Check if connection have subscribed to attribute
14721528 *
1473- * Check if connection has subscribed to attribute value change.
1529+ * Check if the connection has subscribed to an attribute value change.
14741530 *
14751531 * The attribute object can be the so called Characteristic Declaration,
14761532 * which is usually declared with BT_GATT_CHARACTERISTIC followed
@@ -1685,7 +1741,8 @@ struct bt_gatt_discover_params {
16851741 /** Only for stack-internal use, used for automatic discovery. */
16861742 struct bt_gatt_subscribe_params * sub_params ;
16871743#endif /* defined(CONFIG_BT_GATT_AUTO_DISCOVER_CCC) || defined(__DOXYGEN__) */
1688- #if defined(CONFIG_BT_EATT )
1744+ #if defined(CONFIG_BT_EATT ) || defined(__DOXYGEN__ )
1745+ /** Att channel options. */
16891746 enum bt_att_chan_opt chan_opt ;
16901747#endif /* CONFIG_BT_EATT */
16911748};
@@ -1792,7 +1849,8 @@ struct bt_gatt_read_params {
17921849 const struct bt_uuid * uuid ;
17931850 } by_uuid ;
17941851 };
1795- #if defined(CONFIG_BT_EATT )
1852+ #if defined(CONFIG_BT_EATT ) || defined(__DOXYGEN__ )
1853+ /** Att channel options. */
17961854 enum bt_att_chan_opt chan_opt ;
17971855#endif /* CONFIG_BT_EATT */
17981856 /** Internal */
@@ -1867,7 +1925,8 @@ struct bt_gatt_write_params {
18671925 const void * data ;
18681926 /** Length of the data */
18691927 uint16_t length ;
1870- #if defined(CONFIG_BT_EATT )
1928+ #if defined(CONFIG_BT_EATT ) || defined(__DOXYGEN__ )
1929+ /** Att channel options. */
18711930 enum bt_att_chan_opt chan_opt ;
18721931#endif /* CONFIG_BT_EATT */
18731932};
@@ -2075,7 +2134,8 @@ struct bt_gatt_subscribe_params {
20752134 ATOMIC_DEFINE (flags , BT_GATT_SUBSCRIBE_NUM_FLAGS );
20762135
20772136 sys_snode_t node ;
2078- #if defined(CONFIG_BT_EATT )
2137+ #if defined(CONFIG_BT_EATT ) || defined(__DOXYGEN__ )
2138+ /** Att channel options. */
20792139 enum bt_att_chan_opt chan_opt ;
20802140#endif /* CONFIG_BT_EATT */
20812141};
0 commit comments