leaprs/events/
device_status_change_event.rs1use derive_deref::Deref;
2use leap_sys::LEAP_DEVICE_STATUS_CHANGE_EVENT;
3
4use crate::{DeviceRef, DeviceStatus};
5
6#[doc = " A notification that a device's status has changed. One of these messages is received by the client"]
7#[doc = " as soon as the service is connected, or when a new device is attached."]
8#[doc = " @since 3.1.3"]
9#[derive(Deref, Clone, Copy)]
12pub struct DeviceStatusChangeEventRef<'a>(pub(crate) &'a LEAP_DEVICE_STATUS_CHANGE_EVENT);
13
14impl<'a> DeviceStatusChangeEventRef<'a> {
15 #[doc = " A reference to the device whose status has changed"]
16 pub fn device(&self) -> DeviceRef {
17 DeviceRef(self.device)
18 }
19
20 #[doc = " The last known status of the device. This is a combination of eLeapDeviceStatus flags. @since 3.1.3"]
21 pub fn status(&self) -> DeviceStatus {
22 DeviceStatus::from_bits_truncate(self.status)
23 }
24
25 #[doc = " The current status of the device. This is a combination of eLeapDeviceStatus flags. @since 3.1.3"]
26 pub fn last_status(&self) -> DeviceStatus {
27 DeviceStatus::from_bits_truncate(self.last_status)
28 }
29}