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

Function test_long_value_read_write

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

Source from the content-addressed store, hash-verified

305}
306
307pub async fn test_long_value_read_write() {
308 use btleplug::api::WriteType;
309
310 let peripheral = peripheral_finder::find_and_connect().await;
311 peripheral_finder::reset_peripheral(&peripheral).await;
312 let char = peripheral_finder::find_characteristic(&peripheral, gatt_uuids::LONG_VALUE);
313 let data: Vec<u8> = (0..200).map(|i| (i % 256) as u8).collect();
314 peripheral
315 .write(&char, &data, WriteType::WithResponse)
316 .await
317 .unwrap();
318 let read_back = peripheral.read(&char).await.unwrap();
319 assert_eq!(
320 read_back, data,
321 "Long value read-back should match written data"
322 );
323 peripheral.disconnect().await.unwrap();
324}
325
326pub async fn test_characteristic_properties() {
327 use btleplug::api::CharPropFlags;

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