euv_core/platform/wearable/struct.rs
1use super::*;
2
3/// Hardware display and input profile descriptor for a smartwatch vendor target.
4#[derive(Clone, Copy, Data, Debug, PartialEq)]
5pub struct WearableProfile {
6 /// Smartwatch ecosystem vendor.
7 #[get(type(copy))]
8 pub(crate) vendor: WearableVendor,
9 /// Physical watch face shape (`Round`, `Squircle`, or `Rectangular`).
10 #[get(type(copy))]
11 pub(crate) shape: WearableShape,
12 /// Logical viewport width in dp.
13 #[get(type(copy))]
14 pub(crate) logical_width: u32,
15 /// Logical viewport height in dp.
16 #[get(type(copy))]
17 pub(crate) logical_height: u32,
18 /// Display density scale factor mapping dp to physical pixels.
19 #[get(type(copy))]
20 pub(crate) scale_factor: f32,
21 /// Optional bottom chin inset in logical dp for flat-tire round dials.
22 #[get(type(copy))]
23 pub(crate) chin_height_dp: f32,
24 /// Interactive refresh rate in Hertz (`30.0`..=`60.0`).
25 #[get(type(copy))]
26 pub(crate) refresh_rate_hz: f32,
27 /// Whether the watch supports a rotary crown or rotating bezel.
28 #[get(type(copy))]
29 pub(crate) has_rotary_crown: bool,
30 /// Whether the watch supports Always-On Display (AOD) low-power ambient mode.
31 #[get(type(copy))]
32 pub(crate) supports_aod: bool,
33}
34
35/// Normalized rotary crown or rotating bezel rotation event payload.
36#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
37pub struct WearableCrownInput {
38 /// Signed detent delta (`> 0.0` clockwise / scroll down, `< 0.0` counter-clockwise / scroll up).
39 #[get(type(copy))]
40 pub(crate) detents: f32,
41 /// Instantaneous angular velocity in detents per second.
42 #[get(type(copy))]
43 pub(crate) velocity: f32,
44 /// Semantic mapping mode (`Scroll`, `FocusStep`, or `DirectionalStep`).
45 #[get(type(copy))]
46 pub(crate) mode: WearableCrownMode,
47 /// Whether a subtle tactile haptic detent tick should accompany this input.
48 #[get(type(copy))]
49 pub(crate) haptic_detent: bool,
50}
51
52/// Live window record tracked by `WearablePlatform`.
53#[derive(Clone, Data, Debug)]
54pub struct WearableWindowRecord {
55 /// Window configuration snapshot.
56 pub(crate) config: WindowConfig,
57 /// Live window metrics with inscribed safe-area insets applied.
58 #[get(type(copy))]
59 pub(crate) state: WindowState,
60 /// Opaque vendor native surface pointer (`0` in offscreen/simulated sessions).
61 #[get(type(copy))]
62 pub(crate) native_surface: usize,
63 /// Last presented RGBA8 framebuffer snapshot.
64 pub(crate) last_frame: Framebuffer,
65 /// Total frames presented in interactive mode.
66 #[get(type(copy))]
67 pub(crate) present_count: u64,
68 /// Total low-power AOD ambient ticks rendered.
69 #[get(type(copy))]
70 pub(crate) ambient_tick_count: u64,
71}
72
73/// Unified smartwatch host backend smoothing Wear OS, watchOS, HarmonyOS Watch, HyperOS/Vela, OPPO, vivo, Garmin, and ZeppOS.
74#[derive(Clone, Data, Debug)]
75pub struct WearablePlatform {
76 /// Active wearable hardware and display profile.
77 #[get(type(copy))]
78 pub(crate) profile: WearableProfile,
79 /// Current Always-On Display / screen power mode.
80 #[get(type(copy))]
81 pub(crate) ambient_mode: WearableAmbientMode,
82 /// Computed compact viewport scale factor for adaptive UI density.
83 #[get(type(copy))]
84 pub(crate) compact_scale: f32,
85 /// Computed shape-aware safe-area insets (inscribed square for round screens).
86 #[get(type(copy))]
87 pub(crate) safe_area: SafeAreaInsets,
88 /// Fractional rotary crown detent accumulator for crisp discrete focus/arrow steps.
89 #[get(type(copy))]
90 pub(crate) crown_accumulator: f32,
91 /// Logical scroll distance emitted per rotary crown detent.
92 #[get(type(copy))]
93 pub(crate) crown_scroll_step: f32,
94 /// Monotonic window identifier allocator.
95 #[get(pub(crate), type(copy))]
96 #[get_mut(pub(crate))]
97 #[set(pub(crate))]
98 pub(crate) next_id: u64,
99 /// Primary watch window handle, if created.
100 #[get(skip)]
101 pub(crate) primary_window: Option<WindowId>,
102 /// Active watch windows indexed by `WindowId`.
103 pub(crate) windows: HashMap<WindowId, WearableWindowRecord>,
104 /// Touch contact lifecycle tracker ensuring palm-cover and screen-off cancel dangling touches.
105 pub(crate) touch_tracker: TouchPointerTracker,
106 /// Queued normalized window and system events awaiting `poll_events()`.
107 pub(crate) pending_events: Vec<WindowEvent>,
108 /// In-memory sandbox storage backing `PlatformStorage`.
109 pub(crate) storage: HashMap<String, String>,
110 /// Navigation stack backing `PlatformNavigation`.
111 pub(crate) route_stack: Vec<String>,
112 /// Active watch OS theme (`Dark` default for OLED power efficiency).
113 #[get(type(copy))]
114 pub(crate) theme: ThemeMode,
115 /// Whether the watch frame pump is paused (`true` in `ScreenOff` or suspended ambient).
116 #[get(type(copy))]
117 pub(crate) pump_paused: bool,
118 /// Count of rotary haptic detent pulses emitted.
119 #[get(type(copy))]
120 pub(crate) haptic_detent_count: u64,
121 /// Whether `present_framebuffer` retains a cloned RGBA8 snapshot for diagnostic inspection (default `false`).
122 #[get(type(copy))]
123 pub(crate) capture_last_frame: bool,
124}