Understanding different roles of BLE devices
I was really confused at first about the different roles devices get as stated in the BLE protocol stack. After spending a lot of time painstakingly read through the CC2540 BLE software developer’s guide by TI, I got a clearer picture of the different roles involved.
Central and Peripheral
These roles come under the GAP layer, which is responsible for the discovery and link connection between devices.
Peripheral: Sends out advertisements to inform central devices that it is ready for connection.
Central: Scans for advertisements from peripheral devices and initiates connections
There are 2 other roles in the GAP layer – Broadcaster and Observer. Broadcaster is like peripheral that sends out advertisements but not connectable. Observer is like central which scans for advertisements but cannot initiate connections.
Server and Client
These 2 roles belong to the GATT layer, which is used by applications for data communication between two devices that are already connected.
Server is the device that has the data to be read or written by the client.
Client is the device that sends out request to read or write data from the server.
The important thing is that these 2 roles are completely independent from the GAP roles (central/peripheral). So a central device can be a server or a client, a peripheral device can also be a server or client.
A client can be configured to receive notifications from the server, so it doesn’t have to send out request to the server every time it wants data. When the server has some data to be sent, it will automatically notify the client of the data value without any request.
In iOS6, the Core Bluetooth framework allows an iPhone with BLE to be either a central or a peripheral device. The framework allows a central to be connected to multiple peripherals, and a peripheral can also be connected to different centrals at the same time. (WWDC 2012 Core Bluetooth 101).
Here is a very useful presentation explaining how BLE works, especially on the details of the different roles.