pub enum TokenState {
Booting,
Idle,
Authenticated,
WaitingForTouch,
Signing,
Error,
}Expand description
All the operating states the token can be in.
Variants§
Booting
Just powered on, peripherals coming up. Yellow LED blinks.
Idle
Idle, waiting for a host command. Green solid.
Authenticated
PIN session is active and the user can request a signature. Green slow pulse.
WaitingForTouch
A Sign request is pending and the user must press the touch button
within TOUCH_TIMEOUT_MS. Yellow solid.
Signing
Touch confirmed, signing in progress. Both LEDs alternate briefly.
Error
An error occurred. Green LED fast-blinks for ERROR_DISPLAY_MS
then returns to TokenState::Idle.
Implementations§
Source§impl TokenState
impl TokenState
Sourcepub const fn led_pattern(self) -> LedPattern
pub const fn led_pattern(self) -> LedPattern
LED pattern associated with this state.
Sourcepub const fn on_event(self, event: Event) -> Self
pub const fn on_event(self, event: Event) -> Self
Apply an event and return the next state.
Events that do not match any transition for the current state are
ignored. The function returns the state unchanged. This is the
conservative behaviour, equivalent to a default: do nothing arm.
The dispatch loop is free to fire SessionEnded repeatedly without
risking pathological transitions for example.
Trait Implementations§
Source§impl Clone for TokenState
impl Clone for TokenState
Source§fn clone(&self) -> TokenState
fn clone(&self) -> TokenState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more