BLE devices Overview:
What is BLE ?:
Bluetooth Low Energy or Bluetooth LE or BLE, which was formally called Bluetooth Smart, relies on radio waves for communication. These short range radio waves have a limit of up to a hundred meters. Now depending on your device, the power supply of the device, and the physical surroundings you're working in, you may or may not see that level of performance.
Bluetooth Low Energy is a powerful resource for using fairly close range devices. And as the name suggests , it's low energy which makes it a great option for mobile devices as well. You may have seen a variety of Bluetooth devices for health and fitness, entertainment and even productivity like keyboards. Through this course we'll make the process of communicating with Bluetooth low energy devices clear and simple.
Imagine a sensor as a server that provides some services (Battery status), on those services you have some Characteristics (Voltage, current, etc...)
Your phone will be the client, that can read/write information on those characteristics.
GAP is an acronym for the Generic Access Profile, and it controls connections and advertising in Bluetooth. GAP is what makes your device visible to the outside world, and determines how two devices can (or can't) interact with each other.
GAP defines various roles for devices, but the two key concepts to keep in mind are Central devices and Peripheral devices.
Peripheral devices are small, low power, resource contrained devices that can connect to a much more powerful central device. Peripheral devices are things like a heart rate monitor, a BLE enabled proximity tag, etc.
Central devices are usually the mobile phone or tablet that you connect to with far more processing power and memory.
BLE WORKFLOW :
GATT is an acronym for the Generic Attribute Profile, and it defines the way that two Bluetooth Low Energy devices transfer data back and forth using concepts called Services and Characteristics. It makes use of a generic data protocol called the Attribute Protocol (ATT), which is used to store Services, Characteristics and related data in a simple lookup table using 16-bit IDs for each entry in the table.
GATT comes into play once a dedicated connection is established between two devices, meaning that you have already gone through the advertising process governed by GAP.
The most important thing to keep in mind with GATT and connections is that connections are exclusive.What is meant by that is that a BLE peripheral can only be connected to one central device (a mobile phone, etc.) at a time! As soon as a peripheral connects to a central device, it will stop advertising itself and other devices will no longer be able to see it or connect to it until the existing connection is broken.
SERVICE AND CHARACTERISTICS
Imagine a BLE sensor as a information server that gives some kind of information, for instance the Battery Service, provides some characteristics (ex: Battery voltage level, current, time of recharge, etc..)
So basically a service will have one or more characteristics that can be read or written by another device (ie the phone)