#[non_exhaustive]pub enum DeviceEvent {
Discovered {
device: DeviceId,
rssi: Option<i16>,
},
Connected {
device: DeviceId,
info: Option<DeviceInfo>,
},
Disconnected {
device: DeviceId,
reason: DisconnectReason,
},
Reading {
device: DeviceId,
reading: CurrentReading,
},
Error {
device: DeviceId,
error: String,
},
ReconnectStarted {
device: DeviceId,
attempt: u32,
},
ReconnectSucceeded {
device: DeviceId,
attempts: u32,
},
BatteryLow {
device: DeviceId,
level: u8,
},
}Expand description
Events that can be emitted by devices.
All events are serializable for logging, persistence, and IPC.
This enum is marked #[non_exhaustive] to allow adding new event types
in future versions without breaking downstream code.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Discovered
Device was discovered during scanning.
Connected
Successfully connected to device.
Disconnected
Disconnected from device.
Reading
New reading received from device.
Error
Error occurred during device operation.
ReconnectStarted
Reconnection attempt started.
ReconnectSucceeded
Reconnection succeeded.
BatteryLow
Battery level changed significantly.
Trait Implementations§
Source§impl Clone for DeviceEvent
impl Clone for DeviceEvent
Source§fn clone(&self) -> DeviceEvent
fn clone(&self) -> DeviceEvent
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 DeviceEvent
impl Debug for DeviceEvent
Source§impl<'de> Deserialize<'de> for DeviceEvent
impl<'de> Deserialize<'de> for DeviceEvent
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
Auto Trait Implementations§
impl Freeze for DeviceEvent
impl RefUnwindSafe for DeviceEvent
impl Send for DeviceEvent
impl Sync for DeviceEvent
impl Unpin for DeviceEvent
impl UnwindSafe for DeviceEvent
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