GAP server event to get client rssi
igna09 opened this issue · 2 comments
igna09 commented
Hello,
i ported my project from bluedrod to NimBLE
thank you for your amazing work
In my project i need to get rssi of connected client
in bluedroid I used to make this:
esp_err_t rc = esp_ble_gap_read_rssi(this->authenticatedBdAddress->getNative());
...
customGapCallback(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) {
switch(event) {
......
case ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT: {
String message = "[status: ";
message += param->read_rssi_cmpl.status;
message += ", rssi: ";
message += param->read_rssi_cmpl.rssi;
message += ", remote_addr: ";
message += BLEAddress(param->read_rssi_cmpl.remote_addr).toString().c_str();
message += "]";
...
break;
} // ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT
}
}
In NimBLE I can't find a way to trigger event ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT to get rssi
h2zero commented
You don't need to handle an event here for this. There is a low level function you can call: int ble_gap_conn_rssi(uint16_t conn_handle, int8_t *out_rssi);
I will look to add this to the CPP API in the future.
igna09 commented
it worked, thank you!