Struct OtsClient

Source
pub struct OtsClient { /* private fields */ }
Expand description

Object Transfer Service (OTS) client

Implementations§

Source§

impl OtsClient

Source

pub async fn new( session: &BluetoothSession, device_id: &DeviceId, config: &ClientConfig, ) -> Result<Self>

Create new client instance

Source

pub fn action_features(&self) -> &ActionFeature

Get object action feature flags

Source

pub fn list_features(&self) -> &ListFeature

Get object list feature flags

Source

pub async fn id(&self) -> Result<Option<u64>>

Get current object identifier

Source

pub async fn name(&self) -> Result<String>

Get current object name

Source

pub async fn type_(&self) -> Result<Uuid>

Get current object type

Source

pub async fn size(&self) -> Result<Sizes>

Get sizes of current object

Source

pub async fn first_created(&self) -> Result<Option<DateTime>>

Get first created time for selected object

Source

pub async fn last_modified(&self) -> Result<Option<DateTime>>

Get last modified time for selected object

Source

pub async fn properties(&self) -> Result<Property>

Get current object properties

Source

pub async fn metadata(&self) -> Result<Metadata>

Get current object metadata

Source

pub async fn previous(&self) -> Result<bool>

Select previous object

Returns false if current object is first.

Source

pub async fn next(&self) -> Result<bool>

Select next object

Returns false if current object is last.

Source

pub async fn go_to(&self, id: u64) -> Result<bool>

Select object by identifier

Returns false if object nor found.

Source

pub async fn read( &self, offset: usize, length: Option<usize>, ) -> Result<Vec<u8>>

Read object data

Source

pub async fn read_to(&self, offset: usize, buffer: &mut [u8]) -> Result<usize>

Read object data

Source

pub async fn read_stream( &self, offset: usize, length: Option<usize>, ) -> Result<Stream>

Read object data

Source

pub async fn write( &self, offset: usize, buffer: &[u8], mode: WriteMode, ) -> Result<usize>

Write object data

Source

pub async fn write_stream( &self, offset: usize, length: Option<usize>, mode: WriteMode, ) -> Result<Stream>

Write object data

Source§

impl OtsClient

Source

pub async fn create(&self, size: usize, type_: Uuid) -> Result<()>

Create new object

Source

pub async fn delete(&self) -> Result<()>

Delete selected object

Source

pub async fn check_sum(&self, offset: usize, length: usize) -> Result<u32>

Calculate checksum using selected object data

Source

pub async fn execute(&self, param: Vec<u8>) -> Result<Vec<u8>>

Execute selected object

Source

pub async fn abort(&self) -> Result<()>

Abort operation

Source

pub async fn first(&self) -> Result<()>

Select first object in a list

Source

pub async fn last(&self) -> Result<()>

Select last object in a list

Source

pub async fn order(&self, order: SortOrder) -> Result<()>

Change objects order in a list

Source

pub async fn number_of(&self) -> Result<u32>

Get number of objects in a list

Source

pub async fn clear_mark(&self) -> Result<()>

Clear objects mark

Trait Implementations§

Source§

impl AsRef<ActionFeature> for OtsClient

Source§

fn as_ref(&self) -> &ActionFeature

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<AdapterId> for OtsClient

Source§

fn as_ref(&self) -> &AdapterId

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<BluetoothSession> for OtsClient

Source§

fn as_ref(&self) -> &BluetoothSession

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<DeviceId> for OtsClient

Source§

fn as_ref(&self) -> &DeviceId

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ListFeature> for OtsClient

Source§

fn as_ref(&self) -> &ListFeature

Converts this type into a shared reference of the (usually inferred) input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.