Struct Peripheral

Source
pub struct Peripheral<'d, C, P: PacketPool> { /* private fields */ }
Expand description

Type which implements the BLE peripheral role.

Implementations§

Source§

impl<'d, C: Controller, P: PacketPool> Peripheral<'d, C, P>

Source

pub async fn advertise<'k>( &mut self, params: &AdvertisementParameters, data: Advertisement<'k>, ) -> Result<Advertiser<'d, C, P>, BleHostError<C::Error>>

Start advertising with the provided parameters and return a handle to accept connections.

Source

pub async fn update_adv_data<'k>( &mut self, data: Advertisement<'k>, ) -> Result<(), BleHostError<C::Error>>

Update the advertisment adv_data and/or scan_data. Does not change any other advertising parameters. If no advertising is active, this will not produce any observable effect. This is typically useful when implementing a BLE beacon that only broadcasts advertisement data and does not accept any connections.

Source

pub async fn advertise_ext<'k>( &mut self, sets: &[AdvertisementSet<'k>], handles: &mut [AdvSet], ) -> Result<Advertiser<'d, C, P>, BleHostError<C::Error>>

Starts sending BLE advertisements according to the provided config.

The handles are required to provide the storage while advertising, and can be created by calling AdvertisementSet::handles(sets).

Advertisements are stopped when a connection is made against this host, in which case a handle for the connection is returned.

Returns a handle to accept connections.

Source

pub async fn update_adv_data_ext<'k>( &mut self, sets: &[AdvertisementSet<'k>], handles: &mut [AdvSet], ) -> Result<(), BleHostError<C::Error>>

Update the extended advertisment adv_data and/or scan_data for multiple advertising sets. Does not change any other advertising parameters. If no advertising is active, this will not produce any observable effect. This is typically useful when implementing a BLE beacon that only broadcasts advertisement data and does not accept any connections.

Source

pub fn try_accept(&mut self) -> Option<Connection<'d, P>>

Accept any pending available connection.

Accepts the next pending connection if there are any.

Auto Trait Implementations§

§

impl<'d, C, P> Freeze for Peripheral<'d, C, P>

§

impl<'d, C, P> !RefUnwindSafe for Peripheral<'d, C, P>

§

impl<'d, C, P> !Send for Peripheral<'d, C, P>

§

impl<'d, C, P> !Sync for Peripheral<'d, C, P>

§

impl<'d, C, P> Unpin for Peripheral<'d, C, P>

§

impl<'d, C, P> !UnwindSafe for Peripheral<'d, C, P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.