Generic Attribute Profile (GATT) establishes a hierarchy to organize attributes. They are organized as a GATT Server Profile and are grouped into:
- Services, containing:
A collection of data and associated behaviors to accomplish a particular function, defined as a 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"
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.
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 (i.e. "Temperature in the Living Room").
- 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, whereby 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 (whereby the Client does not acknowledge receipt of the update)
- Indications (whereby the Client does acknowledge receipt of the update. 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
Declaration, Value and Descriptor Attribute Types have pre-defined UUIDS provided by the Bluetooth SIG. The following URLs provide useful links to these references, which will be helpful in deciphering attribute databases (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
- 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).