Skip to main content

csi_webclient/
profile.rs

1//! Injectable client-behavior seam.
2//!
3//! [`ClientProfile`] is the extension point that lets a downstream binary add
4//! chip- or standard-specific behavior (extra PHY protocols, CSI presets,
5//! `data_format` labeling) without the open library naming any of it. The open
6//! binary ships [`StandardClientProfile`], a no-op implementation; a private
7//! companion crate can ship its own profile injected via
8//! [`crate::app::CsiClientApp::with_profile`].
9
10use crate::state::DeviceAction;
11use eframe::egui;
12
13/// Pluggable per-deployment behavior for the client.
14///
15/// Every method is defaulted so the open build (and any consumer that only
16/// wants the standard behavior) can use [`StandardClientProfile`] directly.
17pub trait ClientProfile {
18    /// Additional PHY-protocol option strings appended to the core set in the
19    /// protocol dropdown. Each is surfaced as [`crate::state::WifiProtocol::Ext`]
20    /// and round-trips to the server verbatim.
21    fn extra_protocols(&self) -> &[&'static str] {
22        &[]
23    }
24
25    /// Render any extra CSI-preset buttons at the end of the CSI section.
26    ///
27    /// Implementations push [`DeviceAction::SetCsiPreset`] (or any other action)
28    /// into `actions`; the caller routes them to the selected device.
29    fn extra_preset_buttons(&self, ui: &mut egui::Ui, actions: &mut Vec<DeviceAction>) {
30        let _ = (ui, actions);
31    }
32
33    /// Map a numeric `cur_bb_format` to a stable `data_format` label for the
34    /// Parquet export. `None` falls back to the decoded `RxCsiFmt::as_str()`.
35    fn label_format(&self, cur_bb_format: u32) -> Option<&'static str> {
36        let _ = cur_bb_format;
37        None
38    }
39
40    /// Whether the CSI section should surface the HE-STBC numeric field.
41    fn shows_he_stbc_field(&self) -> bool {
42        false
43    }
44}
45
46/// No-op profile: the open build ships this and adds nothing chip-specific.
47pub struct StandardClientProfile;
48
49impl ClientProfile for StandardClientProfile {}