MCPcopy Create free account
hub / github.com/deviceplug/btleplug / read

Method read

src/droidplug/peripheral.rs:384–395  ·  view source on GitHub ↗
(&self, characteristic: &Characteristic)

Source from the content-addressed store, hash-verified

382 }
383
384 async fn read(&self, characteristic: &Characteristic) -> Result<Vec<u8>> {
385 let future = self.with_obj(|env, obj| {
386 let uuid = JUuid::new(env, characteristic.uuid)?;
387 JSendFuture::try_from(obj.read(uuid)?)
388 })?;
389 let result_ref = future.await?;
390 self.with_obj(|env, _obj| {
391 let result = JPollResult::from_env(env, result_ref.as_obj())?;
392 let bytes = get_poll_result(env, result)?;
393 Ok(byte_array_to_vec(env, bytes.into_inner())?)
394 })
395 }
396
397 async fn subscribe(&self, characteristic: &Characteristic) -> Result<()> {
398 self.set_characteristic_notification(characteristic, true)

Callers

nothing calls this directly

Calls 4

get_poll_resultFunction · 0.85
byte_array_to_vecFunction · 0.85
with_objMethod · 0.80
into_innerMethod · 0.80

Tested by

no test coverage detected