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

Function test_read_counter_increments

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

Source from the content-addressed store, hash-verified

221}
222
223pub async fn test_read_counter_increments() {
224 let peripheral = peripheral_finder::find_and_connect().await;
225 peripheral_finder::reset_peripheral(&peripheral).await;
226 let char = peripheral_finder::find_characteristic(&peripheral, gatt_uuids::COUNTER_READ);
227 let first = peripheral.read(&char).await.unwrap();
228 let second = peripheral.read(&char).await.unwrap();
229 let first_val = u32::from_le_bytes(first[..4].try_into().unwrap());
230 let second_val = u32::from_le_bytes(second[..4].try_into().unwrap());
231 assert!(
232 second_val > first_val,
233 "Counter should increment: first={}, second={}",
234 first_val,
235 second_val
236 );
237 peripheral.disconnect().await.unwrap();
238}
239
240pub async fn test_write_with_response() {
241 use btleplug::api::WriteType;

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected