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

Method write_value

src/winrtble/ble/descriptor.rs:49–61  ·  view source on GitHub ↗
(&self, data: &[u8])

Source from the content-addressed store, hash-verified

47 }
48
49 pub async fn write_value(&self, data: &[u8]) -> Result<()> {
50 let writer = DataWriter::new()?;
51 writer.WriteBytes(data)?;
52 let operation = self.descriptor.WriteValueAsync(&writer.DetachBuffer()?)?;
53 let result = operation.into_future().await?;
54 if result == GattCommunicationStatus::Success {
55 Ok(())
56 } else {
57 Err(Error::Other(
58 format!("Windows UWP threw error on write descriptor: {:?}", result).into(),
59 ))
60 }
61 }
62
63 pub async fn read_value(&self) -> Result<Vec<u8>> {
64 let result = self

Callers 2

writeMethod · 0.45
write_descriptorMethod · 0.45

Calls 1

into_futureMethod · 0.80

Tested by

no test coverage detected