pub struct Device { /* private fields */ }Expand description
An opened wallet with discovery metadata and cached successful query results.
Cached information and fingerprints are not automatically invalidated when
callers change the wallet or session through Self::device.
Implementations§
Source§impl Device
impl Device
Sourcepub fn new(
name: &str,
device_type: DeviceType,
path: impl Into<String>,
model: impl Into<String>,
device: Box<dyn HWIDevice>,
is_emulated: bool,
) -> Device
pub fn new( name: &str, device_type: DeviceType, path: impl Into<String>, model: impl Into<String>, device: Box<dyn HWIDevice>, is_emulated: bool, ) -> Device
Wraps an opened wallet with discovery metadata and empty query caches.
Sourcepub fn device_type(&self) -> DeviceType
pub fn device_type(&self) -> DeviceType
Returns the device family.
Sourcepub fn device(&mut self) -> &mut Box<dyn HWIDevice>
pub fn device(&mut self) -> &mut Box<dyn HWIDevice>
Returns the underlying wallet interface without invalidating query caches.
Sourcepub fn is_emulated(&self) -> bool
pub fn is_emulated(&self) -> bool
Returns whether discovery identified this device as an emulator.
Sourcepub fn cached_fingerprint(&self) -> Option<Fingerprint>
pub fn cached_fingerprint(&self) -> Option<Fingerprint>
Returns the last successfully queried fingerprint, without performing I/O.
Sourcepub fn cached_info(&self) -> Option<&Info>
pub fn cached_info(&self) -> Option<&Info>
Returns cached information, without performing I/O.
Sourcepub async fn fingerprint(&mut self) -> Result<Fingerprint, HWIDeviceError>
pub async fn fingerprint(&mut self) -> Result<Fingerprint, HWIDeviceError>
Returns the cached fingerprint or queries the wallet and caches success.
Sourcepub async fn network_mismatch(
&mut self,
expected: Network,
) -> Result<Option<NetworkMismatch>, HWIDeviceError>
pub async fn network_mismatch( &mut self, expected: Network, ) -> Result<Option<NetworkMismatch>, HWIDeviceError>
Returns a mismatch when nonempty reported networks exclude expected.
This may query information; an empty network list is treated as unknown.
Sourcepub async fn info(&mut self) -> Result<Info, HWIDeviceError>
pub async fn info(&mut self) -> Result<Info, HWIDeviceError>
Returns cached information or queries the device and caches success.
Specter-DIY instead receives synthetic default information with version
"unavailable", because it has no version command.