Page 1 of 1

NimBLE GATT Client/Server

Posted: Wed Mar 20, 2024 2:29 pm
by mtaz78
Hi,
While studying the BLE stack I found out that the concepts of Central/Peripheral and Client/Server are not logically connected.
Let me explain, one usually associates Central with Client and Peripheral with Server, but, at least on a theoretical level, the Central/Peripheral distinction concerns the initiation of the connection, while GATT Client/Server the mode of communication.

For my application I would need a Central that is Server and a Peripheral that is Client. I have almost succeeded in implementing this, except that with the API available I cannot execute a "Read" from the Client of a Server Characteristic.

This is simply because from the Client I cannot find the characteristic exposed by the Server. In the IDF examples to do a Read(or write) from the Client they use the "peer" reference (from connection handle),

Code: Select all

peer = peer_find(conn_handle);
chr = peer_chr_find_uuid(peer,
                     remote_svc_uuid,
                     remote_chr_uuid);
saved at the time of the connection from the central, but since my Client is a Peripheral I have no way of saving that reference.
Link to the code: https://github.com/espressif/esp-idf/bl ... ain.c#L142

Do you know of a way to overcome this problem?


I had thought of using the function

Code: Select all

int ble_gattc_read_by_uuid(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, const ble_uuid_t *uuid, ble_gatt_attr_fn *cb, void *cb_arg)
from https://mynewt.apache.org/latest/networ ... ad_by_uuid;

but I cannot understand what the start_handle and end_handle parameters are.

Thank you in advance.