sessiond: put the panel doc comments back on their own functions
A scripted edit stacked three doc comments onto panel_on() and left set_panel() with none. Comments are load-bearing here — set_panel is the report half and request_screen is the ask half, and the whole reason both exist is that a report must not actuate and an ask must not silently edit the machine's idea of the hardware. That distinction was sitting on the wrong function.
This commit is contained in:
parent
b45fb705db
commit
1f1fc5c7dd
1 changed files with 16 additions and 11 deletions
|
|
@ -2123,8 +2123,15 @@ impl DeviceStateMachine {
|
||||||
actions
|
actions
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The executor reports the panel's real state. Turning on counts as
|
/// What the machine currently believes the panel is doing.
|
||||||
/// input, so a dt2w wake starts the blank budget from the wake itself.
|
///
|
||||||
|
/// A belief, and named as one: the executor reports it (`set_panel`) and
|
||||||
|
/// nothing here infers it, so this is the last thing the hardware said
|
||||||
|
/// rather than an assumption about what it must be doing now.
|
||||||
|
pub fn panel_on(&self) -> bool {
|
||||||
|
self.panel_on
|
||||||
|
}
|
||||||
|
|
||||||
/// Ask for the panel, from outside the machine's own rules.
|
/// Ask for the panel, from outside the machine's own rules.
|
||||||
///
|
///
|
||||||
/// The agent's verb lands here (`{"op":"screen"}`), and so does anything
|
/// The agent's verb lands here (`{"op":"screen"}`), and so does anything
|
||||||
|
|
@ -2137,15 +2144,6 @@ impl DeviceStateMachine {
|
||||||
/// screen off — and the ordering invariant is not a permission she is
|
/// screen off — and the ordering invariant is not a permission she is
|
||||||
/// missing, it is a property of the machine that applies to every caller
|
/// missing, it is a property of the machine that applies to every caller
|
||||||
/// including itself.
|
/// including itself.
|
||||||
/// What the machine currently believes the panel is doing.
|
|
||||||
///
|
|
||||||
/// A belief, and named as one: the executor reports it (`set_panel`) and
|
|
||||||
/// nothing here infers it, so this is the last thing the hardware said
|
|
||||||
/// rather than an assumption about what it must be doing now.
|
|
||||||
pub fn panel_on(&self) -> bool {
|
|
||||||
self.panel_on
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn request_screen(&mut self, on: bool, why: &str) -> Vec<Action> {
|
pub fn request_screen(&mut self, on: bool, why: &str) -> Vec<Action> {
|
||||||
if on {
|
if on {
|
||||||
if self.panel_on {
|
if self.panel_on {
|
||||||
|
|
@ -2172,6 +2170,13 @@ impl DeviceStateMachine {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The executor reports the panel's real state. Turning on counts as
|
||||||
|
/// input, so a dt2w wake starts the blank budget from the wake itself.
|
||||||
|
///
|
||||||
|
/// A *report*, never a request — [`Self::request_screen`] is the asking
|
||||||
|
/// half. Keeping them apart is what stops a stale report from driving the
|
||||||
|
/// panel, and stops an ask from quietly editing the machine's idea of what
|
||||||
|
/// the hardware is doing.
|
||||||
pub fn set_panel(&mut self, on: bool) -> Vec<Action> {
|
pub fn set_panel(&mut self, on: bool) -> Vec<Action> {
|
||||||
if self.panel_on == on {
|
if self.panel_on == on {
|
||||||
return Vec::new();
|
return Vec::new();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue