Page 517 - From GMS to LTE
P. 517
Bluetooth and Bluetooth Low Energy 503
Figure 7.32 A GATT Read Response. Source: Gerald Combs / Wireshark.
In many cases a client does not require periodic updates. Instead a notification would
be sufficient when a value changes, e.g. when a button is pressed. For such applications,
BLE offers a method for the client to request server‐initiated updates for particular
attributes. Updates can be sent as notifications or as indications that require an acknowl-
edgement from the client.
7.7.6 Practical Example
Figure 7.33 shows what communicating with a BLE device looks like in practice using a
Bluetooth BLE‐enabled notebook and the Linux Bluetooth command line tools ‘hcitool’
and ‘gatttool’. As described above, the first step before connecting to a remote device is
to scan for it and find its device address. In step 2 the ‘gatttool’ is used to establish a
connection to a device. The ‘primary’ command is then used in step 3 to get a list of all
primary services offered by the device. As can be seen in the figure, each service is
identified by a UUID and its properties can be accessed by a 16‐bit handle. The Generic
Access Profile service that supplies a GATT client with the device’s name, preferred
connection parameters, etc., is identified with the standardized UUID 0x1800‐…
In step 4 the tool is then used to query for all characteristics, i.e. the attributes of each
service. Like the primary services, each characteristic/attribute is identified via a UUID.
The UUID is then linked to a handle which can later be used to read the characteristic’s
properties and a further handle number for reading the content of the attribute. In the
figure, the characteristic with the standardized UUID 0x2a00… is highlighted. This
standardized UUID contains information as to how the device’s name can be read.
Properties such as whether the attribute is readable/writable, etc., can be queried via
handle 0x0002 and the device’s name can be read via handle 0x0003.
In step 5 the tool is then used to read the attribute behind handle 0x0002. The result-
ing data encodes the information that the attribute is readable but not writable, that
data can be accessed via handle 0x0003 and that the value represents the device’s name.