Using Bluetooth low energy

Bluetooth 4.0 introduces Bluetooth low energy (LE), which is designed to support low power consumption. Bluetooth LE has found numerous applications in areas such as health care, fitness, and proximity sensing. For example, the Heart Rate Profile is an LE profile that allows a device to connect to a heart rate sensor and collect heart rate data for fitness applications.

Bluetooth LE profiles and apps are based on a generic profile called the Generic Attribute Profile (GATT). GATT specifications and LE profiles are available on the Bluetooth organization website.

The Bluetooth C API supports Bluetooth LE functionality in the following header files:
  • btdevice.h: APIs that support basic Bluetooth functionality such as pairing and retrieval of device and service information.
  • btgatt.h, btgattsrv.h: APIs that support the Generic Attribute (GATT) profile
  • bthid.h: APIs that support the Human Interface Device (HID) profile
  • btle.h: APIs that support essential LE functionality such as device scan and advertisement

Qt Bluetooth Low Energy is not available in Qt 4.8. To access the LE capabilities on your BlackBerry 10 device, you need to use the Bluetooth C API.

What is GATT?

GATT is a Bluetooth profile that provides a framework for developing low energy profiles. GATT defines a client-server architecture. The server stores attributes grouped into services and advertises its services. The client finds out about the server's services through service discovery. The client requests to connect to a particular service (or services), and receives the requested values in a server response. It may also receive server-initiated updates for particular characteristics it is interested in whenever the values of those characteristics change. GATT can be used in both classic Bluetooth apps and low energy apps.

GATT is based on the Bluetooth Attribute Protocol (ATT), a client-server protocol in which the server stores data as attributes and the client reads values from or writes values to the attributes. An attribute consists of three elements: a 16-bit handle, a UUID, and a value.

The following concepts are important to understanding the GATT architecture.

Service
A set of related characteristics, which often contain measured values from a sensor.
Characteristic
An attribute that defines a measurable piece of data, for example, heart rate or temperature. A characteristic includes a UUID, a unique identifier called a "handle", and a value. A characteristic may also contain descriptors that describe the characteristic in more detail.
Descriptor
An attribute that provides additional information about the characteristic and its value. For example, Client Characteristic Configuration Descriptor (CCCD) is a commonly used descriptor. A client can set the CCCD to enable server-initiated updates for the characteristic in which the descriptor is defined. After the CCCD is set, the server sends updates to the client whenever the characteristic value changes, saving the client from polling for the characteristic.
Notification and indication
Server-initiated updates to the client. Both notifications and indications alert the client of changes in a characteristic that the client is interested in. Indications require confirmation from the client while notifications do not.

The diagrams below illustrate the client server architecture of GATT and the components of a service.

Diagram showing the GATT client server architecture

Diagram showing the GATT service components

Last modified: 2015-07-24



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus