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

Function test_write_without_response_burst

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

Source from the content-addressed store, hash-verified

267}
268
269pub async fn test_write_without_response_burst() {
270 use btleplug::api::WriteType;
271
272 let peripheral = peripheral_finder::find_and_connect().await;
273 peripheral_finder::reset_peripheral(&peripheral).await;
274 let char =
275 peripheral_finder::find_characteristic(&peripheral, gatt_uuids::WRITE_WITHOUT_RESPONSE);
276
277 // Send a burst of writes to exercise flow control. Without proper
278 // canSendWriteWithoutResponse handling, later writes would be silently
279 // dropped by CoreBluetooth.
280 let num_writes = 50;
281 for i in 0u8..num_writes {
282 let data = vec![i; 20];
283 peripheral
284 .write(&char, &data, WriteType::WithoutResponse)
285 .await
286 .expect(&format!("write-without-response #{} should succeed", i));
287 }
288 peripheral.disconnect().await.unwrap();
289}
290
291pub async fn test_read_write_roundtrip() {
292 use btleplug::api::WriteType;

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected