BLE GATT Client in peripheral role
Posted: Sun Oct 21, 2018 3:51 am
I'm trying to figure out how I can run the ESP32 as a BLE peripheral, while *also* using the BLE GATT Client functions. The context is that I have a mobile phone that will connect to the ESP32, but also make some GATT characteristics available to the peripheral (i.e the phone acts as a GATT Server). This is, for example, one of the modes that's possible with the ANCS service on iPhones.
The issue I'm facing is that the API seems to assume that a peripheral is always a GATT server, and that a central is always a GATT client. In my experiments, I'm able to start the ESP32 in peripheral mode, advertise, and allow a phone to connect to it. At that point, I try to register a GATT client, and then perform a service discovery to find the services on the phone, by calling. But that does nothing. No callback is every invoked as a result. I've tried using the GATT server's gatt_if and conn_id with the client, but that doesn't help either.
NOTE: this is a different problem from running as a Central and Peripheral at the same time (which I've seen mentioned in some forum topics). In this case, I want to run only as a Peripheral, but also have a GATT Client.
Any clue? Is that even possible?
The issue I'm facing is that the API seems to assume that a peripheral is always a GATT server, and that a central is always a GATT client. In my experiments, I'm able to start the ESP32 in peripheral mode, advertise, and allow a phone to connect to it. At that point, I try to register a GATT client, and then perform a service discovery to find the services on the phone, by calling
Code: Select all
esp_ble_gattc_search_service()
NOTE: this is a different problem from running as a Central and Peripheral at the same time (which I've seen mentioned in some forum topics). In this case, I want to run only as a Peripheral, but also have a GATT Client.
Any clue? Is that even possible?