Skip to main content

Client

Struct Client 

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

The GATT client of one connection.

Implementations§

Source§

impl Client

Source

pub async fn exchange_mtu(&self, mtu: u16) -> Result<u16>

Exchanges the ATT MTU, offering mtu (23 to 517); returns the one in use.

Source

pub async fn services(&self) -> Result<Vec<Service>>

Every primary service.

Source

pub async fn services_by_uuid(&self, service: Uuid) -> Result<Vec<Service>>

Primary services with one UUID.

Source

pub async fn included(&self, service: &Service) -> Result<Vec<(u16, Service)>>

The services a service includes: (include declaration handle, service).

Source

pub async fn characteristics( &self, service: &Service, ) -> Result<Vec<Characteristic>>

The characteristics of a service.

Source

pub async fn descriptors(&self, c: &Characteristic) -> Result<Vec<Descriptor>>

The descriptors of a characteristic.

Source

pub async fn discover(&self) -> Result<Vec<Service>>

Discovers every primary service with its characteristics and descriptors.

Source

pub async fn read_by_type( &self, start: u16, end: u16, ty: Uuid, ) -> Result<Vec<(u16, Vec<u8>)>>

Reads every attribute of a type in a range: (handle, value).

Source

pub async fn read(&self, handle: u16) -> Result<Vec<u8>>

Reads a value, whole: a value that fills the response is continued with Read Blob until it ends (a long read).

Source

pub async fn read_blob(&self, handle: u16, offset: u16) -> Result<Vec<u8>>

Reads a value from an offset (one Read Blob).

Source

pub async fn read_multiple(&self, handles: &[u16]) -> Result<Vec<u8>>

Reads several values of known lengths in one request; the result is their concatenation (Read Multiple).

Source

pub async fn read_multiple_variable( &self, handles: &[u16], ) -> Result<Vec<Vec<u8>>>

Reads several values in one request, each with its own length (Read Multiple Variable Length).

Source

pub async fn write(&self, handle: u16, value: &[u8]) -> Result<()>

Writes a value and waits for the response. A value longer than one PDU is written with Prepare and Execute (a long write).

Source

pub async fn write_without_response( &self, handle: u16, value: &[u8], ) -> Result<()>

Writes without a response.

Source

pub async fn reliable_write(&self, writes: &[(u16, Vec<u8>)]) -> Result<()>

Writes several values atomically with Prepare Write, checking each echo, then Execute Write; cancels on any mismatch (a reliable write).

Source

pub async fn subscribe( &self, c: &Characteristic, notify: bool, indicate: bool, ) -> Result<()>

Turns notifications and indications on or off for a characteristic by writing its Client Characteristic Configuration descriptor (found by discovery when not yet known). Values arrive as crate::ConnEvent::Notification.

Source

pub async fn characteristic_at( &self, value_handle: u16, ) -> Result<Characteristic>

Finds a characteristic by value handle, discovering as needed.

Source

pub async fn characteristic(&self, u: Uuid) -> Result<Characteristic>

Finds a characteristic by UUID (the first one), discovering as needed.

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more