pub trait PeerService<T: GattTypes> {
// Required methods
fn discover_characteristics(
&self,
uuid: Option<Uuid>,
) -> T::CharacteristicDiscoveryFut;
fn read_characteristic<'a>(
&self,
handle: &Handle,
offset: u16,
buf: &'a mut [u8],
) -> T::ReadFut<'a>;
fn write_characteristic<'a>(
&self,
handle: &Handle,
mode: WriteMode,
offset: u16,
buf: &'a [u8],
) -> T::WriteFut<'a>;
fn read_descriptor<'a>(
&self,
handle: &Handle,
offset: u16,
buf: &'a mut [u8],
) -> T::ReadFut<'a>;
fn write_descriptor<'a>(
&self,
handle: &Handle,
offset: u16,
buf: &'a [u8],
) -> T::WriteFut<'a>;
fn subscribe(&self, handle: &Handle) -> T::NotificationStream;
}
Expand description
A connection to a GATT Service on a Peer. All operations are done synchronously.
Required Methods§
Sourcefn discover_characteristics(
&self,
uuid: Option<Uuid>,
) -> T::CharacteristicDiscoveryFut
fn discover_characteristics( &self, uuid: Option<Uuid>, ) -> T::CharacteristicDiscoveryFut
Discover characteristics on this service.
If uuid
is provided, only the characteristics matching uuid
will be
returned. This operation may use either the Discovery All
Characteristics of a Service or Discovery Characteristic by UUID
procedures, regardless of uuid
.
Sourcefn read_characteristic<'a>(
&self,
handle: &Handle,
offset: u16,
buf: &'a mut [u8],
) -> T::ReadFut<'a>
fn read_characteristic<'a>( &self, handle: &Handle, offset: u16, buf: &'a mut [u8], ) -> T::ReadFut<'a>
Read a characteristic into a buffer, given the handle within the
service. On success, returns the size read and whether the value may
have been truncated. By default this will try to use a long read if
the buf
is larger than a normal read will allow (22 bytes) or if
the offset is non-zero.
fn write_characteristic<'a>( &self, handle: &Handle, mode: WriteMode, offset: u16, buf: &'a [u8], ) -> T::WriteFut<'a>
fn read_descriptor<'a>( &self, handle: &Handle, offset: u16, buf: &'a mut [u8], ) -> T::ReadFut<'a>
fn write_descriptor<'a>( &self, handle: &Handle, offset: u16, buf: &'a [u8], ) -> T::WriteFut<'a>
Sourcefn subscribe(&self, handle: &Handle) -> T::NotificationStream
fn subscribe(&self, handle: &Handle) -> T::NotificationStream
Subscribe to updates on a Characteristic. Either notifications or indications will be enabled depending on the properties available, with indications preferred if they are supported. Fails if the Characteristic doesn’t support indications or notifications. Errors are delivered through an Err item in the stream. This will often write to the Client Characteristic Configuration descriptor for the Characteristic subscribed to. Updates sent from the peer will be delivered to the Stream returned.