Struct rubble::link::advertising::PduBuf [−][src]
Expand description
Stores an advertising channel PDU.
This is an owned version of Pdu
and should be used when creating a PDU
to be sent out.
Fields
header: Header
2-Byte header.
payload_buf: [u8; 37]
Fixed-size buffer that can store the largest PDU. Actual length is stored in the header.
Implementations
fn adv(
ty: PduType,
adv: DeviceAddress,
adv_data: &mut dyn Iterator<Item = &AdStructure<'_>>
) -> Result<Self, Error>
fn adv(
ty: PduType,
adv: DeviceAddress,
adv_data: &mut dyn Iterator<Item = &AdStructure<'_>>
) -> Result<Self, Error>
Builds a PDU buffer containing advertiser address and data.
pub fn connectable_undirected(
advertiser_addr: DeviceAddress,
advertiser_data: &[AdStructure<'_>]
) -> Result<Self, Error>
pub fn connectable_undirected(
advertiser_addr: DeviceAddress,
advertiser_data: &[AdStructure<'_>]
) -> Result<Self, Error>
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
pub fn connectable_directed(
advertiser_addr: DeviceAddress,
initiator_addr: DeviceAddress
) -> Self
Creates a connectable directed advertising PDU (ADV_DIRECT_IND
).
pub fn nonconnectable_undirected(
advertiser_addr: DeviceAddress,
advertiser_data: &[AdStructure<'_>]
) -> Result<Self, Error>
pub fn nonconnectable_undirected(
advertiser_addr: DeviceAddress,
advertiser_data: &[AdStructure<'_>]
) -> Result<Self, Error>
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>
pub fn scannable_undirected(
advertiser_addr: DeviceAddress,
advertiser_data: &[AdStructure<'_>]
) -> Result<Self, Error>
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>
pub fn beacon(
advertiser_addr: DeviceAddress,
advertiser_data: &[AdStructure<'_>]
) -> Result<Self, Error>
Creates an advertising channel PDU suitable for building a simple beacon.
This is equivalent to PduBuf::nonconnectable_undirected
.
pub fn discoverable(
advertiser_addr: DeviceAddress,
advertiser_data: &[AdStructure<'_>]
) -> Result<Self, Error>
pub fn discoverable(
advertiser_addr: DeviceAddress,
advertiser_data: &[AdStructure<'_>]
) -> Result<Self, Error>
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.
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>
pub fn scan_response(
advertiser_addr: DeviceAddress,
scan_data: &[AdStructure<'_>]
) -> Result<Self, Error>
Creates a scan response PDU.
Note that scanning is not yet implemented.