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

Function test_read_write_roundtrip

tests/common/test_cases.rs:291–305  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

289}
290
291pub async fn test_read_write_roundtrip() {
292 use btleplug::api::WriteType;
293
294 let peripheral = peripheral_finder::find_and_connect().await;
295 peripheral_finder::reset_peripheral(&peripheral).await;
296 let char = peripheral_finder::find_characteristic(&peripheral, gatt_uuids::READ_WRITE);
297 let data = vec![0xDE, 0xAD, 0xBE, 0xEF];
298 peripheral
299 .write(&char, &data, WriteType::WithResponse)
300 .await
301 .unwrap();
302 let read_back = peripheral.read(&char).await.unwrap();
303 assert_eq!(read_back, data, "Read-back should match written data");
304 peripheral.disconnect().await.unwrap();
305}
306
307pub async fn test_long_value_read_write() {
308 use btleplug::api::WriteType;

Callers

nothing calls this directly

Calls 6

find_and_connectFunction · 0.85
reset_peripheralFunction · 0.85
find_characteristicFunction · 0.85
writeMethod · 0.45
readMethod · 0.45
disconnectMethod · 0.45

Tested by

no test coverage detected