pub trait Client {
    type Event;

    // Required methods
    fn on_hvx(
        &self,
        conn: &Connection,
        type_: HvxType,
        handle: u16,
        data: &[u8]
    ) -> Option<Self::Event>;
    fn uuid() -> Uuid;
    fn new_undiscovered(conn: Connection) -> Self;
    fn discovered_characteristic(
        &mut self,
        characteristic: &Characteristic,
        descriptors: &[Descriptor]
    );
    fn discovery_complete(&mut self) -> Result<(), DiscoverError>;
}
Expand description

Trait for implementing GATT clients.

Required Associated Types§

Required Methods§

source

fn on_hvx( &self, conn: &Connection, type_: HvxType, handle: u16, data: &[u8] ) -> Option<Self::Event>

Handles notification and indication events from the GATT server.

source

fn uuid() -> Uuid

Get the UUID of the GATT service. This is used by discover to search for the service in the GATT server.

source

fn new_undiscovered(conn: Connection) -> Self

Create a new instance in a “not-yet-discovered” state.

source

fn discovered_characteristic( &mut self, characteristic: &Characteristic, descriptors: &[Descriptor] )

Called by discover for every discovered characteristic. Implementations must check if they’re interested in the UUID of the characteristic, and save their handles if needed.

source

fn discovery_complete(&mut self) -> Result<(), DiscoverError>

Called by discover at the end of the discovery procedure. Implementations must check that all required characteristics have been discovered, and return DiscoverError::ServiceIncomplete otherwise.

If no error is returned, this instance is considered ready to use and is returned to the caller of discover

Object Safety§

This trait is not object safe.

Implementors§