pub struct StoredReading {Show 15 fields
pub id: i64,
pub device_id: String,
pub captured_at: OffsetDateTime,
pub co2: u16,
pub temperature: f32,
pub pressure: f32,
pub humidity: u8,
pub battery: u8,
pub status: Status,
pub radon: Option<u32>,
pub radiation_rate: Option<f32>,
pub radiation_total: Option<f64>,
pub radon_avg_24h: Option<u32>,
pub radon_avg_7d: Option<u32>,
pub radon_avg_30d: Option<u32>,
}Expand description
A current sensor reading stored in the database.
This represents a point-in-time reading captured from a device, typically
via BLE connection. Unlike StoredHistoryRecord, these are readings
captured by your application, not downloaded from the device’s internal memory.
§Supported Sensor Types
- Aranet4: CO2, temperature, pressure, humidity
- Aranet2: Temperature, humidity
- AranetRn+ (Radon): Radon level, temperature, humidity, pressure
- AranetRad (Radiation): Radiation rate/total, temperature, humidity
Fields for unsupported sensors (e.g., radon for Aranet4) will be None.
Fields§
§id: i64Database row ID.
device_id: StringDevice identifier.
captured_at: OffsetDateTimeWhen this reading was captured.
co2: u16CO2 concentration in ppm.
temperature: f32Temperature in Celsius.
pressure: f32Pressure in hPa.
humidity: u8Humidity percentage.
battery: u8Battery percentage.
status: StatusStatus indicator.
radon: Option<u32>Radon level (Bq/m3) for radon devices.
radiation_rate: Option<f32>Radiation rate in uSv/h for radiation devices.
radiation_total: Option<f64>Total radiation dose in mSv for radiation devices.
radon_avg_24h: Option<u32>24-hour average radon concentration in Bq/m³ (radon devices only).
radon_avg_7d: Option<u32>7-day average radon concentration in Bq/m³ (radon devices only).
radon_avg_30d: Option<u32>30-day average radon concentration in Bq/m³ (radon devices only).
Implementations§
Source§impl StoredReading
impl StoredReading
Sourcepub fn from_reading_with_id(
device_id: &str,
reading: &CurrentReading,
id: i64,
) -> Self
pub fn from_reading_with_id( device_id: &str, reading: &CurrentReading, id: i64, ) -> Self
Create a StoredReading from an aranet_types::CurrentReading with an explicit row ID.
Sourcepub fn from_reading(device_id: &str, reading: &CurrentReading) -> Self
pub fn from_reading(device_id: &str, reading: &CurrentReading) -> Self
Create a StoredReading from an aranet_types::CurrentReading.
The database id is set to 0 and will be assigned by SQLite on insert.
If captured_at is None in the source reading, the current time is used.
§Arguments
device_id- The device identifier this reading came fromreading- The source reading fromaranet-types
Sourcepub fn to_reading(&self) -> CurrentReading
pub fn to_reading(&self) -> CurrentReading
Convert back to an aranet_types::CurrentReading.
Note: Some fields are not preserved in storage:
intervalandageare set to 0
Use this when you need to pass stored data to functions expecting CurrentReading.
Trait Implementations§
Source§impl Clone for StoredReading
impl Clone for StoredReading
Source§fn clone(&self) -> StoredReading
fn clone(&self) -> StoredReading
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more