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

Method write_value

src/winrtble/ble/characteristic.rs:67–81  ·  view source on GitHub ↗
(&self, data: &[u8], write_type: WriteType)

Source from the content-addressed store, hash-verified

65 }
66
67 pub async fn write_value(&self, data: &[u8], write_type: WriteType) -> Result<()> {
68 let writer = DataWriter::new()?;
69 writer.WriteBytes(data)?;
70 let operation = self
71 .characteristic
72 .WriteValueWithOptionAsync(&writer.DetachBuffer()?, write_type.into())?;
73 let result = operation.into_future().await?;
74 if result == GattCommunicationStatus::Success {
75 Ok(())
76 } else {
77 Err(Error::Other(
78 format!("Windows UWP threw error on write: {:?}", result).into(),
79 ))
80 }
81 }
82
83 pub async fn read_value(&self) -> Result<Vec<u8>> {
84 let result = self

Callers

nothing calls this directly

Calls 1

into_futureMethod · 0.80

Tested by

no test coverage detected