SensorEvent

Enum SensorEvent 

Source
pub enum SensorEvent {
Show 21 variants CachedDataLoaded { devices: Vec<CachedDevice>, }, ScanStarted, ScanComplete { devices: Vec<DiscoveredDevice>, }, ScanError { error: String, }, DeviceConnecting { device_id: String, }, DeviceConnected { device_id: String, name: Option<String>, device_type: Option<DeviceType>, rssi: Option<i16>, }, DeviceDisconnected { device_id: String, }, ConnectionError { device_id: String, error: String, }, ReadingUpdated { device_id: String, reading: CurrentReading, }, ReadingError { device_id: String, error: String, }, HistoryLoaded { device_id: String, records: Vec<HistoryRecord>, }, HistorySyncStarted { device_id: String, }, HistorySynced { device_id: String, count: usize, }, HistorySyncError { device_id: String, error: String, }, IntervalChanged { device_id: String, interval_secs: u16, }, IntervalError { device_id: String, error: String, }, SettingsLoaded { device_id: String, settings: DeviceSettings, }, BluetoothRangeChanged { device_id: String, extended: bool, }, BluetoothRangeError { device_id: String, error: String, }, SmartHomeChanged { device_id: String, enabled: bool, }, SmartHomeError { device_id: String, error: String, },
}
Expand description

Events sent from the background worker to the UI thread.

These events represent the results of background operations and are used to update the UI state.

Variants§

§

CachedDataLoaded

Cached data loaded from the store on startup.

Fields

§devices: Vec<CachedDevice>

Cached devices with their latest readings.

§

ScanStarted

A device scan has started.

§

ScanComplete

A device scan has completed successfully.

Fields

§devices: Vec<DiscoveredDevice>

The list of discovered devices.

§

ScanError

A device scan failed.

Fields

§error: String

Description of the error.

§

DeviceConnecting

Attempting to connect to a device.

Fields

§device_id: String

The device identifier.

§

DeviceConnected

Successfully connected to a device.

Fields

§device_id: String

The device identifier.

§name: Option<String>

The device name, if available.

§device_type: Option<DeviceType>

The device type, if detected.

§rssi: Option<i16>

RSSI signal strength in dBm.

§

DeviceDisconnected

Disconnected from a device.

Fields

§device_id: String

The device identifier.

§

ConnectionError

Failed to connect to a device.

Fields

§device_id: String

The device identifier.

§error: String

Description of the error.

§

ReadingUpdated

Received an updated reading from a device.

Fields

§device_id: String

The device identifier.

§reading: CurrentReading

The current sensor reading.

§

ReadingError

Failed to read from a device.

Fields

§device_id: String

The device identifier.

§error: String

Description of the error.

§

HistoryLoaded

Historical data loaded for a device.

Fields

§device_id: String

The device identifier.

§records: Vec<HistoryRecord>

The historical records.

§

HistorySyncStarted

History sync started for a device.

Fields

§device_id: String

The device identifier.

§

HistorySynced

History sync completed for a device.

Fields

§device_id: String

The device identifier.

§count: usize

Number of records synced.

§

HistorySyncError

History sync failed for a device.

Fields

§device_id: String

The device identifier.

§error: String

Description of the error.

§

IntervalChanged

Measurement interval changed for a device.

Fields

§device_id: String

The device identifier.

§interval_secs: u16

The new interval in seconds.

§

IntervalError

Failed to set measurement interval.

Fields

§device_id: String

The device identifier.

§error: String

Description of the error.

§

SettingsLoaded

Device settings loaded from the device.

Fields

§device_id: String

The device identifier.

§settings: DeviceSettings

The device settings.

§

BluetoothRangeChanged

Bluetooth range changed for a device.

Fields

§device_id: String

The device identifier.

§extended: bool

Whether extended range is now enabled.

§

BluetoothRangeError

Failed to set Bluetooth range.

Fields

§device_id: String

The device identifier.

§error: String

Description of the error.

§

SmartHomeChanged

Smart Home setting changed for a device.

Fields

§device_id: String

The device identifier.

§enabled: bool

Whether Smart Home mode is now enabled.

§

SmartHomeError

Failed to set Smart Home mode.

Fields

§device_id: String

The device identifier.

§error: String

Description of the error.

Trait Implementations§

Source§

impl Clone for SensorEvent

Source§

fn clone(&self) -> SensorEvent

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SensorEvent

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> 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> 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> 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