# Performance Evaluation of Bluetooth Low Energy: A Systematic Review
## 2 BLE Functioning
### BLE Protocol Stack
#### 2.1.7 Generic Attribute Profile  
The GATT encapsulates the ATT layer, and its main role is to establish how to exchange all profiles' information and data in a BLE link. Profiles are definitions of possible applications and specify general behaviors that Bluetooth devices use to communicate with other Bluetooth devices. Profiles are built on the Bluetooth standard to more clearly define what kind of data a Bluetooth module is transmitting. These data are organized in a hierarchical structure composed of sections called _services_, which, in turn, group data into containers called _characteristics_. GATT defines two roles in a connection, _client_ and _server_, which correspond to those described in the ATT protocol (Section 2.1.6). The Bluetooth SIG defines some standard _services_ and _characteristics_ represented by a 16-bit address format, but the strength of BLE is that it lets the manufacturers define their own _services_ using a 128-bit UUID in order to adapt this technology to brand new and original applications. During the connection establishment, the _server_ exposes its _services_ and _characteristics_ to the _client_ in order to define how the connection will be structured. The logical structure of the GATT server profile, which includes several _services_ and _characteristics_, is shown in Figure 4.  
A _service_ is basically a container that conceptually groups related attributes, while _characteristics_ are the attributes included in a _service_, and each of them is used to communicate a specific type of data. This service-oriented paradigm is a further abstraction on top of the _client-server_ architecture where the _services_ have a defined behavior that will always give the same type of response [56]. Figure 4: GATT data hierarchy. Immediately before the connection, the GATT _server_ exposes its _services_ and _characteristics_. As shown in this figure, _services_ and _characteristics_ are defined in order to form a logical data structure. Moreover, each _characteristic_ exposes its properties, a descriptor that defines what it does, and the data value. Adapted from [52]. Characteristics_ contain the data value, a descriptor, which gives additional information about the _characteristic_, its value and some properties. These properties indicate to the _client_ which operations are allowed to be performed on the _characteristic_; the properties used most are:  
* _Broadcast_: this allows sending data to BLE devices using advertising packets, as described in Section 2.2.1. * _Readable_: if set, the client can only read the _characteristic_ value. * _Writable_: with this property, the client can only write a new value on the _characteristic_. * _Notifiable_: when it is set, the _client_ receives a notification if the _server_ updates the _characteristic_, so that it can read the new value. An example, useful to clarify the structure of the GATT _server_'s profile hierarchy, could be the one described here following. Let us assume that we need to send data from a Magneto-Inertial Measurement Unit (M-IMU) (i.e., a unit that collects three different sensors: an accelerometer, a gyroscope and a magnetometer), that is the _master_, to a mobile device such as a smartphone or a tablet, which represents the _slave_. Let us also assume that the board has an embedded battery, in order to make the device portable, and a temperature sensor: in fact, it is important to know these data since the M-IMU output is influenced by the variation of temperature, for example due to the battery overheating. In this example, it could be useful to construct the profile with two different _services_, as shown in Figure 5.  
* _M-IMU service_: This manages all the data referred to the M-IMU, and it is structured into four different _characteristics_. Three notifiable _characteristics_ perform the task to send data from the sensor to the _central_ device; one is referred to the accelerometer data, one for the gyroscope and the last one for the magnetometer.