From 6346bca25b9b0713a3878928c181690175a009ae Mon Sep 17 00:00:00 2001 From: Bill Kudo Date: Mon, 27 Apr 2020 13:55:26 -0700 Subject: [PATCH] Reset after end, and also, add GO_ONLINE and GO_OFFLINE commands --- src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index b2abe90..16bd358 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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); @@ -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; } } @@ -235,6 +246,8 @@ pub enum State { Trigger(Requirement, f32), Display(String, f32), DisplayImage(String, f32), + GoOffline(f32), + GoOnline(f32), End, }