How GATT server can distinguish between connecting devices

User4356
Posts: 35
Joined: Wed Feb 17, 2021 7:52 am

Re: How GATT server can distinguish between connecting devices

Postby User4356 » Thu Apr 22, 2021 2:13 am

Let's read the specification carefully:
https://www.oreilly.com/library/view/ge ... t_svc_disc
Additionally, CCCDs have two special properties that separate them from other attributes:

Their values are unique per connection

In multi-connection scenarios, in which a central is connected to multiple peripherals and also acting as a GATT server, each peripheral will receive its own copy of the CCCD’s value when reading it with ATT.
Their values are preserved across connections with bonded devices

“Attribute Caching” discusses attribute caching in more detail, but that concerns only attribute handles. Values are typically not stored per-device and the GATT server can reset them between connections. This is not the case with CCCDs among bonded devices: the last value written by a client to a CCCD on the server is guaranteed to be restored upon reconnection, regardless of the time elapsed between connections.

It says there must be a unique value for the peripherals from the central one. As I understand it, the central device should contain one instance of the descriptor for each connection. As you know, the central is the client. Do I understand correctly that the CCC descriptor must be at the client side? And how does the server know that the client wants notifications if the decryptor is at the client side?
4) on connect you get connID/handle, which can be then used in read/write/notify/indicate operations to distinguish which client it is, the same handle you can use to track which client write to CCC and wants notifications
That is, the mechanism is the same that I used in my implementation, with the only difference that I used a special characteristic, and I had to use the CCC descriptor for this. There I watched who writes to this special characteristic, saved the value of the id of the connection and started sending notifications on this connection. I am glad that I managed to practically guess the correct mechanism. But this is if CCC descriptor locate on the server side. If it is on the client side, then I do not understand how this can work.

chegewara
Posts: 2375
Joined: Wed Jun 14, 2017 9:00 pm

Re: How GATT server can distinguish between connecting devices

Postby chegewara » Thu Apr 22, 2021 2:34 am

You can read allk from those tutorials:
https://www.mouser.it/pdfdocs/bluetooth-Core-v50.pdf
https://github.com/espressif/esp-idf/bl ... through.md
https://github.com/espressif/esp-idf/bl ... through.md
https://github.com/espressif/esp-idf/bl ... through.md
User4356 wrote: Do I understand correctly that the CCC descriptor must be at the client side?
No, all attributes are only in server device.

User4356
Posts: 35
Joined: Wed Feb 17, 2021 7:52 am

Re: How GATT server can distinguish between connecting devices

Postby User4356 » Thu Apr 22, 2021 3:42 pm

I've read the Espressif tutorials several times already, but your first tutorial is very helpful! Wonderful! Sumptuously! You know, I saw your questions on github in 2017, it's a shame that people there were trying to answer your questions instead of showing this amazing Tutorial! It was very bad of them.

Thank you! Thank you again!

Who is online

Users browsing this forum: ok-home and 318 guests