Skip to content

Commit

Permalink
Merge pull request #108 from taks/fix-get_descriptors
Browse files Browse the repository at this point in the history
Fixed `BLERemoteCharacteristic::get_descriptors`
  • Loading branch information
taks committed Mar 1, 2024
2 parents 77fa1e3 + 46e0740 commit 8e3f9fe
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/client/ble_remote_characteristic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,18 @@ impl BLERemoteCharacteristic {
ble!(self.state.signal.wait().await)?;
}

unsafe {
ble!(esp_idf_sys::ble_gattc_disc_all_dscs(
self.state.conn_handle(),
self.state.handle,
self.state.end_handle,
Some(Self::descriptor_disc_cb),
self as *mut Self as _,
))?;
if self.state.handle != self.state.end_handle {
unsafe {
ble!(esp_idf_sys::ble_gattc_disc_all_dscs(
self.state.conn_handle(),
self.state.handle,
self.state.end_handle,
Some(Self::descriptor_disc_cb),
self as *mut Self as _,
))?;
}
ble!(self.state.signal.wait().await)?;
}
ble!(self.state.signal.wait().await)?;
}

Ok(self.state.descriptors.as_mut().unwrap().iter_mut())
Expand Down Expand Up @@ -188,7 +190,7 @@ impl BLERemoteCharacteristic {
}

characteristic.state.signal.signal(error.status as _);
error.status as _
esp_idf_sys::BLE_HS_EDONE as _
}

pub async fn read_value(&mut self) -> Result<Vec<u8>, BLEError> {
Expand Down

0 comments on commit 8e3f9fe

Please sign in to comment.