BLE Generic Attribute Profile (GATT)

See this Microchip Developer page:

The Generic Attribute Profile (GATT) establishes how data will be organized and exchanged over a Bluetooth® Low Energy (BLE) connection.

Certain use-case-specific profiles (GATT-Based Profiles) are standardized by the Bluetooth Special Interest Group (SIG):

– Heart Rate Profile
– Proximity Profile
– …

GATT uses the Attribute Protocol (ATT) as a transport mechanism, as well as a means of organizing your data into easily transmitted bits or attributes.

GATT defines these and other fundamental operations in a standard, universally understood manner. It’s important to understand GATT, since most BLE implementations provide GATT APIs for applications wishing to use this functionality.

BLE Client/Server

BLE devices can be a Peripheral(server) or Central(client). These are two of the roles defined in the Generic Access Profile (GAP)

The peripheral might be an exercise machine or health monitor. It contains resources to be monitored. These are organised in an Attribute Database. Servers are able to advertise services.

Central devices are typically things like computers, tablets or phones. Application software on the Central device sends requests to peripherals. Thus, the Central device is a client to the Peripheral server. Clients also perform service discovery. Communication between Peripheral and Central requires a one-to-one connection. Connections are not normally held open?

A Central device may make connections to many Peripheral devices but a Peripheral can only be connected to one Central at a time. Connections are established and broken when requests are made. Transactions are intended to be fast with low latency taking only a couple of milliseconds from start to finish.

Requests and responses are stateful. A client may only start another request when a pending request is complete (I guess there is a timeout?)

BLE Broadcaster/Observer

These are the other two roles defined in the GAP. Broadcasters will periodically send advertising packets that hold data. A weather station might do this. Observers scan for Broadcasters and listen for advertised data.

Many Observers can listen for data from a single Observer. There are no connections. Think of Bingo callers and players.

GATT Attributes

Gatt Servers organize data as attributes. These are labelled, addressable data and have a defined structure:

  • 16 bit Attribute handle. Enumerated by a client during discovery.
  • 16 or 128 bit Attribute Type (UUID). Advertising packets contain a bit that tells the recipient whether the UUID is 16 bits (public) or 128 bits (Custom/private/random)
  • Variable length Attribute Value. Can be of any type but is limited to 512 bytes maximum size.
  • Implementation specific Attribute Permissions. These determine things like Read/Write availability, encryption level and authorisation requirement.

GATT Data Hierarchy

A GATT Server Profile consists of Services which have Characteristics which, in turn, have Attributes (Declaration, Value and optional descriptor.

A Service is just a collection of related characteristics and behaviours that accomplish a defined function. Services are discovered by clients. They are not advertised?


There are Public services and Private services. The Public services use the ‘well-known’, predefined 16 bit UUIDs set out by the BLE Special Interest Group. Private services can be anything but require a vendor defines 128 bit UUID.


A characteristic is just container for some data. Each must contain a minimum of two attributes. The Declaration Attribute holds metadata about the Value attribute – its type and length. The Value Attribute holds the data itself.

An optional Descriptor Attribute may contain further metadata including, but not limited to, a User Description that describes the characteristic.

one of the Descriptors (CCCD) is commonly used to tell the client that the server can send notifications (do not need to be acknowledged by the client) or Indications (must be acknowledged by the client). So that Servers cannot just pump out Notifications or Indications, the client must explicitly turn them on.