Services and Characteristics

We have already covered services and characteristics in extensive detail in the first chapter; however, we will still do a quick refresher here, just in case. We will go bottom up this time starting with characteristics first.

Characteristics are the lowest and the most important echelon of the Bluetooth Low Energy technology. Encapsulated by a related service, these are the actual state variables, each of which stores a single piece of relevant measurement and information data. It is worthwhile reading about the Heart Rate Measurement characteristic, which we will be covering extensively in this chapter.

Characteristics have a UUID, which can be 16-bit or 128-bit based on whether a characteristic has a standard or custom definition. A manufacturer is free to define custom characteristics, which are unique only to the manufacturer's software. However, to facilitate maximum interoperability between Bluetooth Low Energy devices it is always better to follow the definition of standard characteristics; a lot of devices still define custom characteristics due to security and privacy reasons. Bluetooth SIG defines a list of standard Bluetooth Low Energy characteristics here.

To get a list of standard Bluetooth Low Energy characteristics, visit https://www.bluetooth.com/specifications/gatt/characteristics.

A service is a wrapper on top of data encapsulated in the characteristics. Similar kinds of data or characteristics are bundled together in a single service. This is a key factor in understanding the design of services, which exist to bundle similar kinds of data together. Perhaps a couple of examples will provide further clarity on this:

  • Heart rate service: This consists of Heart Rate Measurement characteristic, sensor placement characteristic, and energy expanded characteristic
  • Device information service: This consists of manufacturer name, model number, serial number, and hardware revision characteristics

Each service wraps similar or correlated data. For instance, if you want to get the Heart Rate Measurement data, then you should interrogate the heart rate service and if you need information about the device itself then you should interrogate the device service. The device service knows nothing about Heart Rate Measurement and the heart rate service is oblivious of the device manufacturer's name.

Like Bluetooth profiles, the Bluetooth SIG defines a number of official Services.

You can visit https://www.bluetooth.com/specifications/gatt/services for more insight on service definitions by bluetooth SIG.

Each official service is assigned a unique 16-bit UUID so that it can distinguish itself from others; for example, a Heart Rate Service has a UUID of 0x180D. You can also write your own custom service for a specific purpose, but then it will need to have a 128-bit custom UUID.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.198.173