1#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
5pub enum BatteryState {
6 Charging,
7 Discharging,
8 #[default]
9 Full,
10 NotCharging,
11 Unknown,
12}
13
14#[derive(Debug, Clone, Copy, PartialEq)]
16pub struct BatteryInfo {
17 pub level: f32,
19 pub state: BatteryState,
21 pub is_low_power_mode: bool,
23 pub time_to_empty_secs: Option<u32>,
25 pub time_to_full_secs: Option<u32>,
27}
28
29impl Default for BatteryInfo {
30 fn default() -> Self {
31 Self {
32 level: 1.0,
33 state: BatteryState::Full,
34 is_low_power_mode: false,
35 time_to_empty_secs: None,
36 time_to_full_secs: None,
37 }
38 }
39}
40
41#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default)]
43pub enum ThermalState {
44 #[default]
46 Nominal,
47 Fair,
49 Serious,
51 Critical,
53}
54
55#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default)]
57pub enum MemoryPressure {
58 #[default]
60 Normal,
61 Warning,
63 Critical,
65}
66
67#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
69pub enum GpuBackend {
70 Metal,
71 Vulkan,
72 Direct3D12,
73 WebGpu,
74 OpenGl,
75 #[default]
76 Software,
77}
78
79#[derive(Debug, Clone, PartialEq, Eq)]
81pub struct GpuInfo {
82 pub backend: GpuBackend,
83 pub device_name: String,
84 pub driver_version: String,
85 pub vram_total_bytes: u64,
86 pub vram_used_bytes: u64,
87}
88
89impl Default for GpuInfo {
90 fn default() -> Self {
91 Self {
92 backend: GpuBackend::Software,
93 device_name: "Strata Software Rasterizer".to_string(),
94 driver_version: "1.0.0".to_string(),
95 vram_total_bytes: 0,
96 vram_used_bytes: 0,
97 }
98 }
99}
100
101#[derive(Debug, Clone, Copy, PartialEq)]
103pub struct DisplayRefreshInfo {
104 pub current_hz: f32,
105 pub max_hz: f32,
106 pub is_variable_refresh_rate: bool,
107 pub is_high_refresh_rate: bool,
108}
109
110impl Default for DisplayRefreshInfo {
111 fn default() -> Self {
112 Self {
113 current_hz: 60.0,
114 max_hz: 60.0,
115 is_variable_refresh_rate: false,
116 is_high_refresh_rate: false,
117 }
118 }
119}
120
121#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
123pub enum ConnectionType {
124 #[default]
125 Wifi,
126 Cellular,
127 Ethernet,
128 Bluetooth,
129 Unknown,
130 None,
131}
132
133#[derive(Debug, Clone, Copy, PartialEq, Eq)]
135pub enum CellularGen {
136 TwoG,
137 ThreeG,
138 FourG,
139 FiveG,
140}
141
142#[derive(Debug, Clone, Copy, PartialEq)]
144pub struct NetworkStatus {
145 pub is_online: bool,
146 pub connection_type: ConnectionType,
147 pub cellular_generation: Option<CellularGen>,
148 pub downlink_mbps: Option<f32>,
149 pub rtt_ms: Option<u32>,
150 pub is_metered: bool,
151}
152
153impl Default for NetworkStatus {
154 fn default() -> Self {
155 Self {
156 is_online: true,
157 connection_type: ConnectionType::Wifi,
158 cellular_generation: None,
159 downlink_mbps: Some(100.0),
160 rtt_ms: Some(20),
161 is_metered: false,
162 }
163 }
164}
165
166#[derive(Debug, Clone, Copy, PartialEq, Default)]
168pub struct SafeAreaInsets {
169 pub top: f32,
170 pub right: f32,
171 pub bottom: f32,
172 pub left: f32,
173}
174
175impl SafeAreaInsets {
176 pub const fn zero() -> Self {
177 Self {
178 top: 0.0,
179 right: 0.0,
180 bottom: 0.0,
181 left: 0.0,
182 }
183 }
184
185 pub const fn all(val: f32) -> Self {
186 Self {
187 top: val,
188 right: val,
189 bottom: val,
190 left: val,
191 }
192 }
193
194 pub const fn symmetric(vertical: f32, horizontal: f32) -> Self {
195 Self {
196 top: vertical,
197 right: horizontal,
198 bottom: vertical,
199 left: horizontal,
200 }
201 }
202}
203
204#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
206pub enum ColorGamut {
207 #[default]
208 Srgb,
209 DisplayP3,
210 Rec2020,
211}
212
213#[derive(Debug, Clone, Copy, PartialEq)]
215pub struct ScreenGeometry {
216 pub width_px: u32,
217 pub height_px: u32,
218 pub scale_factor: f32,
219 pub safe_area: SafeAreaInsets,
220 pub color_gamut: ColorGamut,
221}
222
223impl Default for ScreenGeometry {
224 fn default() -> Self {
225 Self {
226 width_px: 1280,
227 height_px: 800,
228 scale_factor: 1.0,
229 safe_area: SafeAreaInsets::zero(),
230 color_gamut: ColorGamut::Srgb,
231 }
232 }
233}