pub struct PtpDevice { /* private fields */ }Expand description
A low-level PTP device connection.
Use this for camera support or when you need raw PTP operations.
For typical MTP usage with Android devices, prefer MtpDevice instead.
Implementations§
Source§impl PtpDevice
impl PtpDevice
Sourcepub async fn open_by_location(location_id: u64) -> Result<Self, Error>
pub async fn open_by_location(location_id: u64) -> Result<Self, Error>
Open a PTP device at a specific USB location (port).
Sourcepub async fn open_by_location_with_timeout(
location_id: u64,
timeout: Duration,
) -> Result<Self, Error>
pub async fn open_by_location_with_timeout( location_id: u64, timeout: Duration, ) -> Result<Self, Error>
Open by location with custom timeout.
Sourcepub async fn open_by_serial(serial: &str) -> Result<Self, Error>
pub async fn open_by_serial(serial: &str) -> Result<Self, Error>
Open a PTP device by its serial number.
Sourcepub async fn open_by_serial_with_timeout(
serial: &str,
timeout: Duration,
) -> Result<Self, Error>
pub async fn open_by_serial_with_timeout( serial: &str, timeout: Duration, ) -> Result<Self, Error>
Open by serial with custom timeout.
Sourcepub async fn open_first() -> Result<Self, Error>
pub async fn open_first() -> Result<Self, Error>
Open the first available PTP device.
Sourcepub async fn open_first_with_timeout(timeout: Duration) -> Result<Self, Error>
pub async fn open_first_with_timeout(timeout: Duration) -> Result<Self, Error>
Open the first available device with custom timeout.
Sourcepub async fn get_device_info(&self) -> Result<DeviceInfo, Error>
pub async fn get_device_info(&self) -> Result<DeviceInfo, Error>
Get device info without opening a session.
This is the only operation that can be performed without a session.
Sourcepub async fn open_session(&self) -> Result<PtpSession, Error>
pub async fn open_session(&self) -> Result<PtpSession, Error>
Open a PTP session.
Most operations require a session to be open first.
Sourcepub async fn open_session_with_id(
&self,
session_id: u32,
) -> Result<PtpSession, Error>
pub async fn open_session_with_id( &self, session_id: u32, ) -> Result<PtpSession, Error>
Open a session with a specific session ID.
Auto Trait Implementations§
impl Freeze for PtpDevice
impl RefUnwindSafe for PtpDevice
impl Send for PtpDevice
impl Sync for PtpDevice
impl Unpin for PtpDevice
impl UnsafeUnpin for PtpDevice
impl UnwindSafe for PtpDevice
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