pub struct BacklightState {
pub enabled: bool,
pub mode: BacklightMode,
pub status: BacklightStatus,
pub current_level: u8,
pub nb_levels: u8,
pub power_save: bool,
pub controls: BacklightControls,
}Expand description
Snapshot of a keyboard’s backlight, merged from the 0x1982
getBacklightConfig and getBacklightInfo responses.
Crosses the agent↔GUI IPC, so field order is wire format — changes require
a PROTOCOL_VERSION bump (guarded by
openlogi-ipc/tests/wire_format.rs).
Fields§
§enabled: boolWhether the backlight system is enabled at all. When false the
firmware keeps the LEDs dark no matter what the sensors report, and
Self::status reads BacklightStatus::DisabledBySoftware.
mode: BacklightModeHow the level is chosen while the backlight is enabled.
status: BacklightStatusWhy the backlight is in its current state.
current_level: u8Current brightness level, 0 (off) up to Self::nb_levels minus one.
nb_levels: u8Number of user-selectable brightness levels the device reports.
power_save: boolWhether battery saving is on: the firmware turns the backlight off when the battery runs low.
serde(default) only keeps recorded JSON fixtures that predate the
field loading; the IPC encoding always carries it.
controls: BacklightControlsWhich BacklightChanges the keyboard accepts.
Implementations§
Source§impl BacklightState
impl BacklightState
Sourcepub fn accepts(self, change: BacklightChange) -> bool
pub fn accepts(self, change: BacklightChange) -> bool
Whether the keyboard accepts change right now: the control exists
and, for a level, the level is in range.
Sourcepub fn is_automatic(self) -> bool
pub fn is_automatic(self) -> bool
Whether the ambient-light sensor chooses the level — the firmware’s automatic mode, or the temporary level the backlight keys set on top of it.
Sourcepub fn is_dark(self) -> bool
pub fn is_dark(self) -> bool
Whether the LEDs are dark right now, for whatever reason — software disable, critical battery, a saturated ambient-light sensor, or a zero manual level.
Sourcepub fn changed(self, change: BacklightChange) -> BacklightState
pub fn changed(self, change: BacklightChange) -> BacklightState
The backlight this one becomes once the keyboard keeps change, as
far as the change alone decides — what software can show before the
keyboard reads back, and what a keyboard double answers.
The firmware owns the rest and it is kept: a critical-battery shutoff
stays in force, and a status the mode did not change — a saturated
sensor, say — stands. Turning the backlight off always reads
BacklightStatus::DisabledBySoftware, the status the keyboard
reports for it. change is not checked against Self::accepts.
Trait Implementations§
Source§impl Clone for BacklightState
impl Clone for BacklightState
Source§fn clone(&self) -> BacklightState
fn clone(&self) -> BacklightState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more