Enum Advertisement

Source
pub enum Advertisement<'a> {
    CompleteLocalName(&'a str),
    ServiceData16BitUuid(u16, &'a [u8]),
    ServiceData32BitUuid(u32, &'a [u8]),
    ServiceData128BitUuid(u128, &'a [u8]),
    ManufacturerSpecificData(u16, &'a [u8]),
}
Expand description

LE Advertisement Type

Variants§

§

CompleteLocalName(&'a str)

Complete local name of the device.

§

ServiceData16BitUuid(u16, &'a [u8])

Service data with 16-bit UUID.

The first parameter is the UUID, the second parameter is the payload.

The payload may be up to 27 bytes for legacy advertising mode.

§

ServiceData32BitUuid(u32, &'a [u8])

Service data with 32-bit UUID

The first parameter is the UUID, the second parameter is the payload.

The payload may be up to 25 bytes for legacy advertising mode.

§

ServiceData128BitUuid(u128, &'a [u8])

Service data with 128-bit UUID

The first parameter is the UUID, the second parameter is the payload.

The payload may be up to 13 bytes for legacy advertising mode.

§

ManufacturerSpecificData(u16, &'a [u8])

Manufacturer-specific data

The first parameter is the manufacturer ID, the second parameter is the payload.

The payload may be up to 27 bytes for legacy advertising mode.

Implementations§

Source§

impl Advertisement<'_>

Source

pub fn len(&self) -> usize

Gets the length of the advertisement payload, in bytes.

This includes the length byte itself.

Source

pub fn copy_into_slice(&self, bytes: &mut [u8]) -> usize

Serialize the advertisement into the given buffer, and return the number of bytes written.

The maximum length of advertisements in legacy mode is 31 bytes.

bytes must be at least Self::len() bytes.

Auto Trait Implementations§

§

impl<'a> Freeze for Advertisement<'a>

§

impl<'a> RefUnwindSafe for Advertisement<'a>

§

impl<'a> Send for Advertisement<'a>

§

impl<'a> Sync for Advertisement<'a>

§

impl<'a> Unpin for Advertisement<'a>

§

impl<'a> UnwindSafe for Advertisement<'a>

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.