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

#[non_exhaustive]
pub enum AdStructure<'a> {
    Flags(Flags),
    ServiceUuids16(ServiceUuids<'a, Uuid16>),
    ServiceUuids32(ServiceUuids<'a, Uuid32>),
    ServiceUuids128(ServiceUuids<'a, Uuid128>),
    ServiceData16 {
        uuid: u16,
        data: &'a [u8],
    },
    CompleteLocalName(&'a str),
    ShortenedLocalName(&'a str),
    ManufacturerSpecificData {
        company_identifier: CompanyId,
        payload: &'a [u8],
    },
    Unknown {
        ty: u8,
        data: &'a [u8],
    },
}
Expand description

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 (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future 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.

Tuple Fields of Flags

0: Flags
ServiceUuids16(ServiceUuids<'a, Uuid16>)

Tuple Fields of ServiceUuids16

0: ServiceUuids<'a, Uuid16>
ServiceUuids32(ServiceUuids<'a, Uuid32>)

Tuple Fields of ServiceUuids32

0: ServiceUuids<'a, Uuid32>
ServiceUuids128(ServiceUuids<'a, Uuid128>)

Tuple Fields of ServiceUuids128

0: ServiceUuids<'a, Uuid128>
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.

Tuple Fields of CompleteLocalName

0: &'a str
ShortenedLocalName(&'a str)

Sets the shortened device name.

Tuple Fields of ShortenedLocalName

0: &'a str
ManufacturerSpecificData

Set manufacturer specific data

Fields of ManufacturerSpecificData

company_identifier: CompanyIdpayload: &'a [u8]
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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Decode a Self from a byte slice, advancing bytes to point past the data that was read. Read more

Lowers this AD structure into a Byte buffer.

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.