pub struct SystemInfo { /* private fields */ }Expand description
System information from device telemetry.
Contains read-only diagnostic data like uptime and network status. These values change frequently and do not trigger callbacks when updated.
§Data Sources
- MQTT telemetry: uptime and
wifi_rssifromtele/<topic>/STATE - HTTP status: All fields from
Status 0command
§Examples
use std::time::Duration;
use tasmor_lib::state::SystemInfo;
let info = SystemInfo::new()
.with_uptime(Duration::from_secs(172800))
.with_wifi_rssi(-60)
.with_heap(25000);
assert_eq!(info.uptime(), Some(Duration::from_secs(172800)));Implementations§
Source§impl SystemInfo
impl SystemInfo
Sourcepub fn with_uptime(self, duration: Duration) -> Self
pub fn with_uptime(self, duration: Duration) -> Self
Sets the uptime.
§Examples
use std::time::Duration;
use tasmor_lib::state::SystemInfo;
let info = SystemInfo::new().with_uptime(Duration::from_secs(86400));
assert_eq!(info.uptime(), Some(Duration::from_secs(86400)));Sourcepub fn with_wifi_rssi(self, rssi: i8) -> Self
pub fn with_wifi_rssi(self, rssi: i8) -> Self
Sets the Wi-Fi RSSI in dBm.
Sourcepub fn uptime(&self) -> Option<Duration>
pub fn uptime(&self) -> Option<Duration>
Returns the device uptime.
§Examples
use std::time::Duration;
use tasmor_lib::state::SystemInfo;
let info = SystemInfo::new().with_uptime(Duration::from_secs(172800));
let uptime = info.uptime().unwrap();
println!("Uptime: {} days", uptime.as_secs() / 86400);Sourcepub fn wifi_rssi(&self) -> Option<i8>
pub fn wifi_rssi(&self) -> Option<i8>
Returns the Wi-Fi signal strength in dBm.
Typical values range from -100 (weak) to 0 (strongest). A signal of -50 dBm or better is considered excellent.
Sourcepub fn merge(&mut self, other: &SystemInfo)
pub fn merge(&mut self, other: &SystemInfo)
Updates fields from another SystemInfo, preserving existing values
when the new value is None.
Trait Implementations§
Source§impl Clone for SystemInfo
impl Clone for SystemInfo
Source§fn clone(&self) -> SystemInfo
fn clone(&self) -> SystemInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SystemInfo
impl Debug for SystemInfo
Source§impl Default for SystemInfo
impl Default for SystemInfo
Source§fn default() -> SystemInfo
fn default() -> SystemInfo
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SystemInfo
impl<'de> Deserialize<'de> for SystemInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for SystemInfo
impl PartialEq for SystemInfo
Source§impl Serialize for SystemInfo
impl Serialize for SystemInfo
impl Eq for SystemInfo
impl StructuralPartialEq for SystemInfo
Auto Trait Implementations§
impl Freeze for SystemInfo
impl RefUnwindSafe for SystemInfo
impl Send for SystemInfo
impl Sync for SystemInfo
impl Unpin for SystemInfo
impl UnwindSafe for SystemInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more