pub struct Peripheral { /* private fields */ }
Expand description
Implementation of api::Peripheral.
Trait Implementations§
Source§impl Clone for Peripheral
impl Clone for Peripheral
Source§fn clone(&self) -> Peripheral
fn clone(&self) -> Peripheral
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Peripheral
impl Debug for Peripheral
Source§impl Peripheral for Peripheral
impl Peripheral for Peripheral
Source§fn id(&self) -> PeripheralId
fn id(&self) -> PeripheralId
Returns the unique identifier of the peripheral.
Source§fn properties<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<PeripheralProperties>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn properties<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<PeripheralProperties>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the set of properties associated with the peripheral. These may be updated over time
as additional advertising reports are received.
Source§fn services(&self) -> BTreeSet<Service>
fn services(&self) -> BTreeSet<Service>
The set of services we’ve discovered for this device. This will be empty until
discover_services
is called.Source§fn is_connected<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_connected<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns true iff we are currently connected to the device.
Source§fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Creates a connection to the device. If this method returns Ok there has been successful
connection. Note that peripherals allow only one connection at a time. Operations that
attempt to communicate with a device will fail until it is connected.
Source§fn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Terminates a connection to the device.
Source§fn discover_services<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn discover_services<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Discovers all services for the device, including their characteristics.
Source§fn write<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
characteristic: &'life1 Characteristic,
data: &'life2 [u8],
write_type: WriteType,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
characteristic: &'life1 Characteristic,
data: &'life2 [u8],
write_type: WriteType,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Write some data to the characteristic. Returns an error if the write couldn’t be sent or (in
the case of a write-with-response) if the device returns an error.
Source§fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
characteristic: &'life1 Characteristic,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
characteristic: &'life1 Characteristic,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sends a read request to the device. Returns either an error if the request was not accepted
or the response from the device.
Source§fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
characteristic: &'life1 Characteristic,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
characteristic: &'life1 Characteristic,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Enables either notify or indicate (depending on support) for the specified characteristic.
Source§fn unsubscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
characteristic: &'life1 Characteristic,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn unsubscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
characteristic: &'life1 Characteristic,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Disables either notify or indicate (depending on support) for the specified characteristic.
Source§fn notifications<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = ValueNotification> + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn notifications<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = ValueNotification> + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns a stream of notifications for characteristic value updates. The stream will receive
a notification when a value notification or indication is received from the device.
The stream will remain valid across connections and can be queried before any connection
is made.
Source§fn write_descriptor<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
descriptor: &'life1 Descriptor,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write_descriptor<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
descriptor: &'life1 Descriptor,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Write some data to the descriptor. Returns an error if the write couldn’t be sent or (in
the case of a write-with-response) if the device returns an error.
Source§fn read_descriptor<'life0, 'life1, 'async_trait>(
&'life0 self,
descriptor: &'life1 Descriptor,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_descriptor<'life0, 'life1, 'async_trait>(
&'life0 self,
descriptor: &'life1 Descriptor,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sends a read descriptor request to the device. Returns either an error if the request
was not accepted or the response from the device.
Source§fn characteristics(&self) -> BTreeSet<Characteristic>
fn characteristics(&self) -> BTreeSet<Characteristic>
The set of characteristics we’ve discovered for this device. This will be empty until
discover_services
is called.Auto Trait Implementations§
impl Freeze for Peripheral
impl !RefUnwindSafe for Peripheral
impl Send for Peripheral
impl Sync for Peripheral
impl Unpin for Peripheral
impl !UnwindSafe for Peripheral
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more