Skip to content

Commit 531ef11

Browse files
committed
Bluetooth:Doc: Clarify GATT API
Clarifies what does start_handle and end_handle means in the GATT API. Signed-off-by: Omkar Kulkarni <[email protected]>
1 parent 2efc859 commit 531ef11

File tree

1 file changed

+55
-13
lines changed
  • include/zephyr/bluetooth

1 file changed

+55
-13
lines changed

include/zephyr/bluetooth/gatt.h

+55-13
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,9 @@ struct bt_gatt_service_val {
330330
struct bt_gatt_include {
331331
/** Service UUID. */
332332
const struct bt_uuid *uuid;
333-
/** Service start handle. */
333+
/** Starting attribute handle for included service. */
334334
uint16_t start_handle;
335-
/** Service end handle. */
335+
/** Ending attribute handle for included service. */
336336
uint16_t end_handle;
337337
};
338338

@@ -633,8 +633,8 @@ typedef uint8_t (*bt_gatt_attr_func_t)(const struct bt_gatt_attr *attr,
633633
*
634634
* Iterate attributes in the given range matching given UUID and/or data.
635635
*
636-
* @param start_handle Start handle.
637-
* @param end_handle End handle.
636+
* @param start_handle Starting attribute handle.
637+
* @param end_handle Ending attribute handle.
638638
* @param uuid UUID to match, passing NULL skips UUID matching.
639639
* @param attr_data Attribute data to match, passing NULL skips data matching.
640640
* @param num_matches Number matches, passing 0 makes it unlimited.
@@ -651,8 +651,8 @@ void bt_gatt_foreach_attr_type(uint16_t start_handle, uint16_t end_handle,
651651
*
652652
* Iterate attributes in the given range.
653653
*
654-
* @param start_handle Start handle.
655-
* @param end_handle End handle.
654+
* @param start_handle Starting attribute handle.
655+
* @param end_handle Ending attribute handle.
656656
* @param func Callback function.
657657
* @param user_data Data to pass to the callback.
658658
*/
@@ -1657,15 +1657,33 @@ struct bt_gatt_discover_params {
16571657
struct {
16581658
/** Include service attribute declaration handle */
16591659
uint16_t attr_handle;
1660-
/** Included service start handle */
1660+
/** Starting attribute handle for included service */
16611661
uint16_t start_handle;
1662-
/** Included service end handle */
1662+
/** Ending attribute handle for included service */
16631663
uint16_t end_handle;
16641664
} _included;
1665-
/** Discover start handle */
1665+
/** Starting attribute handle to begin discovery
1666+
*
1667+
* @note When discovery begins in @ref bt_conn_cb.connected
1668+
* callback this is typically set to
1669+
* @ref BT_ATT_FIRST_ATTRIBUTE_HANDLE. During discovery
1670+
* process this should be set to the next handle value of
1671+
* the recently discovered attribute (e.g.
1672+
* @ref bt_gatt_attr.handle + 1) and discover attribute
1673+
* callback should return @ref BT_GATT_ITER_CONTINUE to
1674+
* continue discovery or @ref BT_GATT_ITER_STOP to stop
1675+
* discovery.
1676+
* During iterative discovery of attributes by service types,
1677+
* this handle is incremented internally by stack.
1678+
*/
16661679
uint16_t start_handle;
16671680
};
1668-
/** Discover end handle */
1681+
/** Ending attribute handle to stop discovery at
1682+
*
1683+
* @note When discovery begins this can be set to
1684+
* @ref BT_ATT_LAST_ATTRIBUTE_HANDLE to discover all attributes
1685+
* in the service.
1686+
*/
16691687
uint16_t end_handle;
16701688
/** Discover type */
16711689
uint8_t type;
@@ -1772,9 +1790,33 @@ struct bt_gatt_read_params {
17721790
bool variable;
17731791
} multiple;
17741792
struct {
1775-
/** First requested handle number. */
1793+
/** First requested attribute handle number.
1794+
*
1795+
* @note The starting handle is set to the starting
1796+
* point of the range over which this read should
1797+
* be performed. For example, this could be set to
1798+
* @ref BT_ATT_FIRST_ATTRIBUTE_HANDLE to set the
1799+
* starting point of the range at the beginning of
1800+
* the GATT database, or to the starting handle of a
1801+
* service after discovery.
1802+
*
1803+
* @note This value is also automatically
1804+
* incremented by the stack after processing each
1805+
* matching handle-value pair returned by the
1806+
* server.
1807+
*/
17761808
uint16_t start_handle;
1777-
/** Last requested handle number. */
1809+
/** Last requested attribute handle number.
1810+
*
1811+
* @note The ending handle is set to the ending
1812+
* point of the range over which this read should
1813+
* be performed. For example, this could be set to
1814+
* @ref BT_ATT_LAST_ATTRIBUTE_HANDLE to set the
1815+
* ending point of the range at the end of the GATT
1816+
* database, or to the end handle service after discovery
1817+
* where the end_handle is available in the
1818+
* @ref bt_gatt_service_val.
1819+
*/
17781820
uint16_t end_handle;
17791821
/** 2 or 16 octet UUID. */
17801822
const struct bt_uuid *uuid;
@@ -1789,7 +1831,7 @@ struct bt_gatt_read_params {
17891831

17901832
/** @brief Read Attribute Value by handle
17911833
*
1792-
* This procedure read the attribute value and return it to the callback.
1834+
* This procedure reads the attribute value and returns it to the callback.
17931835
*
17941836
* When reading attributes by UUID the callback can be called multiple times
17951837
* depending on how many instances of given the UUID exists with the

0 commit comments

Comments
 (0)