added heart rate
This commit is contained in:
parent
2a6f878371
commit
bcfb0eec12
@ -6,6 +6,7 @@ use uuid::{Uuid, uuid};
|
|||||||
|
|
||||||
const FIRMWARE_VERSION_UUID: Uuid = uuid!("00002a26-0000-1000-8000-00805f9b34fb");
|
const FIRMWARE_VERSION_UUID: Uuid = uuid!("00002a26-0000-1000-8000-00805f9b34fb");
|
||||||
const BATTERY_LEVEL_UUID: Uuid = uuid!("00002a19-0000-1000-8000-00805f9b34fb");
|
const BATTERY_LEVEL_UUID: Uuid = uuid!("00002a19-0000-1000-8000-00805f9b34fb");
|
||||||
|
const HEART_RATE_UUDI: Uuid = uuid!("00002a37-0000-1000-8000-00805f9b34fb");
|
||||||
|
|
||||||
pub async fn find_infinitime(adapter: &Adapter) -> Option<Peripheral> {
|
pub async fn find_infinitime(adapter: &Adapter) -> Option<Peripheral> {
|
||||||
for p in adapter.peripherals().await.unwrap() {
|
for p in adapter.peripherals().await.unwrap() {
|
||||||
@ -40,3 +41,8 @@ pub async fn get_battery_level(infinitime: &Peripheral) -> String {
|
|||||||
let percent = data[0];
|
let percent = data[0];
|
||||||
return percent.to_string();
|
return percent.to_string();
|
||||||
}
|
}
|
||||||
|
pub async fn get_heart_rate(infinitime: &Peripheral) -> String {
|
||||||
|
let data = get_property_value(infinitime, HEART_RATE_UUDI).await;
|
||||||
|
let rate = data[1];
|
||||||
|
return rate.to_string();
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user