Skip to content

Commit

Permalink
Added BLEClient::get_rssi
Browse files Browse the repository at this point in the history
  • Loading branch information
taks committed Dec 13, 2023
1 parent 95c7e72 commit f8479b8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/client/ble_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,19 @@ impl BLEClient {
}
}

/// Retrieves the most-recently measured RSSI.
/// A connection’s RSSI is updated whenever a data channel PDU is received.
pub fn get_rssi(&self) -> Result<i8, BLEReturnCode> {
let mut rssi: i8 = 0;
unsafe {
ble!(esp_idf_sys::ble_gap_conn_rssi(
self.conn_handle(),
&mut rssi
))?;
}
Ok(rssi)
}

pub async fn get_services(
&mut self,
) -> Result<core::slice::IterMut<'_, BLERemoteService>, BLEReturnCode> {
Expand Down

0 comments on commit f8479b8

Please sign in to comment.