Android: Bluetooth Low Energy GATT Profile

Daiwik Daarun picture Daiwik Daarun · Feb 2, 2014 · Viewed 8.7k times · Source

I am looking to send information from my Android device to a micro-controller (such as an Arduino). Using Bluetooth Classic I simply send a byte array of data to the micro-controller, and process the byte array accordingly.

I started reading about Bluetooth Low Energy and I am hearing all this talk about GATT profiles. Why should I create a GATT profile? What is a GATT profile going to do for me in the case of exchanging information from an Android device to a micro-controller?

Thanks in advance!

Answer

user1741851 picture user1741851 · Feb 3, 2014

GATT profiles are a way to communicate between Bluetooth central and Peripheral. Lets assume I have an app that reads temperature from a sensor. My current setup is to have the phone act as central, the sensor attached to a bluetooth LE chip as peripheral.

So I communicate to bluetooth LE chip using this profile. In GATT profile declaration in chip, I will be defining a service and two characteristics. Two characteristics being

  1. Sensor enabler
  2. Temperature value

Sensor enabler has both read and write permissions, while temperature value has only read permission.

So in your app, whenever you want to read temperature value, you first write 0x01 to enabler characteristic and then read value from temperature value.

To identify the characteristics and services, bluetooth has the concept of UUIDs and handles. UUIDs are globally unique and handles are assigned in the chip.

Services encapsulate the characteristics available. So in a hierarchy you have, Profiles which can multiple services which in turn can have multiple characteristics.

To explain everything in an answer would be too much. Why don't you go through the basics here? I found these documents really useful.