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) -> Self
pub fn changed(self, change: BacklightChange) -> Self
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
impl Copy for BacklightState
Source§impl Debug for BacklightState
impl Debug for BacklightState
Source§impl<'de> Deserialize<'de> for BacklightState
impl<'de> Deserialize<'de> for BacklightState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for BacklightState
Source§impl PartialEq for BacklightState
impl PartialEq for BacklightState
Source§impl Serialize for BacklightState
impl Serialize for BacklightState
impl StructuralPartialEq for BacklightState
Auto Trait Implementations§
impl Freeze for BacklightState
impl RefUnwindSafe for BacklightState
impl Send for BacklightState
impl Sync for BacklightState
impl Unpin for BacklightState
impl UnsafeUnpin for BacklightState
impl UnwindSafe for BacklightState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.