pub struct Device {
pub model: Model,
pub proto: TouchProto,
pub dims: (u32, u32),
pub dpi: u16,
metadata: OnceCell<DeviceMetadata>,
wifi_manager: OnceCell<Box<dyn WifiManager>>,
}Fields§
§model: Model§proto: TouchProto§dims: (u32, u32)§dpi: u16§metadata: OnceCell<DeviceMetadata>§wifi_manager: OnceCell<Box<dyn WifiManager>>Implementations§
Source§impl Device
impl Device
Sourcefn new(product: &str, model_number: &str) -> Device
fn new(product: &str, model_number: &str) -> Device
Creates a new device from product and model number strings.
Sourcepub fn metadata(&self) -> Result<&DeviceMetadata, DeviceError>
pub fn metadata(&self) -> Result<&DeviceMetadata, DeviceError>
Gets device metadata (lazy initialization).
Sourcepub fn usb_manager(&self) -> Result<Box<dyn UsbManager>, UsbError>
pub fn usb_manager(&self) -> Result<Box<dyn UsbManager>, UsbError>
Creates USB manager for this device.
Sourcepub fn wifi_manager(&self) -> Result<&dyn WifiManager, WifiError>
pub fn wifi_manager(&self) -> Result<&dyn WifiManager, WifiError>
Returns the WiFi manager for this device.
Sourcepub fn color_samples(&self) -> usize
pub fn color_samples(&self) -> usize
Returns the number of color samples for the device screen.
Sourcepub fn frontlight_kind(&self) -> FrontlightKind
pub fn frontlight_kind(&self) -> FrontlightKind
Returns the frontlight kind for this device.
Sourcepub fn has_natural_light(&self) -> bool
pub fn has_natural_light(&self) -> bool
Returns true if the device has natural light capability.
Sourcepub fn has_lightsensor(&self) -> bool
pub fn has_lightsensor(&self) -> bool
Returns true if the device has a light sensor.
Sourcepub fn has_gyroscope(&self) -> bool
pub fn has_gyroscope(&self) -> bool
Returns true if the device has a gyroscope.
Returns true if the device has page turn buttons.
Sourcepub fn has_power_cover(&self) -> bool
pub fn has_power_cover(&self) -> bool
Returns true if the device supports a power cover.
Sourcepub fn has_removable_storage(&self) -> bool
pub fn has_removable_storage(&self) -> bool
Returns true if the device has removable storage.
Returns true if buttons should be inverted for the given rotation.
Sourcepub fn orientation(&self, rotation: i8) -> Orientation
pub fn orientation(&self, rotation: i8) -> Orientation
Returns the orientation for the given rotation.
Sourcepub fn should_mirror_axes(&self, rotation: i8) -> (bool, bool)
pub fn should_mirror_axes(&self, rotation: i8) -> (bool, bool)
Returns whether axes should be mirrored for the given rotation.
Sourcepub fn mirroring_scheme(&self) -> (i8, i8)
pub fn mirroring_scheme(&self) -> (i8, i8)
Returns the center and direction of the mirroring pattern.
Sourcepub fn should_swap_axes(&self, rotation: i8) -> bool
pub fn should_swap_axes(&self, rotation: i8) -> bool
Returns true if axes should be swapped for the given rotation.
Sourcefn swapping_scheme(&self) -> i8
fn swapping_scheme(&self) -> i8
Returns the swapping scheme value.
Sourcepub fn startup_rotation(&self) -> i8
pub fn startup_rotation(&self) -> i8
Returns the startup rotation value.
Sourcepub fn to_canonical(&self, n: i8) -> i8
pub fn to_canonical(&self, n: i8) -> i8
Returns a device independent rotation value.
Sourcepub fn from_canonical(&self, n: i8) -> i8
pub fn from_canonical(&self, n: i8) -> i8
Returns a device dependent rotation value from canonical.
Sourcepub fn transformed_rotation(&self, n: i8) -> i8
pub fn transformed_rotation(&self, n: i8) -> i8
Returns the transformed rotation value.
Sourcepub fn transformed_gyroscope_rotation(&self, n: i8) -> i8
pub fn transformed_gyroscope_rotation(&self, n: i8) -> i8
Returns the transformed gyroscope rotation value.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Device
impl !RefUnwindSafe for Device
impl Send for Device
impl Sync for Device
impl Unpin for Device
impl !UnwindSafe for Device
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more