rodecaster_protocol/names/gui.rs
1//! [`GuiParam`]: the singleton root `GUI`-node front-panel UI-state family.
2
3// The fourteen properties a real Pro II / Duo fullSync carries on the single
4// root-level GUI node (confirmed from capture, firmware 1.7.3). GUI is the
5// front-panel / touchscreen UI-state singleton: display + button brightness,
6// the active pad bank, the metering mode, and which EQ band the touchscreen is
7// editing. None of it is audio routing.
8wire_param_enum! {
9 /// A front-panel UI parameter: one of the flat properties the device carries
10 /// on the single root `GUI` node. This is touchscreen / display state, not
11 /// audio routing: screen + button brightness, the selected pad bank, the
12 /// metering mode, and which EQ band the touchscreen EQ view is focused on.
13 ///
14 /// Two wire-name subtleties worth calling out:
15 /// - `screenTouched` here is the device's *readback* flag (the UI reporting
16 /// the screen is being touched). It is distinct from
17 /// [`crate::Command::ScreenTouched`], which is a separate "wake the
18 /// display" pulse frame, not a write to this property.
19 /// - `eqParamModeLow` / `eqParamModeMid` / `eqParamModeHigh` live on `GUI`,
20 /// not on the channel strip: they select which EQ band the touchscreen is
21 /// editing (UI focus), so they are intentionally absent from
22 /// [`crate::ChannelParam`].
23 GuiParam {
24 // Language.
25 Lang => "lang",
26 // Display / button brightness + dimming.
27 ScreenBrightness => "screenBrightness",
28 AutoBrightness => "autoBrightness",
29 ScreenDimAfterSeconds => "screenDimAfterSeconds",
30 ActiveButtonsBrightness => "activeButtonsBrightness",
31 InactiveButtonsBrightness => "inactiveButtonsBrightness",
32 // Metering.
33 Metering => "metering",
34 BroadcastMeters => "broadcastMeters",
35 // Pad bank / edit state.
36 SelectedBank => "selectedBank",
37 PadActiveEdit => "padActiveEdit",
38 ScreenTouched => "screenTouched",
39 // Touchscreen EQ-band focus (UI state, not channel-strip EQ).
40 EqParamModeLow => "eqParamModeLow",
41 EqParamModeMid => "eqParamModeMid",
42 EqParamModeHigh => "eqParamModeHigh",
43 }
44}
45
46#[cfg(test)]
47mod tests {
48 use super::*;
49
50 #[test]
51 fn gui_param_round_trips_and_exact_wire_names() {
52 for p in [
53 GuiParam::Lang,
54 GuiParam::ScreenBrightness,
55 GuiParam::AutoBrightness,
56 GuiParam::Metering,
57 GuiParam::BroadcastMeters,
58 GuiParam::SelectedBank,
59 GuiParam::PadActiveEdit,
60 GuiParam::ScreenTouched,
61 GuiParam::EqParamModeHigh,
62 ] {
63 assert_eq!(GuiParam::from_name(p.as_str()), p);
64 assert!(p.is_known());
65 assert_eq!(p.to_string(), p.as_str());
66 }
67 assert_eq!(
68 GuiParam::ScreenDimAfterSeconds.as_str(),
69 "screenDimAfterSeconds"
70 );
71 assert_eq!(
72 GuiParam::InactiveButtonsBrightness.as_str(),
73 "inactiveButtonsBrightness"
74 );
75 assert_eq!(
76 GuiParam::ActiveButtonsBrightness.as_str(),
77 "activeButtonsBrightness"
78 );
79 assert_eq!(GuiParam::EqParamModeLow.as_str(), "eqParamModeLow");
80 assert_eq!(GuiParam::EqParamModeMid.as_str(), "eqParamModeMid");
81 }
82
83 #[test]
84 fn gui_param_unknown_falls_back_to_other() {
85 let p = GuiParam::from_name("mysteryGuiFlag");
86 assert_eq!(p, GuiParam::Other("mysteryGuiFlag".to_string()));
87 assert!(!p.is_known());
88 assert_eq!(GuiParam::from_name(p.as_str()), p);
89 }
90}