[][src]Struct rubble::link::advertising::PduBuf

pub struct PduBuf { /* fields omitted */ }

Stores an advertising channel PDU.

This is an owned version of Pdu and should be used when creating a PDU to be sent out.

Methods

impl PduBuf[src]

pub fn connectable_undirected(
    advertiser_addr: DeviceAddress,
    advertiser_data: &[AdStructure]
) -> Result<Self, Error>
[src]

Creates a connectable undirected advertising PDU (ADV_IND).

Parameters

  • adv: The advertiser address, the address of the device sending this PDU.
  • adv_data: Additional advertising data to send.

pub fn connectable_directed(
    advertiser_addr: DeviceAddress,
    initiator_addr: DeviceAddress
) -> Self
[src]

Creates a connectable directed advertising PDU (ADV_DIRECT_IND).

pub fn nonconnectable_undirected(
    advertiser_addr: DeviceAddress,
    advertiser_data: &[AdStructure]
) -> Result<Self, Error>
[src]

Creates a non-connectable undirected advertising PDU (ADV_NONCONN_IND).

This is equivalent to PduBuf::beacon, which should be preferred when building a beacon PDU to improve clarity.

pub fn scannable_undirected(
    advertiser_addr: DeviceAddress,
    advertiser_data: &[AdStructure]
) -> Result<Self, Error>
[src]

Creates a scannable undirected advertising PDU (ADV_SCAN_IND).

Note that scanning is not supported at the moment.

pub fn beacon(
    advertiser_addr: DeviceAddress,
    advertiser_data: &[AdStructure]
) -> Result<Self, Error>
[src]

Creates an advertising channel PDU suitable for building a simple beacon.

This is mostly equivalent to PduBuf::nonconnectable_undirected, but it will automatically add a suitable Flags AD structure to the advertising data (this flags is mandatory).

pub fn discoverable(
    advertiser_addr: DeviceAddress,
    advertiser_data: &[AdStructure]
) -> Result<Self, Error>
[src]

Creates an advertising PDU that makes this device "visible" for scanning devices that want to establish a connection.

This should be used when this device would like to initiate pairing.

This function is mostly equivalent to PduBuf::connectable_undirected, but will automatically add a suitable Flags AD structure to the advertising data.

To establish a connection with an already paired device, a "directed" advertisement must be sent instead.

pub fn scan_request(
    _scanner: DeviceAddress,
    _adv: DeviceAddress
) -> Result<Self, Error>
[src]

Creates a scan request PDU.

Note that scanning is not yet implemented.

Parameters

  • scanner: Device address of the device in scanning state (sender of the request).
  • adv: Device address of the advertising device that this scan request is directed towards.

pub fn scan_response(
    advertiser_addr: DeviceAddress,
    scan_data: &[AdStructure]
) -> Result<Self, Error>
[src]

Creates a scan response PDU.

Note that scanning is not yet implemented.

pub fn header(&self) -> Header[src]

pub fn payload(&self) -> &[u8][src]

Trait Implementations

impl Debug for PduBuf[src]

Auto Trait Implementations

impl Send for PduBuf

impl Sync for PduBuf

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]