When using BLE events i'm usually confused which event to handle , for example GATTS_WRITE or GATTC_WRITE.. i don't know which is the server and the client ?
Any idea to differenciate between them ?
I tested some apps and i read some documents ,, i arrived to this conclusion :
Is that True ?
Your Mobile is generally a GAP Central & your device[say smart sensor] is the GAP Peripheral at the time of establishing connection[adversitement].
Once the connection is established, we denote them by GATT Client & GATT Server respectively.
Master & Slave is just another way of saying the same.
The client always asks for info from the server.
I hope this helps...
What you're talking about is two different sets of roles really...
GAP roles: Devices are either a Central (master) or a Peripheral (slave).
Centrals initiate the connections to the Peripherals. For example, your phone may act as a central to a bluetooth speaker (it initiates the bond).
GATT roles: Devices are Clients or Servers.
Clients are the users of the connected devices, who act as the servers. i.e. a bluetooth sensor (server)would serve data to the connect phone (client).
Here's a good page with more explanation: punchthrough.com/.../
And another related post: devzone.nordicsemi.com/.../
Ok , i understand that, the central (let's say, Master control) is the one who asks for BLE connection. the peripheral (let's say evaluation Kit ) is the one accepts this connection. Refering to what you said, the MC is the client here. But , i implemented a characteristic, and after connection establishement, if the master control sends "write command " on that cjaracteristic the Evaluation Kit gets it as BLE_GATTS_EVT_WRITE.. That means MC is the server and not the client !!!
Any idea ?
Within a server, you can implement Read & Write characteristics, i.e your client can send data to a write characteristic & read data from a read characteristic.
For example,in case of a heart rate service, you can read the heart beat value, but cannot write on it.
Also, there are various ways with which characteristics can be read or written into..