diff --git a/src/api.rs b/src/api.rs index 146063aed20..0aa59dce6db 100644 --- a/src/api.rs +++ b/src/api.rs @@ -82,6 +82,7 @@ generate_enums! { Reboot: 42 Uptime: 43 Wink: 44 + SetCustomStatus: 45 ////////////// // Counters // @@ -325,6 +326,9 @@ pub mod request { Wink: - duration: core::time::Duration + SetCustomStatus: + - status: u8 + CreateCounter: - location: Location @@ -481,6 +485,8 @@ pub mod reply { Wink: + SetCustomStatus: + CreateCounter: - id: CounterId diff --git a/src/client.rs b/src/client.rs index 037bed2c552..ce0b950b479 100644 --- a/src/client.rs +++ b/src/client.rs @@ -709,6 +709,10 @@ pub trait UiClient: PollClient { fn wink(&mut self, duration: core::time::Duration) -> ClientResult<'_, reply::Wink, Self> { self.request(request::Wink { duration }) } + + fn set_custom_status(&mut self, status: u8) -> ClientResult<'_, reply::SetCustomStatus, Self> { + self.request(request::SetCustomStatus { status }) + } } /// Builder for [`ClientImplementation`][]. diff --git a/src/service.rs b/src/service.rs index 5c94f2d6b58..ecbdbf16abc 100644 --- a/src/service.rs +++ b/src/service.rs @@ -20,6 +20,7 @@ pub use crate::store::{ filestore::{ClientFilestore, Filestore, ReadDirFilesState, ReadDirState}, keystore::{ClientKeystore, Keystore}, }; +use crate::types::ui::Status; use crate::types::*; use crate::Bytes; use crate::{api::*, interrupt::InterruptFlag}; @@ -584,6 +585,11 @@ impl ServiceResources

{ Ok(Reply::Wink(reply::Wink {})) } + Request::SetCustomStatus(request) => { + self.platform.user_interface().set_status(Status::Custom(request.status)); + Ok(Reply::SetCustomStatus(reply::SetCustomStatus {})) + } + Request::CreateCounter(request) => { counterstore.create(request.location) .map(|id| Reply::CreateCounter(reply::CreateCounter { id } )) diff --git a/src/types.rs b/src/types.rs index 46548139e64..22057c245f8 100644 --- a/src/types.rs +++ b/src/types.rs @@ -176,6 +176,7 @@ pub mod ui { WaitingForUserPresence, Processing, Error, + Custom(u8), } }