Enum AdStructure

Source
pub enum AdStructure<'a> {
    Flags(u8),
    ServiceUuids16(&'a [[u8; 2]]),
    ServiceUuids128(&'a [[u8; 16]]),
    ServiceData16 {
        uuid: [u8; 2],
        data: &'a [u8],
    },
    CompleteLocalName(&'a [u8]),
    ShortenedLocalName(&'a [u8]),
    ManufacturerSpecificData {
        company_identifier: u16,
        payload: &'a [u8],
    },
    Unknown {
        ty: u8,
        data: &'a [u8],
    },
}
Expand description

Advertisement data structure.

Variants§

§

Flags(u8)

Device flags and baseband capabilities.

This should be sent if any flags apply to the device. If not (ie. the value sent would be 0), this may be omitted.

Must not be used in scan response data.

§

ServiceUuids16(&'a [[u8; 2]])

List of 16-bit service UUIDs. The UUID data matches the ble network’s endian order (should be little endian).

§

ServiceUuids128(&'a [[u8; 16]])

List of 128-bit service UUIDs. The UUID data matches the ble network’s endian order (should be little endian).

§

ServiceData16

Service data with 16-bit service UUID. The UUID data matches the ble network’s endian order (should be little endian).

Fields

§uuid: [u8; 2]

The 16-bit service UUID.

§data: &'a [u8]

The associated service data. May be empty.

§

CompleteLocalName(&'a [u8])

Sets the full (unabbreviated) device name.

This will be shown to the user when this device is found.

§

ShortenedLocalName(&'a [u8])

Sets the shortened device name.

§

ManufacturerSpecificData

Set manufacturer specific data

Fields

§company_identifier: u16

Company identifier.

§payload: &'a [u8]

Payload data.

§

Unknown

An unknown or unimplemented AD structure stored as raw bytes.

Fields

§ty: u8

Type byte.

§data: &'a [u8]

Raw data transmitted after the type.

Implementations§

Source§

impl AdStructure<'_>

Source

pub fn encode_slice( data: &[AdStructure<'_>], dest: &mut [u8], ) -> Result<usize, Error>

Encode a slice of advertisement structures into a buffer.

Source

pub fn decode( data: &[u8], ) -> impl Iterator<Item = Result<AdStructure<'_>, Error>>

Decode a slice of advertisement structures from a buffer.

Trait Implementations§

Source§

impl<'a> Clone for AdStructure<'a>

Source§

fn clone(&self) -> AdStructure<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for AdStructure<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Copy for AdStructure<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for AdStructure<'a>

§

impl<'a> RefUnwindSafe for AdStructure<'a>

§

impl<'a> Send for AdStructure<'a>

§

impl<'a> Sync for AdStructure<'a>

§

impl<'a> Unpin for AdStructure<'a>

§

impl<'a> UnwindSafe for AdStructure<'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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.