Skip to main content

DeviceState

Struct DeviceState 

Source
pub struct DeviceState {
Show 22 fields pub id: String, pub mac: Option<String>, pub port_path: Option<String>, pub baud_rate: Option<u32>, pub serial_connected: Option<bool>, pub collection_running: Option<bool>, pub firmware_verified: Option<bool>, pub fault: Option<String>, pub latest_info: Option<DeviceInfo>, pub forms: DeviceForms, pub latest_config: Option<DeviceConfig>, pub auto_resetting_cache: bool, pub ws_connected: bool, pub frames_received: u64, pub bytes_received: u64, pub recent_frames: Vec<FrameSummary>, pub auto_scroll_stream: bool, pub details_loaded: bool, pub recording: bool, pub record_path: Option<String>, pub recorded_frames: u64, pub record_decode_errors: u64,
}
Expand description

Complete per-device state: identity, config forms, status, and stream.

Every attached device discovered via GET /api/devices owns one of these. State is fully isolated per device, matching the server’s per-device model.

Fields§

§id: String

Stable device id used to build /api/devices/{id}/... paths.

§mac: Option<String>

Stable board MAC when reported by the webserver (USB iSerialNumber).

§port_path: Option<String>§baud_rate: Option<u32>§serial_connected: Option<bool>§collection_running: Option<bool>§firmware_verified: Option<bool>§fault: Option<String>

Chip fault reported by the webserver (e.g. the ESP32-C5/C6 USB-JTAG reset-loop wedge), including the recovery action. None = healthy.

§latest_info: Option<DeviceInfo>§forms: DeviceForms§latest_config: Option<DeviceConfig>§auto_resetting_cache: bool

Guards against an infinite reset/fetch loop when an empty fetch auto-issues config/reset and the follow-up fetch is also empty.

§ws_connected: bool§frames_received: u64§bytes_received: u64§recent_frames: Vec<FrameSummary>§auto_scroll_stream: bool§details_loaded: bool

True once the one-time info/config/status fetch has been issued for this freshly-discovered device.

§recording: bool

True while this device’s stream is being recorded to a Parquet file.

§record_path: Option<String>

Output path of the current (or most recent) recording.

§recorded_frames: u64

Frames written to the active recording.

§record_decode_errors: u64

Frames the recorder could not decode (wire drift / truncation).

Implementations§

Source§

impl DeviceState

Source

pub fn new(id: impl Into<String>) -> Self

Create a new device state with default forms.

Source

pub fn apply_list_entry(&mut self, entry: &DeviceListEntry)

Refresh the live status fields from a GET /api/devices list entry.

This keeps the dashboard/fleet view current on every discovery poll without per-device round-trips.

Source

pub fn push_frame(&mut self, bytes: &[u8])

Record one received frame and update stream counters/history.

Source

pub fn clear_frames(&mut self)

Clear stream frames and counters for this device.

Source

pub fn apply_control_status(&mut self, status: ControlStatus)

Apply a control/status payload to this device’s runtime status.

Source

pub fn apply_device_config(&mut self, config: DeviceConfig) -> usize

Apply server config payload into this device’s form fields.

Returns the number of fields that were actually applied; callers use a zero return to detect an empty server cache.

Source§

impl DeviceState

Source

pub fn supports_v07_modes(&self) -> bool

True when cached firmware info supports v0.7.0 modes.

Source

pub fn supports_unsolicited(&self) -> bool

True when cached firmware info supports set-traffic --unsolicited.

Trait Implementations§

Source§

impl Clone for DeviceState

Source§

fn clone(&self) -> DeviceState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DeviceState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more