Skip to content

Commit

Permalink
Reset after end, and also, add GO_ONLINE and GO_OFFLINE commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill13579 committed Apr 27, 2020
1 parent 221c2cc commit 6346bca
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ impl Handler {
"S" => State::Trigger(Requirement::new(data), timeout),
"IMG" => State::DisplayImage(data, timeout),
"INPUT" => State::Trigger(Requirement::new(data), timeout),
"GO_OFFLINE" => State::GoOffline(timeout),
"GO_ONLINE" => State::GoOnline(timeout),
&_ => {
eprintln!("Invalid command: {}", cmd_type);
process::exit(1);
Expand Down Expand Up @@ -192,7 +194,16 @@ impl EventHandler for Handler {
}
timeout = *t;
},
State::GoOffline(t) => {
ctx.invisible();
timeout = *t;
},
State::GoOnline(t) => {
ctx.online();
timeout = *t;
},
State::End => {
*entry = None;
break;
}
}
Expand Down Expand Up @@ -235,6 +246,8 @@ pub enum State {
Trigger(Requirement, f32),
Display(String, f32),
DisplayImage(String, f32),
GoOffline(f32),
GoOnline(f32),
End,
}

Expand Down

0 comments on commit 6346bca

Please sign in to comment.