Skip to content

Commit

Permalink
Implemented polling
Browse files Browse the repository at this point in the history
  • Loading branch information
PoorRican committed Jan 28, 2023
1 parent 71761f6 commit a21429d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ impl std::fmt::Display for IOKind {
// TODO: enum for `IODirection` when implementing control system

/// Encapsulates sensor data. Provides a unified data type for returning data.
#[derive(Debug)]
pub struct IOData<T> {
pub kind: IOKind,
pub data: T,
}

/// Encapsulates `IOData` alongside of timestamp and device data
#[derive(Debug)]
pub struct IOEvent<T> {
pub version_id: i32,
pub sensor_id: i32,
Expand Down
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ fn main() {
poller.sensors.add(0, Box::new(s0));
poller.sensors.add(1, Box::new(s1));

dbg!(poller.sensors.iter());
loop {
poller.poll();
std::thread::sleep(std::time::Duration::from_secs(1));
dbg!(&poller.log)
}

}

0 comments on commit a21429d

Please sign in to comment.