1212
1313/**
1414 * @brief Generic Attribute Profile (GATT)
15+ * @details The GATT layer manages the service database by providing APIs for
16+ * service registration and attribute declaration. For more
17+ * information, see @ref bt_gatt_client and @ref bt_gatt_server.
1518 * @defgroup bt_gatt Generic Attribute Profile (GATT)
1619 * @ingroup bluetooth
1720 * @{
@@ -222,9 +225,9 @@ typedef ssize_t (*bt_gatt_attr_write_func_t)(struct bt_conn *conn,
222225 * pass the pointer to GATT server APIs.
223226 */
224227struct bt_gatt_attr {
225- /** @brief Attribute Type, aka. "UUID"
228+ /** @brief Attribute Type
226229 *
227- * The Attribute Type determines the interface that can
230+ * The Attribute Type is a UUID which determines the interface that can
228231 * be expected from the read() and write() methods and
229232 * the possible permission configurations.
230233 *
@@ -275,16 +278,13 @@ struct bt_gatt_attr {
275278 */
276279 void * user_data ;
277280
278- /** @brief Attribute Handle or zero, maybe?
281+ /** @brief Attribute Handle
279282 *
280- * The meaning of this field varies and is not specified here.
281- * Some APIs use this field as input/output. It does not always
282- * contain the Attribute Handle.
283+ * The Attribute Handle is an index corresponding to a specific
284+ * Attribute in the ATT database.
283285 *
284286 * @note Use bt_gatt_attr_get_handle() for attributes in the
285287 * local ATT database.
286- *
287- * @sa bt_gatt_discover_func_t about this field.
288288 */
289289 uint16_t handle ;
290290
@@ -294,8 +294,6 @@ struct bt_gatt_attr {
294294 *
295295 * The permissions are security requirements that must be
296296 * satisfied before calling read() or write().
297- *
298- * @sa bt_gatt_discover_func_t about this field.
299297 */
300298 uint16_t perm : 15 ;
301299
@@ -311,39 +309,61 @@ struct bt_gatt_attr {
311309 /** @endcond */
312310};
313311
314- /** @brief GATT Service structure */
312+ /** @brief Static GATT Service structure
313+ *
314+ * Allows the user the declare static GATT Services with the aim of reducing the
315+ * used RAM. The @ref BT_GATT_SERVICE_DEFINE macro can be used to statically
316+ * define and register a service.
317+ */
315318struct bt_gatt_service_static {
316319 /** Service Attributes */
317320 const struct bt_gatt_attr * attrs ;
318321 /** Service Attribute count */
319322 size_t attr_count ;
320323};
321324
322- /** @brief GATT Service structure */
325+ /** @brief GATT Service structure
326+ *
327+ * This structure is used to define GATT services which can be registered and
328+ * unregistered at runtime. See @ref bt_gatt_service_register for when services
329+ * should be registered.
330+ */
323331struct bt_gatt_service {
324332 /** Service Attributes */
325333 struct bt_gatt_attr * attrs ;
326334 /** Service Attribute count */
327335 size_t attr_count ;
328-
336+ /** @cond INTERNAL_HIDDEN
337+ * Field used for list handling.
338+ */
329339 sys_snode_t node ;
340+ /** @endcond */
330341};
331342
332- /** @brief Service Attribute Value. */
343+ /** @brief Service Attribute Value.
344+ *
345+ * This is the data described by the Attribute Type and indexed by the
346+ * Attribute Handle in the database.
347+ */
333348struct bt_gatt_service_val {
334349 /** Service UUID. */
335350 const struct bt_uuid * uuid ;
336- /** Service end handle . */
351+ /** Handle of the last Attribute within the Service . */
337352 uint16_t end_handle ;
338353};
339354
340- /** @brief Include Attribute Value. */
355+ /** @brief Include Attribute Value.
356+ *
357+ * This structure represents an included service attribute in the GATT
358+ * server. An included service is a service that is referenced within another
359+ * service, allowing for the reuse of common service definitions.
360+ */
341361struct bt_gatt_include {
342362 /** Service UUID. */
343363 const struct bt_uuid * uuid ;
344- /** Service start handle . */
364+ /** Handle of the first attribute within the included service . */
345365 uint16_t start_handle ;
346- /** Service end handle . */
366+ /** Handle of the last attribute within the included service . */
347367 uint16_t end_handle ;
348368};
349369
@@ -360,7 +380,11 @@ struct bt_gatt_cb {
360380 */
361381 void (* att_mtu_updated )(struct bt_conn * conn , uint16_t tx , uint16_t rx );
362382
383+ /** @cond INTERNAL_HIDDEN
384+ * Field used for list handling.
385+ */
363386 sys_snode_t node ;
387+ /** @endcond */
364388};
365389
366390/** @brief GATT authorization callback structure. */
@@ -448,23 +472,33 @@ struct bt_gatt_authorization_cb {
448472 */
449473#define BT_GATT_CHRC_EXT_PROP 0x80
450474
451- /** @brief Characteristic Attribute Value. */
475+ /** @brief Attribute Value of a Characteristic Declaration.
476+ *
477+ * This is the data associated with the characteristic, and can be read from or
478+ * written to by a GATT client depending on the characteristic properties.
479+ */
452480struct bt_gatt_chrc {
453481 /** Characteristic UUID. */
454482 const struct bt_uuid * uuid ;
455483 /** Characteristic Value handle. */
456484 uint16_t value_handle ;
457- /** Characteristic properties. */
485+ /** Characteristic properties, a bitmap of ``BT_GATT_CHRC_*`` macros . */
458486 uint8_t properties ;
459487};
460488
461489/** Characteristic Extended Properties Bit field values */
462490#define BT_GATT_CEP_RELIABLE_WRITE 0x0001
463491#define BT_GATT_CEP_WRITABLE_AUX 0x0002
464492
465- /** @brief Characteristic Extended Properties Attribute Value. */
493+ /** @brief Characteristic Extended Properties Attribute Value.
494+ *
495+ * Used in the discovery of standard characteristic descriptor values. Shall
496+ * exist if the @ref BT_GATT_CHRC_EXT_PROP bit is set in the characteristic
497+ * properties. Can be used with the @ref BT_GATT_CEP macro to declare the CEP
498+ * descriptor.
499+ */
466500struct bt_gatt_cep {
467- /** Characteristic Extended properties */
501+ /** Characteristic Extended properties, a bitmap of ``BT_GATT_CEP_*`` macros. */
468502 uint16_t properties ;
469503};
470504
@@ -483,9 +517,12 @@ struct bt_gatt_cep {
483517 */
484518#define BT_GATT_CCC_INDICATE 0x0002
485519
486- /** Client Characteristic Configuration Attribute Value */
520+ /** @brief Client Characteristic Configuration Attribute Value
521+ *
522+ * Used in the discovery of standard characteristic descriptor values.
523+ */
487524struct bt_gatt_ccc {
488- /** Client Characteristic Configuration flags */
525+ /** Client Characteristic Configuration flags, a bitmap of ``BT_GATT_CCC_*`` macros. */
489526 uint16_t flags ;
490527};
491528
@@ -499,25 +536,52 @@ struct bt_gatt_ccc {
499536 */
500537#define BT_GATT_SCC_BROADCAST 0x0001
501538
502- /** Server Characteristic Configuration Attribute Value */
539+ /** @brief Server Characteristic Configuration Attribute Value
540+ *
541+ * Used in the discovery of standard characteristic descriptor values.
542+ */
503543struct bt_gatt_scc {
504- /** Server Characteristic Configuration flags */
544+ /** Server Characteristic Configuration flags, a bitmap of ``BT_GATT_SCC_*`` macros. */
505545 uint16_t flags ;
506546};
507547
508- /** @brief GATT Characteristic Presentation Format Attribute Value. */
548+ /** @brief GATT Characteristic Presentation Format Attribute Value.
549+ *
550+ * Used in the discovery of standard characteristic descriptor values. Can be
551+ * used with the @ref BT_GATT_CPF macro to declare the CPF descriptor.
552+ */
509553struct bt_gatt_cpf {
510- /** Format of the value of the characteristic */
554+ /** @brief Format of the value of the characteristic.
555+ *
556+ * The format types can be found in section 2.4.1 of the Bluetooth SIG
557+ * Assigned Numbers document.
558+ */
511559 uint8_t format ;
512- /** Exponent field to determine how the value of this characteristic is
513- * further formatted
560+ /** @brief Exponent field for value formatting.
561+ *
562+ * Only used on integer format types.
563+ * actual value = Characteristic Value x 10^Exponent
514564 */
515565 int8_t exponent ;
516- /** Unit of the characteristic */
566+ /** @brief UUID of the unit of the characteristic.
567+ *
568+ * The units can be found in section 3.5 of the Bluetooth SIG Assigned
569+ * Numbers document.
570+ */
517571 uint16_t unit ;
518- /** Name space of the description */
572+ /** @brief Name space of the description.
573+ *
574+ * Used to identify the organization that is responsible for defining
575+ * the enumerations for the description field. See section 2.4.2 of the
576+ * Bluetooth SIG Assigned Numbers document.
577+ */
519578 uint8_t name_space ;
520- /** Description of the characteristic as defined in a higher layer profile */
579+ /** @brief Description of the characteristic as defined in a higher layer profile.
580+ *
581+ * An enumerated value defined by the organization identified by the
582+ * name_space field. See section 2.4.2.1 of the Bluetooth SIG Assigned
583+ * Numbers document.
584+ */
521585 uint16_t description ;
522586};
523587
@@ -721,8 +785,8 @@ uint16_t bt_gatt_attr_get_handle(const struct bt_gatt_attr *attr);
721785 *
722786 * @param attr A Characteristic Attribute.
723787 *
724- * @note The ``user_data`` of the attribute must of type @ref bt_gatt_chrc and the ``uuid`` shall be
725- * BT_UUID_GATT_CHRC
788+ * @note The ``user_data`` of the attribute must be of type @ref bt_gatt_chrc and the ``uuid`` shall
789+ * be BT_UUID_GATT_CHRC.
726790 *
727791 * @return the handle of the corresponding Characteristic Value. The value will
728792 * be zero (the invalid handle) if @p attr was not a characteristic
@@ -1722,6 +1786,7 @@ struct bt_gatt_discover_params {
17221786 /** Discover attribute callback */
17231787 bt_gatt_discover_func_t func ;
17241788 union {
1789+ /** See @ref bt_gatt_include for more on included services. */
17251790 struct {
17261791 /** Include service attribute declaration handle */
17271792 uint16_t attr_handle ;
@@ -1841,9 +1906,9 @@ struct bt_gatt_read_params {
18411906 bool variable ;
18421907 } multiple ;
18431908 struct {
1844- /** First requested handle number . */
1909+ /** Attribute handle to start reading from . */
18451910 uint16_t start_handle ;
1846- /** Last requested handle number . */
1911+ /** Attribute handle to stop reading at . */
18471912 uint16_t end_handle ;
18481913 /** 2 or 16 octet UUID. */
18491914 const struct bt_uuid * uuid ;
@@ -2133,7 +2198,11 @@ struct bt_gatt_subscribe_params {
21332198 /** Subscription flags */
21342199 ATOMIC_DEFINE (flags , BT_GATT_SUBSCRIBE_NUM_FLAGS );
21352200
2201+ /** @cond INTERNAL_HIDDEN
2202+ * Field used for list handling.
2203+ */
21362204 sys_snode_t node ;
2205+ /** @endcond */
21372206#if defined(CONFIG_BT_EATT ) || defined(__DOXYGEN__ )
21382207 /** Att channel options. */
21392208 enum bt_att_chan_opt chan_opt ;
0 commit comments