Trait nrf_softdevice::ble::gatt_client::Client
source · 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§
sourcefn on_hvx(
&self,
conn: &Connection,
type_: HvxType,
handle: u16,
data: &[u8]
) -> Option<Self::Event>
fn on_hvx( &self, conn: &Connection, type_: HvxType, handle: u16, data: &[u8] ) -> Option<Self::Event>
Handles notification and indication events from the GATT server.
sourcefn uuid() -> Uuid
fn uuid() -> Uuid
Get the UUID of the GATT service. This is used by discover
to search for the
service in the GATT server.
sourcefn new_undiscovered(conn: Connection) -> Self
fn new_undiscovered(conn: Connection) -> Self
Create a new instance in a “not-yet-discovered” state.
sourcefn discovered_characteristic(
&mut self,
characteristic: &Characteristic,
descriptors: &[Descriptor]
)
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.
sourcefn discovery_complete(&mut self) -> Result<(), DiscoverError>
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.