Struct rubble::link::advertising::Header [−][src]
pub struct Header(u16);
Expand description
16-bit Advertising Channel PDU header preceding the Payload.
The header looks like this:
LSB MSB
+------------+------------+---------+---------+--------------+------------+
| PDU Type | - | TxAdd | RxAdd | Length | - |
| (4 bits) | (2 bits) | (1 bit) | (1 bit) | (6 bits) | (2 bits) |
+------------+------------+---------+---------+--------------+------------+
The TxAdd
and RxAdd
field are only used for some payloads, for all others, they should be
set to 0.
Length may be in range 6 to 37 (inclusive). With the 2-Byte header this is exactly the max. on-air packet size.
Tuple Fields
0: u16
Implementations
Creates a new Advertising Channel PDU header specifying the Payload type ty
.
Returns the raw representation of the header.
The returned u16
must be transmitted LSb first as the first 2 octets of the PDU.
Sets all bits in the header that are set in mask
.
Clears all bits in the header that are set in mask
.
Sets the TxAdd
field’s value.
Sets the RxAdd
field’s value.
Returns the length of the payload in octets as specified in the Length
field.
According to the spec, the length must be in range 6…37, but this isn’t checked by this function.
Sets the payload length of this PDU.
The length
must be in range 6…37, otherwise this function panics.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Header
impl UnwindSafe for Header
Blanket Implementations
Mutably borrows from an owned value. Read more