summaryrefslogtreecommitdiff
path: root/examples/src/bin/ble_bas_central.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <dirbaio@dirbaio.net>2020-09-14 21:38:49 +0200
committerDario Nieuwenhuis <dirbaio@dirbaio.net>2020-09-14 21:38:49 +0200
commit0ab5eaa08e3f1077cf412d2bd3da3e43774adc34 (patch)
tree05d12ba49df6ecaa03cf2b2c7bde6b39c1c24e13 /examples/src/bin/ble_bas_central.rs
parentcd2e5bbed937a9bc69d288bad447b841f10209d6 (diff)
downloadnrf-softdevice-0ab5eaa08e3f1077cf412d2bd3da3e43774adc34.zip
Add GATT client read.
Diffstat (limited to 'examples/src/bin/ble_bas_central.rs')
-rw-r--r--examples/src/bin/ble_bas_central.rs7
1 files changed, 7 insertions, 0 deletions
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]