From 0ab5eaa08e3f1077cf412d2bd3da3e43774adc34 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Mon, 14 Sep 2020 21:38:49 +0200 Subject: Add GATT client read. --- examples/src/bin/ble_bas_central.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'examples/src/bin/ble_bas_central.rs') diff --git a/examples/src/bin/ble_bas_central.rs b/examples/src/bin/ble_bas_central.rs index 2fa4807..0de50d6 100644 --- a/examples/src/bin/ble_bas_central.rs +++ b/examples/src/bin/ble_bas_central.rs @@ -91,6 +91,13 @@ async fn ble_central_task(sd: &'static Softdevice) { "discovered! {:u16} {:u16}", client.battery_level_value_handle, client.battery_level_cccd_handle ); + + let buf = &mut [0; 16]; + let len = gatt_client::read(&conn, client.battery_level_value_handle, buf) + .await + .dexpect(intern!("read")); + + info!("read battery level: {:[u8]}", &buf[..len]); } #[entry] -- cgit v1.2.3