Expand description
A library for community with HLK-LD6002 radar respiratory and heartbeat sensors.
§Usage
use embedded_io_adapters::std::FromStd;
use hlk_ld6002::{Data, MessageStream};
use serialport::ClearBuffer;
use std::time::Duration;
let port = serialport::new("/dev/ttyUSB0", 1_382_400)
.timeout(Duration::from_millis(50))
.open()
.expect("Failed to open port");
let mut messages = MessageStream::new(FromStd::new(port));
let mut data = Data::default();
for message in messages.flatten() {
data.update(message);
println!("{data:?}");
}Structs§
- Async
Message Stream - A wrapper around
AsyncReadfor reading messages from the sensor - Data
- A helper struct to store the received data
- Message
Stream - A wrapper around
Readfor reading messages from the sensor
Enums§
- LdError
- Error type for reading data from the sensor
- Message
Body - The decoded message from the sensor
- Message
Type - Message type sent by the sensor