pub struct Client { /* private fields */ }Expand description
The GATT client of one connection.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn exchange_mtu(&self, mtu: u16) -> Result<u16>
pub async fn exchange_mtu(&self, mtu: u16) -> Result<u16>
Exchanges the ATT MTU, offering mtu (23 to 517); returns the one in use.
Sourcepub async fn services_by_uuid(&self, service: Uuid) -> Result<Vec<Service>>
pub async fn services_by_uuid(&self, service: Uuid) -> Result<Vec<Service>>
Primary services with one UUID.
Sourcepub async fn included(&self, service: &Service) -> Result<Vec<(u16, Service)>>
pub async fn included(&self, service: &Service) -> Result<Vec<(u16, Service)>>
The services a service includes: (include declaration handle, service).
Sourcepub async fn characteristics(
&self,
service: &Service,
) -> Result<Vec<Characteristic>>
pub async fn characteristics( &self, service: &Service, ) -> Result<Vec<Characteristic>>
The characteristics of a service.
Sourcepub async fn descriptors(&self, c: &Characteristic) -> Result<Vec<Descriptor>>
pub async fn descriptors(&self, c: &Characteristic) -> Result<Vec<Descriptor>>
The descriptors of a characteristic.
Sourcepub async fn discover(&self) -> Result<Vec<Service>>
pub async fn discover(&self) -> Result<Vec<Service>>
Discovers every primary service with its characteristics and descriptors.
Sourcepub async fn read_by_type(
&self,
start: u16,
end: u16,
ty: Uuid,
) -> Result<Vec<(u16, Vec<u8>)>>
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).
Sourcepub async fn read(&self, handle: u16) -> Result<Vec<u8>>
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).
Sourcepub async fn read_blob(&self, handle: u16, offset: u16) -> Result<Vec<u8>>
pub async fn read_blob(&self, handle: u16, offset: u16) -> Result<Vec<u8>>
Reads a value from an offset (one Read Blob).
Sourcepub async fn read_multiple(&self, handles: &[u16]) -> Result<Vec<u8>>
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).
Sourcepub async fn read_multiple_variable(
&self,
handles: &[u16],
) -> Result<Vec<Vec<u8>>>
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).
Sourcepub async fn write(&self, handle: u16, value: &[u8]) -> Result<()>
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).
Sourcepub async fn write_without_response(
&self,
handle: u16,
value: &[u8],
) -> Result<()>
pub async fn write_without_response( &self, handle: u16, value: &[u8], ) -> Result<()>
Writes without a response.
Sourcepub async fn reliable_write(&self, writes: &[(u16, Vec<u8>)]) -> Result<()>
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).
Sourcepub async fn subscribe(
&self,
c: &Characteristic,
notify: bool,
indicate: bool,
) -> Result<()>
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.
Sourcepub async fn characteristic_at(
&self,
value_handle: u16,
) -> Result<Characteristic>
pub async fn characteristic_at( &self, value_handle: u16, ) -> Result<Characteristic>
Finds a characteristic by value handle, discovering as needed.
Sourcepub async fn characteristic(&self, u: Uuid) -> Result<Characteristic>
pub async fn characteristic(&self, u: Uuid) -> Result<Characteristic>
Finds a characteristic by UUID (the first one), discovering as needed.