Generic Attribute Profile (GATT) establishes a hierarchy to organize attributes. They are organized as a GATT Server Profile and are grouped into:
- Services, containing:
- Characteristics, containing:
- Attributes (Declaration, Value, Descriptor (Optional))
- Characteristics, containing:
Service
A collection of data and associated behaviors to accomplish a particular function is called the Service Definition (i.e. a collection of characteristic attributes). Primary services are discovered by a GATT Client via a "GATT Primary Service Discovery Procedure".
Services are classified as Public or Private
Characteristics
As depicted above, characteristics are essentially containers for user data. They contain a minimum of two attributes:
- Characteristic Declaration Attribute
- Metadata for the Value Attribute
- Characteristic Value Attribute
- Contains the data value itself
Declaration attribute permissions are always set to "Read with No Encryption" so as to be always discoverable by a client.
A Characteristic can optionally contain Descriptor Attributes, described below.
Characteristic Descriptors
These are special attributes used to further expand the metadata contained in the Declaration Attribute. Common Descriptor Attributes defined by GATT include:
- Extended Properties
- Contains additional declaration property bits
- Characteristic User Description
- Contains a user-readable description for the characteristic in which it is placed
- Client Characteristic Configuration Descriptor (CCCD)
- A switch, enabling/disabling server-initiated updates
Client Characteristic Configuration Descriptor (CCCD)
This is a very commonly used descriptor.
The client-server nature of GATT data communications has a drawback, in that the client must typically poll for updates of a characteristic on a server.
The CCCD provides a mechanism to enable server-initiated updates where the server can asynchronously push updated characteristic values to the client without the client having to poll for it.
There are two types of server-initiated updates:
- Notifications (client doesn't acknowledge receipt of the update)
- Indications (client does acknowledge receipt of the update; the server cannot send further indications until received)
The Client must enable this server-Initiated update mechanism by writing to the corresponding CCCD before the server can start sending them.
SIG-Approved GATT UUIDs
The Declaration, Value, and Descriptor Attribute Types have pre-defined UUIDS provided by the Bluetooth SIG. The following links provide useful resources (see GATT Heart Rate Service below).
- Standard GATT Services, Attribute Types, Characteristic Descriptors, Characteristic Types
- SIG-Defined GATT Services
- SIG-Defined GATT Characteristics
- SIG-Defined GATT Descriptors
GATT Profile Example
The following diagram depicts the GATT Heart Rate Service.
Notes:
- Service contains eight attribute data structures.
- Service contains three characteristics.
- "Heart Rate Measurement" characteristic contains three attributes, including a Descriptor Attribute (CCCD Type), set for Notifications.
- This is a server-initiated update characteristic - the value will be sent to the client whenever the value attribute is updated.
GATT Profile Example (BM70)
Server profiles are created and depicted in vendor-specific ways. For example, the following depicts the GATT Heart Rate Service being incorporated into the BM70 radio via the BLEDK3 UI Configuration Utility:
Note that the Attribute Handle values are automatically assigned by this tool (starting at 0x8000).