pub struct DeviceState {
pub thermal: ThermalState,
pub low_power_mode: Option<bool>,
pub app_state: AppState,
pub memory: MemoryPressure,
pub network: NetworkType,
pub network_expensive: bool,
pub network_constrained: bool,
pub battery_level: Option<u32>,
pub battery_charging: bool,
}Expand description
What the host observes about the device; pushed with Telemetry::set_device_state whenever
anything changes.
The host owns the OS APIs (thermal, power, memory, battery, network path, lifecycle) — they
are not reachable from Rust without a JVM/ObjC bridge — and the core owns what to do with
them: emit the change events from SPEC.md, stretch its own cadence and hold uploads so
telemetry never competes with the call. CPU is deliberately not measured here (measuring CPU
costs CPU): thermal state is the OS’s judgement, and WebRTC’s own qualityLimitationReason
(see RtcStatsSample) says when the encoder is CPU-starved.
Fields§
§thermal: ThermalStateThe OS’s thermal state; Unknown when the platform has no source.
low_power_mode: Option<bool>Low Power Mode / Battery Saver; None when the platform has no source (no change event,
no stretch).
app_state: AppStateWhether the app is in front of the user.
memory: MemoryPressureThe OS’s memory pressure.
network: NetworkTypeThe active network path.
network_expensive: boolCellular / personal hotspot (NWPath.isExpensive, metered on Android).
network_constrained: boolThe user asked for less traffic: Low Data Mode (NWPath.isConstrained), Data Saver,
navigator.connection.saveData.
battery_level: Option<u32>Battery charge in percent; None when unknown (desktops, tvOS, monitoring disabled).
battery_charging: boolPlugged in and charging: a charging battery is never low.