[][src]Struct libmtp_rs::device::MtpDevice

pub struct MtpDevice { /* fields omitted */ }

Result from opening a raw device descriptor, holds information about the device like default folders, battery level, manufacturer, model, storage, etc.

Storage is directly tied to an MTP device by the StoragePool struct abstraction, which you may get with storage_pool after updating the storage with update_storage.

Example

mtp_device.update_storage().expect("Couldn't update storage");
let storage_pool = mtp_device.storage_pool();

Implementations

impl MtpDevice[src]

pub fn default_music_folder(&self) -> u32[src]

Retrieves the default music folder, if there isn't one this value may be garbage. Therefore, it's not recommended to depend on this value, unless you know exactly how the device you are interacting with handles this setting.

pub fn default_playlist_folder(&self) -> u32[src]

Retrieves the default playlist folder, if there isn't one this value may be garbage. Therefore, it's not recommended to depend on this value, unless you know exactly how the device you are interacting with handles this setting.

pub fn default_picture_folder(&self) -> u32[src]

Retrieves the default picture folder, if there isn't one this value may be garbage. Therefore, it's not recommended to depend on this value, unless you know exactly how the device you are interacting with handles this setting.

pub fn default_video_folder(&self) -> u32[src]

Retrieves the default video folder, if there isn't one this value may be garbage. Therefore, it's not recommended to depend on this value, unless you know exactly how the device you are interacting with handles this setting.

pub fn default_organizer_folder(&self) -> u32[src]

Retrieves the default organizer folder, if there isn't one this value may be garbage. Therefore, it's not recommended to depend on this value, unless you know exactly how the device you are interacting with handles this setting.

pub fn default_zencast_folder(&self) -> u32[src]

Retrieves the default zencast folder, if there isn't one this value may be garbage. Therefore, it's not recommended to depend on this value, unless you know exactly how the device you are interacting with handles this setting.

pub fn default_album_folder(&self) -> u32[src]

Retrieves the default album folder, if there isn't one this value may be garbage. Therefore, it's not recommended to depend on this value, unless you know exactly how the device you are interacting with handles this setting.

pub fn default_text_folder(&self) -> u32[src]

Retrieves the default text folder, if there isn't one this value may be garbage. Therefore, it's not recommended to depend on this value, unless you know exactly how the device you are interacting with handles this setting.

pub fn get_friendly_name(&self) -> Result<String>[src]

Gets the friendly name of this device, e.g. "Kevin's Android"

pub fn set_friendly_name(&self, name: &str) -> Result<()>[src]

Sets the friendly name of this device

pub fn get_sync_partner(&self) -> Result<String>[src]

Retrieves the synchronization partner of this device.

pub fn set_sync_partner(&self, partner: &str) -> Result<()>[src]

Sets the synchronization partner of this device.

pub fn manufacturer_name(&self) -> Result<String>[src]

Returns the manufacturer name of this device.

pub fn model_name(&self) -> Result<String>[src]

Returns the model name of this device.

pub fn serial_number(&self) -> Result<String>[src]

Returns the serial number of this device.

pub fn device_certificate(&self) -> Result<String>[src]

Returns the device (public key) certificate as an XML document string.

pub fn battery_level(&self) -> Result<(BatteryLevel, u8)>[src]

Retrieves the current and maximum battery level of this device.

pub fn secure_time(&self) -> Result<String>[src]

Returns the secure time as an XML document string.

pub fn supported_filetypes(&self) -> Result<Vec<Filetype>>[src]

Retrieves a list of supported file types that this device claims it supports.
This list is mitigated to include the filetypes that libmtp (C library) can handle.

pub fn check_capability(&self, capability: DeviceCapability) -> bool[src]

Check whether this device has some specific capabilitiy.

pub fn reset_device(&self) -> Result<()>[src]

Reset the device only if this one supports the PTP_OC_ResetDevice operation code (0x1010)

pub fn update_storage(&mut self, sort_by: StorageSort) -> Result<UpdateResult>[src]

Updates all the internal storage ids and properties of this device, it can also optionally sort the list. This operation may success, partially success (only ids were retrieved) or fail.

pub fn storage_pool(&self) -> StoragePool<'_>[src]

Returns the inner storage pool, you need to call this if you updated the storage with update_storage. Note that the pool may be empty.

pub fn dump_device_info(&self)[src]

Dumps out a large chunk of textual information provided from the PTP protocol and additionally some extra MTP specific information where applicable.

pub fn is_property_supported(
    &self,
    property: Property,
    filetype: Filetype
) -> Result<bool>
[src]

Determines wheter a property is supported for a given file type.

pub fn allowed_property_values(
    &self,
    property: Property,
    filetype: Filetype
) -> Result<AllowedValues>
[src]

Retrieves the allowes values (range or enumeration) for an specific property.

Trait Implementations

impl Debug for MtpDevice[src]

impl Drop for MtpDevice[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.