pub struct GattClient<'reference, T: Controller, P: PacketPool, const MAX_SERVICES: usize> { /* private fields */ }
Expand description
A GATT client capable of using the GATT protocol.
Implementations§
Source§impl<'reference, C: Controller, P: PacketPool, const MAX_SERVICES: usize> GattClient<'reference, C, P, MAX_SERVICES>
impl<'reference, C: Controller, P: PacketPool, const MAX_SERVICES: usize> GattClient<'reference, C, P, MAX_SERVICES>
Sourcepub async fn new(
stack: &'reference Stack<'reference, C, P>,
connection: &Connection<'reference, P>,
) -> Result<GattClient<'reference, C, P, MAX_SERVICES>, BleHostError<C::Error>>
pub async fn new( stack: &'reference Stack<'reference, C, P>, connection: &Connection<'reference, P>, ) -> Result<GattClient<'reference, C, P, MAX_SERVICES>, BleHostError<C::Error>>
Creates a GATT client capable of processing the GATT protocol using the provided table of attributes.
Sourcepub async fn services_by_uuid(
&self,
uuid: &Uuid,
) -> Result<Vec<ServiceHandle, MAX_SERVICES>, BleHostError<C::Error>>
pub async fn services_by_uuid( &self, uuid: &Uuid, ) -> Result<Vec<ServiceHandle, MAX_SERVICES>, BleHostError<C::Error>>
Discover primary services associated with a UUID.
Sourcepub async fn characteristic_by_uuid<T: AsGatt>(
&self,
service: &ServiceHandle,
uuid: &Uuid,
) -> Result<Characteristic<T>, BleHostError<C::Error>>
pub async fn characteristic_by_uuid<T: AsGatt>( &self, service: &ServiceHandle, uuid: &Uuid, ) -> Result<Characteristic<T>, BleHostError<C::Error>>
Discover characteristics in a given service using a UUID.
Sourcepub async fn read_characteristic<T: AsGatt>(
&self,
characteristic: &Characteristic<T>,
dest: &mut [u8],
) -> Result<usize, BleHostError<C::Error>>
pub async fn read_characteristic<T: AsGatt>( &self, characteristic: &Characteristic<T>, dest: &mut [u8], ) -> Result<usize, BleHostError<C::Error>>
Read a characteristic described by a handle.
The number of bytes copied into the provided buffer is returned.
Sourcepub async fn read_characteristic_long<T: AsGatt>(
&self,
characteristic: &Characteristic<T>,
dest: &mut [u8],
) -> Result<usize, BleHostError<C::Error>>
pub async fn read_characteristic_long<T: AsGatt>( &self, characteristic: &Characteristic<T>, dest: &mut [u8], ) -> Result<usize, BleHostError<C::Error>>
Read a long characteristic value using blob reads if necessary.
This method automatically handles characteristics longer than ATT MTU by using Read Blob requests to fetch the complete value.
Sourcepub async fn read_characteristic_by_uuid(
&self,
service: &ServiceHandle,
uuid: &Uuid,
dest: &mut [u8],
) -> Result<usize, BleHostError<C::Error>>
pub async fn read_characteristic_by_uuid( &self, service: &ServiceHandle, uuid: &Uuid, dest: &mut [u8], ) -> Result<usize, BleHostError<C::Error>>
Read a characteristic described by a UUID.
The number of bytes copied into the provided buffer is returned.
Sourcepub async fn write_characteristic<T: FromGatt>(
&self,
handle: &Characteristic<T>,
buf: &[u8],
) -> Result<(), BleHostError<C::Error>>
pub async fn write_characteristic<T: FromGatt>( &self, handle: &Characteristic<T>, buf: &[u8], ) -> Result<(), BleHostError<C::Error>>
Write to a characteristic described by a handle.
Sourcepub async fn write_characteristic_without_response<T: FromGatt>(
&self,
handle: &Characteristic<T>,
buf: &[u8],
) -> Result<(), BleHostError<C::Error>>
pub async fn write_characteristic_without_response<T: FromGatt>( &self, handle: &Characteristic<T>, buf: &[u8], ) -> Result<(), BleHostError<C::Error>>
Write without waiting for a response to a characteristic described by a handle.
Sourcepub async fn subscribe<T: AsGatt>(
&self,
characteristic: &Characteristic<T>,
indication: bool,
) -> Result<NotificationListener<'_, 512>, BleHostError<C::Error>>
pub async fn subscribe<T: AsGatt>( &self, characteristic: &Characteristic<T>, indication: bool, ) -> Result<NotificationListener<'_, 512>, BleHostError<C::Error>>
Subscribe to indication/notification of a given Characteristic
A listener is returned, which has a next()
method
Sourcepub async fn unsubscribe<T: AsGatt>(
&self,
characteristic: &Characteristic<T>,
) -> Result<(), BleHostError<C::Error>>
pub async fn unsubscribe<T: AsGatt>( &self, characteristic: &Characteristic<T>, ) -> Result<(), BleHostError<C::Error>>
Unsubscribe from a given Characteristic