Skip to main content

strata_device/
lib.rs

1//! Strata Device: Hardware introspection, OS Geolocation/GPS, hardware sensors, and reactive signals.
2//!
3//! Provides reactive hooks for geolocation (`use_geolocation`), compass (`use_compass`),
4//! 6-DoF IMU (`use_imu`), barometer (`use_barometer`), ambient light (`use_ambient_light`),
5//! battery state, thermals, network, display geometry, safe area insets, and system-wide
6//! memory pressure eviction callbacks.
7
8pub mod mock;
9pub mod os_sensors;
10pub mod os_telemetry;
11pub mod signals;
12pub mod types;
13
14pub use mock::{DeviceMockController, DeviceTelemetrySnapshot};
15pub use os_sensors::{
16    clear_ip_geolocation_cache, probe_linux_iio_ambient_light_in_dir,
17    probe_linux_iio_barometer_in_dir, probe_linux_iio_compass_in_dir, probe_linux_iio_imu_in_dir,
18    probe_nmea_file, probe_os_ambient_light, probe_os_barometer, probe_os_compass,
19    probe_os_geolocation, probe_os_geolocation_async, probe_os_imu, refresh_sensors_from_hardware,
20    register_web_api_geolocation_provider,
21};
22pub use os_telemetry::{
23    probe_hardware_telemetry, probe_os_battery, probe_os_network, probe_os_thermal,
24    refresh_from_hardware,
25};
26pub use signals::{
27    clear_memory_pressure_listeners, notify_memory_pressure, on_memory_pressure,
28    poll_geolocation_updates, request_geolocation_refresh_async, unregister_memory_pressure,
29    use_ambient_light, use_barometer, use_battery, use_compass, use_display_refresh,
30    use_geolocation, use_geolocation_with_options, use_imu, use_network, use_screen, use_thermal,
31};
32pub use types::{
33    isa_pressure_altitude_m, lux_to_daylight_factor, AmbientLightReading, BarometerReading,
34    BatteryInfo, BatteryState, CellularGen, ColorGamut, CompassReading, ConnectionType,
35    DisplayRefreshInfo, GeolocationInfo, GeolocationSource, GpuBackend, GpuInfo, ImuReading,
36    MemoryPressure, NetworkStatus, SafeAreaInsets, ScreenGeometry, ThermalState,
37};
38
39/// Device telemetry and hardware sensor prelude module.
40pub mod prelude {
41    pub use super::mock::DeviceMockController;
42    pub use super::os_sensors::{
43        probe_os_ambient_light, probe_os_barometer, probe_os_compass, probe_os_geolocation,
44        probe_os_geolocation_async, probe_os_imu, refresh_sensors_from_hardware,
45        register_web_api_geolocation_provider,
46    };
47    pub use super::signals::{
48        clear_memory_pressure_listeners, notify_memory_pressure, on_memory_pressure,
49        poll_geolocation_updates, request_geolocation_refresh_async, unregister_memory_pressure,
50        use_ambient_light, use_barometer, use_battery, use_compass, use_display_refresh,
51        use_geolocation, use_geolocation_with_options, use_imu, use_network, use_screen,
52        use_thermal,
53    };
54    pub use super::types::{
55        isa_pressure_altitude_m, lux_to_daylight_factor, AmbientLightReading, BarometerReading,
56        BatteryInfo, BatteryState, CellularGen, ColorGamut, CompassReading, ConnectionType,
57        DisplayRefreshInfo, GeolocationInfo, GeolocationSource, GpuBackend, GpuInfo, ImuReading,
58        MemoryPressure, NetworkStatus, SafeAreaInsets, ScreenGeometry, ThermalState,
59    };
60}