[][src]Enum rubble::link::ad_structure::AdStructure

pub enum AdStructure<'a> {
    Flags(Flags),
    ServiceUuids16(ServiceUuids<'a, Uuid16>),
    ServiceUuids32(ServiceUuids<'a, Uuid32>),
    ServiceUuids128(ServiceUuids<'a, Uuid>),
    ServiceData16 {
        uuid: u16,
        data: &'a [u8],
    },
    CompleteLocalName(&'a str),
    ShortenedLocalName(&'a str),
    Unknown {
        ty: u8,
        data: &'a [u8],
    },
    // some variants omitted
}

A list of AD structures can be sent along with an advertising packet or scan response.

This mechanism allows a scanner to, for example, receive the device's name without having to establish a connection.

Unless otherwise noted, each variant of this enum should only be included at most once per packet sent.

From a very unrepresentative scan, most devices seem to include Flags and Manufacturer Data, and optionally a device name, of course.

Variants

Flags(Flags)

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(ServiceUuids<'a, Uuid16>)ServiceUuids32(ServiceUuids<'a, Uuid32>)ServiceUuids128(ServiceUuids<'a, Uuid>)ServiceData16

Service data with 16-bit service UUID.

Fields of ServiceData16

uuid: u16

The 16-bit service UUID.

data: &'a [u8]

The associated service data. May be empty.

CompleteLocalName(&'a str)

Sets the full (unabbreviated) device name.

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

ShortenedLocalName(&'a str)

Sets the shortened device name.

Unknown

An unknown or unimplemented AD structure stored as raw bytes.

Fields of Unknown

ty: u8

Type byte.

data: &'a [u8]

Raw data transmitted after the type.

Trait Implementations

impl<'a> ToBytes for AdStructure<'a>[src]

fn to_bytes(&self, buf: &mut ByteWriter) -> Result<(), Error>[src]

Lowers this AD structure into a Byte buffer.

Returns the number of Bytes of buf that are used by this AD structure.

impl<'a> FromBytes<'a> for AdStructure<'a>[src]

impl<'a> Copy for AdStructure<'a>[src]

impl<'a> Debug for AdStructure<'a>[src]

impl<'a> From<Flags> for AdStructure<'a>[src]

impl<'a> Clone for AdStructure<'a>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

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

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

Blanket Implementations

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> From for T[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]