pub struct ManagedDevice {
pub id: String,
pub name: Option<String>,
pub device_type: Option<DeviceType>,
pub auto_reconnect: bool,
pub last_reading: Option<CurrentReading>,
pub info: Option<DeviceInfo>,
pub reconnect_options: ReconnectOptions,
pub priority: DevicePriority,
pub consecutive_failures: u32,
pub last_success: Option<u64>,
/* private fields */
}Expand description
Information about a managed device.
Fields§
§id: StringDevice identifier.
name: Option<String>Device name.
device_type: Option<DeviceType>Device type.
auto_reconnect: boolWhether auto-reconnect is enabled.
last_reading: Option<CurrentReading>Last known reading.
info: Option<DeviceInfo>Device info.
reconnect_options: ReconnectOptionsReconnection options (if auto-reconnect is enabled).
priority: DevicePriorityDevice priority for connection management.
consecutive_failures: u32Number of consecutive connection failures.
last_success: Option<u64>Last successful connection timestamp (Unix epoch millis).
Implementations§
Source§impl ManagedDevice
impl ManagedDevice
Sourcepub fn with_reconnect_options(id: &str, options: ReconnectOptions) -> Self
pub fn with_reconnect_options(id: &str, options: ReconnectOptions) -> Self
Create a managed device with custom reconnect options.
Sourcepub fn with_priority(id: &str, priority: DevicePriority) -> Self
pub fn with_priority(id: &str, priority: DevicePriority) -> Self
Create a managed device with priority.
Sourcepub fn with_options(
id: &str,
options: ReconnectOptions,
priority: DevicePriority,
) -> Self
pub fn with_options( id: &str, options: ReconnectOptions, priority: DevicePriority, ) -> Self
Create a managed device with reconnect options and priority.
Sourcepub fn record_success(&mut self)
pub fn record_success(&mut self)
Record a successful operation.
Sourcepub fn record_failure(&mut self)
pub fn record_failure(&mut self)
Record a failed operation.
Sourcepub fn has_device(&self) -> bool
pub fn has_device(&self) -> bool
Check if the device is connected (sync check, doesn’t query BLE).
Sourcepub async fn is_connected(&self) -> bool
pub async fn is_connected(&self) -> bool
Check if the device is connected (async, queries BLE).
Sourcepub fn device_arc(&self) -> Option<Arc<Device>>
pub fn device_arc(&self) -> Option<Arc<Device>>
Get a clone of the device Arc.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ManagedDevice
impl !RefUnwindSafe for ManagedDevice
impl Send for ManagedDevice
impl Sync for ManagedDevice
impl Unpin for ManagedDevice
impl !UnwindSafe for ManagedDevice
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